MPI_INFO_GET_NKEYS(3)
π MPI_INFO_GET_NKEYS(3) β Open MPI, bestie edition π
okay so you're in section 3 of the Open MPI manual, which means we're talking library calls, and today's main character is MPI_Info_get_nkeys. she counts keys. that's her whole thing and she ate.
β¨ NAME β¨
MPI_Info_get_nkeys β gets the number of keys currently defined in an info object.
like. she tells you how many keys are in your info object. that's it. that's the gig. π
πΈ SYNTAX πΈ
C Syntax
#include <mpi.h>
int MPI_Info_get_nkeys(MPI_Info info, int *nkeys)
Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_INFO_GET_NKEYS(INFO, NKEYS, IERROR)
INTEGER INFO, NKEYS, IERROR
Fortran 2008 Syntax
USE mpi_f08
MPI_Info_get_nkeys(info, nkeys, ierror)
TYPE(MPI_Info), INTENT(IN) :: info
INTEGER, INTENT(OUT) :: nkeys
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π«Ά INPUT PARAMETER π«Ά
infoβ the Info object, as a handle. bestie, that's the thing you're inspecting. π
π OUTPUT PARAMETERS π
nkeysβ number of defined keys, an integer. literally the whole point of this function. π₯ierrorβ Fortran only: error status, an integer. π«
π DESCRIPTION π
MPI_Info_get_nkeys returns the number of currently defined keys in info.
that's it. no cap. she counts, she returns, she leaves. icon behavior. β¨
π ERRORS π
okay this part is long but it's important so we're doing it properly, no skipping. π
Almost all MPI routines return an error value β C routines hand it back as the return result of the function, and Fortran routines put it in that last argument. classic.
Before that error value gets returned, the current MPI error handler associated with the communication object (think: communicator, window, file) gets called. And if there's no communication object attached to the MPI call? Then the call is considered attached to MPI_COMM_SELF and it calls the error handler associated with that. π
And when MPI_COMM_SELF isn't initialized β meaning before MPI_Init/MPI_Init_thread, or after MPI_Finalize, or when you're using the Sessions Model exclusively β the error raises the initial error handler instead. You can change that initial error handler by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when you're using the World model, or via the mpi_initial_errhandler CLI argument to mpiexec, or via the info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. And if literally no other appropriate error handler has been set? Then MPI_ERRORS_RETURN gets called for MPI I/O functions, and MPI_ERRORS_ABORT gets called for all other MPI functions. π€―
Open MPI ships three predefined error handlers you can use:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. yeah. everybody. gone. πMPI_ERRORS_ABORTβ an error handler that can be invoked on a communicator, window, file, or session. When it's called on a communicator, it acts as ifMPI_Abortwas called on that communicator. 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. Called on a session? It aborts only the local process.MPI_ERRORS_RETURNβ returns an error code to the application. chill. polite. hands you the receipt. π§Ύ
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_errhandler, or 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, fr fr, don't assume you can just keep vibing after an error. π
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_nthkeyMPI_Info_get_valuelen
π Copyright π
2003-2026, The Open MPI Community
and that's the whole page, bestie!! π¦ this was the MPI_INFO_GET_NKEYS(3) page from Open MPI, dated Sep 10, 2026 β mwah, slay, go count some keys π
β¨π
π¦ 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