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
32296cf4
Unverified
Commit
32296cf4
authored
Mar 14, 2022
by
Frank Lee
Committed by
GitHub
Mar 14, 2022
Browse files
Merge pull request #409 from 1SAA/develop
[hotfix] fixed error when no collective communication in CommProfiler
parents
62b08acc
907ac4a2
Changes
2
Show 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 @
32296cf4
...
@@ -93,16 +93,16 @@ class CommProfiler(BaseProfiler):
...
@@ -93,16 +93,16 @@ class CommProfiler(BaseProfiler):
dist
.
reduce
=
torch_reduce
dist
.
reduce
=
torch_reduce
def
to_tensorboard
(
self
,
writer
):
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
):
def
to_file
(
self
,
filename
:
Path
):
with
open
(
filename
,
"w"
)
as
f
:
with
open
(
filename
,
"w"
)
as
f
:
f
.
write
(
self
.
result_
li
st
())
f
.
write
(
self
.
result_st
r
())
def
show
(
self
):
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
=
[]
res
=
[]
def
append
(
s
:
str
=
None
):
def
append
(
s
:
str
=
None
):
...
@@ -114,6 +114,9 @@ class CommProfiler(BaseProfiler):
...
@@ -114,6 +114,9 @@ class CommProfiler(BaseProfiler):
append
(
"Warnning: there exists multiple communication operations in the same time. As a result, "
append
(
"Warnning: there exists multiple communication operations in the same time. As a result, "
"the profiling result is not accurate."
)
"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
(
"Collective communication profiling result:"
)
append
(
"total cuda time: {}"
.
format
(
_format_time
(
self
.
total_cuda_time
)))
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
)))
append
(
"average bandwidth: {}"
.
format
(
_format_bandwidth
(
self
.
total_comm_vol
,
self
.
total_cuda_time
)))
...
...
colossalai/utils/profiler/pcie_profiler.py
View file @
32296cf4
...
@@ -105,16 +105,16 @@ class PcieProfiler(BaseProfiler):
...
@@ -105,16 +105,16 @@ class PcieProfiler(BaseProfiler):
self
.
profiler
=
None
self
.
profiler
=
None
def
to_tensorboard
(
self
,
writer
):
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
):
def
to_file
(
self
,
filename
:
Path
):
with
open
(
filename
,
"w"
)
as
f
:
with
open
(
filename
,
"w"
)
as
f
:
f
.
write
(
self
.
result_
li
st
())
f
.
write
(
self
.
result_st
r
())
def
show
(
self
):
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
=
[]
res
=
[]
def
append
(
s
:
str
=
None
):
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