Repository navigation
Conversation
raffenet
force-pushed
the
cnc
branch
2 times, most recently
from
October 30, 2026 14:57
eb5abbe to
2f9ce7f
Compare
Collaborator
Author
|
Updated the branch to expand
Also extended |
raffenet
force-pushed
the
cnc
branch
6 times, most recently
from
November 9, 2026 22:04
ff62a77 to
e45c737
Compare
raffenet
marked this pull request as ready for review
November 10, 2026 18:37
raffenet
force-pushed
the
cnc
branch
4 times, most recently
from
November 11, 2026 15:44
14eb59f to
09708cf
Compare
Add optional support for external libcncoll collectives when configured with --with-cnc=<prefix>, covering blocking intracommunicator barrier, bcast, gather, gatherv, scatter, scatterv, allgather, allgatherv, alltoall, alltoallv, reduce, allreduce, and reduce_scatter_block. Register each as the "cnc" algorithm in collective selection and the corresponding algorithm CVARs. Byte-oriented collectives (bcast, gather, gatherv, scatter, scatterv, allgather, allgatherv, alltoall, alltoallv) accept any host or device datatype, using contiguous host buffers directly and staging non-contiguous datatypes, negative-displacement segments, or device buffers locally via MPIR_Localcopy(..., MPIR_BYTE_INTERNAL) so ranks never diverge on collective eligibility. Reduction collectives (reduce, allreduce, reduce_scatter_block) match internal 32-bit integer and float handles (MPIR_INT32, MPIR_FLOAT32) with MPI_SUM, MPI_PROD, MPI_MIN, and MPI_MAX. Each communicator lazily creates a private communicator copy and initializes a libcncoll MPI transport over it on first use, releasing both during communicator cleanup in MPII_Coll_comm_cleanup. Guard the private communicator against recursive entry during transport initialization, cache any transport initialization failure on the communicator, and fall back to MPIR algorithms when multi-threaded or when reduction arguments are not supported by libcncoll. Signed-off-by: Ken Raffenetti <ken.raffenetti@cornelisnetworks.com>
Add unit tests for src/mpi/coll/cnc/cnc_coll.c using a lightweight libcncoll shim header and mock functions. Exercise lazy private communicator and transport initialization, cached transport reuse, communicator cleanup, recursive initialization avoidance via CNC_PRIV_SKIP, all thirteen blocking collective entry points (including in-place variants and internal reduction datatype handles), local staging of non-contiguous datatypes and device buffers via MPIR_Localcopy, fallback paths (unsupported reduction datatypes/ops and multi-threaded execution), and cached transport failure fallback without resource leaks. Signed-off-by: Ken Raffenetti <ken.raffenetti@cornelisnetworks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Description
Add optional support for
libcncollcollectives at theMPIRcollective layer, covering blocking intracommunicatorbarrier,bcast,gather,gatherv,scatter,scatterv,allgather,allgatherv,alltoall,alltoallv,reduce,allreduce, andreduce_scatter_block.Background and Comparison with #7998 (
fi_collective)PR #7998 prototyped collective offload through libfabric's
fi_collectiveinterface inch4/ofi. Whilefi_collectivemakes sense when a provider offloads collectives directly to fabric hardware, using it for a host-driven collective library likelibcncollthat executes schedules over point-to-point messaging introduces several unnecessary layers of indirection and artificial constraints:FI_TAGGEDtransport backend,libcncollcan use MPI point-to-point communication as its transport. Integratinglibcncollat theMPIRcollective layer over its MPI transport allows it to work over any MPICH device, netmod, or fabric (ch4:ofiwith any provider, not just OPX, as well asch4:ucx,ch3, shared memory, etc.), whereas thefi_collectivepath in ch4/ofi: Add support for fi_collective offload #7998 was restricted toch4:ofiwith a provider supportingFI_COLLECTIVE.MPIDI_OFI_coll_*sits belowsrc/mpi/colland is not directly visible toMPIRcollective algorithm selection (coll_algorithms.txt/ CVARs). Integratinglibcncollas anMPIRcollective algorithm (MPIR_*_intra_cnc) makes it a first-class algorithm in MPICH's existing selection framework without reintroducing netmod collective hooks.fi_collectivepath requires requestingFI_COLLECTIVEdomain/endpoint capabilities atMPI_Init, binding a dedicated event queue, and performing an asynchronousfi_av_set+fi_join_collectivehandshake on every communicator creation. In contrast,libcncollinitializes lazily over a private communicator copy only when acnccollective is actually invoked.MPIDI_OFI->fi_collective-> a libfabric utility/offload provider ->FI_TAGGEDoperations adds multiple translation layers (datatype/op mapping, completion queues, and progress polling) and single-NIC/single-VCI constraints. Callinglibcncolldirectly at theMPIRlayer cuts out thefi_collectivemiddleware entirely.Implementation Summary
--with-cnc=<prefix>(disabled by default).cncalgorithm for all 13 blocking intracommunicator collectives supported bylibcncoll(barrier-intra,bcast-intra,gather-intra,gatherv-intra,scatter-intra,scatterv-intra,allgather-intra,allgatherv-intra,alltoall-intra,alltoallv-intra,reduce-intra,allreduce-intra, andreduce_scatter_block-intra), selectable via the correspondingMPIR_CVAR_*_INTRA_ALGORITHM=cncCVARs.bcast,gather,gatherv,scatter,scatterv,allgather,allgatherv,alltoall,alltoallv) use contiguous host buffers in place and stage non-contiguous datatypes, negative-displacement segments, or device buffers locally viaMPIR_Localcopy(..., MPIR_BYTE_INTERNAL)so ranks never diverge on collective eligibility.reduce,allreduce,reduce_scatter_block) match internal 32-bit integer and single-precision float datatype handles (MPIR_INT32,MPIR_FLOAT32viaMPIR_DATATYPE_GET_RAW_INTERNAL) withMPI_SUM,MPI_PROD,MPI_MIN, andMPI_MAX, staging device buffers locally when needed.MPII_Comm_copy) and initializes alibcncollMPI transport over it; both are released during communicator teardown inMPII_Coll_comm_cleanup.CNC_PRIV_SKIP) so any internal collectives called duringcnc_init()fall back to nativeMPIRalgorithms rather than recursing, caches any transport initialization failure on the communicator, and falls back to existingMPIRcollective algorithms when multi-threaded (MPI_THREAD_MULTIPLE) or when reduction datatypes/ops are not supported.test/units/cnc_coll.unit) with a lightweightlibcncollshim to exercise lazy initialization, transport reuse, cleanup, recursion avoidance, all 13 collective entry points, internal reduction datatype handles, local staging viaMPIR_Localcopy, fallback paths, and cached error recovery inmake unit-testing.Author Checklist