estimagic icon indicating copy to clipboard operation
estimagic copied to clipboard

Multistart Parallelization with Jit Compatible Code

Open nikithiel opened this issue 3 months ago • 7 comments

Hey there,

I am trying to run a gradient-based algorithm with multistart of my jit compatible code in parallel. Can I use estimagic's parallelisation using 'nprocs' via joblib or pathos or do I need to create a sample for the exploration phase manually and distribute it using jax parallelisation?

When running multistart=True with n_procs=2, I'm encountering the following warning:

RuntimeWarning: os.fork() was called. os.fork() is incompatible with multithreaded code, and JAX is multithreaded, so this will likely lead to a deadlock.

If helpful, I can post a some code snippets from my implementation.

nikithiel avatar Apr 02 '24 14:04 nikithiel