Should I use mutable or immutable types for parameters when writing parallel code?

Hi there,

I’m a newbie to both Julia and parallel computing, trying to parallelise some code which runs a sampling algorithm. I have a master and multiple workers, all of which need access to some global parameters. I have defined a type which contains all of these parameters (not too many, ~20 variables).

It would seem good practice to make this type immutable since it effectively contains global variables, but the docs mention that immutable types are copied each time they are passed. Is it therefore better from the point of view of efficiency to make the type containing the global parameters mutable, or is there a totally different solution that I’m not seeing?

AFAIK immutable are passed by reference if they are large enough for it to be worthwhile.

Be very careful with any kind of mutation or globals with parallel computing. In general, anything which will be changed should be local to specific processes.