MPI_CARTDIM_GET(3)

πŸ’… MPI_CARTDIM_GET(3) β€” Open MPI

okay so bestie, welcome to the MPI_CARTDIM_GET page from the Open MPI manual (yes, section 3, the library-calls girlies) ✨ this one is short and sweet and it slaps.

πŸŽ€ NAME πŸŽ€

MPI_Cartdim_get β€” retrieves Cartesian topology information associated with a communicator. that's it, that's the whole vibe check πŸ¦‹

✨ 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 β€” a communicator that's got that Cartesian structure going on (it's a handle, bestie).

🌟 OUTPUT PARAMETERS 🌟

  • ndims β€” the number of dimensions of the Cartesian structure (an integer). literally the whole point of the call πŸ‘‘
  • ierror β€” Fortran only: the error status (an integer).

πŸ’« DESCRIPTION πŸ’«

MPI_Cartdim_get hands you back the number of dimensions of the Cartesian structure. that's the tea, no cap β˜•

πŸ”₯ ERRORS πŸ”₯

okay so this part is long but it's important so stay with me 🫢 β€” almost all MPI routines return an error value; C routines give it to you as the return result of the function, and Fortran routines stick it in the last argument.

Before that error value comes back to you, the current MPI error handler associated with the communication object (like, a communicator, a window, or a file β€” you know the type) gets called. if there's no communication object associated with the MPI call, then the call counts as attached to MPI_COMM_SELF and it'll call that associated MPI error handler. and when MPI_COMM_SELF is not initialized (i.e., before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when you're using the Sessions Model exclusively β€” all of those 😭), the error raises the initial error handler. that initial error handler can be changed 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 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. periodt πŸ’…

Open MPI includes 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 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. if it's called on a session, it aborts only the local process.
  • MPI_ERRORS_RETURN β€” returns an error code to the application. the chill one 🧚

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. like, do not assume you can just keep going, 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! πŸ“ source + version: The Open MPI Community, 2003-2026, dated Sep 11, 2026 β€” go get that topology info, you main character πŸ’œβœ¨

πŸ“¦ where this page comes from