Skip to content

Commit

Permalink
attempt to define cores on win
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskaus committed Apr 21, 2024
1 parent 21a8f4c commit 53a826c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/run_lamem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ julia> run_lamem(ParamFile, 2, "-nstep_max = 1")
```
"""
function run_lamem(ParamFile::String, cores::Int64=1, args::String=""; wait=true, deactivate_multithreads=true)
cores_compute = cores
if iswindows() & cores>1
cores=1;
cores_compute=1;
println("LaMEM_jll does not support parallel runs on windows; using 1 core instead")
end
@show cores
if cores==1
@show cores_compute
if cores_compute==1
# Run LaMEM on a single core, which does not require a working MPI
cmd = `$(LaMEM_jll.LaMEM()) -ParamFile $(ParamFile) $args`
if deactivate_multithreads
Expand All @@ -59,7 +60,7 @@ function run_lamem(ParamFile::String, cores::Int64=1, args::String=""; wait=true
mpirun = setenv(mpiexec, LaMEM_jll.JLLWrappers.JLLWrappers.LIBPATH_env=>LaMEM_jll.LIBPATH[]);

# create command-line object
cmd = `$(mpirun) -n $cores $(LaMEM_jll.LaMEM_path) -ParamFile $(ParamFile) $args`
cmd = `$(mpirun) -n $cores_compute $(LaMEM_jll.LaMEM_path) -ParamFile $(ParamFile) $args`
if deactivate_multithreads
cmd = deactivate_multithreading(cmd)
end
Expand Down

0 comments on commit 53a826c

Please sign in to comment.