Greetings! I created a package ModelUtils
and hope to run it in multiple workers. In this package, a function called linear_regression
being exported. The module is under src
folder and has the following content
module ModelUtils
export linear_regression
include("linear_models.jl")
end
In main.jl
file where I would invoke the linear_models
using Distributed
addprocs(exeflags="--project") # the --project flags is essentially running ] activate .
@everywhere using ModelUtils
fn_arg = rand(Float64, (5,2))
@sync for i in 1:nworkers()
@spawnat i linear_regression(fn_arg)
end
I would get the following error
UndefVarError: linear_regression not defined
What is the cause for this error? Thank you.