Browse Source

ddp barrier 添加是否已初始化的判断

dev0.8.0
x54-729 2 years ago
parent
commit
b01b84ae47
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      fastNLP/core/drivers/torch_driver/ddp.py

+ 1
- 1
fastNLP/core/drivers/torch_driver/ddp.py View File

@@ -661,7 +661,7 @@ class TorchDDPDriver(TorchDriver):
r"""
通过使用该函数来使得各个进程之间同步操作。
"""
if int(os.environ.get(FASTNLP_NO_SYNC, 0)) < 1: # 当 FASTNLP_NO_SYNC 小于 1 时实际执行
if int(os.environ.get(FASTNLP_NO_SYNC, 0)) < 1 and dist.is_initialized(): # 当 FASTNLP_NO_SYNC 小于 1 时实际执行
torch.distributed.barrier(async_op=False)

def is_distributed(self):


Loading…
Cancel
Save