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
fairscale
Commits
bb468670
Unverified
Commit
bb468670
authored
Dec 05, 2020
by
Min Xu
Committed by
GitHub
Dec 05, 2020
Browse files
[fix] skipping NCCL tests on 2-GPU systems (#233)
parent
92210136
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
tests/optim/test_oss.py
tests/optim/test_oss.py
+4
-0
No files found.
tests/optim/test_oss.py
View file @
bb468670
...
@@ -194,6 +194,8 @@ def run_test_add_param_group(rank, world_size, tempfile_name):
...
@@ -194,6 +194,8 @@ def run_test_add_param_group(rank, world_size, tempfile_name):
def
test_add_param_group
():
def
test_add_param_group
():
world_size
=
3
world_size
=
3
if
torch
.
cuda
.
device_count
()
<
world_size
:
pytest
.
skip
(
"Not enough GPUs for NCCL-based test"
)
temp_file_name
=
tempfile
.
mkstemp
()[
1
]
temp_file_name
=
tempfile
.
mkstemp
()[
1
]
mp
.
spawn
(
run_test_add_param_group
,
args
=
(
world_size
,
temp_file_name
),
nprocs
=
world_size
,
join
=
True
)
mp
.
spawn
(
run_test_add_param_group
,
args
=
(
world_size
,
temp_file_name
),
nprocs
=
world_size
,
join
=
True
)
...
@@ -309,6 +311,8 @@ def run_test_sharding(rank, world_size, tempfile_name):
...
@@ -309,6 +311,8 @@ def run_test_sharding(rank, world_size, tempfile_name):
def
test_sharding
():
def
test_sharding
():
world_size
=
3
world_size
=
3
if
torch
.
cuda
.
device_count
()
<
world_size
:
pytest
.
skip
(
"Not enough GPUs for NCCL-based test"
)
temp_file_name
=
tempfile
.
mkstemp
()[
1
]
temp_file_name
=
tempfile
.
mkstemp
()[
1
]
mp
.
spawn
(
run_test_sharding
,
args
=
(
world_size
,
temp_file_name
),
nprocs
=
world_size
,
join
=
True
)
mp
.
spawn
(
run_test_sharding
,
args
=
(
world_size
,
temp_file_name
),
nprocs
=
world_size
,
join
=
True
)
...
...
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