Yes, using __init__
will do.
It seems that your module was first precompiled in a single threaded context. The codes inside the module will not be reevaluated even if you restart, hence ntasks will always equal 1 no matter how many threads you restart julia with.
You can use __init__
to execute a code whenever the module is loaded.
For more info, I believe @oxinabox 's post will be helpful.