I am writing a Julia course, where the script is compiled to MD and then to HTML using Literate.jl and Documenter.jl on GitHub actions.
The problem is in this snippet:
using Distributed, BenchmarkTools
a = rand(1:35,100)
addprocs(3)
rmprocs(workers()[2])
@everywhere function fib(n)
if n == 0 return 0 end
if n == 1 return 1 end
return fib(n-1) + fib(n-2)
end
result = pmap(fib,a)
With GitHub action complaining LoadError: UndefVarError: fib not defined
.
Where is the problem? On my PC it works correctly, as I “send” the Fibonacci function to every process with @everywhere
…
EDIT
It seems to be more general, GitHub actions raise errors on any call on multiprocess functions, also when I use the @distributed
macro :-/