项目文件夹

文件
Quan (Andy) Gan caa6d6072c [Feature] Replacing thread_wrapped_func with minimal mp.Process wrapper (#2905)
* standardizing thread_wrapped_func

* lints

* Update __init__.py
2021-05-14 11:34:49 +08:00

17 行
727 B
Python

"""Wrapper of the multiprocessing module for multi-GPU training."""
# To avoid duplicating the graph structure for node classification or link prediction
# training we recommend using fork() rather than spawn() for multiple GPU training.
# However, we need to work around https://github.com/pytorch/pytorch/issues/17199 to
# make fork() and openmp work together.
from .. import backend as F
if F.get_preferred_backend() == 'pytorch':
# Wrap around torch.multiprocessing...
from torch.multiprocessing import *
# ... and override the Process initializer
from .pytorch import Process
else:
# Just import multiprocessing module.
from multiprocessing import * # pylint: disable=redefined-builtin