MPI_GROUP_SIZE(3)
π MPI_GROUP_SIZE β bestie, let's count some processes π
Okay so this is the <pink>MPI_GROUP_SIZE(3)</pink> page from the Open MPI manual (section 3, the library-calls section, iykyk), and honestly? It's a little icon. It's giving "one job and it does it perfectly." Let's get into it π«Ά
β¨ NAME β¨
MPI_Group_size β returns the size of a group. That's it. That's the whole vibe. π
π¦ SYNTAX π¦
C Syntax
#include <mpi.h>
int MPI_Group_size(MPI_Group group, int *size)
Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_GROUP_SIZE(GROUP, SIZE, IERROR)
INTEGER GROUP, SIZE, IERROR
Fortran 2008 Syntax
USE mpi_f08
MPI_Group_size(group, size, ierror)
TYPE(MPI_Group), INTENT(IN) :: group
INTEGER, INTENT(OUT) :: size
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Like, the Fortran 2008 one is the glow-up version β typed group, OPTIONAL ierror, the whole aesthetic. Slay. β¨
πΈ INPUT PARAMETERS πΈ
groupβ the group handle. That's the thing you're asking about, bestie. π
π OUTPUT PARAMETERS π
sizeβ number of processes in the group (integer). The answer!! The payoff!! πierrorβ Fortran only: error status (integer). The Fortran girlies get their error code handed right back to them, no cap.
π DESCRIPTION π
So MPI_Group_size returns, in size, the number of processes in the group. Literally that's the whole function. Lowkey iconic for how unbothered it is.
And the deets, because they matter:
- if
group = MPI_GROUP_EMPTY, then the call will returnsize = 0β yes bestie, zero is a valid answer, an empty group is still a group and we respect her π«Ά - on the other hand, a call with
group = MPI_GROUP_NULLis erroneous. Not "returns zero," not "shrugs" β erroneous. Do not do this. It's giving "playing with fire." π
π₯ ERRORS π₯
Okay this is the long part but do not scroll, it's important, fr fr.
Almost all MPI routines return an error value; C routines as the return result of the function and Fortran routines in the last argument.
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.
Phew. Okay. Breathe. Now the fun part β the three predefined error handlers Open MPI ships with:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. Like, everyone. Gone. Dramatic but honest. π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. Context really is everything, bestie. β¨MPI_ERRORS_RETURNβ returns an error code to the application. The chill one. Hands you the receipt and lets you deal with it. π§Ύ
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, it might! It might not! No promises, bestie. Plan accordingly. π
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. (Yes, the standard. She's long but she's thorough. π )
π COPYRIGHT π
2003-2026, The Open MPI Community.
And that's the page!! π Go forth and count your processes, you absolute main character. Periodt. πβ¨π¦
Source: Open MPI Β· dated Sep 11, 2026 Β· that's the sign-off bestie, mwah π«Άπ
π¦ 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