joshspeagle / dynesty

Dynamic Nested Sampling package for computing Bayesian posteriors and evidences
https://dynesty.readthedocs.io/
MIT License
346 stars 76 forks source link

multi-GPU parallellzation #446

Closed simoncasassus closed 1 year ago

simoncasassus commented 1 year ago

Dynesty version dynesty==2.1.2

Your question I am trying to find a way to run the dynamic nested sampler on multiple GPU cards. Is there a way to relate the thread number in dynesty's Pool object to a specific card ID? For instance, if I have 3 GPU cards, I would like to paralleize dynesty with 3 threads, and run each thread on a specific card.

Thanks!!

segasai commented 1 year ago

I am not entirely sure, but you have access to the PID of the process and can use that to determine the GPU to send. Also you can use just a simple multiprocessing Pool instead of dynesty's pool. In that case you will have full control of initializing it and ensuring that each process has an assigned GPU.

simoncasassus commented 1 year ago

thank you very much Sergey, I will try as you say.