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

Scalene does not seem to work with multiprocessing #809

Open
makmanalp opened this issue Apr 15, 2024 · 0 comments
Open

Scalene does not seem to work with multiprocessing #809

makmanalp opened this issue Apr 15, 2024 · 0 comments

Comments

@makmanalp
Copy link

Describe the bug

Scalene does not seem to collect profiling data from subprocesses forked by multiprocessing.

To Reproduce

Run this:

import multiprocessing as mp

def fun(args):
    return args

if __name__ == "__main__":
    p = mp.Pool(mp.cpu_count())
    r = p.map(fun, range(1000000))
    print(sum(x for x in r))
    print(((1000000-1) * 1000000) / 2)

in scalene via python3 -m scalene scalenetest.py

Expected behavior

Expect to see line profiler show stats from inside the function fun(), gathered from the subprocesses. What happens instead is that I get a profile that shows that the bulk of the time is spent in the main process waiting for the subprocesses to complete.

Screenshots
image

Desktop (please complete the following information):

  • OS: OSX Ventura 13.6.6
  • Python: Python 3.12.2
  • Scalene: Scalene version 1.5.38 (2024.03.24) - also tried repository version

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant