diff --git a/src/Run.jl b/src/Run.jl index 223a702..6176240 100644 --- a/src/Run.jl +++ b/src/Run.jl @@ -1,27 +1,15 @@ module Run # module to run LaMEM_jll -using LaMEM_jll,Glob +using LaMEM_jll,Glob, MPI -export run_lamem, run_lamem_save_grid, mpiexec +export run_lamem, run_lamem_save_grid export remove_popup_messages_mac, show_paths_LaMEM include("run_lamem.jl") include("run_lamem_save_grid.jl") include("utils_Run.jl") -# load the correct MPI -const mpiexec = if isdefined(LaMEM_jll,:MPICH_jll) - LaMEM_jll.MPICH_jll.mpiexec() -elseif isdefined(LaMEM_jll,:MicrosoftMPI_jll) - LaMEM_jll.MicrosoftMPI_jll.mpiexec() -elseif isdefined(LaMEM_jll,:OpenMPI_jll) - LaMEM_jll.OpenMPI_jll.mpiexec() -elseif isdefined(LaMEM_jll,:MPItrampoline_jll) - LaMEM_jll.MPItrampoline_jll.mpiexec() -else - println("Be careful! No MPI library detected; parallel runs won't work") - nothing -end +const mpiexec = MPI.mpiexec() end \ No newline at end of file diff --git a/src/run_lamem.jl b/src/run_lamem.jl index 0647f39..be7b3af 100644 --- a/src/run_lamem.jl +++ b/src/run_lamem.jl @@ -15,7 +15,6 @@ function deactivate_multithreading(cmd::Cmd) # does not work well. Switch that off: cmd = addenv(cmd,"OMP_NUM_THREADS"=>1) cmd = addenv(cmd,"VECLIB_MAXIMUM_THREADS"=>1) - return cmd end @@ -57,10 +56,10 @@ function run_lamem(ParamFile::String, cores::Int64=1, args::String=""; wait=true run(cmd, wait=wait); else # set correct environment - mpirun = setenv(mpiexec, LaMEM_jll.JLLWrappers.JLLWrappers.LIBPATH_env=>LaMEM_jll.LIBPATH[]); + mpirun = setenv(mpiexec, LaMEM_jll.LaMEM().env); # create command-line object - cmd = `$(mpirun) -n $cores_compute $(LaMEM_jll.LaMEM_path) -ParamFile $(ParamFile) $args` + cmd = `$(mpirun) -n $cores_compute $(LaMEM_jll.LaMEM().exec) -ParamFile $(ParamFile) $args` if deactivate_multithreads cmd = deactivate_multithreading(cmd) end