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

add support for spawn multiprocessing mode #638

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

osma
Copy link
Member

@osma osma commented Nov 1, 2022

This (draft) PR attempts to add support for the spawn multiprocessing mode. This is the only mode supported on Windows, and the default mode on Mac OS. The fork mode, supported on Linux and some other *nix systems, is more efficient because it allows loading models only once and then reusing them in forked child processes, with most of the memory shared between the processes. But spawn mode is still better than not being able to perform multiprocessing at all.

This PR needs more testing, ideally on both Mac OS and Windows. Currently there is just a single unit test that exercises parallel evaluation using the spawn mode.

Fixes #637

@osma osma self-assigned this Nov 1, 2022
@codecov
Copy link

codecov bot commented Nov 1, 2022

Codecov Report

Base: 99.58% // Head: 99.58% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (36c79c0) compared to base (63af34c).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #638   +/-   ##
=======================================
  Coverage   99.58%   99.58%           
=======================================
  Files          87       87           
  Lines        5972     5992   +20     
=======================================
+ Hits         5947     5967   +20     
  Misses         25       25           
Impacted Files Coverage Δ
annif/parallel.py 100.00% <100.00%> (ø)
annif/registry.py 100.00% <100.00%> (ø)
tests/test_cli.py 100.00% <100.00%> (ø)
tests/test_parallel.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@osma
Copy link
Member Author

osma commented Nov 2, 2022

Successfully tested parallel training of NN ensemble with this PR branch on a MacBook with an M1 processor (arm architecture) by @holehan, according to this report. Thanks a lot!

@osma osma force-pushed the issue637-multiprocessing-spawn branch from 3f507d9 to 36c79c0 Compare November 11, 2022 14:48
@osma
Copy link
Member Author

osma commented Nov 11, 2022

Rebased on current master (with black & isort reformatting), fixed up and force-pushed.

@osma osma marked this pull request as ready for review November 11, 2022 14:49
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@monalehtinen
Copy link
Contributor

Tested parallel processing in this PR branch using Windows 10 (Intel Core i5-8250U processor). Succesfully trained an nn-ensemble model, ran into no problems related to PR.

@osma osma added this to the 0.60 milestone Nov 23, 2022
@osma osma merged commit 1a58116 into master Nov 23, 2022
@osma osma deleted the issue637-multiprocessing-spawn branch November 23, 2022 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support spawn multiprocessing mode on Mac OS and Windows
2 participants