Skip to content

Commit

Permalink
Added automatic ntasks, need to make backend
Browse files Browse the repository at this point in the history
  • Loading branch information
nefrathenrici committed Dec 11, 2024
1 parent 884b815 commit 952cbd8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/slurm_workers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function worker_calibrate(ekp::EKP.EnsembleKalmanProcess, ensemble_size,n_iterat
;
rng_seed = 1234,
)
for iter in 0:(n_iterations)
for iter in 0:n_iterations
(; time) = @timed run_iteration(iter, ensemble_size, output_dir; worker_pool, failure_rate)
@info "Iteration $iter time: $time"
# Process results
Expand All @@ -79,6 +79,10 @@ worker_arg() = `--worker=$(worker_cookie())`

struct SlurmManager <: ClusterManager
ntasks::Integer

function SlurmManager(ntasks::Integer = parse(Int, get(ENV, "SLURM_NTASKS", "1")))
new(ntasks)
end
end

function Distributed.manage(manager::SlurmManager, id::Integer, config::WorkerConfig,
Expand All @@ -88,6 +92,7 @@ end

# Main SlurmManager function, mostly copied from the unmaintained ClusterManagers.jl
# Original code: https://github.com/JuliaParallel/ClusterManagers.jl
# TODO: Log per member
function Distributed.launch(sm::SlurmManager,params::Dict, instances_arr::Array,
c::Condition)
default_params = Distributed.default_addprocs_params()
Expand Down

0 comments on commit 952cbd8

Please sign in to comment.