Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/man-openmpi/man3/MPI_Comm_split_type.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ MPI_COMM_TYPE_SHARED
This type splits the communicator into subcommunicators, each of
which can create a shared memory region.

MPI_COMM_TYPE_HW_GUIDED
This type splits the communicator into subcommunicators according
to the resource type specified by the ``mpi_hw_resource_type``
info key.

MPI_COMM_TYPE_RESOURCE_GUIDED
This type splits the communicator into subcommunicators according
to the resource type specified by the ``mpi_hw_resource_type``
or ``mpi_pset_name`` info key.

OMPI_COMM_TYPE_NODE
Synonym for MPI_COMM_TYPE_SHARED.

Expand Down
13 changes: 9 additions & 4 deletions ompi/communicator/comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Copyright (c) 2015 Mellanox Technologies. All rights reserved.
* Copyright (c) 2017-2022 IBM Corporation. All rights reserved.
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
* Copyright (c) 2018-2024 Triad National Security, LLC. All rights
* Copyright (c) 2018-2025 Triad National Security, LLC. All rights
* reserved.
* Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
* $COPYRIGHT$
Expand Down Expand Up @@ -99,6 +99,9 @@ static const char * ompi_comm_split_type_to_str(int split_type) {
else if (MPI_COMM_TYPE_HW_UNGUIDED == split_type) {
return "MPI_COMM_TYPE_HW_UNGUIDED";
}
else if (MPI_COMM_TYPE_RESOURCE_GUIDED == split_type) {
return "MPI_COMM_TYPE_RESOURCE_GUIDED";
}
return "Unknown";
}

Expand Down Expand Up @@ -830,9 +833,10 @@ static int ompi_comm_split_type_get_part (ompi_group_t *group, const int split_t
break;
case MPI_COMM_TYPE_HW_GUIDED:
case MPI_COMM_TYPE_HW_UNGUIDED:
case MPI_COMM_TYPE_RESOURCE_GUIDED:
/*
* MPI_COMM_TYPE_HW_(UN)GUIDED handled in calling function.
* We should not get here as the split type will be changed
* MPI_COMM_TYPE_HW_(UN)GUIDED and MPI_COMM_TYPE_RESOURCE_GUIDED handled
* in calling function. We should not get here as the split type will be changed
* at a higher level.
*/
opal_show_help("help-comm.txt",
Expand Down Expand Up @@ -1186,7 +1190,8 @@ int ompi_comm_split_type (ompi_communicator_t *comm, int split_type, int key,
inter = OMPI_COMM_IS_INTER(comm);

/* Step 0: Convert MPI_COMM_TYPE_HW_GUIDED to the internal type */
if (MPI_COMM_TYPE_HW_GUIDED == split_type) {
if ((MPI_COMM_TYPE_HW_GUIDED == split_type) ||
(MPI_COMM_TYPE_RESOURCE_GUIDED == split_type)) {
opal_info_get(info, "mpi_hw_resource_type", &value, &flag);
/* If key is not in the 'info', then return MPI_COMM_NULL.
* This is caught at the MPI interface level, but it doesn't hurt to
Expand Down
3 changes: 2 additions & 1 deletion ompi/include/mpi.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,8 @@ enum {
OMPI_COMM_TYPE_CU,
OMPI_COMM_TYPE_CLUSTER,
MPI_COMM_TYPE_HW_UNGUIDED,
MPI_COMM_TYPE_HW_GUIDED
MPI_COMM_TYPE_HW_GUIDED,
MPI_COMM_TYPE_RESOURCE_GUIDED
};
#define OMPI_COMM_TYPE_NODE MPI_COMM_TYPE_SHARED

Expand Down
1 change: 1 addition & 0 deletions ompi/include/mpif-values.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@
'OMPI_COMM_TYPE_CLUSTER': 11,
'MPI_COMM_TYPE_HW_UNGUIDED': 12,
'MPI_COMM_TYPE_HW_GUIDED': 13,
'MPI_COMM_TYPE_RESOURCE_GUIDED': 14,
}

# IO Constants
Expand Down
3 changes: 2 additions & 1 deletion ompi/mpi/bindings/ompi_bindings/consts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2024 Triad National Security, LLC. All rights
# Copyright (c) 2024-2025 Triad National Security, LLC. All rights
# reserved.
#
# $COPYRIGHT$
Expand Down Expand Up @@ -157,6 +157,7 @@
'MPI_COMM_TYPE_SHARED',
'MPI_COMM_TYPE_HW_UNGUIDED',
'MPI_COMM_TYPE_HW_GUIDED',
'MPI_COMM_TYPE_RESOURCE_GUIDED',
]

RESERVED_WINDOWS = [
Expand Down
24 changes: 18 additions & 6 deletions ompi/mpi/c/comm_split_type.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017-2022 IBM Corporation. All rights reserved.
* Copyright (c) 2024 Triad National Security, LLC. All rights
* Copyright (c) 2024-2025 Triad National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -59,6 +59,7 @@ PROTOTYPE ERROR_CLASS comm_split_type(COMM comm, INT split_type, INT key,
if ( MPI_COMM_TYPE_SHARED != split_type && // Same as OMPI_COMM_TYPE_NODE
MPI_COMM_TYPE_HW_UNGUIDED != split_type &&
MPI_COMM_TYPE_HW_GUIDED != split_type &&
MPI_COMM_TYPE_RESOURCE_GUIDED != split_type &&
OMPI_COMM_TYPE_CLUSTER != split_type &&
OMPI_COMM_TYPE_CU != split_type &&
OMPI_COMM_TYPE_HOST != split_type &&
Expand Down Expand Up @@ -93,8 +94,9 @@ PROTOTYPE ERROR_CLASS comm_split_type(COMM comm, INT split_type, INT key,
}
#endif

if ( MPI_COMM_TYPE_HW_GUIDED == split_type ) {
int flag;
if (( MPI_COMM_TYPE_HW_GUIDED == split_type ) ||
( MPI_COMM_TYPE_RESOURCE_GUIDED == split_type)) {
int flag_hw, flag_res;
opal_cstring_t *value = NULL;

/* MPI_Info is required for this split_type.
Expand All @@ -106,15 +108,25 @@ PROTOTYPE ERROR_CLASS comm_split_type(COMM comm, INT split_type, INT key,
OMPI_ERRHANDLER_RETURN ( rc, comm, rc, FUNC_NAME);
}

/* MPI_Info with key "mpi_hw_resource_type" is required for this split_type.
/* MPI_Info with key "mpi_hw_resource_type" or "mpi_pset_name",
* in the case of MPI_COMM_TYPE_RESOURCED_GUIDED, is required for
* these split_types.
* Not an error condition, per MPI 4.0.
*/
ompi_info_get(info, "mpi_hw_resource_type", &value, &flag);
if ( !flag ) {
ompi_info_get(info, "mpi_hw_resource_type", &value, &flag_hw);
if ( !flag_hw && (MPI_COMM_TYPE_HW_GUIDED == split_type)) {
*newcomm = MPI_COMM_NULL;
rc = MPI_SUCCESS;
OMPI_ERRHANDLER_RETURN ( rc, comm, rc, FUNC_NAME);
}
if( !flag_hw && (MPI_COMM_TYPE_RESOURCE_GUIDED == split_type)) {
ompi_info_get(info, "mpi_pset_name", &value, &flag_res);
if ( !flag_res ) {
*newcomm = MPI_COMM_NULL;
rc = MPI_SUCCESS;
OMPI_ERRHANDLER_RETURN ( rc, comm, rc, FUNC_NAME);
}
}
}

if( (MPI_COMM_SELF == comm) && (MPI_UNDEFINED == split_type) ) {
Expand Down