MPI_INFO_SET(3)

πŸ’– MPI_INFO_SET πŸ’–

okay so bestie, we're in the Open MPI section of the manual (the 3 part is just the section number, iykyk) and today's main character is MPI_Info_set β€” she adds a key/value pair to info. that's it. that's the whole job. and she does it flawlessly. πŸ’…


✨ SYNTAX ✨

🌸 C Syntax

#include <mpi.h>

int MPI_Info_set(MPI_Info info, const char *key, const char *value)

🌸 Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_INFO_SET(INFO, KEY, VALUE, IERROR)
     INTEGER         INFO, IERROR
     CHARACTER*(*)   KEY, VALUE

🌸 Fortran 2008 Syntax

USE mpi_f08
MPI_Info_set(info, key, value, ierror)
     TYPE(MPI_Info), INTENT(IN) :: info
     CHARACTER(LEN=*), INTENT(IN) :: key, value
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸ’« INPUT/OUTPUT PARAMETER

  • info β€” the Info object, aka the handle. she's the one getting ✨edited✨.

πŸ’« INPUT PARAMETERS

  • key β€” the key, a string. πŸ‘‘
  • value β€” the value, also a string. πŸŽ€

πŸ’« OUTPUT PARAMETER

  • ierror β€” Fortran only bestie: the error status (an integer). πŸ¦‹

🌈 DESCRIPTION 🌈

MPI_Info_set adds the (key,value) pair to info, and overrides the value if a value for the same key was previously set. she doesn't argue, she doesn't warn you, she just replaces it. periodt. πŸ’…

In C, the key and value parameters are null-terminated strings. In Fortran, leading and trailing spaces in key and value get stripped β€” no cap, they literally get trimmed.

and if either key or value is larger than the allowed maximums? 😭 the error MPI_ERR_INFO_KEY or MPI_ERR_INFO_VALUE is raised, respectively. so like, watch your sizes bestie.

😭 ERRORS 😭

Almost all MPI routines return an error value, okay? C routines hand it back as the return result of the function, and Fortran routines put it in that last argument. classic Fortran behaviour, we love her anyway. πŸ’œ

Before the error value is returned, the current MPI error handler associated with the communication object (e.g., communicator, window, file) gets called. And if there's no communication object associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and it'll call the associated MPI error handler. Now β€” 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 you're using the World model, or by the mpi_initial_errhandler CLI argument to mpiexec, or by that 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. that's the deal. 🀝

Open MPI includes three predefined error handlers you can use:

  • MPI_ERRORS_ARE_FATAL β€” Causes the program to abort all connected MPI processes. πŸ’€ no survivors.
  • 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 if MPI_Abort was called on that communicator. If called on a window or file, it acts as if MPI_Abort was 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. she's polite like that. 🫢

MPI applications can also implement their own error handlers by calling:

  • MPI_Comm_create_errhandler then MPI_Comm_set_errhandler
  • MPI_File_create_errhandler then MPI_File_set_errhandler
  • MPI_Session_create_errhandler then MPI_Session_set_errhandler or at MPI_Session_init
  • MPI_Win_create_errhandler then MPI_Win_set_errhandler
⚠️ note that MPI does not guarantee that an MPI program can continue past an error. she said what she said. πŸ’€

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_create
  • MPI_Info_delete
  • MPI_Info_dup
  • MPI_Info_free
  • MPI_Info_set

2003-2026, The Open MPI Community


okay that's the whole page bestie, you ate that πŸ“πŸ’– and just so you know, this edition is the Sep 10, 2026 printing of MPI_INFO_SET(3) from Open MPI, section 3 of the manual, brought to you by the Open MPI Community (the 2003-2026 copyright era, iconic run). go set some keys, you're gonna slay βœ¨πŸ¦‹πŸ’…

πŸ“¦ where this page comes from