MPI_CARTDIM_GET(3)

πŸ’– MPI_CARTDIM_GET(3) β€” the Open MPI one, bestie πŸ’–

okay so you're deep in Open MPI land and you found the MPI_Cartdim_get page?? slay. this is the MPI_CARTDIM_GET(3) manual page and we are going to read it TOGETHER, no cap. grab your iced coffee. 🧚


✨ NAME ✨

MPI_Cartdim_get β€” retrieves Cartesian topology information associated with a communicator.

like. it just tells you stuff about your cart comm. that's the whole job. iconic behavior honestly. πŸ‘‘


🌸 SYNTAX 🌸

C Syntax

#include <mpi.h>

int MPI_Cartdim_get(MPI_Comm comm, int *ndims)

Fortran Syntax

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

MPI_CARTDIM_GET(COMM, NDIMS, IERROR)
    INTEGER COMM, NDIMS, IERROR

Fortran 2008 Syntax

USE mpi_f08

MPI_Cartdim_get(comm, ndims, ierror)
    TYPE(MPI_Comm), INTENT(IN) :: comm
    INTEGER, INTENT(OUT) :: ndims
    INTEGER, OPTIONAL, INTENT(OUT) :: ierror

🫢 INPUT PARAMETER 🫢

  • comm β€” the communicator that has Cartesian structure, i.e. the handle. it's giving "already cart, already cute". πŸ’…

πŸŽ€ OUTPUT PARAMETERS πŸŽ€

  • ndims β€” how many dimensions your Cartesian structure has (that's an integer bestie).
  • ierror β€” Fortran only: the error status (integer). so Fortran girlies get an extra little slot for it. πŸ’œ

🌈 DESCRIPTION 🌈

MPI_Cartdim_get returns the number of dimensions of the Cartesian structure. that's it. that's the function. it's a one-job queen and she does her job. periodt. ✨


πŸ’€ ERRORS πŸ’€

almost all MPI routines return an error value, lowkey. C routines hand it back as the return result of the function, and Fortran routines put it in the last argument. classic.

before that error value even comes back to you, the current MPI error handler associated with the communication object (think: communicator, window, file) gets called. and if there is no communication object associated with the MPI call?? then the call is considered attached to MPI_COMM_SELF and it'll call the error handler associated with that. and when MPI_COMM_SELF is not initialized (aka 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 with the mpi_initial_errhandler CLI argument to mpiexec, or via the 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.

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

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. dramatic. as she should. πŸ’…
  • 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. it's a whole vibe per-object. πŸ¦‹
  • MPI_ERRORS_RETURN β€” returns an error code to the application. polite. love that for her. 🫢

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. so like. don't count on it 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_Cart_get

2003-2026, The Open MPI Community


and that's the whole page, bestie!! you ate this one fr fr β€” go get those Cartesian dimensions. this was Open MPI, MPI_CARTDIM_GET(3), dated Sep 10, 2026. mwah. πŸ’–πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from