added auto port find

This commit is contained in:
William Falcon
2019-07-24 15:11:29 -04:00
parent 9f0d963e37
commit b1e16c2e7b
2 changed files with 9 additions and 1 deletions
+5 -1
View File
@@ -570,7 +570,11 @@ class Trainer(TrainerIO):
:return:
"""
# sets the appropriate port
self.__find_open_port()
try:
port = os.environ['MASTER_PORT']
except Exception as e:
port = 12910
os.environ['MASTER_PORT'] = f'{port}'
root_node = self.__resolve_root_node_address()
os.environ['MASTER_ADDR'] = root_node
+4
View File
@@ -113,6 +113,8 @@ def test_multi_gpu_model_ddp():
warnings.warn('test_multi_gpu_model_ddp cannot run. Rerun on a node with 2+ GPUs to run this test')
return
os.environ['MASTER_PORT'] = str(np.random.randint(12000, 19000, 1)[0])
trainer_options = dict(
progress_bar=False,
max_nb_epochs=1,
@@ -137,6 +139,8 @@ def test_amp_gpu_ddp():
warnings.warn('test_amp_gpu_ddp cannot run. Rerun on a node with 2+ GPUs to run this test')
return
os.environ['MASTER_PORT'] = str(np.random.randint(12000, 19000, 1)[0])
trainer_options = dict(
progress_bar=True,
max_nb_epochs=1,