Yes you can serialize
the call using pthead mutex if you have created threads using pthreads.
Basically whatever thread libray you are using for thread creation provides
synchronization API's which you have to use here.
OPAL_THREAD_LOCK and UNLOCK code is
also implemented using supported thread library on your platform(selected
by default during configure or use --with-threads).
You can't use OPAL library as it is
not exported to outside MPI programming world.
Neeraj Chourasia (MTS)
Computational Research Laboratories Ltd.
(A wholly Owned Subsidiary of TATA SONS Ltd)
B-101, ICC Trade Towers, Senapati Bapat Road
Pune 411016 (Mah) INDIA
(O) +91-20-6620 9863 (Fax) +91-20-6620 9862
|Ashika Umanga Umagiliya
Sent by: firstname.lastname@example.org
09/18/2009 09:25 AM
Please respond to
Open MPI Users <email@example.com>
|Open MPI Users <firstname.lastname@example.org>
|Re: [OMPI users] Multi-threading with
I have not much experience in this area.shall i use
pthread_mutex_lock(*),*pthread_mutex_unlock() ..etc or following which
saw in OpenMPI source :
static opal_mutex_t ompi_lock;
Thanks in advance,
Ralph Castain wrote:
> Only thing I can suggest is to place a thread lock around the call
> comm_spawn so that only one thread at a time can execute that
> function. The call to mpi_init_thread is fine - you just need to
> explicitly protect the call to comm_spawn.
> On Sep 17, 2009, at 7:44 PM, Ashika Umanga Umagiliya wrote:
>> HI Jeff, Ralph,
>> Yes, I call MPI_COMM_SPAWN in multiple threads simultaneously.
>> Because I need to expose my parallel algorithm as a web service,
>> need multiple clients connect and execute my logic as same time(ie
>> mutiple threads).
>> For each client , a new thread is created (by Web service framework)
>> and inside the thread,MPI_Init_Thread() is called if the MPI hasnt
>> been initialized.
>> The the thread calls MPI_COMM__SPAWN and create new processes.
>> So ,if this is the case isn't there any workarounds ?
>> Thanks in advance,
>> Jeff Squyres wrote:
>>> On Sep 16, 2009, at 9:53 PM, Ralph Castain wrote:
>>>> Only the obvious, and not very helpful one: comm_spawn
>>>> safe at this time. You'll need to serialize your requests
>>> This is likely the cause of your issues if you are calling
>>> MPI_COMM_SPAWN in multiple threads simultaneously. Can
>>> If not, we'll need to dig a little deeper to figure out what's
>>> on. But Ralph is right -- read up on the THREAD_MULTIPLE
>>> constraints (check the OMPI README file) to see if that's
>>> biting you.
>> users mailing list
> users mailing list
users mailing list
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments.
Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability
for any errors or omissions.Thank you