[mpich-discuss] MPI_THREAD_MULTIPLE

chong tan chong_guan_tan at yahoo.com
Fri Sep 25 12:49:58 CDT 2009


I am a litle confused with what is discussed in this thread. 

Jayesh, are you saying if we call MPI_Init_thread with THREAD_MULTIPLE, the default 
channel is socket ?  Even if MPICH2 is built with THREAD_MULTIPLE ?

I thought (or was told) that the default channel is 'nemesis', and MPICH2 runtime will pick
the proper thread safe channel depending on the situation.  So, if I build MPICH2 (2.1.1+)
without specifying the channel and threading, and I call MPI_Init_Thread with THREAD_MULTIPLE,
the channel will be thread-safe nemesis, is this remotely correct ?

tan

 

________________________________
From: Jayesh Krishna <jayesh at mcs.anl.gov>
To: Lubomir Radev <lubomirr at yahoo.com>
Cc: mpich-discuss at mcs.anl.gov
Sent: Friday, September 25, 2009 7:18:46 AM
Subject: Re: [mpich-discuss] MPI_THREAD_MULTIPLE


Hi,
 If you are starting your program without mpiexec the default channel is picked. You can control the channel used by the library using the "MPICH2_CHANNEL" environment variable.
 Please set MPICH2_CHANNEL environment variable as follows (and then run your MPI program),
 
1) To use the Nemesis channel, MPICH2_CHANNEL=nemesis
2) To use the multithreaded channel, MPICH2_CHANNEL=mt
 
 The default channel (MPICH2_CHANNEL=sock) is the single threaded sock channel.
 Let us know if it works for you.
 
Regards,
Jayesh


________________________________
From: Lubomir Radev [mailto:lubomirr at yahoo.com] 
Sent: Tuesday, September 22, 2009 11:05 AM
To: Jayesh Krishna
Cc: mpich-discuss at mcs.anl.gov
Subject: Re: [mpich-discuss] MPI_THREAD_MULTIPLE


I will do that, but in the meantime, could you run your own test code below directly, not using mpiexec, and see the result. For me, it's returning MPI_THREAD_SINGLE - is that how it's supposed to be, i.e. the thread-safe support can only be enabled if the application is run via mpiexec? 



________________________________
From: Jayesh Krishna <jayesh at mcs.anl.gov>
To: Lubomir Radev <lubomirr at yahoo.com>
Cc: mpich-discuss at mcs.anl.gov
Sent: Tuesday, September 22, 2009 8:21:44 AM
Subject: RE: [mpich-discuss] MPI_THREAD_MULTIPLE


Hi,
 Can you send us a test program ?
 
Regards,
Jayesh


________________________________
From: Lubomir Radev [mailto:lubomirr at yahoo.com] 
Sent: Tuesday, September 22, 2009 2:27 AM
To: Jayesh Krishna; mpich-discuss at mcs.anl.gov
Subject: Re: [mpich-discuss] MPI_THREAD_MULTIPLE


This works for me too, returning MPI_THREAD_MULTIPLE, but only when started via mpiexec.

However, I need to launch my worker processes programmatically by using MPI_Comm_spawn_multiple(). That's necessitated by the nature of my app - it's actually a library that clients will be linking against. So the client process has to spawn workers and communicate with them, which works just fine from one thread and fails with two. And if I use MPI_Init_thread() from the client/master process (which isn't started by mpiexec), it always returns MPI_THREAD_SINGLE.

Should I try to pack all of my MPI communications in one thread or can you suggest a solution other than mpiexec for multiple threads? Perhaps I could somehow perform the same thread support initialization that mpiexec apparently does internally?

Thanks very much.



________________________________
From: Jayesh Krishna <jayesh at mcs.anl.gov>
To: mpich-discuss at mcs.anl.gov
Cc: Lubomir Radev <lubomirr at yahoo.com>
Sent: Monday, September 21, 2009 9:04:17 AM
Subject: RE: [mpich-discuss] MPI_THREAD_MULTIPLE


Hi,
 Are you launching your MPI job using the "-channel" option of mpiexec (mpiexec -n 2 -channel nemesis thread_multiple_test.exe)? A simple MPI program (see below) that queries for the thread level support returns MPI_THREAD_MULTIPLE for me.
 
=========== Thread multiple test ===================
#include<iostream>
#include"mpi.h"
intmain(intargc, char*argv[]){
intprovided;provided = MPI::Init_thread(MPI_THREAD_MULTIPLE);
if(provided == MPI_THREAD_MULTIPLE){
std::cout << "Thread multiple supported"<< std::endl;}
else{
std::cout << "Thread multiple NOT supported"<< std::endl;}
MPI::Finalize();
}
=========== Thread multiple test ===================
 
Regards,
Jayesh


________________________________
From: mpich-discuss-bounces at mcs.anl.gov [mailto:mpich-discuss-bounces at mcs.anl.gov] On Behalf Of Lubomir Radev
Sent: Sunday, September 20, 2009 7:23 PM
To: mpich-discuss at mcs.anl.gov
Subject: Re: [mpich-discuss] MPI_THREAD_MULTIPLE


Yes. I was using 1.0.8p1 originally, but after your suggestion got 1.1.1p1 and the problem persists.

I could reduce my code to a test case exhibiting the issue, but I need to understand why MPI_Init_thread() won't provide me with MPI_THREAD_MULTIPLE support and always returns MPI_THREAD_SINGLE regardless of the channel configuration. I need to get that working first so my multi-threaded code can assume it operates in a correctly initialized environment and can legitimately call into MPICH2 simultaneously from more than one thread.

I'm using Boost.MPI wrapper (and Boost.Thread), but that shouldn't matter.

Thanks


________________________________
From: Jayesh Krishna <jayesh at mcs.anl.gov>
To: mpich-discuss at mcs.anl.gov
Sent: Friday, September 18, 2009 8:42:38 AM
Subject: Re: [mpich-discuss] MPI_THREAD_MULTIPLE


Hi,
 Are you trying the latest stable release, 1.1.1p1, of MPICH2 (http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads) ?
 Can you send us a test program ?

Regards,
Jayesh

-----Original Message-----
From: mpich-discuss-bounces at mcs.anl.gov [mailto:mpich-discuss-bounces at mcs.anl.gov] On Behalf Of Lubomir Radev
Sent: Thursday, September 17, 2009 10:08 PM
To: mpich-discuss at mcs.anl.gov
Subject: [mpich-discuss] MPI_THREAD_MULTIPLE

Hey guys,

I need to call into the thread-safe version of MPICH2 so I tried to initialize with MPI_Init_thread() and MPI_THREAD_MULTIPLE, but no matter how I configured the channels on my nodes - tried both mt and nemesis - that function returns MPI_THREAD_SINGLE as provided thread support.

I'm using 1.0.8p1 on Windows if that matters. Installed from the provided MSI binary. Perhaps I need to build from sources, configuring it with thread support?

Thanks



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20090925/f66a61eb/attachment-0003.htm>


More information about the mpich-discuss mailing list