Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] How to create multi-thread parallel program using thread-safe send and recv?
From: guosong (guosong1079_at_[hidden])
Date: 2009-09-22 20:26:09


This is just a test example. The real project behind it needs to configure like that.
 
> From: terry_at_[hidden]
> To: users_at_[hidden]
> Date: Wed, 23 Sep 2009 09:39:22 +1000
> Subject: Re: [OMPI users] How to create multi-thread parallel program using thread-safe send and recv?
>
> If you want all threads to communicate via MPI, and your initially
> launching multiple parents, I don't really see the advantage of using
> threads at all. Why not launch 12 MPI processes?
>
> On Tue, 2009-09-22 at 10:32 -0700, Eugene Loh wrote:
> > guosong wrote:
> > > Thanks for responding. I used a linux cluster. I think I would like
> > > to create a model that is multithreaded and each thread can make MPI
> > > calls. I attached test code as follow. It has two pthreads and there
> > > are MPI calls in both of those two threads. In the main function,
> > > there are also MPI calls. Should I use a full multithreading?
> > I guess so. It seems like the created threads are expected to make
> > independent/concurrent message-passing calls. Do read the link I
> > sent. You need to convert from MPI_Init to MPI_Init_thread(), asking
> > for a full-multithreaded model and checking that you got it. Also
> > note in main() that the MPI_Isend() calls should be matched with
> > MPI_Wait() or similar calls. I guess the parent thread will sit in
> > such calls while the child threads do their own message passing. Good
> > luck.
> > _______________________________________________
> > users mailing list
> > users_at_[hidden]
> > http://www.open-mpi.org/mailman/listinfo.cgi/users
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users
                                               
_________________________________________________________________
Messenger10Äê¼ÎÄ껪£¬ÀñÆ·´ó½±µÈÄãÄã¡
http://10.msn.com.cn
--_f0d421df-cf23-4223-8eea-5fa8f41dd1ee_
Content-Type: text/html; charset="gb2312"
Content-Transfer-Encoding: 8bit

<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
This is just a test example. The real project behind it needs to configure like that.<BR>&nbsp;<BR>&gt; From: terry_at_[hidden]<BR>&gt; To: users_at_[hidden]<BR>&gt; Date: Wed, 23 Sep 2009 09:39:22 +1000<BR>&gt; Subject: Re: [OMPI users] How to create multi-thread parallel program using thread-safe send and recv?<BR>&gt; <BR>&gt; If you want all threads to communicate via MPI, and your initially<BR>&gt; launching multiple parents, I don't really see the advantage of using<BR>&gt; threads at all. Why not launch 12 MPI processes?<BR>&gt; <BR>&gt; On Tue, 2009-09-22 at 10:32 -0700, Eugene Loh wrote:<BR>&gt; &gt; guosong wrote: <BR>&gt; &gt; &gt; Thanks for responding. I used a linux cluster. I think I would like<BR>&gt; &gt; &gt; to create a model that is multithreaded and each thread can make MPI<BR>&gt; &gt; &gt; calls. I attached test code as follow. It has two pthreads and there<BR>&gt; &gt; &gt; are MPI calls in both of those two threads. In the main function,<BR>&gt; &gt; &gt; there are also MPI calls. Sh
ould I use a full multithreading?<BR>&gt; &gt; I guess so. It seems like the created threads are expected to make<BR>&gt; &gt; independent/concurrent message-passing calls. Do read the link I<BR>&gt; &gt; sent. You need to convert from MPI_Init to MPI_Init_thread(), asking<BR>&gt; &gt; for a full-multithreaded model and checking that you got it. Also<BR>&gt; &gt; note in main() that the MPI_Isend() calls should be matched with<BR>&gt; &gt; MPI_Wait() or similar calls. I guess the parent thread will sit in<BR>&gt; &gt; such calls while the child threads do their own message passing. Good<BR>&gt; &gt; luck.<BR>&gt; &gt; _______________________________________________<BR>&gt; &gt; users mailing list<BR>&gt; &gt; users_at_[hidden]<BR>&gt; &gt; http://www.open-mpi.org/mailman/listinfo.cgi/users>&gt; <BR>&gt; _______________________________________________<BR>&gt; users mailing list<BR>&gt; users_at_[hidden]<BR>&gt; http://www.open-mpi.org/mailman/listinfo.cgi/users> <br /><hr />Á¢¿ÌÏÂÔØ MSN ±£»
¤
¶Ü£¬±£ÕÏMessenger °²È«Îȶ¨£¡ <a href='
http://im.live.cn/safe/' target='_new'>ÏÖÔÚ¾ÍÏÂÔØ£¡</a></body>
</html>
--_f0d421df-cf23-4223-8eea-5fa8f41dd1ee_--