joshspeagle / dynesty

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

Unique identifier for evaluating point #488

Open romanovzky opened 3 hours ago

romanovzky commented 3 hours ago

Dynesty version 2.1.4

Your question Is there a way of having a unique identifier for an evaluating point? My likelihood requires querying an external program through writing an input and reading an output files. In order to parallelise, I need a unique identifier so that I don't have concurrency issues with having multiple processes trying to write and read from a file with a same name. Is there any feature in dynesty that I could use to achieve this?

Cheers

segasai commented 2 hours ago

Hi,

If you are running stuff on one machine you can always use os.getpid() as an identifier.

romanovzky commented 2 hours ago

Hmmmm not exactly the same, as I'll only have N unique ids for each of the N parallel processes, not for the M likelihood calls. It depends now on how dynesty queues its jobs, but I guess that if it does on the usual way where M calls are divided by the N processes, then in each process the M/N calls are evaluated sequentially so I can reuse the os.getpid() within the process. It should do the trick, I'll try. Thanks!