"odd" behavior of module import in multi process environment

Maybe odd only in the eye of novice user, but I would like to know why.

So, I have the settings for multi process environment

  • JULIA_NUM_THREADS = 4
  • number of precesses = 4 (-p4)

Also, I have push!(LOCAL_PATH, “.”) in startup.jl.

There is a very simple module (MyMod.jl) define as:

module MyMod

function func()
    Core.println("1234")
end

end # MyMod

Now, I do in REPL: using MyMod

Then I get the error: (this error only happens when #processes are more than 1)
I feel this is very strange because there is no multi process calls in the module.

One notable thing is that error is not produced if I do:

include("/path/to/MyMod.jl")
using .MyMod

So I guess that unless a module is not part of a package system, then correct way of import a module is to use include() and .using syntax. but I have no idea.

ERROR: On worker 2:
ArgumentError: Package MyMod [top-level] is required but does not seem to be installed:

  • Run Pkg.instantiate() to install all recorded dependencies.

_require at .\loading.jl:982
require at .\loading.jl:911
#2 at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.2\Distributed\src\Distributed.jl:78
#116 at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.2\Distributed\src\process_messages.jl:307
run_work_thunk at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.2\Distributed\src\process_messages.jl:79
run_work_thunk at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.2\Distributed\src\process_messages.jl:88
#102 at .\task.jl:268
#remotecall_wait#154(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(remotecall_wait), ::Function, ::Distributed.Worker) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.2\Distributed\src\remotecall.jl:421
remotecall_wait(::Function, ::Distributed.Worker) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.2\Distributed\src\remotecall.jl:412
#remotecall_wait#157(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(remotecall_wait), ::Function, ::Int64) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.2\Distributed\src\remotecall.jl:433
remotecall_wait at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.2\Distributed\src\remotecall.jl:433 [inlined]
(::getfield(Distributed, Symbol("##1#3")){Base.PkgId,Int64})() at .\task.jl:268

…and 3 more exception(s).

Stacktrace:
[1] sync_end(::Array{Any,1}) at .\task.jl:235
[2] _require_callback(::Base.PkgId) at .\task.jl:254
[3] #invokelatest#1 at .\essentials.jl:790 [inlined]
[4] invokelatest at .\essentials.jl:789 [inlined]
[5] require(::Base.PkgId) at .\loading.jl:914
[6] require(::Module, ::Symbol) at .\loading.jl:906