MPIX_QUERY_CUDA_SUPPORT(3)
π MPIX_QUERY_CUDA_SUPPORT(3) π
okay so bestie, this page lives in the Open MPI manual, and it's about one tiny little function that tells you whether your CUDA vibes are immaculate or not. Let's get into it π«Ά
β¨ NAME β¨
MPIX_Query_cuda_support β returns 1 if there is CUDA-aware support and 0 if there is not. That's it. That's the whole personality. π
π¦ SYNTAX π¦
π C Syntax
#include <mpi.h>
#include <mpi-ext.h>
int MPIX_Query_cuda_support(void)
π Fortran Syntax
There is no Fortran binding for this function. sorry Fortran girlies, not today π
π C++ Syntax
There is no C++ binding for this function either. nope, not you either π
πΈ DESCRIPTION πΈ
So this function? It's part of an Open MPI extension β meaning it is not part of standard MPI. it's giving "special edition, not the base game" β¨
This routine returns 1 if both the MPI library was built with the NVIDIA CUDA library and the runtime supports CUDA buffers. Otherwise, it returns 0. Literally an all-or-nothing situation, no in-between π
β οΈ Important: this routine must be called after MPI is initialized, e.g., by a call toMPI_Init(3)orMPI_Init_thread(3). do NOT call it before, that's not the vibe.
Including the Open MPI-specific file <mpi-ext.h> will define the C preprocessor macro OMPI_HAVE_MPI_EXT to 1. Otherwise, it will be undefined. This macro can be used by applications as a sentinel to know whether <mpi-ext.h> has been included or not. it's like a little "yes i was here" note π
The Open MPI CUDA extension is built by default (regardless of whether or not Open MPI was built with CUDA support), but could have been disabled by an administrative action. so like... it usually exists, but an admin can absolutely take it away from you π
It is therefore safest for applications to check that the preprocessor macro OMPI_HAVE_MPI_EXT_CUDA is defined and is set to 1 to know whether the MPIX_Query_CUDA_support() function is available. Checking for this macro also protects the use of this function when compiling the application with older versions of Open MPI or other MPI implementations that do not have this function. very "protect yourself at all times" of you, honestly π
π EXAMPLES π
here's the whole thing in action, copy-paste energy, exact characters, no cap:
#include <stdio.h>
#include <mpi.h>
#include <mpi-ext.h> /* Needed for CUDA-aware check */
int main(int argc, char *argv[])
{
MPI_Init(&argc, &argv);
bool happy = false;
#if defined(OMPI_HAVE_MPI_EXT_CUDA) && OMPI_HAVE_MPI_EXT_CUDA
happy = (bool) MPIX_Query_cuda_support();
#endif
if (happy) {
printf("This Open MPI installation has CUDA-aware support.\n");
} else {
printf("This Open MPI installation does not have CUDA-aware support.\n");
}
MPI_Finalize();
return 0;
}
see how happy is the variable name? iconic honestly. main character energy π
π SEE ALSO π
MPIX_Query_rocm_supportβ the AMD-flavored cousin, go say hi π§
π COPYRIGHT π
2003-2026, The Open MPI Community
and that's the whole page bestie, you ate that π«Άπ β¨
little sign-off: this came from the Open MPI manual, dated Sep 11, 2026 β go forth and query your CUDA support responsibly, ily, bye ππ
π¦ where this page comes from
- arch rolling: openmpi 5.0.11-1 Β· BSD-3-Clause AND LicenseRef-MPICH
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms