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 theompi_lookup_orderinfo 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
mpirunof 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 ifMPI_Abortwas called on that communicator. If called on a window or file, it acts as ifMPI_Abortwas 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_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, 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_nameMPI_Open_port
π Copyright
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
- ubuntu stonking: openmpi-doc 5.0.10-6 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms