From 7fa31260060429b24ec87b1063f407ba6bef2319 Mon Sep 17 00:00:00 2001 From: Boris Kaus Date: Wed, 18 Sep 2024 13:07:10 +0200 Subject: [PATCH 1/2] change how we call MPI, to make it compatible with MPItrampoline --- src/Run.jl | 18 +++--------------- src/run_lamem.jl | 5 ++--- test/runLaMEM.jl | 8 ++++---- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/Run.jl b/src/Run.jl index 223a702c..61762408 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 0647f39a..be7b3afd 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 diff --git a/test/runLaMEM.jl b/test/runLaMEM.jl index c1e1dec3..c34614e8 100644 --- a/test/runLaMEM.jl +++ b/test/runLaMEM.jl @@ -27,10 +27,10 @@ pkg_dir = pkgdir(LaMEM) #@test isnothing(out) # Try direct solvers - ParamFile = "input_files/FallingBlock_DirectSolver.dat"; - ParamFile = joinpath(pkg_dir,"test", ParamFile); - out = run_lamem(ParamFile, 1, "-nstep_max 2") # 1 core - @test isnothing(out) + #ParamFile = "input_files/FallingBlock_DirectSolver.dat"; + #ParamFile = joinpath(pkg_dir,"test", ParamFile); + #out = run_lamem(ParamFile, 1, "-nstep_max 2") # 1 core + #@test isnothing(out) if !Sys.iswindows() out = run_lamem(ParamFile, 2, "-nstep_max 5") # 2 cores (mumps) From e2afb90f4895d9a977df7f49c562f59c6a4b7cfa Mon Sep 17 00:00:00 2001 From: Boris Kaus Date: Wed, 18 Sep 2024 13:34:57 +0200 Subject: [PATCH 2/2] activate additional test --- test/runLaMEM.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/runLaMEM.jl b/test/runLaMEM.jl index c34614e8..c1e1dec3 100644 --- a/test/runLaMEM.jl +++ b/test/runLaMEM.jl @@ -27,10 +27,10 @@ pkg_dir = pkgdir(LaMEM) #@test isnothing(out) # Try direct solvers - #ParamFile = "input_files/FallingBlock_DirectSolver.dat"; - #ParamFile = joinpath(pkg_dir,"test", ParamFile); - #out = run_lamem(ParamFile, 1, "-nstep_max 2") # 1 core - #@test isnothing(out) + ParamFile = "input_files/FallingBlock_DirectSolver.dat"; + ParamFile = joinpath(pkg_dir,"test", ParamFile); + out = run_lamem(ParamFile, 1, "-nstep_max 2") # 1 core + @test isnothing(out) if !Sys.iswindows() out = run_lamem(ParamFile, 2, "-nstep_max 5") # 2 cores (mumps)