MPI_GRAPHDIMS_GET(3)
π MPI_GRAPHDIMS_GET π
okay bestie, so this one is from the Open MPI manual, section 3, and it's called MPI_GRAPHDIMS_GET β yes the whole name is uppercase, it's giving very shouty but also iconic. let's get into it π«Ά
β¨ NAME β¨
MPI_Graphdims_get β retrieves the graph topology info that's hanging out with a communicator. like, the dimensions of the graph, not the whole thing. keep reading, you'll see π
β¨ 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 that's got a graph structure going on (a handle). it's the friend group, basically π«Ά
β¨ OUTPUT PARAMETERS β¨
nnodesβ how many nodes are in the graph (integer). the headcount of the party πnedgesβ how many edges are in the graph (integer). the connections, the group-chat threads, the lore πierrorβ Fortran only: the error status (integer). C girlies, you get yours as the return value, no cap.
β¨ DESCRIPTION β¨
so MPI_Graphdims_get and MPI_Graph_get are the duo that retrieves the graph-topology info that was associated with a communicator by MPI_Graph_create. they're a matching set, like besties who finish each other's sentences π
the info you get from MPI_Graphdims_get is exactly what you need to dimension the vectors index and edges correctly for a call to MPI_Graph_get. literally its whole job β it's the "how big does my array need to be" girlie so the other function can get to work without you guessing and crying π
β¨ ERRORS β¨
almost every MPI routine returns an error value, okay? C routines hand it back as the return result of the function, and Fortran routines put it in the last argument. that's just how they do it. π
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 no communication object is associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and will call the 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. the initial error handler can be changed by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or the mpi_initial_errhandler CLI argument to mpiexec or 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. okay that was a lot, drink some water π
Open MPI includes three predefined error handlers that can be used:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. like, everyone. gone. dramatic but effective π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. so, context-aware chaos π₯MPI_ERRORS_RETURNβ returns an error code to the application. the polite one. the one that lets you handle it yourself π
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, don't count on it bestie, no cap π
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 β go read that one next, it's the origin story π
β¨ COPYRIGHT β¨
2003-2026, The Open MPI Community
and that's the whole page, periodt π the source is Open MPI, dated Sep 11, 2026 β go forth and dimension your vectors correctly, queen ππ¦
π¦ 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