Skip to content

Commit 2b491a1

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 <[email protected]>
1 parent e2a2583 commit 2b491a1

File tree

13 files changed

+226
-2
lines changed

13 files changed

+226
-2
lines changed

docs/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ OMPI_MAN3 = \
257257
MPI_Get_count.3 \
258258
MPI_Get_elements.3 \
259259
MPI_Get_elements_x.3 \
260+
MPI_Get_hw_resource_info.3 \
260261
MPI_Get_library_version.3 \
261262
MPI_Get_processor_name.3 \
262263
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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,9 @@ prototype_sources = \
215215
get_count.c.in \
216216
get_elements.c.in \
217217
get_elements_x.c.in \
218-
get_library_version.c.in \
219-
get_processor_name.c.in \
218+
get_hw_resource_info.c.in \
219+
get_library_version.c.in \
220+
get_processor_name.c.in \
220221
get_version.c.in \
221222
graph_create.c.in \
222223
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: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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$
16+
*
17+
* Additional copyrights may follow
18+
*
19+
* $HEADER$
20+
*/
21+
22+
#include "ompi_config.h"
23+
24+
#include "ompi/mpi/fortran/mpif-h/bindings.h"
25+
26+
#if OMPI_BUILD_MPI_PROFILING
27+
#if OPAL_HAVE_WEAK_SYMBOLS
28+
#pragma weak PMPI_GET_HW_RESOURCE_INFO = ompi_get_hw_resource_info_f
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+
33+
#pragma weak PMPI_Get_hw_resource_info_f = ompi_get_hw_resource_info_f
34+
#pragma weak PMPI_Get_hw_resource_info_f08 = ompi_get_hw_resource_info_f
35+
#else
36+
OMPI_GENERATE_F77_BINDINGS (PMPI_GET_HW_RESOURCE_INFO,
37+
pmpi_get_hw_resource_info,
38+
pmpi_get_hw_resource_info_,
39+
pmpi_get_hw_resource_info__,
40+
pompi_get_hw_resource_info_f,
41+
(MPI_Fint *info, MPI_Fint *ierr),
42+
(info, ierr) )
43+
#endif
44+
#endif
45+
46+
#if OPAL_HAVE_WEAK_SYMBOLS
47+
#pragma weak MPI_GET_HW_RESOURCE_INFO = ompi_get_hw_resource_info_f
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+
52+
#pragma weak MPI_Get_hw_resource_info_f = ompi_get_hw_resource_info_f
53+
#pragma weak MPI_Get_hw_resource_info_f08 = ompi_get_hw_resource_info_f
54+
#else
55+
#if ! OMPI_BUILD_MPI_PROFILING
56+
OMPI_GENERATE_F77_BINDINGS (MPI_GET_HW_RESOURCE_INFO,
57+
mpi_get_hw_resource_info,
58+
mpi_get_hw_resource_info_,
59+
mpi_get_hw_resource_info__,
60+
ompi_get_hw_resource_info_f,
61+
(MPI_Fint *info, MPI_Fint *ierr),
62+
(info, ierr) )
63+
#else
64+
#define ompi_get_hw_resource_info_f pompi_get_hw_resource_info_f
65+
#endif
66+
#endif
67+
68+
69+
void ompi_get_hw_resource_info_f(MPI_Fint *info, MPI_Fint *ierr)
70+
{
71+
int c_ierr;
72+
MPI_Info c_info;
73+
74+
c_ierr = PMPI_Get_hw_resource_info(&c_info);
75+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
76+
77+
if (MPI_SUCCESS == c_ierr) {
78+
*info = PMPI_Info_c2f(c_info);
79+
}
80+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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)