Skip to content

Commit 6fdbf38

Browse files
committed
use MPI.mpiexec function
1 parent 8c78251 commit 6fdbf38

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/MPIClusterManagers.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export MPIManager, launch, manage, kill, procs, connect, mpiprocs, @mpi_do, Tran
44

55
using Distributed, Serialization
66
import MPI
7-
const mpiexec = isdefined(MPI, :mpiexec_path) ? MPI.mpiexec_path : "mpiexec"
87

98
include("mpimanager.jl")
109

src/mpimanager.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ mutable struct MPIManager <: ClusterManager
2929
mode::TransportMode
3030

3131
launched::Bool # Are the MPI processes running?
32-
mpirun_cmd::Cmd # How to start MPI processes
3332
launch_timeout::Int # seconds
3433

3534
initialized::Bool # All workers registered with us
@@ -51,10 +50,9 @@ mutable struct MPIManager <: ClusterManager
5150
receiving_done::Channel{Nothing}
5251

5352
function MPIManager(; np::Integer = Sys.CPU_THREADS,
54-
mpirun_cmd::Cmd = `$mpiexec -n $np`,
5553
launch_timeout::Real = 60.0,
5654
mode::TransportMode = MPI_ON_WORKERS,
57-
master_tcp_interface::String="" )
55+
master_tcp_interface::String="" )
5856
mgr = new()
5957
mgr.np = np
6058
mgr.mpi2j = Dict{Int,Int}()
@@ -64,7 +62,6 @@ mutable struct MPIManager <: ClusterManager
6462
# Only start MPI processes for MPI_ON_WORKERS
6563
mgr.launched = mode != MPI_ON_WORKERS
6664
@assert MPI.Initialized() == mgr.launched
67-
mgr.mpirun_cmd = mpirun_cmd
6865
mgr.launch_timeout = launch_timeout
6966

7067
mgr.initialized = false
@@ -141,8 +138,10 @@ function Distributed.launch(mgr::MPIManager, params::Dict,
141138
end
142139
cookie = string(":cookie_",Distributed.cluster_cookie())
143140
setup_cmds = `import MPIClusterManagers\;MPIClusterManagers.setup_worker'('$(mgr.ip),$(mgr.port),$cookie')'`
144-
mpi_cmd = `$(mgr.mpirun_cmd) $(params[:exename]) -e $(Base.shell_escape(setup_cmds))`
145-
open(detach(mpi_cmd))
141+
MPI.mpiexec() do mpiexec_cmd
142+
mpi_cmd = `$mpiexec_cmd -n $(mgr.np) $(params[:exename]) -e $(Base.shell_escape(setup_cmds))`
143+
open(detach(mpi_cmd))
144+
end
146145
mgr.launched = true
147146
end
148147

0 commit comments

Comments
 (0)