Skip to content

cache node IDs in MPI communicator#223

Merged
wkliao merged 6 commits intoParallel-NetCDF:masterfrom
wkliao:comm_cache
Feb 14, 2026
Merged

cache node IDs in MPI communicator#223
wkliao merged 6 commits intoParallel-NetCDF:masterfrom
wkliao:comm_cache

Conversation

@wkliao
Copy link
Member

@wkliao wkliao commented Feb 14, 2026

Calculating compute node IDs of MPI processes in a given MPI communicator is
necessary for intra-node aggregation as well as selecting a good value for hint
cb_nodes. Such calculation is done at file create and open time, which requires
MPI communication. Caching the node IDs into the MPI communicator can save
costs when the same communicator is used in successive file create/open calls.

github copilot code quality
    [nitpick] Variable name `dir_name` uses underscore convention while
    `path_dup` uses underscore as well, but the naming could be more
    consistent with the project's naming conventions. Consider using
    consistent naming patterns throughout the file.
In case the same communicator is used to create/open multiple files, we
can cache the node IDs of all processes as attributes of the MPI
communicator, so they can be reused every time the same communicator is
used to create/open a file in the same application run. Using the cached
node IDs can avoid repeatedly calling MPI_Get_processor_name(),
MPI_Gather(), and MPI_Bcast() to construct the node IDs.

Note cb_nodes, the number of I/O aggregators, and rank IDs of I/O
aggregators cannot be reused by another file, because cb_nodes is a hint
that may be set to a different value each time file is created/opened.
Thus cb_nodes and rank IDs of I/O aggregators must be recalculated at
each file create/open.  Fortunately, Lustre_set_cb_node_list() and
GEN_set_cb_node_list() do not make any MPI communication calls. The cost of
recalculating cb_nodes and rank IDs is expected to be small.
Node IDs and the number of compute nodes are generated during file
creation or opening at the dispatcher.
@wkliao wkliao merged commit 4d0cc55 into Parallel-NetCDF:master Feb 14, 2026
9 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.

1 participant