Skip to content

Commit 771690f

Browse files
committed
Merge branch 'use_ENVs_for_OMFIT_OMAS' of github.com:ProjectTorreyPines/FUSE.jl into use_ENVs_for_OMFIT_OMAS
2 parents c0494c2 + 3a0eb15 commit 771690f

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/utils_begin.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ Start multiprocessing environment
164164
"""
165165
function parallel_environment(cluster::String="localhost", nworkers::Integer=-1, cpus_per_task::Int=1; memory_usage_fraction::Float64=0.5, workers_import_fuse::Bool=true, kw...)
166166
if nworkers == 0
167+
pid_list = []
167168
#pass
168169

169170
elseif cluster == "omega"
@@ -179,7 +180,7 @@ function parallel_environment(cluster::String="localhost", nworkers::Integer=-1,
179180
gigamem_per_cpu = Int(ceil(memory_usage_fraction * gigamem_per_node / cpus_per_node * cpus_per_task))
180181
ENV["JULIA_WORKER_TIMEOUT"] = "360"
181182
if Distributed.nprocs() < np
182-
Distributed.addprocs(
183+
pid_list = Distributed.addprocs(
183184
ClusterManagers.SlurmManager(np - Distributed.nprocs());
184185
partition="ga-ird",
185186
exclusive="",
@@ -207,7 +208,7 @@ function parallel_environment(cluster::String="localhost", nworkers::Integer=-1,
207208
gigamem_per_cpu = Int(ceil(memory_usage_fraction * gigamem_per_node / cpus_per_node * cpus_per_task))
208209
ENV["JULIA_WORKER_TIMEOUT"] = "360"
209210
if Distributed.nprocs() < np
210-
Distributed.addprocs(
211+
pid_list = Distributed.addprocs(
211212
ClusterManagers.SlurmManager(np - Distributed.nprocs());
212213
partition="pppl-medium",
213214
exclusive="",
@@ -235,7 +236,7 @@ function parallel_environment(cluster::String="localhost", nworkers::Integer=-1,
235236
gigamem_per_cpu = Int(ceil(memory_usage_fraction * gigamem_per_node / cpus_per_node * cpus_per_task))
236237
ENV["JULIA_WORKER_TIMEOUT"] = "180"
237238
if Distributed.nprocs() < np
238-
Distributed.addprocs(
239+
pid_list = Distributed.addprocs(
239240
ClusterManagers.SlurmManager(np - Distributed.nprocs());
240241
exclusive="",
241242
topology=:master_worker,
@@ -261,7 +262,7 @@ function parallel_environment(cluster::String="localhost", nworkers::Integer=-1,
261262
gigamem_per_cpu = Int(ceil(memory_usage_fraction * gigamem_per_node / cpus_per_node * cpus_per_task))
262263
ENV["JULIA_WORKER_TIMEOUT"] = "360"
263264
if Distributed.nprocs() < np
264-
Distributed.addprocs(
265+
pid_list = Distributed.addprocs(
265266
ClusterManagers.SlurmManager(np - Distributed.nprocs());
266267
partition="LocalQ",
267268
topology=:master_worker,
@@ -288,7 +289,7 @@ function parallel_environment(cluster::String="localhost", nworkers::Integer=-1,
288289
gigamem_per_cpu = Int(ceil(memory_usage_fraction * gigamem_per_node / cpus_per_node * cpus_per_task))
289290
ENV["JULIA_WORKER_TIMEOUT"] = "360"
290291
if Distributed.nprocs() < np
291-
Distributed.addprocs(
292+
pid_list = Distributed.addprocs(
292293
ClusterManagers.SlurmManager(np - Distributed.nprocs());
293294
partition="sched_mit_psfc_r8",
294295
exclusive="",
@@ -311,7 +312,7 @@ function parallel_environment(cluster::String="localhost", nworkers::Integer=-1,
311312
end
312313
np = nworkers + 1
313314
if Distributed.nprocs() < np
314-
Distributed.addprocs(np - Distributed.nprocs(); topology=:master_worker,
315+
pid_list = Distributed.addprocs(np - Distributed.nprocs(); topology=:master_worker,
315316
exeflags=["--threads=$(cpus_per_task)", "--heap-size-hint=$(mem_size)G", "--project=$(Base.active_project())"])
316317
end
317318

@@ -337,6 +338,8 @@ function parallel_environment(cluster::String="localhost", nworkers::Integer=-1,
337338
end
338339

339340
return println("Using $(Distributed.nprocs()-1) workers on $(gethostname())")
341+
println("Using $(Distributed.nprocs()-1) workers on $(gethostname())")
342+
return pid_list
340343
end
341344

342345
"""

0 commit comments

Comments
 (0)