Open xiaodaigh opened 2 years ago
Try @everywhere using FileTrees
before doing anything with FileTrees to ensure that FileTrees and Dagger are properly scoped in Main
.
Longer explanation: When you addprocs
with Distributed, you spin up new Julia processes which are pretty much independent of the process you call addprocs
from. As such, they don't know anything about what modules you have loaded and what variables you have declared. This is also what allows Distributed to run on multiple machines connected over a network, e.g. a compute cluster. The @everywhere
commad just means "run this command on all processes".
Note that if you are not running from the default environment (e.g. you have started Julia with --project
or have ran Pkg.activate()
) you also need to ensure that the added processes are running in the same environment or else you will get a similar error as above. Most failsafe way to do this is to run addprocs(...; exeflags ="--project")
.
Afaik, Dagger
also makes seamless usage of Threads which don't require jumping through the above hoops to get parallelism as they run inside the same process. There are some subtleties w.r.t. memory allocation which in some cases makes running multiple threads slower than multiple processes, so it can be useful to try both though.
I am expecting
4
to be returned but it's complaining aboutI am on Julia 1.7.2 and FileTrees 0.3.4