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
tsoc
superbenchmark
Commits
ce1481dd
Unverified
Commit
ce1481dd
authored
Dec 24, 2021
by
Yuting Jiang
Committed by
GitHub
Dec 24, 2021
Browse files
Bug - Fix bug of detecting if gpu_index is none #275
**Description** Fix bug of detecting if gpu_index is none.
parent
3d8721a2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
superbench/benchmarks/micro_benchmarks/ib_validation_performance.py
.../benchmarks/micro_benchmarks/ib_validation_performance.py
+1
-1
tests/benchmarks/micro_benchmarks/test_ib_traffic_performance.py
...enchmarks/micro_benchmarks/test_ib_traffic_performance.py
+18
-1
No files found.
superbench/benchmarks/micro_benchmarks/ib_validation_performance.py
View file @
ce1481dd
...
@@ -249,7 +249,7 @@ def __prepare_general_ib_command_params(self):
...
@@ -249,7 +249,7 @@ def __prepare_general_ib_command_params(self):
msg_size
=
'-s '
+
str
(
self
.
_args
.
msg_size
)
msg_size
=
'-s '
+
str
(
self
.
_args
.
msg_size
)
# Add GPUDirect for ib command
# Add GPUDirect for ib command
gpu_enable
=
''
gpu_enable
=
''
if
self
.
_args
.
gpu_index
:
if
self
.
_args
.
gpu_index
is
not
None
:
gpu
=
GPU
()
gpu
=
GPU
()
if
gpu
.
vendor
==
'nvidia'
:
if
gpu
.
vendor
==
'nvidia'
:
gpu_enable
=
' --use_cuda={gpu_index}'
.
format
(
gpu_index
=
str
(
self
.
_args
.
gpu_index
))
gpu_enable
=
' --use_cuda={gpu_index}'
.
format
(
gpu_index
=
str
(
self
.
_args
.
gpu_index
))
...
...
tests/benchmarks/micro_benchmarks/test_ib_traffic_performance.py
View file @
ce1481dd
...
@@ -117,8 +117,9 @@ def read_config(filename):
...
@@ -117,8 +117,9 @@ def read_config(filename):
Path
(
test_config_file
).
unlink
()
Path
(
test_config_file
).
unlink
()
@
mock
.
patch
(
'superbench.common.devices.GPU.vendor'
,
new_callable
=
mock
.
PropertyMock
)
@
mock
.
patch
(
'superbench.common.utils.network.get_ib_devices'
)
@
mock
.
patch
(
'superbench.common.utils.network.get_ib_devices'
)
def
test_ib_traffic_performance
(
self
,
mock_ib_devices
):
def
test_ib_traffic_performance
(
self
,
mock_ib_devices
,
mock_gpu
):
"""Test ib-traffic benchmark."""
"""Test ib-traffic benchmark."""
# Test without ib devices
# Test without ib devices
# Check registry.
# Check registry.
...
@@ -168,6 +169,22 @@ def test_ib_traffic_performance(self, mock_ib_devices):
...
@@ -168,6 +169,22 @@ def test_ib_traffic_performance(self, mock_ib_devices):
command
=
benchmark
.
_bin_name
+
benchmark
.
_commands
[
0
].
split
(
benchmark
.
_bin_name
)[
1
]
command
=
benchmark
.
_bin_name
+
benchmark
.
_commands
[
0
].
split
(
benchmark
.
_bin_name
)[
1
]
assert
(
command
==
expect_command
)
assert
(
command
==
expect_command
)
parameters
=
'--ib_index 0 --iters 2000 --pattern one-to-one --hostfile hostfile --gpu_index 0'
mock_gpu
.
return_value
=
'nvidia'
benchmark
=
benchmark_class
(
benchmark_name
,
parameters
=
parameters
)
ret
=
benchmark
.
_preprocess
()
expect_command
=
'ib_validation --hostfile hostfile --cmd_prefix "ib_write_bw -F '
+
\
'--iters=2000 -d mlx5_0 -a --use_cuda=0" --input_config '
+
os
.
getcwd
()
+
'/config.txt'
command
=
benchmark
.
_bin_name
+
benchmark
.
_commands
[
0
].
split
(
benchmark
.
_bin_name
)[
1
]
assert
(
command
==
expect_command
)
mock_gpu
.
return_value
=
'amd'
benchmark
=
benchmark_class
(
benchmark_name
,
parameters
=
parameters
)
ret
=
benchmark
.
_preprocess
()
expect_command
=
'ib_validation --hostfile hostfile --cmd_prefix "ib_write_bw -F '
+
\
'--iters=2000 -d mlx5_0 -a --use_rocm=0" --input_config '
+
os
.
getcwd
()
+
'/config.txt'
command
=
benchmark
.
_bin_name
+
benchmark
.
_commands
[
0
].
split
(
benchmark
.
_bin_name
)[
1
]
assert
(
command
==
expect_command
)
# Custom config
# Custom config
config
=
[
'0,1'
,
'1,0;0,1'
,
'0,1;1,0'
,
'1,0;0,1'
]
config
=
[
'0,1'
,
'1,0;0,1'
,
'0,1;1,0'
,
'1,0;0,1'
]
with
open
(
'test_config.txt'
,
'w'
)
as
f
:
with
open
(
'test_config.txt'
,
'w'
)
as
f
:
...
...
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