MPI_GRAPH_GET(3)

πŸ¦‹ NAME πŸ¦‹

MPI_Graph_get β€” okay so, this one retrieves the graph topology information that's been vibing with a communicator. That's the whole thing. (You're reading the Open MPI manual page for it, section 3, bestie πŸ’–)


✨ SYNTAX ✨

🌸 C Syntax 🌸

#include <mpi.h>

int MPI_Graph_get(MPI_Comm comm, int maxindex, int maxedges,
    int index[], int edges[])

πŸ’œ Fortran Syntax πŸ’œ

USE MPI
! or the older form: INCLUDE 'mpif.h'

MPI_GRAPH_GET(COMM, MAXINDEX, MAXEDGES, INDEX, EDGES, IERROR)
    INTEGER COMM, MAXINDEX, MAXEDGES, INDEX(*)
    INTEGER EDGES(*), IERROR

🧚 Fortran 2008 Syntax 🧚

USE mpi_f08

MPI_Graph_get(comm, maxindex, maxedges, index, edges, ierror)
    TYPE(MPI_Comm), INTENT(IN) :: comm
    INTEGER, INTENT(IN) :: maxindex, maxedges
    INTEGER, INTENT(OUT) :: index(maxindex), edges(maxedges)
    INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸ’– INPUT PARAMETERS πŸ’–

  • comm β€” the communicator that's got the graph structure, aka the handle πŸ‘‘
  • maxindex β€” how long your index vector is in the calling program (integer).
  • maxedges β€” how long your edges vector is in the calling program (integer).

🫢 OUTPUT PARAMETERS 🫢

  • index β€” an array of integers holding the graph structure. For all the deets on what that structure even is, go look at the definition of MPI_Graph_create, iykyk.
  • edges β€” an array of integers holding the graph structure.
  • ierror β€” Fortran only: the error status (integer).

🌈 DESCRIPTION 🌈

So MPI_Graphdims_get and MPI_Graph_get are literally the duo that retrieves the graph-topology information that some communicator got hooked up with by MPI_Graph_create. ✨

And the info you get from MPI_Graphdims_get? You use it to dimension your index and edges vectors correctly before you call MPI_Graph_get. That's the pipeline, bestie β€” dims first, then get. Periodt.


πŸ’€ ERRORS πŸ’€

Almost every MPI routine hands back an error value, no cap: for C routines it's the return result of the function, and for Fortran routines it's chillin' in the last argument.

Before that error value comes back, the current MPI error handler that's attached to the communication object (like, a communicator, window, or file, for example) gets called. And if there's no communication object tied to the MPI call? Then the call counts as attached to MPI_COMM_SELF and it'll call the associated MPI error handler. And when MPI_COMM_SELF isn't initialized β€” like before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when you're using the Sessions Model exclusively β€” the error raises the initial error handler. 😭

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 the info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. And if 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 the other MPI functions.

Open MPI ships three predefined error handlers you can use, and they are:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. πŸ’€
  • 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 if MPI_Abort was called on that communicator. If it's 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. And if it's called on a session, it aborts only the local process.
  • MPI_ERRORS_RETURN β€” returns an error code to the application.

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

  • MPI_Comm_create_errhandler and then MPI_Comm_set_errhandler
  • MPI_File_create_errhandler and then MPI_File_set_errhandler
  • MPI_Session_create_errhandler and then MPI_Session_set_errhandler, or at MPI_Session_init
  • MPI_Win_create_errhandler and then MPI_Win_set_errhandler
Heads up bestie: MPI does not guarantee that an MPI program can continue past an error. Like, at all. πŸ™ˆ

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_Graph_create


2003-2026, The Open MPI Community


And that's a wrap, my love πŸŽ€ this was MPI_GRAPH_GET(3) from the Open MPI crew, dated Sep 10, 2026 β€” go forth and query those graph dims, you absolute icon πŸ‘‘πŸ’…

πŸ“¦ where this page comes from