Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XPU] fix the dataloader problem in RDMA env #54150

Merged
merged 7 commits into from
Jun 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion python/paddle/io/dataloader/dataloader_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,21 @@ def __init__(self, loader):
self._shutdown = False

def _init_workers(self):
from paddle.incubate import multiprocessing
# NOTE(zhangxiaoci): When trained in XPU multi-node RDMA environment, an unexpected
# segmentfault will be raised in dataloader process, where the traceback goes all
# back to a runtime error that dataloader workers exit unexpectedly. Similar problems
# have been discussed that lead to a misbehavior of OpenCV working in multiprocessing
# environment. A possible solution is to change default 'fork' mode of multiprocessing
# start method to 'spawn'. See https://stackoverflow.com/questions/54013846 for details.
# NOTE(zhangxiaoci): Replace multiprocessing with multiprocess since in some training
# environments the former will raise 'AttributeError: Can't pickle local object xxx',
# which is a side effect of changing the default start method.
if paddle.is_compiled_with_xpu():
import multiprocess as multiprocessing

multiprocessing.set_start_method('spawn', force=True)
else:
from paddle.incubate import multiprocessing

# multiprocess worker and indice queue list initial as empty
self._workers = []
Expand Down