@@ -6,7 +6,7 @@ MPIX_Query_rocm_support
6
6
7
7
.. include_body
8
8
9
- **MPIX_Query_rocm_support ** - Returns 1 if there is AMD ROCm aware support
9
+ **MPIX_Query_rocm_support ** - Returns 1 if there is AMD ROCm- aware support
10
10
and 0 if there is not.
11
11
12
12
@@ -40,33 +40,58 @@ There is no C++ binding for this function.
40
40
DESCRIPTION
41
41
-----------
42
42
43
- This routine return 1 if MPI library is build with ROCm and runtime
44
- supports ROCm buffers. This routine must be called after MPI is
45
- initialized by a call to :ref: `MPI_Init ` or :ref: `MPI_Init_thread `.
43
+ This function is part of an :ref: `Open MPI extension
44
+ <ompi-features-extentions-label>`; it is not part of standard MPI.
45
+
46
+ This routine returns 1 if both the MPI library was built with the AMD
47
+ ROCm library and the runtime supports ROCm buffers. Otherwise, it
48
+ returns 0. This routine must be called after MPI is initialized,
49
+ e.g., by a call to :ref: `MPI_Init(3) <MPI_Init >` or
50
+ :ref: `MPI_Init_thread(3) <MPI_Init_thread >`.
51
+
52
+ Including the Open MPI-specific file ``<mpi-ext.h> `` will define the C
53
+ preprocessor macro ``OMPI_HAVE_MPI_EXT `` to ``1 ``. Otherwise, it will
54
+ be undefined. This macro can be used by applications as a sentinel to
55
+ know whether ``<mpi-ext.h> `` has been included or not.
56
+
57
+ The Open MPI ROCm extension is built by default (regardless of whether
58
+ or not Open MPI was built with ROCm support), but *could * have been
59
+ disabled by an administrative action. It is therefore safest for
60
+ applications to check that the preprocessor macro
61
+ ``OMPI_HAVE_MPI_EXT_ROCM `` is defined and is set to 1 to know whether
62
+ the ``MPIX_Query_rocm_support() `` function is available. Checking for
63
+ this macro also protects the use of this function when compiling the
64
+ application with older versions of Open MPI or other MPI
65
+ implementations that do not have this function.
46
66
47
67
48
68
Examples
49
69
^^^^^^^^
50
70
51
- ::
52
-
71
+ .. code-block :: c
53
72
54
73
#include <stdio.h>
55
- #include "mpi.h"
56
-
57
- #include "mpi-ext.h" /* Needed for ROCm-aware check */
74
+ #include <mpi.h>
75
+ #include <mpi-ext.h> /* Needed for ROCm-aware check */
58
76
59
77
int main(int argc, char *argv[])
60
78
{
61
-
62
79
MPI_Init(&argc, &argv);
63
80
64
- if (MPIX_Query_rocm_support()) {
65
- printf("This MPI library has ROCm-aware support.);
81
+ bool happy = false;
82
+ #if defined(OMPI_HAVE_MPI_EXT_ROCM) && OMPI_HAVE_MPI_EXT_ROCM
83
+ happy = (bool) MPIX_Query_rocm_support();
84
+ #endif
85
+
86
+ if (happy) {
87
+ printf("This Open MPI installation has ROCm-aware support.\n");
66
88
} else {
67
- printf("This MPI library does not have ROCm-aware support.);
89
+ printf("This Open MPI installation does not have ROCm-aware support.\n" );
68
90
}
69
- MPI_Finalize();
70
91
92
+ MPI_Finalize();
71
93
return 0;
72
94
}
95
+
96
+ .. seealso ::
97
+ :ref: `MPIX_Query_cuda_support `
0 commit comments