Skip to content

Commit 9ff7866

Browse files
authored
Merge pull request #13568 from JiabinYang/fix/mac_0924
disable nccl2 test on CPU only mode
2 parents 3fa68dc + a34c956 commit 9ff7866

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

python/paddle/fluid/tests/unittests/test_dist_transpiler.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -661,22 +661,25 @@ def transpiler_test_impl(self):
661661

662662
class TestNCCL2Transpile(TranspilerTest):
663663
def test_nccl2_transpile(self):
664-
main = fluid.Program()
665-
startup = fluid.Program()
666-
with fluid.program_guard(main, startup):
667-
self.net_conf()
668-
669-
config = fluid.DistributeTranspilerConfig()
670-
config.mode = "nccl2"
671-
t = fluid.DistributeTranspiler(config=config)
672-
t.transpile(
673-
0,
674-
trainers="127.0.0.1:6174,127.0.0.1:6175",
675-
current_endpoint="127.0.0.1:6174",
676-
startup_program=startup)
677-
print([op.type for op in startup.global_block().ops])
678-
self.assertEqual(startup.global_block().ops[-1].type, "gen_nccl_id")
679-
self.assertIsNotNone(startup.global_block().vars.get("NCCLID"))
664+
if fluid.core.is_compiled_with_cuda(): #test nccl2 only with cuda
665+
main = fluid.Program()
666+
startup = fluid.Program()
667+
with fluid.program_guard(main, startup):
668+
self.net_conf()
669+
670+
config = fluid.DistributeTranspilerConfig()
671+
config.mode = "nccl2"
672+
t = fluid.DistributeTranspiler(config=config)
673+
t.transpile(
674+
0,
675+
trainers="127.0.0.1:6174,127.0.0.1:6175",
676+
current_endpoint="127.0.0.1:6174",
677+
startup_program=startup)
678+
print([op.type for op in startup.global_block().ops])
679+
self.assertEqual(startup.global_block().ops[-1].type, "gen_nccl_id")
680+
self.assertIsNotNone(startup.global_block().vars.get("NCCLID"))
681+
else:
682+
pass
680683

681684

682685
if __name__ == "__main__":

0 commit comments

Comments
 (0)