Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ColossalAI
Commits
907ac4a2
Commit
907ac4a2
authored
Mar 14, 2022
by
1SAA
Browse files
fixed error when no collective communication in CommProfiler
parent
62b08acc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
colossalai/utils/profiler/comm_profiler.py
colossalai/utils/profiler/comm_profiler.py
+7
-4
colossalai/utils/profiler/pcie_profiler.py
colossalai/utils/profiler/pcie_profiler.py
+4
-4
No files found.
colossalai/utils/profiler/comm_profiler.py
View file @
907ac4a2
...
...
@@ -93,16 +93,16 @@ class CommProfiler(BaseProfiler):
dist
.
reduce
=
torch_reduce
def
to_tensorboard
(
self
,
writer
):
writer
.
add_text
(
tag
=
"Collective Communication"
,
text_string
=
self
.
result_
li
st
(
"
\n\n
"
))
writer
.
add_text
(
tag
=
"Collective Communication"
,
text_string
=
self
.
result_st
r
(
"
\n\n
"
))
def
to_file
(
self
,
filename
:
Path
):
with
open
(
filename
,
"w"
)
as
f
:
f
.
write
(
self
.
result_
li
st
())
f
.
write
(
self
.
result_st
r
())
def
show
(
self
):
print
(
self
.
result_
li
st
())
print
(
self
.
result_st
r
())
def
result_
li
st
(
self
,
sep
:
str
=
"
\n
"
):
def
result_st
r
(
self
,
sep
:
str
=
"
\n
"
):
res
=
[]
def
append
(
s
:
str
=
None
):
...
...
@@ -114,6 +114,9 @@ class CommProfiler(BaseProfiler):
append
(
"Warnning: there exists multiple communication operations in the same time. As a result, "
"the profiling result is not accurate."
)
if
self
.
total_cuda_time
==
0
:
return
"No collective communication has been called yet!"
append
(
"Collective communication profiling result:"
)
append
(
"total cuda time: {}"
.
format
(
_format_time
(
self
.
total_cuda_time
)))
append
(
"average bandwidth: {}"
.
format
(
_format_bandwidth
(
self
.
total_comm_vol
,
self
.
total_cuda_time
)))
...
...
colossalai/utils/profiler/pcie_profiler.py
View file @
907ac4a2
...
...
@@ -105,16 +105,16 @@ class PcieProfiler(BaseProfiler):
self
.
profiler
=
None
def
to_tensorboard
(
self
,
writer
):
writer
.
add_text
(
tag
=
"Data Transmission"
,
text_string
=
self
.
result_
li
st
(
"
\n\n
"
))
writer
.
add_text
(
tag
=
"Data Transmission"
,
text_string
=
self
.
result_st
r
(
"
\n\n
"
))
def
to_file
(
self
,
filename
:
Path
):
with
open
(
filename
,
"w"
)
as
f
:
f
.
write
(
self
.
result_
li
st
())
f
.
write
(
self
.
result_st
r
())
def
show
(
self
):
print
(
self
.
result_
li
st
())
print
(
self
.
result_st
r
())
def
result_
li
st
(
self
,
sep
:
str
=
"
\n
"
):
def
result_st
r
(
self
,
sep
:
str
=
"
\n
"
):
res
=
[]
def
append
(
s
:
str
=
None
):
...
...
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