I have a project folder with a package that can make computations in parallel processes and a script that makes use of the package. Because I want my script to run in parallel I need to load the package in all process, so
script.jl starts like this
using Distributed @everywhere using MyPackage
MyPackage is not in the load path, so I need to activate its environment in all cores first. I would like to be able to run the script from the command line in the appropriate environment, so I was expecting this would work:
shell> julia -p auto --project=. script.jl
However, I get the error that worker 2 could not find the package, so I assume the project is only activated in the main process (
shell> julia --project=. script.jl does not throw any errors). Is there a way to activate the project on all cores from the command line?
I am getting around this issue by modifying the script to activate the environment in all cores but I do not like to have my script be dependent on the working directory:
using Distributed @everywhere using Pkg @everywhere Pkg.activate(".") @everywhere using MyPackage
Any advice on best practices would be much appreciated.