Suppose I have a file located at dir/ModuleA.jl
:
module ModuleA
export f
function f()
return("foo")
end
end
and another file located at dir/main.jl
:
addprocs(4)
@everywhere include("ModuleA.jl")
Running main.jl from inside dir
with julia main.jl
works fine, but fails from anywhere else because worker 2 tries to locate ModuleA.jl
inside the current working directory.
As a fix I tried
@everywhere include(joinpath(@__DIR__, "ModuleA.jl"))
but @__DIR__
returns nothing
on the workers.
Can someone enlighten me what’s happening here?
The problem I want to solve is making an existing module available on all workers while still being able to call the script from any working directory.