-
Notifications
You must be signed in to change notification settings - Fork 1
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
thread process_stack(img, ref) #35
Comments
@Phlair create new branch as iss35 :) |
Rewrote _process_stack() in a multithreading manner using concurrent.futures, looks like minimal (possibly zero) gains on runtime. Looking at resource monitor during testing it looks like my CPU is maxing out at ~13% regardless of whether it's being threaded or not (this number makes sense as 1 core out of 8). This makes me think there are possible performance gains to be had with multi processing instead... I'll look into that next, will need slightly different thinking for implementation. |
I've always tried with multiprocessing lib and it never works! pytraction/pytraction/core copy.py Lines 318 to 321 in b36600a
How much harder is it to write directly to a locked dict? Or is the cost-benefit not worth it? |
Managed to partially implement multiprocessing and seeing expected performance gains 👍
|
Also in response to your message, generally I would avoid locking unless you really need to lock. In this case I'm only populating that defaultdict ('log') back in the main thread/process with the response from the processes as they complete, so no need to lock anything |
Thanks for implimenting the verbose is coming from the PIV. I've been using a hacky work around to supress this prcoess and need to look into a looging lib to handle this. Thanks for added the part on multithreading :) the if name == "main" part is super annoying for non expect python users. Do you think it's possible to call a script else where with an arg parse so this is hidden from the user i.e.
|
multithread _process_stack method and include
num_workers
arg i.e.process_stack(img, ref, num_workers=x)
. Note that the log file (either h5 or defaultdict) will need to have a lock.The part that needs threading is
becomes
The following scripts should be considerably faster.
The text was updated successfully, but these errors were encountered: