Previously I’ve always specified the number of worker processes on the Julia command line via -p . Since the source file passed in is the same for all the processes, I can use Distributed.remotecall_fetch() for any function available to the main process.
Now I’m trying to add workers dynamically, via addproc from julia_main() in program.jl (the entry-point to my application). I’d like to be able to do the equivalent of
@everywhere import MyModule once the workers have been added (in julia_main()), but ‘import’ can only be used at the top level. So far, the solution I’ve come up with is to do
@everywhere include("/path/to/program.jl") but this seems rather ugly. Is there a cleaner way? Thanks.