Re: [OMPI devel] errno and reentrance

2014-10-27 Thread Gilles Gouaillardet
Thanks Paul,

so the simplest way is to force -D_REENTRANT on Solaris, i will do that !

Cheers,

Gilles

On 2014/10/27 19:36, Paul Hargrove wrote:
> Gilles,
>
> I responded too quickly, not thinking that this test is pretty quick and
> doesn't require that I try sparc, ppc, ia64, etc.
> So my results:
>
> Solaris-{10,11}:
>   With "cc" I agree with your findings (need -D_REENTRANT for correct
> behavior).
>   With gcc either "-pthread" or "-D_REENTRANT" gave correct behavior
>
> NetBSD-5:
>   Got "KO: error 4 (0)" no matter what I tried
>
> Linux,  FreeBSD-{9,10}, NetBSD-6, OpenBSD-5:
>   Using "-pthread" or "-lpthread" was necessary to link, and sufficient for
> correct results.
>
> MacOSX-10.{5,6,7,8}:
>   No compiler options were required for 'cc' (which has been gcc, llvm-gcc
> and clang through those OS revs)
>
> Though I have access, I did not try compute nodes on BG/Q or Cray X{E,K,C}.
> Let me know if any of those are of significant concern.
>
> I no longer have AIX or IRIX access.
>
> -Paul
>
>
> On Mon, Oct 27, 2014 at 2:48 AM, Gilles Gouaillardet <
> gilles.gouaillar...@iferc.org> wrote:
>
>>  Thanks Paul !
>>
>> Gilles
>>
>> On 2014/10/27 18:47, Paul Hargrove wrote:
>>
>> On Mon, Oct 27, 2014 at 2:42 AM, Gilles Gouaillardet 
>>  wrote:
>> [...]
>>
>>
>>  Paul, since you have access to many platforms, could you please run this
>> test with and without -D_REENTRANT / -D_THREAD_SAFE
>> and tell me where the program produces incorrect behaviour (output is
>> KO...) without the flag ?
>>
>> Thanks in advance,
>>
>> Gilles
>>
>>
>>  Gilles,
>>
>> I have a lot of things due between now and the SC14 conference.
>> I've added this test to my to-do list, but cannot be sure of how soon I'll
>> be able to get results back to you.
>>
>> Feel free to remind me off-list,
>> -Paul
>>
>>
>>
>>
>>
>>
>> ___
>> devel mailing listde...@open-mpi.org
>> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
>> Link to this post: 
>> http://www.open-mpi.org/community/lists/devel/2014/10/16095.php
>>
>>
>>
>> ___
>> devel mailing list
>> de...@open-mpi.org
>> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
>> Link to this post:
>> http://www.open-mpi.org/community/lists/devel/2014/10/16096.php
>>
>
>
>
>
> ___
> devel mailing list
> de...@open-mpi.org
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
> Link to this post: 
> http://www.open-mpi.org/community/lists/devel/2014/10/16097.php



Re: [OMPI devel] errno and reentrance

2014-10-27 Thread Paul Hargrove
Gilles,

I responded too quickly, not thinking that this test is pretty quick and
doesn't require that I try sparc, ppc, ia64, etc.
So my results:

Solaris-{10,11}:
  With "cc" I agree with your findings (need -D_REENTRANT for correct
behavior).
  With gcc either "-pthread" or "-D_REENTRANT" gave correct behavior

NetBSD-5:
  Got "KO: error 4 (0)" no matter what I tried

Linux,  FreeBSD-{9,10}, NetBSD-6, OpenBSD-5:
  Using "-pthread" or "-lpthread" was necessary to link, and sufficient for
correct results.

MacOSX-10.{5,6,7,8}:
  No compiler options were required for 'cc' (which has been gcc, llvm-gcc
and clang through those OS revs)

Though I have access, I did not try compute nodes on BG/Q or Cray X{E,K,C}.
Let me know if any of those are of significant concern.

I no longer have AIX or IRIX access.

-Paul


On Mon, Oct 27, 2014 at 2:48 AM, Gilles Gouaillardet <
gilles.gouaillar...@iferc.org> wrote:

>  Thanks Paul !
>
> Gilles
>
> On 2014/10/27 18:47, Paul Hargrove wrote:
>
> On Mon, Oct 27, 2014 at 2:42 AM, Gilles Gouaillardet 
>  wrote:
> [...]
>
>
>  Paul, since you have access to many platforms, could you please run this
> test with and without -D_REENTRANT / -D_THREAD_SAFE
> and tell me where the program produces incorrect behaviour (output is
> KO...) without the flag ?
>
> Thanks in advance,
>
> Gilles
>
>
>  Gilles,
>
> I have a lot of things due between now and the SC14 conference.
> I've added this test to my to-do list, but cannot be sure of how soon I'll
> be able to get results back to you.
>
> Feel free to remind me off-list,
> -Paul
>
>
>
>
>
>
> ___
> devel mailing listde...@open-mpi.org
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
> Link to this post: 
> http://www.open-mpi.org/community/lists/devel/2014/10/16095.php
>
>
>
> ___
> devel mailing list
> de...@open-mpi.org
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
> Link to this post:
> http://www.open-mpi.org/community/lists/devel/2014/10/16096.php
>



-- 
Paul H. Hargrove  phhargr...@lbl.gov
Future Technologies Group
Computer and Data Sciences Department Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory Fax: +1-510-486-6900


Re: [OMPI devel] errno and reentrance

2014-10-27 Thread Gilles Gouaillardet
Thanks Paul !

Gilles

On 2014/10/27 18:47, Paul Hargrove wrote:
> On Mon, Oct 27, 2014 at 2:42 AM, Gilles Gouaillardet <
> gilles.gouaillar...@iferc.org> wrote:
> [...]
>
>> Paul, since you have access to many platforms, could you please run this
>> test with and without -D_REENTRANT / -D_THREAD_SAFE
>> and tell me where the program produces incorrect behaviour (output is
>> KO...) without the flag ?
>>
>> Thanks in advance,
>>
>> Gilles
>>
> Gilles,
>
> I have a lot of things due between now and the SC14 conference.
> I've added this test to my to-do list, but cannot be sure of how soon I'll
> be able to get results back to you.
>
> Feel free to remind me off-list,
> -Paul
>
>
>
>
>
> ___
> devel mailing list
> de...@open-mpi.org
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
> Link to this post: 
> http://www.open-mpi.org/community/lists/devel/2014/10/16095.php



Re: [OMPI devel] errno and reentrance

2014-10-27 Thread Paul Hargrove
On Mon, Oct 27, 2014 at 2:42 AM, Gilles Gouaillardet <
gilles.gouaillar...@iferc.org> wrote:
[...]

> Paul, since you have access to many platforms, could you please run this
> test with and without -D_REENTRANT / -D_THREAD_SAFE
> and tell me where the program produces incorrect behaviour (output is
> KO...) without the flag ?
>
> Thanks in advance,
>
> Gilles
>

Gilles,

I have a lot of things due between now and the SC14 conference.
I've added this test to my to-do list, but cannot be sure of how soon I'll
be able to get results back to you.

Feel free to remind me off-list,
-Paul



-- 
Paul H. Hargrove  phhargr...@lbl.gov
Future Technologies Group
Computer and Data Sciences Department Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory Fax: +1-510-486-6900


[OMPI devel] errno and reentrance

2014-10-27 Thread Gilles Gouaillardet
Folks,

While investigating an issue started at
http://www.open-mpi.org/community/lists/users/2014/10/25562.php
i found that it is mandatory to compile with -D_REENTRANT on Solaris (10
and 11)
(otherwise errno is not per thread specific, and the pmix thread
silently misinterpret EAGAIN or EWOULDBLOCK and that
leads to random behaviour, that generally terminates the application)

This is a bug / unexpected side effect introduced by me in commit
b1c4daa9567c7647318b9b673698c2251264f22e

on a RedHat 6 like server, this is not necessary.

on aix and/or freebsd, it might be necessary to compile with
-D_THREAD_SAFE in order to get a correct behaviour.

i wrote the simple attached program in order to check the correct
behavior with/without -D_REENTRANT or -D_THREAD_SAFE.

one option is to add automatically test this in
config/opal_config_pthreads.m4,
an other option is to hardcode this for the required OS.

Paul, since you have access to many platforms, could you please run this
test with and without -D_REENTRANT / -D_THREAD_SAFE
and tell me where the program produces incorrect behaviour (output is
KO...) without the flag ?

Thanks in advance,

Gilles
#include 
#include 
#include 
#include 

static void * fn (void * arg) {
if (errno == 1) {
return (void *)-1;
}
read(0, NULL, 0);
if (errno != 0) {
return (void *)-2;
}
errno = 2;
return NULL;
}

int main (int argc, char *argv[]) {
pthread_t t;
void *s = NULL;
errno = 1;
if (pthread_create(, NULL, fn, NULL) < 0) {
perror ("pthread_create ");
return 1;
}
if (pthread_join(t, ) < 0) {
perror ("pthread_join ");
return 2;
}
if (NULL != s) {
fprintf(stderr, "KO: error 3 (%ld)\n", (long)s);
return 3;
} else if (2 == errno) {
fprintf(stderr, "KO: error 4 (%ld)\n", (long)s);
return 4;
} else {
fprintf(stderr, "OK\n");
return 0;
}
}