MPI_INFO_GET_NTHKEY(3)
π MPI_INFO_GET_NTHKEY(3) β Open MPI, bestie edition π
okay so this is a page from Open MPI (yes, the MPI_INFO_GET_NTHKEY(3) one, you found it, slay) and it's genuinely so simple it's almost cute. It returns the nth defined key in an info object. That's the whole vibe. Let's get into it β¨
πΈ SYNTAX πΈ
π» C Syntax
#include <mpi.h>
int MPI_Info_get_nthkey(MPI_Info info, int n, char *key)
π§ Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_INFO_GET_NTHKEY(INFO, N, KEY, IERROR)
INTEGER INFO, N, IERROR
CHARACTER*(*) KEY
π¦ Fortran 2008 Syntax
USE mpi_f08
MPI_Info_get_nthkey(info, n, key, ierror)
TYPE(MPI_Info), INTENT(IN) :: info
INTEGER, INTENT(IN) :: n
CHARACTER(LEN=*), INTENT(OUT) :: key
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π INPUT PARAMETERS π
infoβ the Info object, aka the handle. Your little bag of key/value gossip πnβ the key number, an integer. Which one you want, bestie β¨
π«Ά OUTPUT PARAMETERS π«Ά
keyβ the key itself, as a string. There she is πierrorβ Fortran only: the error status, an integer π
π DESCRIPTION π
So MPI_Info_get_nthkey returns the nth defined key in info, bestie. The keys are numbered 0β¦N - 1, where N is whatever MPI_Info_get_nkeys handed you. Every key between 0 and N - 1 is guaranteed to be defined β no cap, that's a promise π«Ά.
And the number of a given key does not change as long as info isn't modified with MPI_Info_set or MPI_Info_delete. So like, once you know a key's number, it stays put. iconic behaviour honestly π₯
π ERRORS π
Almost all MPI routines return an error value, just so you know: C routines give it back as the return result of the function, and Fortran routines put it in the last argument. classic π
Before that error value is returned, the current MPI error handler associated with the communication object (think communicator, window, file) gets called. And if no communication object is associated with the MPI call, then the call counts as attached to MPI_COMM_SELF and will call its associated MPI error handler. When MPI_COMM_SELF is not initialized (i.e., before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when using the Sessions Model exclusively) the error raises the initial error handler. That initial error handler can be changed by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or by the mpi_initial_errhandler CLI argument to mpiexec, or by the info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. And if no other appropriate error handler has been set, then the MPI_ERRORS_RETURN error handler is called for MPI I/O functions and the MPI_ERRORS_ABORT error handler is called for all other MPI functions. yes that's a lot, no I'm not skipping it π
Open MPI ships three predefined error handlers you can use:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. dramatic much πMPI_ERRORS_ABORTβ an error handler that can be invoked on a communicator, window, file, or session. When called on a communicator, it acts as ifMPI_Abortwas called on that communicator. If called on a window or file, it acts as ifMPI_Abortwas called on a communicator containing the group of processes in the corresponding window or file. If called on a session, it aborts only the local process.MPI_ERRORS_RETURNβ returns an error code to the application. the polite one π
MPI applications can also implement their own error handlers by calling:
MPI_Comm_create_errhandlerthenMPI_Comm_set_errhandlerMPI_File_create_errhandlerthenMPI_File_set_errhandlerMPI_Session_create_errhandlerthenMPI_Session_set_errhandleror atMPI_Session_initMPI_Win_create_errhandlerthenMPI_Win_set_errhandler
β οΈ note that MPI does not guarantee that an MPI program can continue past an error. like, it might just be over. fr fr.
See the MPI man page for a full list of MPI error codes π
See the Error Handling section of the MPI-3.1 standard for more information π
π¦ SEE ALSO π¦
MPI_Info_getMPI_Info_get_nkeysMPI_Info_get_valuelen
β COPYRIGHT β
2003-2026, The Open MPI Community β protect them at all costs π
aaaand that's the page, bestie π it's dated Sep 11, 2026, it comes from Open MPI, and it lives under the name MPI_INFO_GET_NTHKEY(3) in the manual β go forth and get that nth key πβ¨πΈ
π¦ 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