From 9584ac8775bfd674eee74cb4b1c8dbe130a246ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= <765740+giordano@users.noreply.github.com> Date: Fri, 13 Sep 2024 09:25:26 +0100 Subject: [PATCH] Deprecate old `mpiexec` method (#874) Keep only the method which returns the path to the `mpiexec` executable, which is the one JLLs prefer nowadays, too. --- docs/make.jl | 2 +- lib/MPIPreferences/src/system.jl | 3 ++- src/environment.jl | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 69e14c99a..9a1d84fe5 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -39,7 +39,7 @@ for (example_title, example_md) in EXAMPLES println(mdfile, "```") println(mdfile, "> mpiexecjl -n 4 julia $example_jl") cd(@__DIR__) do - write(mdfile, mpiexec(cmd -> read(`$cmd -n 4 $(Base.julia_cmd()) --project $example_jl`))) + write(mdfile, read(`$(mpiexec()) -n 4 $(Base.julia_cmd()) --project $example_jl`)) end println(mdfile, "```") end diff --git a/lib/MPIPreferences/src/system.jl b/lib/MPIPreferences/src/system.jl index 3d16043d0..f54c7307b 100644 --- a/lib/MPIPreferences/src/system.jl +++ b/lib/MPIPreferences/src/system.jl @@ -8,7 +8,8 @@ module System const preloads_env_switch = @load_preference("preloads_env_switch") const mpiexec_path = @load_preference("mpiexec") mpiexec(;adjust_PATH=true, adjust_LIBPATH=true) = `$mpiexec_path` - mpiexec(f;adjust_PATH=true, adjust_LIBPATH=true) = f(`$mpiexec_path`) + # The following method may be removed in future releases. + Base.@deprecate mpiexec(f;adjust_PATH=true, adjust_LIBPATH=true) f(mpiexec()) libmpi_handle = C_NULL function __init__() diff --git a/src/environment.jl b/src/environment.jl index ed0068324..70502173b 100644 --- a/src/environment.jl +++ b/src/environment.jl @@ -1,12 +1,12 @@ """ - mpiexec(fn) + mpiexec() -A wrapper function for the MPI launcher executable. Calls `fn(cmd)`, where `cmd` is a `Cmd` object of the MPI launcher. +A wrapper function for the MPI launcher executable. Returns a `Cmd` object pointing to the MPI launcher. # Usage ```jldoctest -julia> mpiexec(cmd -> run(`\$cmd -n 3 echo hello world`)); +julia> run(`\$(mpiexec()) -n 3 echo hello world`); hello world hello world hello world