@@ -40,11 +40,11 @@ def exec_filepath():
4040 yield fp .as_posix ()
4141
4242
43- def execute (cmd ):
43+ def execute (cmd , env = None ):
4444
4545 import ignite
4646
47- env = dict (os .environ )
47+ env = dict (os .environ ) if env is None else env
4848 env ["PYTHONPATH" ] = f"{ os .path .dirname (ignite .__path__ [0 ])} "
4949 process = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , env = env )
5050 process .wait ()
@@ -153,6 +153,38 @@ def test_check_idist_parallel_spawn_n_procs_gloo(exec_filepath):
153153 _test_check_idist_parallel_spawn (exec_filepath , "gloo" , np )
154154
155155
156+ @pytest .mark .distributed
157+ @pytest .mark .skipif (not has_native_dist_support , reason = "Skip if no native dist support" )
158+ @pytest .mark .skipif ("WORLD_SIZE" in os .environ , reason = "Skip if launched as multiproc" )
159+ def test_smoke_test_check_idist_parallel_spawn_multinode_n_procs_gloo (exec_filepath ):
160+ # Just a smoke test from check_idist_parallel.py for an emulated multi-node configuration
161+ cmd1 = "export CUDA_VISIBLE_DEVICES= && "
162+ cmd1 += 'bash -c "python tests/ignite/distributed/check_idist_parallel.py --backend=gloo --nproc_per_node=2 '
163+ cmd1 += '--nnodes=2 --node_rank=0 --master_addr=localhost --master_port=3344 &"'
164+ os .system (cmd1 )
165+
166+ cmd2 = [
167+ sys .executable ,
168+ exec_filepath ,
169+ "--backend=gloo" ,
170+ "--nproc_per_node=2" ,
171+ "--nnodes=2" ,
172+ "--node_rank=1" ,
173+ "--master_addr=localhost" ,
174+ "--master_port=3344" ,
175+ ]
176+ env = dict (os .environ )
177+ env ["CUDA_VISIBLE_DEVICES" ] = ""
178+ out = execute (cmd2 , env = env )
179+
180+ assert "backend=gloo" in out
181+ assert "nproc_per_node: 2" in out
182+ assert "nnodes: 2" in out
183+ assert "master_addr: localhost" in out
184+ assert "master_port: 3344" in out
185+ assert "End of run" in out
186+
187+
156188@pytest .mark .distributed
157189@pytest .mark .skipif (not has_native_dist_support , reason = "Skip if no native dist support" )
158190@pytest .mark .skipif ("WORLD_SIZE" in os .environ , reason = "Skip if launched as multiproc" )
0 commit comments