mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-19 22:15:01 +08:00
[Log] Save profiler results to file instead of stdout (#28144)
Signed-off-by: Randall Smith <ransmith@amd.com> Co-authored-by: Randall Smith <ransmith@amd.com>
This commit is contained in:
parent
e0c910bb89
commit
ba041d980b
@ -596,14 +596,19 @@ class Worker(WorkerBase):
|
|||||||
self.profiler.start()
|
self.profiler.start()
|
||||||
else:
|
else:
|
||||||
self.profiler.stop()
|
self.profiler.stop()
|
||||||
# only print profiler results on rank 0
|
if isinstance(self.profiler, torch.profiler.profile):
|
||||||
if (
|
rank = self.local_rank
|
||||||
isinstance(self.profiler, torch.profiler.profile)
|
profiler_dir = envs.VLLM_TORCH_PROFILER_DIR
|
||||||
and self.local_rank == 0
|
profiler_out_file = f"{profiler_dir}/profiler_out_{rank}.txt"
|
||||||
):
|
sort_key = "self_cuda_time_total"
|
||||||
print(
|
table = self.profiler.key_averages().table(sort_by=sort_key)
|
||||||
self.profiler.key_averages().table(sort_by="self_cuda_time_total")
|
|
||||||
)
|
with open(profiler_out_file, "w") as f:
|
||||||
|
print(table, file=f)
|
||||||
|
|
||||||
|
# only print profiler results on rank 0
|
||||||
|
if rank == 0:
|
||||||
|
print(table)
|
||||||
|
|
||||||
def execute_dummy_batch(self) -> None:
|
def execute_dummy_batch(self) -> None:
|
||||||
self.model_runner._dummy_run(1, uniform_decode=True)
|
self.model_runner._dummy_run(1, uniform_decode=True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user