MPI_CART_GET(3)
π MPI_CART_GET(3) β the Open MPI one β¨
okay bestie, so this page is literally about MPI_Cart_get from Open MPI, and no cap, it's the glow-up you need when you've got a Cartesian topology and you're like "wait, what even is my grid??" π
πΈ NAME πΈ
MPI_Cart_get β retrieves Cartesian topology information associated with a communicator. literally it hands you back the receipts of the grid you built π
β¨ SYNTAX β¨
π¦ C Syntax
#include <mpi.h>
int MPI_Cart_get(MPI_Comm comm, int maxdims, int dims[], int periods[],
int coords[])
π¦ Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_CART_GET(COMM, MAXDIMS, DIMS, PERIODS, COORDS, IERROR)
INTEGER COMM, MAXDIMS, DIMS(*), COORDS(*), IERROR
LOGICAL PERIODS(*)
π¦ Fortran 2008 Syntax
USE mpi_f08
MPI_Cart_get(comm, maxdims, dims, periods, coords, ierror)
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, INTENT(IN) :: maxdims
INTEGER, INTENT(OUT) :: dims(maxdims), coords(maxdims)
LOGICAL, INTENT(OUT) :: periods(maxdims)
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π INPUT PARAMETERS π
commβ the communicator with Cartesian structure, a.k.a. the handle. this is the one that's already got the grid vibe going on π«Άmaxdimsβ length of the vectorsdims,periods, andcoordsin the calling program. integer energy. don't let it be too smol bestie π
π©· OUTPUT PARAMETERS π©·
dimsβ number of processes for each Cartesian dimension. array of integers, iconic little census of your grid πperiodsβ periodicity (true/false) for each Cartesian dimension. array of logicals, so yes/no vibes per dim πcoordsβ coordinates of the calling process in the Cartesian structure. array of integers. this is literally your address in the grid πΊοΈierrorβ Fortran only: error status (integer). the "how did it go" lil note π
π DESCRIPTION π
the functions MPI_Cartdim_get and MPI_Cart_get return the Cartesian topology information that was associated with a communicator by MPI_Cart_create. so likeβ¦ you made the grid with MPI_Cart_create, and this is the friend who remembers what the grid actually looks like. no cap, super useful β¨
π₯ ERRORS π₯
okay so almost all MPI routines return an error value: C routines as the return result of the function, and Fortran routines in the last argument. iykyk π
before the error value is returned, the current MPI error handler associated with the communication object (e.g., communicator, window, file) is called. 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. 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. fr fr, that's the whole chain π«
Open MPI includes three predefined error handlers that can be used:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. dramatic? yes. effective? also yes π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, acts as ifMPI_Abortwas called on a communicator containing the group of processes in the corresponding window or file. if called on a session, aborts only the local process. it's giving "we're ending this, but exactly how much is context-dependent" πMPI_ERRORS_RETURNβ returns an error code to the application. the chill one, it just hands you the note and lets you deal π
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. that's not me being dramatic, that's literally the spec bestie π
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_Cartdim_getβ the other half of this little duo, go read it too π§
π COPYRIGHT π
2003β2026, The Open MPI Community. protect the copyright bestie π
and that's the whole page, mwah π β signed off with love from Open MPI, dated Sep 11, 2026. slay, go build your grid π
π¦ 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