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

Multiprocessing #5

Open
Jiaxuan777 opened this issue Aug 6, 2024 · 2 comments
Open

Multiprocessing #5

Jiaxuan777 opened this issue Aug 6, 2024 · 2 comments

Comments

@Jiaxuan777
Copy link

Hello,
I'm glad to see your project. It's useful for what I am doing now. But I have a problem to inquire you. I have put this WSI Normalizer in my dataloader, and the transform part is in the function getitem(). When I set the 'num_workers': > 1 to accelerate. It will cause the error like this:

image

I spent two days on it. However, I cannot solve it except for setting the ‘num workers = 0’,but my data is so big, this way is too slow.
And I referred to this settings.Peter554/StainTools#43 But it still no use. Can you help me? Thank you!

@cwlkr
Copy link
Owner

cwlkr commented Aug 6, 2024

Hello,

Yes, this is unfortunately not straight forward to solve. The problem is in how CUDA is used in accelerating tasks which does not lend to multiprocessing. CUDA, does multiprocessing by splitting a task into smaller simple step tasks that can be run in parallel on GPU kernels, while CPU multiprocessing takes a tasks and runs the same task for different inputs in parallel. Unfortunately, in how CUDA is constructed these are not easily inter-mixable. This is why ‘num workers = 0’, works while setting num_workers > 0 will crash.

My code works therefore best for larger input tiles (normalizing a WSI), but not in a parallel DataLoader.

I have found that in StainTools, it is actually faster to use SPAMS settings akin to the wonderful stain_mixup project. I have used the same in my related augmentation strategy stainlist_augmentation.

Best,
Cédric

@Jiaxuan777
Copy link
Author

Thank you! I konw it.

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

2 participants