[mpich-discuss] [PATCH] Issue 5486: Nobody checks the return code from "MTest_Start_thread()".
Dave Goodell
goodell at mcs.anl.gov
Fri May 22 16:30:49 CDT 2009
A variant of this was committed as r4621: https://trac.mcs.anl.gov/projects/mpich2/changeset/4621
Thanks again for the patch,
-Dave
On May 22, 2009, at 8:44 AM, Dave Goodell wrote:
> Hi Joe,
>
> Thanks for the patch. The idea is a good one, although I think I'll
> tweak it a little bit when I commit this to the trunk. Just minor
> stuff like abort() --> MPI_Abort(...) and slightly different
> bracing. Also, we obviously can't disable the new multisend tests
> in general, so you'll probably just have to keep that hunk in your
> branches.
>
> I'll work something up later today and let you know when I've
> committed it.
>
> Thanks again,
> -Dave
>
> On May 21, 2009, at 4:39 PM, Joe Ratterman wrote:
>
>> From: Joe Ratterman <jratt at us.ibm.com>
>>
>> BGP has a maximum of 3 threads that can be created (SMP mode), but
>> sometimes only 1 (DUAL mode). Because some tests try to create more
>> than 3 threads, pthread_create() will fail. However, nobody checks
>> that, so the tests time-out.
>>
>> This adds an abort: if something absolutely *must* happen, you cannot
>> let it silently fail.
>> ---
>> mpich2/test/mpi/threads/pt2pt/testlist | 6 +++---
>> mpich2/test/mpi/threads/util/mtestthread.c | 9 +++++++--
>> 2 files changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/mpich2/test/mpi/threads/pt2pt/testlist b/mpich2/test/
>> mpi/threads/pt2pt/testlist
>> index d62e8c7..c53b354 100644
>> --- a/mpich2/test/mpi/threads/pt2pt/testlist
>> +++ b/mpich2/test/mpi/threads/pt2pt/testlist
>> @@ -2,8 +2,8 @@ threaded_sr 2
>> alltoall 4
>> sendselfth 1
>> multisend 2
>> -multisend2 5
>> -multisend3 5
>> -multisend4 5
>> +# multisend2 5 # This test uses too many threads
>> +# multisend3 5 # This test uses too many threads
>> +# multisend4 5 # This test uses too many threads
>> greq_wait 1
>> greq_test 1
>> diff --git a/mpich2/test/mpi/threads/util/mtestthread.c b/mpich2/
>> test/mpi/threads/util/mtestthread.c
>> index b171785..af01643 100644
>> --- a/mpich2/test/mpi/threads/util/mtestthread.c
>> +++ b/mpich2/test/mpi/threads/util/mtestthread.c
>> @@ -60,7 +60,6 @@ int MTest_Join_threads( void ){
>> int MTest_Start_thread(MTEST_THREAD_RETURN_TYPE (*fn)(void *p),void
>> *arg)
>> {
>> int err;
>> - pthread_t thread;
>> pthread_attr_t attr;
>> pthread_attr_init(&attr);
>> pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
>> @@ -71,7 +70,13 @@ int MTest_Start_thread(MTEST_THREAD_RETURN_TYPE
>> (*fn)(void *p),void *arg)
>> return 1;
>> }
>> err = pthread_create(threads+nthreads, &attr, fn, arg);
>> - if (!err) nthreads++;
>> + if (!err)
>> + nthreads++;
>> + else
>> + {
>> + fprintf(stderr, "Failed to create thread calling func %p
>> with arg %p\n", fn, arg);
>> + abort();
>> + }
>> pthread_attr_destroy(&attr);
>> return err;
>> }
>> --
>> 1.6.3.2.gbfc07d5
>>
>
More information about the mpich-discuss
mailing list