MPIX_QUERY_CUDA_SUPPORT(3)
π MPIX_QUERY_CUDA_SUPPORT π
okay bestie, welcome to the Open MPI manual page for MPIX_Query_cuda_support π¦ β yeah, this whole thing lives in section 3 of the Open MPI docs, and it's about to tell you whether your setup is CUDA-aware or not. slay.
MPIX_Query_cuda_support β returns 1 if there is CUDA-aware support and 0 if there is not. π
β¨ SYNTAX β¨
π C Syntax
#include <mpi.h>
#include <mpi-ext.h>
int MPIX_Query_cuda_support(void)
π Fortran Syntax
ngl bestie, there is no Fortran binding for this function. π
π C++ Syntax
and there is no C++ binding for this function either. π
β¨ DESCRIPTION β¨
So here's the tea β β this function is part of an Open MPI extension; it is not part of standard MPI. iykyk.
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. Periodt. π
β οΈ okay this part matters β this routine must be called after MPI is initialized, e.g. by a call toMPI_Init(3)orMPI_Init_thread(3). Do not skip this step, bestie, I'm begging. π«Ά
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. sentinel queen π
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 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. no cap, that's the whole point. π
πΈ EXAMPLES πΈ
here's a little snack of code for you, copy it, it's iconic:
#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 also:
MPIX_Query_rocm_supportπ¦ β the ROCm sibling, go say hi
π Copyright π
2003-2026, The Open MPI Community
and that's the whole vibe check, bestie π this was pulled from the Open MPI docs, and the version stamp on it is dated Sep 10, 2026. go forth and query your CUDA support, you absolute main character πβ¨π π
π¦ where this page comes from
- ubuntu stonking: openmpi-doc 5.0.10-6 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms