JuliaDynamics / DrWatson.jl

The perfect sidekick to your scientific inquiries
https://juliadynamics.github.io/DrWatson.jl/stable/
Other
830 stars 93 forks source link

Usage together with Distributed can cause precompile issues #270

Open Naikless opened 3 years ago

Naikless commented 3 years ago

As mentioned already in https://github.com/JuliaDynamics/DrWatson.jl/issues/269, using DrWatson together with the Distributed package can cause errors where many remote worker processes try to precompile packages at the same time. This either causes the machine to run out of memory or raise issues with the compilecache.

MWE for the error (now using a pure Julia package):

using Distributed
addprocs(8)
@everywhere using DrWatson
@everywhere @quickactivate "TestEnv" 

@everywhere begin
    using Distributions
end

Slightly altering the order of imports solves the issue. This works:

using Distributed
addprocs(8)
@everywhere using DrWatson

@everywhere begin
    @quickactivate "TestEnv" 
    using Distributions
end

The issue seems indeed to be related to DrWatson, because running

using Distributed
addprocs(8)
@everywhere import Pkg
@everywhere Pkg.activate(".") 

@everywhere begin
    using Distributions
end

also poses no problem.

I am really interested to know the reasons for this.

EDIT: Last example corrected to better match the issue case.

fcdimitr commented 1 year ago

@Naikless Does starting Julia with the following flag

julia --compiled-modules=no 

resolve the issue? Startup will definitely be slower, but the processes should not collide in compiling packages/loading caches.