MPI_LOOKUP_NAME(3)

πŸ’– MPI_LOOKUP_NAME(3) β€” the Open MPI glow-up edition ✨

okay bestie, so this is a page from the Open MPI manual, and it's all about MPI_Lookup_name β€” the little icon that goes ✨"hey, what port is hiding behind this service name?"✨

🌸 NAME 🌸

MPI_Lookup_name β€” finds the port associated with a service name. That's it, that's the whole vibe. πŸŽ€


πŸ¦‹ SYNTAX πŸ¦‹

✨ C Syntax

#include <mpi.h>

int MPI_Lookup_name(const char *service_name, MPI_Info info,
     char *port_name)

✨ Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_LOOKUP_NAME(SERVICE_NAME, INFO, PORT_NAME, IERROR)
     CHARACTER*(*)   SERVICE_NAME, PORT_NAME
     INTEGER         INFO, IERROR

✨ Fortran 2008 Syntax

USE mpi_f08
MPI_Lookup_name(service_name, info, port_name, ierror)
     CHARACTER(LEN=*), INTENT(IN) :: service_name
     TYPE(MPI_Info), INTENT(IN) :: info
     CHARACTER(LEN=MPI_MAX_PORT_NAME), INTENT(OUT) :: port_name
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸŽ€ INPUT PARAMETERS πŸŽ€

  • service_name β€” a service name, it's a string, periodt.
  • info β€” options passed to the name service functions (it's a handle).

πŸ’… OUTPUT PARAMETERS πŸ’…

  • port_name β€” a port name, which is also a string.
  • ierror β€” Fortran only bestie: the error status (an integer).

🌈 DESCRIPTION 🌈

So this function literally goes and retrieves a port_name that was published under service_name by a previous call to MPI_Publish_name. Like, somebody already did the publishing, and now you're doing the looking up. iconic behavior honestly.

The catch (ngl there's always a catch): your application has to hand over a port_name buffer that's big enough to hold the largest possible port name β€” meaning MPI_MAX_PORT_NAME bytes. Do not skimp. Do not be cute about the buffer size. 😭


⭐ INFO ARGUMENTS ⭐

Here's what info recognizes, bestie:

  • ompi_lookup_order β€” type: char * β€” description: the resolution order for name lookup.

(the original page had a whole table for that one, we're giving it the bullet-list treatment πŸ’–)

Now, the ompi_lookup_order info key can pick one of four valid string values (and yes, check the NAME SCOPE section below for the tea on name scopes):

  • local: only search the local scope for name resolution.
  • global: only search the global scope for name resolution.
  • local,global: search the local scope first for name resolution, and if it's not found, try searching the global scope. This behavior is the default if the ompi_lookup_order info key is not specified. πŸ‘‘
  • global,local: search the global scope first for name resolution, and if it's not found, try searching the local scope.

And if you pass no info key at all? The search will first check whether a global server has been specified and is available. If it has, the search defaults to global scope first, followed by local. Otherwise, the search defaults to local. Not me explaining defaults like it's gossip πŸ’€


🧚 NAME SCOPE 🧚

Open MPI supports two name scopes: global and local. Here's the breakdown:

  • Local scope values live in a data store located on the mpirun of the calling process' job.
  • Global scope values reside on a central server.

Calls to MPI_Unpublish_name must correctly specify the scope to be used in finding the value to be removed β€” like, you have to tell it which shelf to look on. The function will return an error if the specified service name is not found on the indicated location. No hiding, no mercy. πŸ’€

Want the full scoping-rules lore? Go read the MPI_Publish_name man page, bestie. πŸ“–


😭 ERRORS 😭

Almost all MPI routines return an error value β€” C routines give it back as the return result of the function, and Fortran routines put it in the last argument.

Before that error value gets returned, the current MPI error handler associated with the communication object (think communicator, window, file) is called. And if there's no communication object associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and it 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.

That initial error handler can be changed by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or by the mpi_initial_errhandler CLI argument to mpiexec, or by 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 with three predefined error handlers you can use:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. dramatic but effective.
  • 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. ✨
  • MPI_ERRORS_RETURN β€” returns an error code to the application. polite of it.

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, no promises bestie, fr fr.

See the MPI man page for a full list of MPI error codes, and see the Error Handling section of the MPI-3.1 standard for more information.

πŸ’œ See also

  • MPI_Publish_name
  • MPI_Open_port

2003-2026, The Open MPI Community


and that's the whole page, bestie πŸ’– ty for reading, mwah 🫢 this was the Open MPI MPI_LOOKUP_NAME(3) page, dated Sep 10, 2026 β€” copyright belongs to The Open MPI Community, 2003-2026. slay, stay scoped, and always size your buffers. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from