diff --git a/docs/Makefile.am b/docs/Makefile.am index 871ac41079e..d11cf35819f 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,6 +1,7 @@ # # Copyright (c) 2022 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2023-2025 Jeffrey M. Squyres. All rights reserved. +# Copyright (c) 2025 Triad National Security, LLC. All rights reserved. # # $COPYRIGHT$ # @@ -257,6 +258,7 @@ OMPI_MAN3 = \ MPI_Get_count.3 \ MPI_Get_elements.3 \ MPI_Get_elements_x.3 \ + MPI_Get_hw_resource_info.3 \ MPI_Get_library_version.3 \ MPI_Get_processor_name.3 \ MPI_Get_version.3 \ diff --git a/docs/man-openmpi/man3/MPI_Get_hw_resource_info.3.rst b/docs/man-openmpi/man3/MPI_Get_hw_resource_info.3.rst new file mode 100644 index 00000000000..8dd5e14e262 --- /dev/null +++ b/docs/man-openmpi/man3/MPI_Get_hw_resource_info.3.rst @@ -0,0 +1,35 @@ +.. _mpi_info_get_hw_resource_info: + + +MPI_Info_get_hw_resource_info +============================= + +.. include_body + +:ref:`MPI_Info_get_hw_resource_info` |mdash| Returns an info object containing information pertaining to the hardware platform +are used. + +.. The following file was automatically generated +.. include:: ./bindings/mpi_get_hw_resource_info.rst + +OUTPUT PARAMETERS +----------------- +* ``info``: Info object created (handle). +* ``ierror``: Fortran only: Error status (integer). + +DESCRIPTION +----------- + +:ref:`MPI_Info_get_hw_resource_info` an info object containing information pertaining to the hardware platform on +which the calling \MPI/ process is executing at the moment of the call. The application is responsible for freeing +the returned info object using :ref:`MPI_Info_free`. + +.. note:: Open MPI currently provides no hardware platform information in the returned ``info`` object. + +ERRORS +------ + +.. include:: ./ERRORS.rst + +.. seealso:: + * :ref:`MPI_Info_free` diff --git a/docs/man-openmpi/man3/index.rst b/docs/man-openmpi/man3/index.rst index eb9d69fc532..8c786a8887b 100644 --- a/docs/man-openmpi/man3/index.rst +++ b/docs/man-openmpi/man3/index.rst @@ -177,6 +177,7 @@ MPI API manual pages (section 3) MPI_Get_count.3.rst MPI_Get_elements.3.rst MPI_Get_elements_x.3.rst + MPI_Get_hw_resource_info.3.rst MPI_Get_library_version.3.rst MPI_Get_processor_name.3.rst MPI_Get_version.3.rst diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index ea05aba0eff..c79af856909 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -1890,6 +1890,7 @@ OMPI_DECLSPEC int MPI_Get_count(const MPI_Status *status, MPI_Datatype datatype OMPI_DECLSPEC int MPI_Get_count_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count); OMPI_DECLSPEC int MPI_Get_elements(const MPI_Status *status, MPI_Datatype datatype, int *count); OMPI_DECLSPEC int MPI_Get_elements_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count); +OMPI_DECLSPEC int MPI_Get_hw_resource_info(MPI_Info *hw_info); OMPI_DECLSPEC int MPI_Get(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, @@ -3048,6 +3049,7 @@ OMPI_DECLSPEC int PMPI_Get_count(const MPI_Status *status, MPI_Datatype datatyp OMPI_DECLSPEC int PMPI_Get_count_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count); OMPI_DECLSPEC int PMPI_Get_elements(const MPI_Status *status, MPI_Datatype datatype, int *count); OMPI_DECLSPEC int PMPI_Get_elements_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count); +OMPI_DECLSPEC int PMPI_Get_hw_resource_info(MPI_Info *hw_info); OMPI_DECLSPEC int PMPI_Get(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, diff --git a/ompi/mpi/c/Makefile.am b/ompi/mpi/c/Makefile.am index 2659e084568..424d20811ac 100644 --- a/ompi/mpi/c/Makefile.am +++ b/ompi/mpi/c/Makefile.am @@ -20,6 +20,7 @@ # Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights # reserved. # Copyright (c) 2025 Advanced Micro Devices, Inc. All Rights reserved. +# Copyright (c) 2025 Triad National Security, LLC. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -215,8 +216,9 @@ prototype_sources = \ get_count.c.in \ get_elements.c.in \ get_elements_x.c.in \ - get_library_version.c.in \ - get_processor_name.c.in \ + get_hw_resource_info.c.in \ + get_library_version.c.in \ + get_processor_name.c.in \ get_version.c.in \ graph_create.c.in \ graphdims_get.c.in \ diff --git a/ompi/mpi/c/get_hw_resource_info.c.in b/ompi/mpi/c/get_hw_resource_info.c.in new file mode 100644 index 00000000000..8136ced4bdb --- /dev/null +++ b/ompi/mpi/c/get_hw_resource_info.c.in @@ -0,0 +1,65 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2018-2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/c/bindings.h" +#include "ompi/runtime/params.h" +#include "ompi/communicator/communicator.h" +#include "ompi/errhandler/errhandler.h" +#include "ompi/info/info.h" + +/** + * Create a info object holding local hardware resource info. + * + * @param info Pointer to the MPI_Info handle + * + * @retval MPI_SUCCESS + * @retval MPI_ERR_INFO + * @retval MPI_ERR_NO_MEM + * + * When an MPI_Info object is not being used, it should be freed using + * MPI_Info_free + */ +PROTOTYPE ERROR_CLASS get_hw_resource_info(INFO_OUT info) +{ + if (MPI_PARAM_CHECK) { + if (NULL == info) { + return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_INFO, + FUNC_NAME); + } + } + + /* + * Just allocate an info object. No resources currently being + * specified so just return empty info object. + */ + + *info = ompi_info_allocate (); + if (NULL == (*info)) { + return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM, + FUNC_NAME); + } + + return MPI_SUCCESS; +} diff --git a/ompi/mpi/fortran/mpif-h/Makefile.am b/ompi/mpi/fortran/mpif-h/Makefile.am index 96d848fc4a7..86547f48f7c 100644 --- a/ompi/mpi/fortran/mpif-h/Makefile.am +++ b/ompi/mpi/fortran/mpif-h/Makefile.am @@ -291,6 +291,7 @@ lib@OMPI_LIBMPI_NAME@_mpifh_la_SOURCES += \ get_count_f.c \ get_elements_f.c \ get_elements_x_f.c \ + get_hw_resource_info_f.c \ get_library_version_f.c \ get_processor_name_f.c \ get_version_f.c \ diff --git a/ompi/mpi/fortran/mpif-h/get_hw_resource_info_f.c b/ompi/mpi/fortran/mpif-h/get_hw_resource_info_f.c new file mode 100644 index 00000000000..ca18bb45fbc --- /dev/null +++ b/ompi/mpi/fortran/mpif-h/get_hw_resource_info_f.c @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2015 Triad National Security, LLC. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/fortran/mpif-h/bindings.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak PMPI_GET_HW_RESOURCE_INFO = ompi_get_hw_resource_info_f +#pragma weak pmpi_get_hw_resource_info = ompi_get_hw_resource_info_f +#pragma weak pmpi_get_hw_resource_info_ = ompi_get_hw_resource_info_f +#pragma weak pmpi_get_hw_resource_info__ = ompi_get_hw_resource_info_f + +#pragma weak PMPI_Get_hw_resource_info_f = ompi_get_hw_resource_info_f +#pragma weak PMPI_Get_hw_resource_info_f08 = ompi_get_hw_resource_info_f +#else +OMPI_GENERATE_F77_BINDINGS (PMPI_GET_HW_RESOURCE_INFO, + pmpi_get_hw_resource_info, + pmpi_get_hw_resource_info_, + pmpi_get_hw_resource_info__, + pompi_get_hw_resource_info_f, + (MPI_Fint *info, MPI_Fint *ierr), + (info, ierr) ) +#endif +#endif + +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_GET_HW_RESOURCE_INFO = ompi_get_hw_resource_info_f +#pragma weak mpi_get_hw_resource_info = ompi_get_hw_resource_info_f +#pragma weak mpi_get_hw_resource_info_ = ompi_get_hw_resource_info_f +#pragma weak mpi_get_hw_resource_info__ = ompi_get_hw_resource_info_f + +#pragma weak MPI_Get_hw_resource_info_f = ompi_get_hw_resource_info_f +#pragma weak MPI_Get_hw_resource_info_f08 = ompi_get_hw_resource_info_f +#else +#if ! OMPI_BUILD_MPI_PROFILING +OMPI_GENERATE_F77_BINDINGS (MPI_GET_HW_RESOURCE_INFO, + mpi_get_hw_resource_info, + mpi_get_hw_resource_info_, + mpi_get_hw_resource_info__, + ompi_get_hw_resource_info_f, + (MPI_Fint *info, MPI_Fint *ierr), + (info, ierr) ) +#else +#define ompi_get_hw_resource_info_f pompi_get_hw_resource_info_f +#endif +#endif + + +void ompi_get_hw_resource_info_f(MPI_Fint *info, MPI_Fint *ierr) +{ + int c_ierr; + MPI_Info c_info; + + c_ierr = PMPI_Get_hw_resource_info(&c_info); + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); + + if (MPI_SUCCESS == c_ierr) { + *info = PMPI_Info_c2f(c_info); + } +} diff --git a/ompi/mpi/fortran/mpif-h/profile/Makefile.am b/ompi/mpi/fortran/mpif-h/profile/Makefile.am index 39160a8c9de..2dbf1218c22 100644 --- a/ompi/mpi/fortran/mpif-h/profile/Makefile.am +++ b/ompi/mpi/fortran/mpif-h/profile/Makefile.am @@ -18,7 +18,7 @@ # Copyright (c) 2015-2021 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. -# Copyright (c) 2019-2022 Triad National Security, LLC. All rights +# Copyright (c) 2019-2025 Triad National Security, LLC. All rights # reserved. # Copyright (c) 2025 Jeffrey M. Squyres. All rights reserved. # $COPYRIGHT$ @@ -203,6 +203,7 @@ linked_files = \ pget_count_f.c \ pget_elements_f.c \ pget_elements_x_f.c \ + pget_hw_resource_info_f.c \ pget_library_version_f.c \ pget_processor_name_f.c \ pget_version_f.c \ diff --git a/ompi/mpi/fortran/mpif-h/prototypes_mpi.h b/ompi/mpi/fortran/mpif-h/prototypes_mpi.h index cc538ab98a6..772fb2d9484 100644 --- a/ompi/mpi/fortran/mpif-h/prototypes_mpi.h +++ b/ompi/mpi/fortran/mpif-h/prototypes_mpi.h @@ -16,7 +16,7 @@ * reserved. * Copyright (c) 2016-2023 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2019-2023 Triad National Security, LLC. All rights + * Copyright (c) 2019-2025 Triad National Security, LLC. All rights * reserved. * Copyright (c) 2021 Bull S.A.S. All rights reserved. * $COPYRIGHT$ @@ -252,6 +252,7 @@ PN2(void, MPI_Get_address, mpi_get_address, MPI_GET_ADDRESS, (char *location, MP PN2(void, MPI_Get_count, mpi_get_count, MPI_GET_COUNT, (MPI_Fint *status, MPI_Fint *datatype, MPI_Fint *count, MPI_Fint *ierr)); PN2(void, MPI_Get_elements, mpi_get_elements, MPI_GET_ELEMENTS, (MPI_Fint *status, MPI_Fint *datatype, MPI_Fint *count, MPI_Fint *ierr)); PN2(void, MPI_Get_elements_x, mpi_get_elements_x, MPI_GET_ELEMENTS_X, (MPI_Fint *status, MPI_Fint *datatype, MPI_Count *count, MPI_Fint *ierr)); +PN2(void, MPI_Get_hw_resource_info, mpi_get_hw_resource_info, MPI_GET_HW_RESOURCE_INFO, (MPI_Fint *info, MPI_Fint *ierr)); PN2(void, MPI_Get, mpi_get, MPI_GET, (char *origin_addr, MPI_Fint *origin_count, MPI_Fint *origin_datatype, MPI_Fint *target_rank, MPI_Aint *target_disp, MPI_Fint *target_count, MPI_Fint *target_datatype, MPI_Fint *win, MPI_Fint *ierr)); PN2(void, MPI_Get_library_version, mpi_get_library_version, MPI_GET_LIBRARY_VERSION, (char *version, MPI_Fint *resultlen, MPI_Fint *ierr, MPI_Fint version_len)); PN2(void, MPI_Get_processor_name, mpi_get_processor_name, MPI_GET_PROCESSOR_NAME, (char *name, MPI_Fint *resultlen, MPI_Fint *ierr, int name_len)); diff --git a/ompi/mpi/fortran/use-mpi-f08/Makefile.prototype_files b/ompi/mpi/fortran/use-mpi-f08/Makefile.prototype_files index fe55803049c..a90a2741724 100644 --- a/ompi/mpi/fortran/use-mpi-f08/Makefile.prototype_files +++ b/ompi/mpi/fortran/use-mpi-f08/Makefile.prototype_files @@ -70,6 +70,7 @@ prototype_files = \ get_address_ts.c.in \ get_count.c.in \ get_elements.c.in \ + get_hw_resource_info.c.in \ get_ts.c.in \ iallgather_ts.c.in \ iallgatherv_ts.c.in \ diff --git a/ompi/mpi/fortran/use-mpi-f08/get_hw_resource_info.c.in b/ompi/mpi/fortran/use-mpi-f08/get_hw_resource_info.c.in new file mode 100644 index 00000000000..50eacdb817c --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/get_hw_resource_info.c.in @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2015 Triad National Security, LLC. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +PROTOTYPE VOID get_hw_resource_info(INFO_OUT info) +{ + int c_ierr; + MPI_Info c_info; + + c_ierr = @INNER_CALL@(&c_info); + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); + + if (MPI_SUCCESS == c_ierr) { + *info = PMPI_Info_c2f(c_info); + } +} + diff --git a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.prototype_files b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.prototype_files index 67adffe7c9e..2076523481d 100644 --- a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.prototype_files +++ b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.prototype_files @@ -3,6 +3,7 @@ # prototype_files = \ + get_hw_resource_info.c.in \ request_get_status.c.in \ request_get_status_all.c.in \ request_get_status_any.c.in \