Skip to content

Commit afee38b

Browse files
Rename MPI to MPIProcesses to Fix #189 and #185
1 parent 531e9fd commit afee38b

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

docs/src/mpi.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ mpi_run = pigeons(
8686
target = toy_mvn_target(1000000),
8787
n_chains = 1000,
8888
checkpoint = true,
89-
on = MPI(
89+
on = MPIProcesses(
9090
n_mpi_processes = 1000,
9191
n_threads = 1))
9292
```
9393

94-
This will start a distributed PT algorithm with 1000 chains on 1000 MPI processes, each using one thread, targeting a one million
94+
This will start a distributed PT algorithm with 1000 chains on 1000 MPIProcesses processes, each using one thread, targeting a one million
9595
dimensional target distribution. On the UBC Sockeye cluster, the last
9696
round of this run (i.e. the last 1024 iterations) takes 10 seconds to complete, versus more than
9797
2 hours if run serially, i.e. a >700x speed-up.
@@ -126,11 +126,11 @@ are built-in inside the Pigeons module.
126126
However in typical use cases,
127127
some user-provided code needs to be provided to
128128
[`ChildProcess`](@ref)
129-
and [`MPI`](@ref) so that the other participating Julia
129+
and [`MPIProcesses`](@ref) so that the other participating Julia
130130
processes have access to it.
131131
This is done with the argument `dependencies` (of type `Vector`; present in
132132
both [`ChildProcess`](@ref)
133-
and [`MPI`](@ref)).
133+
and [`MPIProcesses`](@ref)).
134134
Two types of elements can be used in the vector of dependencies, and they can be mixed:
135135

136136
- elements of type `Module`: for each of those, an `using` statement will be generated in the script used by the child process;

docs/src/output-mpi-postprocessing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Option (1) is more convenient than (2) but it uses more RAM.
1717

1818
Many of Pigeons' post-processing tools take as input a [`PT`](@ref) struct.
1919
When running locally, [`pigeons()`](@ref) returns a [`PT`](@ref) struct,
20-
however, when running a job via [`MPI`](@ref) or [`ChildProcess`](@ref),
20+
however, when running a job via [`MPIProcesses`](@ref) or [`ChildProcess`](@ref),
2121
[`pigeons()`](@ref) returns a [`Result`](@ref) struct (which only holds the
2222
directory where samples are stored).
2323

src/Pigeons.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ include("includes.jl")
6363

6464
export pigeons, Inputs, PT,
6565
# for running jobs:
66-
ChildProcess, MPI,
66+
ChildProcess, MPIProcesses,
6767
# references:
6868
DistributionLogPotential,
6969
# targets:

src/includes.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ include("tempering/NonReversiblePT.jl")
3434
include("tempering/StabilizedPT.jl")
3535
include("tempering/tempering.jl")
3636
include("swap/swap_graph.jl")
37-
include("submission/MPI.jl")
37+
include("submission/MPIProcesses.jl")
3838
include("targets/BlangTarget.jl")
3939
include("submission/MPISettings.jl")
4040
include("submission/ChildProcess.jl")

src/pt/checks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function check_against_serial(pt)
5656
# run a serial copy
5757
dependencies =
5858
if isfile("$(pt.exec_folder)/.dependencies.jls")
59-
# this process was itself spawn using ChildProcess/MPI
59+
# this process was itself spawn using ChildProcess/MPIProcesses
6060
# so use the same dependencies as this process
6161
deserialize("$(pt.exec_folder)/.dependencies.jls")
6262
else

src/submission/MPI.jl renamed to src/submission/MPIProcesses.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Fields:
1414
1515
$FIELDS
1616
"""
17-
@kwdef struct MPI <: Submission
17+
@kwdef struct MPIProcesses <: Submission
1818
"""
1919
The number of threads per MPI process, 1 by default.
2020
"""
@@ -51,7 +51,7 @@ end
5151
"""
5252
$SIGNATURES
5353
"""
54-
function pigeons(pt_arguments, mpi_submission::MPI)
54+
function pigeons(pt_arguments, mpi_submission::MPIProcesses)
5555
if !is_mpi_setup()
5656
error("call setup_mpi(..) first")
5757
end
@@ -77,13 +77,13 @@ function pigeons(pt_arguments, mpi_submission::MPI)
7777
end
7878

7979
# todo: abstract out to other submission systems
80-
function mpi_submission_cmd(exec_folder, mpi_submission::MPI, julia_cmd)
80+
function mpi_submission_cmd(exec_folder, mpi_submission::MPIProcesses, julia_cmd)
8181
r = rosetta()
8282
submission_script = mpi_submission_script(exec_folder, mpi_submission, julia_cmd)
8383
return `$(r.submit) $submission_script`
8484
end
8585

86-
function mpi_submission_script(exec_folder, mpi_submission::MPI, julia_cmd)
86+
function mpi_submission_script(exec_folder, mpi_submission::MPIProcesses, julia_cmd)
8787
# TODO: generalize to other submission systems
8888
# TODO: move some more things over from mpi-run
8989
info_folder = "$exec_folder/info"
@@ -133,23 +133,23 @@ const _rosetta = (;
133133

134134
supported_submission_systems() = filter(x -> x != :queue_concept && x != :custom, keys(_rosetta))
135135

136-
resource_string(m::MPI, symbol) = resource_string(m, Val(symbol))
136+
resource_string(m::MPIProcesses, symbol) = resource_string(m, Val(symbol))
137137

138-
resource_string(m::MPI, ::Val{:pbs}) =
138+
resource_string(m::MPIProcesses, ::Val{:pbs}) =
139139
# +-- each chunks should request as many cpus as threads,
140140
# +-- number of "chunks"... | +-- NB: if mpiprocs were set to more than 1 this would give a number of mpi processes equal to select*mpiprocs
141141
# v v v
142142
"#PBS -l walltime=$(m.walltime),select=$(m.n_mpi_processes):ncpus=$(m.n_threads):mpiprocs=1:mem=$(m.memory)"
143143

144-
resource_string(m::MPI, ::Val{:slurm}) =
144+
resource_string(m::MPIProcesses, ::Val{:slurm}) =
145145
"""
146146
#SBATCH -t $(m.walltime)
147147
#SBATCH --ntasks=$(m.n_mpi_processes)
148148
#SBATCH --cpus-per-task=$(m.n_threads)
149149
#SBATCH --mem-per-cpu=$(m.memory)
150150
"""
151151

152-
function resource_string(m::MPI, ::Val{:lsf})
152+
function resource_string(m::MPIProcesses, ::Val{:lsf})
153153
@assert m.n_threads == 1 "TODO: find how to specify number of threads per node with LSF"
154154
"""
155155
#BSUB -W $(m.walltime)

src/submission/submission_utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function find_rank_file(folder, machine::Int)
114114
return nothing
115115
end
116116

117-
# construct launch cmd and script for MPI and ChildProcess
117+
# construct launch cmd and script for MPIProcesses and ChildProcess
118118

119119
function launch_cmd(pt_arguments, exec_folder, dependencies, n_threads::Int, on_mpi::Bool)
120120
script_path = launch_script(pt_arguments, exec_folder, dependencies, on_mpi)
@@ -200,7 +200,7 @@ function launch_code(
200200
Pigeons.deserialize_immutables!(raw"$path_to_serialized_immutables")
201201
deserialize(raw"$path_to_serialized_pt_arguments")
202202
catch e
203-
println("Hint: probably missing dependencies, use the dependencies argument in MPI() or ChildProcess()")
203+
println("Hint: probably missing dependencies, use the dependencies argument in MPIProcesses() or ChildProcess()")
204204
rethrow(e)
205205
end
206206

test/activate_test_env.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# If we do not do this, we will end up testing the
55
# latest released version instead of the one checked out.
66

7-
# We have to do this because ChildProcess/MPI depend on
7+
# We have to do this because ChildProcess/MPIProcesses depend on
88
# a single toml file to know how to load Pigeons and other
99
# dependencies.
1010

0 commit comments

Comments
 (0)