Skip to content

comm: fix HW_GUIDED split for non-proper subset - #7995

Merged
hzhou merged 1 commit into
pmodels:mainfrom
hzhou-muse:fix-hw-guided-proper-subset
Oct 7, 2026
Merged

hzhou merged 1 commit into
pmodels:mainfrom
hzhou-muse:fix-hw-guided-proper-subset

Conversation

@hzhou-muse

@hzhou-muse hzhou-muse commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request Description

Fixes #7160.

MPI_COMM_TYPE_HW_GUIDED should return the largest subset of processes
that match the resource type; unlike HW_UNGUIDED it does not need to be
a proper subset. We returned MPI_COMM_NULL whenever the split didn't
reduce the node comm, e.g. package on a single-package node, while
mpi_shared_memory returned a valid comm.

That proper-subset check (from 7f0f0b8) was really a proxy for
"process is not inside a single instance of the resource", where
MPIR_hwtopo_get_obj_by_name falls back to MPIR_HWTOPO_GID_ROOT.
This PR checks that per process and uses MPI_UNDEFINED as the color,
so every process still joins the split (keeps the hang fix). Same for
processes without hwtopo. node/machine resolve to the root gid by
design, so they return the node comm directly.

Added a machine check to test/mpi/comm/cmsplit_type.c.

Tested (single-package i7-7820X, 4 procs, ch4:ofi):

resource before (bound) after (bound) after (unbound)
machine/node NULL 4 4
package/numanode NULL 4 4
core/hwthread 1 1 NULL
bogus NULL NULL NULL

Mixed binding (rank 0 unbound) gives NULL on rank 0 for core, 1 on
others, no hang. cmsplit_type passes bound and unbound.

Author Checklist

  • Provide Description
  • Commits Follow Good Practice
  • Passes All Tests
  • Contribution Agreement

🤖 Generated with Claude Code

Comment thread src/mpi/comm/comm_split_type.c
@hzhou-muse
hzhou-muse force-pushed the fix-hw-guided-proper-subset branch from 42a75db to b394ab5 Compare October 6, 2026 03:56
@hzhou

hzhou commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

test:mpich/ch3/tcp
test:mpich/ch4/ofi

@hzhou hzhou changed the title comm: fix HW_GUIDED split returning MPI_COMM_NULL for non-proper subset comm: fix HW_GUIDED split for non-proper subset Oct 6, 2026
MPI_COMM_TYPE_HW_GUIDED should return the largest subset of processes
that match the resource type. Unlike HW_UNGUIDED, it is not required to
be a proper subset. Previously, we returned MPI_COMM_NULL whenever the
split did not reduce the node comm, e.g. "package" on a single-package
node, while "mpi_shared_memory" returned a valid comm.

The proper-subset check was a proxy for detecting processes that are
not contained in a single instance of the resource (gid falls back to
the root gid). Check that per process instead and use MPI_UNDEFINED as
the color, so all processes still participate in the split (no hang).

"node" and "machine" resolve to the root gid by design, so return the
node comm directly for them. This does not depend on hwtopo, so check it
before returning MPI_COMM_NULL for an uninitialized hwtopo, e.g. on osx,
where the process binding cannot be queried.

Fixes pmodels#7160

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hzhou-muse
hzhou-muse force-pushed the fix-hw-guided-proper-subset branch from b394ab5 to 73f42f9 Compare October 6, 2026 18:17
@hzhou-muse

Copy link
Copy Markdown
Contributor Author

test:mpich/ch3/tcp

@hzhou
hzhou merged commit 560a974 into pmodels:main Oct 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MPI_Comm_split_type with MPI_COMM_TYPE_HW_GUIDED seems inconsistent

2 participants