MPIX_GPU_query_support(3)

πŸ’– MPIX_GPU_query_support(3) πŸ’–

okay bestie, so this little cutie lives in the MPI family, and her whole job is answering one (1) very important question: does this machine vibe with your GPU or not? She's MPIX_GPU_query_support, and she is the name of the page you're reading rn. 🫢


✨ NAME ✨

MPIX_GPU_query_support β€” returns whether the specific type of GPU is supported πŸ’…


🌸 SYNOPSIS 🌸

int MPIX_GPU_query_support(int gpu_type, int *is_supported)

like... that's it. two args. she's low maintenance. 😌


πŸ‘‘ INPUT PARAMETERS πŸ‘‘

  • gpu_type β€” the GPU flavor you're asking about, as an integer. Your options are literally just these three besties:
    • MPIX_GPU_SUPPORT_CUDA
    • MPIX_GPU_SUPPORT_ZE
    • MPIX_GPU_SUPPORT_HIP

πŸŽ€ OUTPUT PARAMETERS πŸŽ€

  • is_supported β€” logical. It comes back as true if a GPU of the given type is supported, and false otherwise. no maybes, no "it's complicated", just true/false energy. periodt. ✨

πŸ¦‹ THREAD AND INTERRUPT SAFETY πŸ¦‹

This routine is thread-safe, okay? That means multiple threads can call her at the same time and you do not need to bring your own user-provided thread locks. She handles herself. πŸ’…

But β€” and this is the important part β€” she is not interrupt safe. 😭

Typically that's because of memory allocation routines like malloc, or other non-MPICH runtime routines that are themselves not interrupt-safe. so like... threads? yes. interrupts? absolutely not, bestie. 🚫


🧚 NOTES FOR FORTRAN 🧚

Real talk for the Fortran girlies: every MPI routine in Fortran (except for MPI_WTIME and MPI_WTICK) gets an extra argument called ierr tacked onto the end of the argument list. ierr is an integer and it means the exact same thing as the return value of the routine in C.

Also, in Fortran, MPI routines are subroutines and you invoke them with the call statement.

And all MPI objects (like MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. no cap. πŸ’œ


⭐ ERRORS ⭐

So every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β€” C routines hand it back as the value of the function, and Fortran routines put it in that last argument. Before that value gets returned, the current MPI error handler gets called. And by default? That error handler aborts the MPI job. πŸ’€ yes, the whole thing.

You can change the error handler with:

  • MPI_Comm_set_errhandler (for communicators)
  • MPI_File_set_errhandler (for files)
  • MPI_Win_set_errhandler (for RMA windows)

There's also the MPI-1 routine MPI_Errhandler_set, which you may use, but heads up: its use is deprecated. πŸ™ˆ

If you want error values returned instead of the job just dying, you can use the predefined error handler MPI_ERRORS_RETURN. And note that MPI does not guarantee an MPI program can continue past an error β€” however, MPI implementations will attempt to continue whenever possible.

Here's the error code lineup:

  • MPI_SUCCESS β€” no error; the MPI routine completed successfully. slay. ✨
  • MPI_ERR_ARG β€” invalid argument. Some argument is invalid and is not identified by a specific error class (e.g., MPI_ERR_RANK).
  • MPI_ERR_OTHER β€” other error; use MPI_Error_string to get more information about this error code.

and that's the whole page, bestie. thank you for coming to my ted talk. 🫢

πŸ’– bye ily, this was MPIX_GPU_query_support(3) from 4/10/2026 β€” go ask your GPU some questions πŸ’–

πŸ“¦ where this page comes from