Skip to content

Commit af3d87d

Browse files
committed
Fix ppr mapper
When mapping ppr, we need to know if there are enough cpus to map the required ppn for just that object. So be a little more careful on the logic checking for availability. Cleanup the display allocation a bit - need to ensure we had the opportunity to set slots before declaring the allocation as having been displayed. Signed-off-by: Ralph Castain <[email protected]> (cherry picked from commit 7766e92)
1 parent 44eeb24 commit af3d87d

File tree

5 files changed

+80
-22
lines changed

5 files changed

+80
-22
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: macOS
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
macOS:
7+
runs-on: macos-latest
8+
steps:
9+
- name: Setup macOS
10+
run: |
11+
# install autotools
12+
brew install autoconf
13+
brew install automake
14+
brew install libtool
15+
brew install libevent
16+
brew install hwloc
17+
- name: Git clone PMIx
18+
uses: actions/checkout@v3
19+
with:
20+
submodules: recursive
21+
repository: openpmix/openpmix
22+
path: openpmix/master
23+
ref: master
24+
- name: Build PMIx
25+
run: |
26+
cd openpmix/master
27+
./autogen.pl
28+
./configure --prefix=$RUNNER_TEMP/pmixinstall
29+
make -j
30+
make install
31+
- name: Git clone PRRTE
32+
uses: actions/checkout@v3
33+
with:
34+
submodules: recursive
35+
clean: false
36+
- name: Build PRRTE
37+
run: |
38+
./autogen.pl
39+
./configure --prefix=$RUNNER_TEMP/prteinstall --with-pmix=$RUNNER_TEMP/pmixinstall --enable-devel-check
40+
make -j
41+
make install
42+
- name: Build examples
43+
run: |
44+
pushd examples
45+
make
46+
popd
47+
- name: Test sanity check
48+
run: |
49+
mpirun --map-by ppr:1:core examples/hello
50+
mpirun --map-by ppr:1:core examples/legacy

src/mca/plm/base/plm_base_frame.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,6 @@ static void launch_daemons(int fd, short args, void *cbdata)
266266
// check for topology limitations
267267
prte_rmaps_base.require_hwtcpus = !prte_hwloc_base_core_cpus(node->topology->topo);
268268

269-
// display the allocation, if requested
270-
if (prte_get_attribute(&state->jdata->attributes, PRTE_JOB_DISPLAY_ALLOC, NULL, PMIX_BOOL)) {
271-
prte_ras_base_display_alloc(state->jdata);
272-
}
273-
274269
/* jump to mapping */
275270
state->jdata->state = PRTE_JOB_STATE_VM_READY;
276271
PRTE_ACTIVATE_JOB_STATE(state->jdata, PRTE_JOB_STATE_DAEMONS_REPORTED);

src/mca/ras/base/ras_base_allocate.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ void prte_ras_base_display_alloc(prte_job_t *jdata)
124124
bool parsable;
125125
pmix_proc_t source;
126126

127-
128127
if (prte_get_attribute(&jdata->attributes, PRTE_JOB_ALLOC_DISPLAYED, NULL, PMIX_BOOL)) {
129128
return;
130129
}
@@ -722,8 +721,7 @@ void prte_ras_base_allocate(int fd, short args, void *cbdata)
722721

723722
DISPLAY:
724723
/* shall we display the results? */
725-
if (4 < pmix_output_get_verbosity(prte_ras_base_framework.framework_output) ||
726-
prte_get_attribute(&jdata->attributes, PRTE_JOB_DISPLAY_ALLOC, NULL, PMIX_BOOL)) {
724+
if (4 < pmix_output_get_verbosity(prte_ras_base_framework.framework_output)) {
727725
prte_ras_base_display_alloc(jdata);
728726
}
729727

src/mca/rmaps/base/rmaps_base_support_fns.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -712,15 +712,25 @@ bool prte_rmaps_base_check_avail(prte_job_t *jdata,
712712
/* the available cpus are in the scratch location */
713713
options->target = hwloc_bitmap_dup(prte_rmaps_base.available);
714714

715+
// compute how many procs we can support on this object
715716
nprocs = options->ncpus / options->cpus_per_rank;
716-
if (options->nprocs <= nprocs) {
717-
avail = true;
718-
} else if (options->overload) {
719-
/* doesn't matter how many cpus are in use */
720-
avail = true;
721-
} else if (0 == options->pprn && 0 < nprocs) {
722-
options->nprocs = nprocs;
723-
avail = true;
717+
718+
if (0 < options->pprn) {
719+
// we are ppr mapping, so there must be enough cpus to
720+
// support at least pprn procs on this object
721+
if (options->pprn <= nprocs) {
722+
avail = true;
723+
}
724+
} else {
725+
if (options->nprocs <= nprocs) {
726+
avail = true;
727+
} else if (options->overload) {
728+
/* doesn't matter how many cpus are in use */
729+
avail = true;
730+
} else if (0 < nprocs) {
731+
options->nprocs = nprocs;
732+
avail = true;
733+
}
724734
}
725735

726736
done:

src/mca/rmaps/ppr/rmaps_ppr.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,15 @@ static int ppr_mapper(prte_job_t *jdata,
207207

208208
if (HWLOC_OBJ_MACHINE == options->maptype) {
209209
options->nprocs = options->pprn;
210-
/* if the number of procs is greater than the number of CPUs
211-
* on this node, but less or equal to the number of slots,
210+
/* if the number of procs times the number of pes/proc
211+
* is greater than the number of CPUs
212+
* on this node, but the number of procs is less or equal
213+
* to the number of slots,
212214
* then we are not oversubscribed but we are overloaded. If
213215
* the user didn't specify a required binding, then we set
214216
* the binding policy to do-not-bind for this node */
215217
ncpus = prte_rmaps_base_get_ncpus(node, NULL, options);
216-
if (options->nprocs > ncpus &&
218+
if ((options->nprocs * options->cpus_per_rank) > ncpus &&
217219
options->nprocs <= node->slots_available &&
218220
!PRTE_BINDING_POLICY_IS_SET(jdata->map->binding)) {
219221
options->bind = PRTE_BIND_TO_NONE;
@@ -253,13 +255,15 @@ static int ppr_mapper(prte_job_t *jdata,
253255
continue;
254256
}
255257
options->nprocs = options->pprn * nobjs;
256-
/* if the number of procs is greater than the number of CPUs
257-
* on this node, but less or equal to the number of slots,
258+
/* if the number of procs times the number of pes/proc
259+
* is greater than the number of CPUs
260+
* on this node, but the number of procs is less or equal
261+
* to the number of slots,
258262
* then we are not oversubscribed but we are overloaded. If
259263
* the user didn't specify a required binding, then we set
260264
* the binding policy to do-not-bind for this node */
261265
ncpus = prte_rmaps_base_get_ncpus(node, NULL, options);
262-
if (options->nprocs > ncpus &&
266+
if ((options->nprocs * options->cpus_per_rank) > ncpus &&
263267
options->nprocs <= node->slots_available &&
264268
!PRTE_BINDING_POLICY_IS_SET(jdata->map->binding)) {
265269
options->bind = PRTE_BIND_TO_NONE;
@@ -269,6 +273,7 @@ static int ppr_mapper(prte_job_t *jdata,
269273
for (i = 0; i < nobjs && nprocs_mapped < app->num_procs; i++) {
270274
obj = prte_hwloc_base_get_obj_by_type(node->topology->topo,
271275
options->maptype, options->cmaplvl, i);
276+
// are there enough cpus on this obj to meet the request?
272277
if (!prte_rmaps_base_check_avail(jdata, app, node, &node_list, obj, options)) {
273278
continue;
274279
}

0 commit comments

Comments
 (0)