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

Allow start_methods other than fork on MultiprocessParallelUpdater #7552

Merged
merged 3 commits into from
Mar 12, 2020

Conversation

emcastillo
Copy link
Member

If a cuda context is created before running MultiprocessParallelUpdater it should fail.

multiprocessing.set_start_mode('spawn') avoids the cuda context duplication on the worker processes even if we have performed cuda operations on the main thread such as getting the number of available GPUs.

#7309 is related.

@emcastillo emcastillo added the cat:enhancement Implementation that does not break interfaces. label Jun 19, 2019
@niboshi niboshi self-assigned this Jun 19, 2019
@stale
Copy link

stale bot commented Sep 17, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Not updated for a longer period of time. label Sep 17, 2019
@stale
Copy link

stale bot commented Oct 17, 2019

This issue is closed as announced. Feel free to re-open it if needed.

@stale stale bot closed this Oct 17, 2019
@niboshi niboshi reopened this Oct 17, 2019
@stale stale bot removed the stale Not updated for a longer period of time. label Oct 17, 2019
@stale
Copy link

stale bot commented Jan 15, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Not updated for a longer period of time. label Jan 15, 2020
@niboshi niboshi added this to the v7.3.0 milestone Feb 4, 2020
@stale stale bot removed the stale Not updated for a longer period of time. label Feb 4, 2020
@kmaehashi kmaehashi added cat:bug Bug report or fix. and removed cat:enhancement Implementation that does not break interfaces. labels Feb 18, 2020
'MultiprocessParallelUpdater assumes the context is '
'uninitialized. Please do not call CUDA API before '
'MultiprocessParallelUpdater creates processes.')
if multiprocessing.get_start_method() != 'spawn':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Check 'forkserver'. (Thanks @kmaehashi)
  • if _cuda_initialized and multiprocessing.get_start_method() != 'spawn':?

Copy link
Member Author

@emcastillo emcastillo Feb 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update on this.
forkserver also works.

There is a problem when using spawn and forkserver
the converter attribute of the MultiprocessParallelUpdater can't be pickled.
Either we define all the converters as classes -> no compat and horrible approach.
Or we find some way around

@emcastillo
Copy link
Member Author

Now that #8549 has been merged this has been rebased and added support for forkserver as a multiprocess start method.

@toslunar can I get a review please? 😇

…a_init.py

Co-Authored-By: Toshiki Kataoka <tos.lunar@gmail.com>
Copy link
Member

@toslunar toslunar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@toslunar
Copy link
Member

The PR itself looks good, but could you change its title to clarify the change makes the usage more permissive, e.g. "Allow start_methods other than fork on MultiprocessParallelUpdater"?

@toslunar
Copy link
Member

Jenkins, test this please.

@emcastillo emcastillo changed the title Do not allow fork as start_method on MultiprocessParallelUpdater Allow start_methods other than fork on MultiprocessParallelUpdater Mar 11, 2020
@emcastillo
Copy link
Member Author

Thanks!🙇

@toslunar toslunar added the st:test-and-merge State indicating that pull request is approved by a reviewer and can be merged after CI passes. label Mar 11, 2020
@toslunar toslunar self-assigned this Mar 11, 2020
@chainer-ci
Copy link
Member

Jenkins CI test (for commit 2068699, target branch master) succeeded!

@mergify mergify bot merged commit d00b3cb into chainer:master Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:bug Bug report or fix. st:test-and-merge State indicating that pull request is approved by a reviewer and can be merged after CI passes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants