[mpich-discuss] Linux socket command may return 0 until MPI_Init_thread called.

Jan Bierbaum jan.bierbaum at tudos.org
Mon Jun 15 07:33:03 CDT 2015


Hi Marvin!

> Essentially, until you call MPI_Init_thread, the Linux socket command
> will return 0 for all ranks except rank 0.  This seems to me like a
> problem.
Indeed. 'socket' should not return 0. Quoting from its manpage:

| On success, a file descriptor for the new socket is returned. On
| error, -1 is returned, and errno is set appropriately.

FD 0 is already taken by STDIN, so you should never get that return
value unless you close STDIN first.


> Given the following code sample...
[...]
> *The application returns output this with mpirun.
Works for me:

| $ mpirun  -np 2 ./test-socket
| Pre Socket: 10
| MPI_Init
| Pre Socket: 6
| MPI_Init
| Post Socket: 14
| Post Socket: 15
|
| $ mpirun  -np 3 ./test-socket
| Pre Socket: 10
| MPI_Init
| Pre Socket: 6
| MPI_Init
| Pre Socket: 6
| MPI_Init
| Post Socket: 14
| Post Socket: 15
| Post Socket: 10


> I am running this code sample using Red-Hat Enterprise Linux 7.1 with
> mpich
[...]
>     Version:                                 3.0.4
For me it's MPICH 3.1.4 on Debian 8 and I get similar results with MPICH
3.1rc on a local cluster. Taking into account the weird return value you
get from 'socket' ... maybe your system is the problem.


Regards, Jan
_______________________________________________
discuss mailing list     discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss


More information about the discuss mailing list