Hello,
I am trying to build a responsive GUI program. QML.jl (see:
https://github.com/barche/QML.jl ) works
already nicely in providing a GUI, but for performance reasons I have to do
the heavy work in the
background.
I am doing the following (very simple test):
addprocs(2)
remotecall(2, include, "remote.jl")
This works. Now I try to execute a function remotely:
remotecall(2, plotme)
This doesn't work:
ERROR: UndefVarError: plotme not defined
The remote module looks like this:
module remote
export plotme
using PyPlot
function plotme()
println("Hello!")
end
end
If I now execute:
julia> tic();using remote;toc()
WARNING: replacing module remote
elapsed time: 6.517559409 seconds
6.517559409
julia>
I get the warning:
WARNING: replacing module remote
Why is there this warning? I do not want to import the module twice.
Furthermore this is extremely slow. I loose the speed gain, that I intend
my using multiple processes in the first place.
The remote call works now:
julia> remotecall(2, plotme)
RemoteRef{Channel{Any}}(2,1,8)
julia> From worker 2: Hello!
Question:
How can I call a function in a remote worker that imports large libraries
that are slow to import without importing these libraries in the main
process?
Any hints welcome.
Uwe