Skip to content

Commit

Permalink
Partition devices based on number of co-locales, not locales
Browse files Browse the repository at this point in the history
If we are oversubscribed then the locales should share the devices, instead
of treating them as co-locales and partitioning the devices

Signed-off-by: John H. Hartman <jhh67@users.noreply.github.com>
  • Loading branch information
jhh67 committed Oct 8, 2024
1 parent 840e56d commit b49c745
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions runtime/src/topo/hwloc/topo-hwloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1507,20 +1507,21 @@ int chpl_topo_selectMyDevices(chpl_topo_pci_addr_t *inAddrs,
int numLocales = chpl_get_num_locales_on_node();
_DBG_P("count = %d", *count);
_DBG_P("numLocales = %d", numLocales);
if (numLocales > 1) {
int numColocales = chpl_env_rt_get_int("LOCALES_PER_NODE", 0);
if (numColocales > 1) {
int numDevs = *count;
int owners[numDevs]; // locale that owns each device
hwloc_obj_t objs[numDevs]; // the device objects
int devsPerLocale = numDevs / numLocales;
int devsPerLocale = numDevs / numColocales;
_DBG_P("devsPerLocale = %d", devsPerLocale);
int owned[numLocales]; // number of devices each locale owns
int owned[numColocales]; // number of devices each co-locale owns

for (int i = 0; i < numDevs; i++) {
owners[i] = -1;
objs[i] = NULL;
}

for (int i = 0; i < numLocales; i++) {
for (int i = 0; i < numColocales; i++) {
owned[i] = 0;
}

Expand Down Expand Up @@ -1589,6 +1590,7 @@ int chpl_topo_selectMyDevices(chpl_topo_pci_addr_t *inAddrs,
assert(j == devsPerLocale);
*count = devsPerLocale;
} else {
// No co-locales, use all the devices.
for (int i = 0; i < *count; i++) {
outAddrs[i] = inAddrs[i];
}
Expand Down

0 comments on commit b49c745

Please sign in to comment.