Skip to content

Commit c66e485

Browse files
committed
MPI_Get_hw_resource_info: basic implementation
Just allocate an info object but don't populate it with any key/values. MPI 4.1 standard doesn't mandate any particular key/values be supported. related to #12080 Signed-off-by: Howard Pritchard <howardp@lanl.gov>
1 parent e2a2583 commit c66e485

File tree

13 files changed

+232
-4
lines changed

13 files changed

+232
-4
lines changed

docs/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#
22
# Copyright (c) 2022 Cisco Systems, Inc. All rights reserved.
33
# Copyright (c) 2023-2025 Jeffrey M. Squyres. All rights reserved.
4+
# Copyright (c) 2025 Triad National Security, LLC. All rights reserved.
45
#
56
# $COPYRIGHT$
67
#
@@ -257,6 +258,7 @@ OMPI_MAN3 = \
257258
MPI_Get_count.3 \
258259
MPI_Get_elements.3 \
259260
MPI_Get_elements_x.3 \
261+
MPI_Get_hw_resource_info.3 \
260262
MPI_Get_library_version.3 \
261263
MPI_Get_processor_name.3 \
262264
MPI_Get_version.3 \
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.. _mpi_info_get_hw_resource_info:
2+
3+
4+
MPI_Info_get_hw_resource_info
5+
=============================
6+
7+
.. include_body
8+
9+
:ref:`MPI_Info_get_hw_resource_info` |mdash| Returns an info object containing information pertaining to the hardware platform
10+
are used.
11+
12+
.. The following file was automatically generated
13+
.. include:: ./bindings/mpi_get_hw_resource_info.rst
14+
15+
OUTPUT PARAMETERS
16+
-----------------
17+
* ``info``: Info object created (handle).
18+
* ``ierror``: Fortran only: Error status (integer).
19+
20+
DESCRIPTION
21+
-----------
22+
23+
:ref:`MPI_Info_get_hw_resource_info` an info object containing information pertaining to the hardware platform on
24+
which the calling \MPI/ process is executing at the moment of the call. The application is responsible for freeing
25+
the returned info object using :ref:`MPI_Info_free`.
26+
27+
.. note:: Open MPI currently provides no hardware platform information in the returned ``info`` object.
28+
29+
ERRORS
30+
------
31+
32+
.. include:: ./ERRORS.rst
33+
34+
.. seealso::
35+
* :ref:`MPI_Info_free`

docs/man-openmpi/man3/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ MPI API manual pages (section 3)
177177
MPI_Get_count.3.rst
178178
MPI_Get_elements.3.rst
179179
MPI_Get_elements_x.3.rst
180+
MPI_Get_hw_resource_info.3.rst
180181
MPI_Get_library_version.3.rst
181182
MPI_Get_processor_name.3.rst
182183
MPI_Get_version.3.rst

ompi/include/mpi.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,6 +1890,7 @@ OMPI_DECLSPEC int MPI_Get_count(const MPI_Status *status, MPI_Datatype datatype
18901890
OMPI_DECLSPEC int MPI_Get_count_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count);
18911891
OMPI_DECLSPEC int MPI_Get_elements(const MPI_Status *status, MPI_Datatype datatype, int *count);
18921892
OMPI_DECLSPEC int MPI_Get_elements_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count);
1893+
OMPI_DECLSPEC int MPI_Get_hw_resource_info(MPI_Info *hw_info);
18931894
OMPI_DECLSPEC int MPI_Get(void *origin_addr, int origin_count,
18941895
MPI_Datatype origin_datatype, int target_rank,
18951896
MPI_Aint target_disp, int target_count,
@@ -3048,6 +3049,7 @@ OMPI_DECLSPEC int PMPI_Get_count(const MPI_Status *status, MPI_Datatype datatyp
30483049
OMPI_DECLSPEC int PMPI_Get_count_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count);
30493050
OMPI_DECLSPEC int PMPI_Get_elements(const MPI_Status *status, MPI_Datatype datatype, int *count);
30503051
OMPI_DECLSPEC int PMPI_Get_elements_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count);
3052+
OMPI_DECLSPEC int PMPI_Get_hw_resource_info(MPI_Info *hw_info);
30513053
OMPI_DECLSPEC int PMPI_Get(void *origin_addr, int origin_count,
30523054
MPI_Datatype origin_datatype, int target_rank,
30533055
MPI_Aint target_disp, int target_count,

ompi/mpi/c/Makefile.am

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
2121
# reserved.
2222
# Copyright (c) 2025 Advanced Micro Devices, Inc. All Rights reserved.
23+
# Copyright (c) 2025 Triad National Security, LLC. All rights reserved.
2324
# $COPYRIGHT$
2425
#
2526
# Additional copyrights may follow
@@ -215,8 +216,9 @@ prototype_sources = \
215216
get_count.c.in \
216217
get_elements.c.in \
217218
get_elements_x.c.in \
218-
get_library_version.c.in \
219-
get_processor_name.c.in \
219+
get_hw_resource_info.c.in \
220+
get_library_version.c.in \
221+
get_processor_name.c.in \
220222
get_version.c.in \
221223
graph_create.c.in \
222224
graphdims_get.c.in \
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2+
/*
3+
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
4+
* University Research and Technology
5+
* Corporation. All rights reserved.
6+
* Copyright (c) 2004-2020 The University of Tennessee and The University
7+
* of Tennessee Research Foundation. All rights
8+
* reserved.
9+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10+
* University of Stuttgart. All rights reserved.
11+
* Copyright (c) 2004-2005 The Regents of the University of California.
12+
* All rights reserved.
13+
* Copyright (c) 2015 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
15+
* Copyright (c) 2018-2025 Triad National Security, LLC. All rights
16+
* reserved.
17+
* $COPYRIGHT$
18+
*
19+
* Additional copyrights may follow
20+
*
21+
* $HEADER$
22+
*/
23+
24+
#include "ompi_config.h"
25+
26+
#include "ompi/mpi/c/bindings.h"
27+
#include "ompi/runtime/params.h"
28+
#include "ompi/communicator/communicator.h"
29+
#include "ompi/errhandler/errhandler.h"
30+
#include "ompi/info/info.h"
31+
32+
/**
33+
* Create a info object holding local hardware resource info.
34+
*
35+
* @param info Pointer to the MPI_Info handle
36+
*
37+
* @retval MPI_SUCCESS
38+
* @retval MPI_ERR_INFO
39+
* @retval MPI_ERR_NO_MEM
40+
*
41+
* When an MPI_Info object is not being used, it should be freed using
42+
* MPI_Info_free
43+
*/
44+
PROTOTYPE ERROR_CLASS get_hw_resource_info(INFO_OUT info)
45+
{
46+
if (MPI_PARAM_CHECK) {
47+
if (NULL == info) {
48+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_INFO,
49+
FUNC_NAME);
50+
}
51+
}
52+
53+
/*
54+
* Just allocate an info object. No resources currently being
55+
* specified so just return empty info object.
56+
*/
57+
58+
*info = ompi_info_allocate ();
59+
if (NULL == (*info)) {
60+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM,
61+
FUNC_NAME);
62+
}
63+
64+
return MPI_SUCCESS;
65+
}

ompi/mpi/fortran/mpif-h/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ lib@OMPI_LIBMPI_NAME@_mpifh_la_SOURCES += \
291291
get_count_f.c \
292292
get_elements_f.c \
293293
get_elements_x_f.c \
294+
get_hw_resource_info_f.c \
294295
get_library_version_f.c \
295296
get_processor_name_f.c \
296297
get_version_f.c \
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2015 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
15+
* Copyright (c) 2015 Triad National Security, LLC. All rights reserved.
16+
* $COPYRIGHT$
17+
*
18+
* Additional copyrights may follow
19+
*
20+
* $HEADER$
21+
*/
22+
23+
#include "ompi_config.h"
24+
25+
#include "ompi/mpi/fortran/mpif-h/bindings.h"
26+
27+
#if OMPI_BUILD_MPI_PROFILING
28+
#if OPAL_HAVE_WEAK_SYMBOLS
29+
#pragma weak PMPI_GET_HW_RESOURCE_INFO = ompi_get_hw_resource_info_f
30+
#pragma weak pmpi_get_hw_resource_info = ompi_get_hw_resource_info_f
31+
#pragma weak pmpi_get_hw_resource_info_ = ompi_get_hw_resource_info_f
32+
#pragma weak pmpi_get_hw_resource_info__ = ompi_get_hw_resource_info_f
33+
34+
#pragma weak PMPI_Get_hw_resource_info_f = ompi_get_hw_resource_info_f
35+
#pragma weak PMPI_Get_hw_resource_info_f08 = ompi_get_hw_resource_info_f
36+
#else
37+
OMPI_GENERATE_F77_BINDINGS (PMPI_GET_HW_RESOURCE_INFO,
38+
pmpi_get_hw_resource_info,
39+
pmpi_get_hw_resource_info_,
40+
pmpi_get_hw_resource_info__,
41+
pompi_get_hw_resource_info_f,
42+
(MPI_Fint *info, MPI_Fint *ierr),
43+
(info, ierr) )
44+
#endif
45+
#endif
46+
47+
#if OPAL_HAVE_WEAK_SYMBOLS
48+
#pragma weak MPI_GET_HW_RESOURCE_INFO = ompi_get_hw_resource_info_f
49+
#pragma weak mpi_get_hw_resource_info = ompi_get_hw_resource_info_f
50+
#pragma weak mpi_get_hw_resource_info_ = ompi_get_hw_resource_info_f
51+
#pragma weak mpi_get_hw_resource_info__ = ompi_get_hw_resource_info_f
52+
53+
#pragma weak MPI_Get_hw_resource_info_f = ompi_get_hw_resource_info_f
54+
#pragma weak MPI_Get_hw_resource_info_f08 = ompi_get_hw_resource_info_f
55+
#else
56+
#if ! OMPI_BUILD_MPI_PROFILING
57+
OMPI_GENERATE_F77_BINDINGS (MPI_GET_HW_RESOURCE_INFO,
58+
mpi_get_hw_resource_info,
59+
mpi_get_hw_resource_info_,
60+
mpi_get_hw_resource_info__,
61+
ompi_get_hw_resource_info_f,
62+
(MPI_Fint *info, MPI_Fint *ierr),
63+
(info, ierr) )
64+
#else
65+
#define ompi_get_hw_resource_info_f pompi_get_hw_resource_info_f
66+
#endif
67+
#endif
68+
69+
70+
void ompi_get_hw_resource_info_f(MPI_Fint *info, MPI_Fint *ierr)
71+
{
72+
int c_ierr;
73+
MPI_Info c_info;
74+
75+
c_ierr = PMPI_Get_hw_resource_info(&c_info);
76+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
77+
78+
if (MPI_SUCCESS == c_ierr) {
79+
*info = PMPI_Info_c2f(c_info);
80+
}
81+
}

ompi/mpi/fortran/mpif-h/profile/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# Copyright (c) 2015-2021 Research Organization for Information Science
1919
# and Technology (RIST). All rights reserved.
2020
# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
21-
# Copyright (c) 2019-2022 Triad National Security, LLC. All rights
21+
# Copyright (c) 2019-2025 Triad National Security, LLC. All rights
2222
# reserved.
2323
# Copyright (c) 2025 Jeffrey M. Squyres. All rights reserved.
2424
# $COPYRIGHT$
@@ -203,6 +203,7 @@ linked_files = \
203203
pget_count_f.c \
204204
pget_elements_f.c \
205205
pget_elements_x_f.c \
206+
pget_hw_resource_info_f.c \
206207
pget_library_version_f.c \
207208
pget_processor_name_f.c \
208209
pget_version_f.c \

ompi/mpi/fortran/mpif-h/prototypes_mpi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* reserved.
1717
* Copyright (c) 2016-2023 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
19-
* Copyright (c) 2019-2023 Triad National Security, LLC. All rights
19+
* Copyright (c) 2019-2025 Triad National Security, LLC. All rights
2020
* reserved.
2121
* Copyright (c) 2021 Bull S.A.S. All rights reserved.
2222
* $COPYRIGHT$
@@ -252,6 +252,7 @@ PN2(void, MPI_Get_address, mpi_get_address, MPI_GET_ADDRESS, (char *location, MP
252252
PN2(void, MPI_Get_count, mpi_get_count, MPI_GET_COUNT, (MPI_Fint *status, MPI_Fint *datatype, MPI_Fint *count, MPI_Fint *ierr));
253253
PN2(void, MPI_Get_elements, mpi_get_elements, MPI_GET_ELEMENTS, (MPI_Fint *status, MPI_Fint *datatype, MPI_Fint *count, MPI_Fint *ierr));
254254
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));
255+
PN2(void, MPI_Get_hw_resource_info, mpi_get_hw_resource_info, MPI_GET_HW_RESOURCE_INFO, (MPI_Fint *info, MPI_Fint *ierr));
255256
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));
256257
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));
257258
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));

0 commit comments

Comments
 (0)