MPI_GRAPHDIMS_GET(3)
π« MPI_GRAPHDIMS_GET π«
okay bestie, gather round, because this is the Open MPI manual page for MPI_Graphdims_get, and it's lowkey one of those tiny functions that saves your whole entire life when you're trying to figure out how big your graph arrays gotta be. β¨
It's in section 3 (the library calls girlies), and it does exactly one thing: it tells you the dimensions of a graph topology hiding inside a communicator. no cap.
πΈ NAME πΈ
MPI_Graphdims_get β pulls out the graph topology info that's chillin' inside a communicator. π¦
β¨ SYNTAX β¨
C Syntax
#include <mpi.h>
int MPI_Graphdims_get(MPI_Comm comm, int *nnodes, int *nedges)
Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_GRAPHDIMS_GET(COMM, NNODES, NEDGES, IERROR)
INTEGER COMM, NNODES, NEDGES, IERROR
Fortran 2008 Syntax
USE mpi_f08
MPI_Graphdims_get(comm, nnodes, nedges, ierror)
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, INTENT(OUT) :: nnodes, nedges
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π INPUT PARAMETER π
commβ the communicator for the group rockin' that graph structure, it's a handle. π
π OUTPUT PARAMETERS π
nnodesβ how many nodes are in the graph, as an integer. count 'em up bestie πnedgesβ how many edges are in the graph, also an integer. the connections fr fr π₯ierrorβ Fortran only, babes: the error status, as an integer. π
π DESCRIPTION π
So MPI_Graphdims_get and MPI_Graph_get are a lil duo β they retrieve the graph-topology information that some other call associated with a communicator in the first place, specifically MPI_Graph_create. that's the origin story, iconic honestly.
The whole point of MPI_Graphdims_get? The info it hands you lets you dimension your index and edges vectors correctly before you call MPI_Graph_get. like, you cannot just guess the size, that's giving chaos. use this first, then go forth and MPI_Graph_get. π
π ERRORS π
okay here's the part where we get serious for a sec. almost every MPI routine returns an error value β C routines hand it back as the return result of the function, and Fortran routines put it in that last argument. noted. βοΈ
Before that error value ever 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'll call the associated MPI error handler for that. now 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 instead. π
And that initial error handler can be changed! you do it by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when you're on 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 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 the other MPI functions. that's just how it is. π
Open MPI ships three predefined error handlers you can use:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. yeah. all of them. πMPI_ERRORS_ABORTβ an error handler you can invoke on a communicator, window, file, or session. when it's called on a communicator, it acts as ifMPI_Abortwas called on that communicator. if it's called on a window or a file, it acts as ifMPI_Abortwas 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. local queen behavior. πMPI_ERRORS_RETURNβ returns an error code to the application. simple, clean, respectful. β¨
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
π¨ important bestie: note that MPI does not guarantee that an MPI program can continue past an error. so don't be out here assuming you can just vibe through it.
See the MPI man page for a full list of MPI error codes. π
See the Error Handling section of the MPI-3.1 standard if you want the deep lore. π
See also:
MPI_Graph_create
π Copyright π
2003-2026, The Open MPI Community
and that's the whole page, bestie!! π«Ά written up on Sep 10, 2026, from Open MPI, living in section 3 as MPI_GRAPHDIMS_GET(3). go dimension those vectors correctly and slay. ππ§πΈ
π¦ 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