I find using Base.source_dir()
super convenient for include
ing files into a Julia script because it is easy to load everything using relative paths from the script file. This doesn't work properly with parallelized code. For example, if we have a test file in /Users/username/test/
called test.jl
, with the following code:
@everywhere println(pwd())
@everywhere println(Base.source_dir())
and we run julia -p 1 test/test.jl
we get
/Users/username
From worker 2: /Users/username
/Users/username/test
From worker 2: nothing
what would be the most robust way to include
another file that is also in the test
directory?