MPI_GRAPH_NEIGHBORS_COUNT(3)

πŸ’… MPI_GRAPH_NEIGHBORS_COUNT(3) πŸ’…

ok so bestie, welcome to the Open MPI manual, section 3 β€” this is MPI_Graph_neighbors_count, and she's basically the girl who tells you how many friends a node has in a graph topology. Main character energy fr fr πŸŽ€


✨ NAME ✨

MPI_Graph_neighbors_count β€” returns the number of neighbors of a node associated with a graph topology. that's it, that's the whole vibe πŸ¦‹


🌸 SYNTAX 🌸

πŸ’– C Syntax πŸ’–

#include <mpi.h>

int MPI_Graph_neighbors_count(MPI_Comm comm, int rank,
    int *nneighbors)

πŸ’œ Fortran Syntax πŸ’œ

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

MPI_GRAPH_NEIGHBORS_COUNT(COMM, RANK, NNEIGHBORS, IERROR)
    INTEGER COMM, RANK, NNEIGHBORS, IERROR

🧚 Fortran 2008 Syntax 🧚

USE mpi_f08

MPI_Graph_neighbors_count(comm, rank, nneighbors, ierror)
    TYPE(MPI_Comm), INTENT(IN) :: comm
    INTEGER, INTENT(IN) :: rank
    INTEGER, INTENT(OUT) :: nneighbors
    INTEGER, OPTIONAL, INTENT(OUT) :: ierror

🫢 INPUT PARAMETERS 🫢

  • comm β€” the communicator that's carrying the graph topology, bestie. it's a handle πŸ’…
  • rank β€” the rank of the process inside the group of comm. an integer, no cap ⭐

πŸŽ€ OUTPUT PARAMETERS πŸŽ€

  • nneighbors β€” the number of neighbors of the specified process. an integer, and yes she's the whole point of the call πŸ‘‘
  • ierror β€” Fortran only, babe: the error status, also an integer πŸ’€

🌈 DESCRIPTION 🌈

ok so MPI_Graph_neighbors_count and MPI_Graph_neighbors are the duo that hands you adjacency info for a general, graph topology. iconic behavior honestly.

MPI_Graph_neighbors_count returns the number of neighbors for the process signified by rank β€” like, it's giving headcount of your node's besties πŸ”₯


πŸ’€ ERRORS πŸ’€

almost all MPI routines return an error value, bestie. C routines? it's the return result of the function. Fortran routines? it's in the last argument. that's just how she moves.

heads up 🚨 before the error value gets returned, the current MPI error handler associated with the communication object (e.g., communicator, window, file) gets called. so like, something will happen first.

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. periodt.

Open MPI includes three predefined error handlers that can be used, and they are:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. like, everyone. gone. 😭
  • 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. very situational queen πŸ’…
  • 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, she might just not recover, and that's the tea.

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. iykyk πŸ“š


πŸ¦‹ SEE ALSO πŸ¦‹

  • MPI_Graph_neighbors

2003-2026, The Open MPI Community


and that's the whole page, bestie πŸ’– she was documented in the Open MPI manual, dated Sep 11, 2026 β€” go forth and count those neighbors, slay ✨🌸🫢

πŸ“¦ where this page comes from