1MPI_Comm_join(3)                    LAM/MPI                   MPI_Comm_join(3)
2
3
4

NAME

6       MPI_Comm_join -  Connect two MPI processed joined by a socket
7

SYNOPSIS

9       #include <mpi.h>
10       int
11       MPI_Comm_join(int fd, MPI_Comm *newcomm)
12

INPUT PARAMETER

14       fd     - socket file descriptor
15
16

OUTPUT PARAMETER

18       newcomm
19              - intercommunicator with client as remote group
20
21

DESCRIPTION

23       This  function  only  works between two LAM/MPI processes that are con‐
24       nected by a socket.  They either must have the same endian orientation,
25       or  not  have  used the homogeneous flag to mpirun (1) (-O).  Both pro‐
26       cesses must be in a single LAM universe -- they must share LAM  daemons
27       that  are  already  connected to each other.  That is, they were either
28       initially lamboot(1)ed together, or a lamgrow(1) command was  given  to
29       grow  an  initial LAM universe such that the resulting set includes the
30       two hosts in question.
31
32       The  socket  may  not  be  used  by  the  calling   application   until
33       MPI_Comm_join  has  completed.  When MPI_Comm_join completes, fd may be
34       used by the calling application.  Per MPI-2, the socket  is  only  used
35       for  initial  handshaking  -- it will not be used as the communications
36       channel between the newly connected processes.
37
38

SAMPLE

40       The following code shows an  abbreviated  example  using  MPI_Comm_join
41       since no example is provided in the MPI-2 standard.  Note that only one
42       rank in each MPI application  should  call  this  function  since  each
43       socket can only have two endpoints (i.e., an endpoint in each process).
44       Upon successful completion, the intercommunicator that is returned will
45       have two members -- the local process and the remote process.
46
47       MPI_Comm
48       do_join(char* server_name, int port) {
49       int sfd, fd = -1;
50       unsigned char addr[4];
51       MPI_Comm intercomm;
52       if (server_name != NULL) {
53       if (getinetaddr(server_name, &addr) == 0)
54       fd = open_socket_to_server(addr, port);
55       } else {
56       if ((sfd = open_listening_socket(&port)) >= 0) {
57       fd = accept_client_socket(sfd, -1);
58       close(sfd);
59       }
60       }
61       if (fd < 0)
62       MPI_Abort(MPI_COMM_WORLD, 0);
63       MPI_Comm_join(fd, &intercomm);
64       return intercomm;
65       }
66
67
68

NOTES FOR FORTRAN

70       All  MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK ) have
71       an additional argument ierr at the end of the argument list.   ierr  is
72       an  integer and has the same meaning as the return value of the routine
73       in C.  In Fortran, MPI routines are subroutines, and are  invoked  with
74       the call statement.
75
76       All MPI objects (e.g., MPI_Datatype , MPI_Comm ) are of type INTEGER in
77       Fortran.
78
79

USAGE WITH IMPI EXTENSIONS

81       The IMPI standard only supports MPI-1 functions.  Hence, this  function
82       is currently not designed to operate within an IMPI job.
83
84

ERRORS

86       If an error occurs in an MPI function, the current MPI error handler is
87       called to handle it.  By default, this error  handler  aborts  the  MPI
88       job.   The  error  handler may be changed with MPI_Errhandler_set ; the
89       predefined error handler MPI_ERRORS_RETURN may be used to  cause  error
90       values  to  be  returned  (in C and Fortran; this error handler is less
91       useful in with the C++ MPI  bindings.   The  predefined  error  handler
92       MPI::ERRORS_THROW_EXCEPTIONS  should  be used in C++ if the error value
93       needs to be recovered).  Note that MPI does not guarantee that  an  MPI
94       program can continue past an error.
95
96       All  MPI  routines  (except  MPI_Wtime  and MPI_Wtick ) return an error
97       value; C routines as the value of the function and Fortran routines  in
98       the  last  argument.  The C++ bindings for MPI do not return error val‐
99       ues; instead, error values are communicated by throwing  exceptions  of
100       type  MPI::Exception  (but not by default).  Exceptions are only thrown
101       if the error value is not MPI::SUCCESS .
102
103
104       Note that if the MPI::ERRORS_RETURN handler is set in  C++,  while  MPI
105       functions  will  return  upon an error, there will be no way to recover
106       what the actual error value was.
107       MPI_SUCCESS
108              - No error; MPI routine completed successfully.
109       MPI_ERR_ARG
110              - Invalid argument.  Some argument is invalid and is not identi‐
111              fied  by  a  specific  error  class.   This  is typically a NULL
112              pointer or other such error.
113       MPI_ERR_INTERN
114              - An internal error has been detected.  This is  fatal.   Please
115              send  a  bug report to the LAM mailing list (see http://www.lam-
116              mpi.org/contact.php ).
117       MPI_ERR_OTHER
118              - Other error; use  MPI_Error_string  to  get  more  information
119              about this error code.
120
121

SEE ALSO

123       lamboot(1), lamgrow(1), mpirun(1), MPI_Finalize(3)
124
125

MORE INFORMATION

127       For more information, please see the official MPI Forum web site, which
128       contains the text of both the MPI-1 and MPI-2 standards.   These  docu‐
129       ments  contain  detailed  information  about each MPI function (most of
130       which is not duplicated in these man pages).
131
132       http://www.mpi-forum.org/
133

LOCATION

135       join.c
136
137
138
139LAM/MPI 7.1.2                      2/23/2006                  MPI_Comm_join(3)
Impressum