Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
13e6b1b9
Unverified
Commit
13e6b1b9
authored
Apr 10, 2026
by
Elham
Committed by
GitHub
Apr 10, 2026
Browse files
[BugFix][CPU] Add CPU profiler summary file output (#38366)
Signed-off-by:
Elham Harirpoush
<
elham.harirpoush@arm.com
>
parent
58c0a928
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
15 deletions
+33
-15
vllm/profiler/wrapper.py
vllm/profiler/wrapper.py
+33
-15
No files found.
vllm/profiler/wrapper.py
View file @
13e6b1b9
...
@@ -240,6 +240,28 @@ class TorchProfilerWrapper(WorkerProfiler):
...
@@ -240,6 +240,28 @@ class TorchProfilerWrapper(WorkerProfiler):
0
,
0
,
)
)
def
_build_profiler_table
(
self
,
sort_key
:
str
,
row_limit
:
int
|
None
=
None
,
)
->
str
:
if
row_limit
is
None
:
# use profiler default row limit of 100
return
self
.
profiler
.
key_averages
().
table
(
sort_by
=
sort_key
)
return
self
.
profiler
.
key_averages
().
table
(
sort_by
=
sort_key
,
row_limit
=
row_limit
,
)
def
_write_profiler_table
(
self
,
rank
:
int
,
table
:
str
)
->
None
:
profiler_dir
=
self
.
profiler_config
.
torch_profiler_dir
# Skip file write for URI paths (gs://, s3://, etc.)
# as standard file I/O doesn't work with URI schemes
if
not
_is_uri_path
(
profiler_dir
):
profiler_out_file
=
f
"
{
profiler_dir
}
/profiler_out_
{
rank
}
.txt"
with
open
(
profiler_out_file
,
"w"
)
as
f
:
print
(
table
,
file
=
f
)
@
override
@
override
def
_start
(
self
)
->
None
:
def
_start
(
self
)
->
None
:
self
.
profiler
.
start
()
self
.
profiler
.
start
()
...
@@ -251,26 +273,22 @@ class TorchProfilerWrapper(WorkerProfiler):
...
@@ -251,26 +273,22 @@ class TorchProfilerWrapper(WorkerProfiler):
profiler_config
=
self
.
profiler_config
profiler_config
=
self
.
profiler_config
rank
=
self
.
local_rank
rank
=
self
.
local_rank
if
profiler_config
.
torch_profiler_dump_cuda_time_total
:
if
profiler_config
.
torch_profiler_dump_cuda_time_total
:
profiler_dir
=
profiler_config
.
torch_profiler_dir
table
=
self
.
_build_profiler_table
(
sort_key
=
"self_cuda_time_total"
)
sort_key
=
"self_cuda_time_total"
self
.
_write_profiler_table
(
rank
,
table
)
table
=
self
.
profiler
.
key_averages
().
table
(
sort_by
=
sort_key
)
# Skip file write for URI paths (gs://, s3://, etc.)
# as standard file I/O doesn't work with URI schemes
if
not
_is_uri_path
(
profiler_dir
):
profiler_out_file
=
f
"
{
profiler_dir
}
/profiler_out_
{
rank
}
.txt"
with
open
(
profiler_out_file
,
"w"
)
as
f
:
print
(
table
,
file
=
f
)
# only print profiler results on rank 0
# only print profiler results on rank 0
if
rank
==
0
:
if
rank
==
0
:
print
(
table
)
print
(
table
)
if
self
.
dump_cpu_time_total
and
rank
==
0
:
logger
.
info
(
if
self
.
dump_cpu_time_total
:
self
.
profiler
.
key_averages
().
table
(
table
=
self
.
_build_profiler_table
(
sort_by
=
"self_cpu_time_total"
,
row_limit
=
50
sort_key
=
"self_cpu_time_total"
,
row_limit
=
50
)
)
)
self
.
_write_profiler_table
(
rank
,
table
)
# only print profiler results on rank 0
if
rank
==
0
:
print
(
table
)
@
override
@
override
def
_profiler_step
(
self
)
->
bool
:
def
_profiler_step
(
self
)
->
bool
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment