I am trying to figure out how to run a single function on all workers once for setup.
I have a system where after the simulation has reached a certain point there are some parameters that are changed and I need to instruct all workers to rebuild their local caches.
I know I can map the function and use a large enough sequence that all the workers will probably run the code to update the cache at least once but that does not guarantee all of them run it and running it multiple times is not efficient.
The other idea I had was for the master process to generate a token and hand it with every simulation to all workers and if the token is ever different then they rebuild their caches but that would require a lot of changes to the system and I would prefer not do something like that.
Any suggestions for how to do this?