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-27 17:03:22


The reason I asked the background thread is that I need to make MPI calls in this thread and this is also why I got errors in the little testing program.
 

Date: Sun, 27 Sep 2009 14:00:00 -0700
From: Eugene.Loh_at_[hidden]
To: users_at_[hidden]
Subject: Re: [OMPI users] How to create multi-thread parallel program using thread-safe send and recv?

guosong wrote:

I used MPI_Init_thread(&argc,&argv, MPI_THREAD_MULTIPLE, &provided); in my program and got provided = 0 which turns out to be the MPI_THREAD_SINGLE. Does this mean that I can not use MPI_THREAD_MULTIPLE model?Right. I've not done much multithreaded MPI work. Someone else on this list can advise you better what you need to do to get provided=MPI_THREAD_MULTIPLE.

I write a little program to test the multithreading and it worked sometimes and failed sometimes. It also hang there sometimes. Does this only because the MPI_THREAD_MULTIPLE is not supported or there are some bugs in the program?I don't know if there are bugs in the program, but without the MPI threads support you can't really test it.

BTW, if I want to create a background thread which is sort of like a deamon thread, how can I achieve that in MPI programs? Thanks.
I'm not sure I understand the question. Creating a background thread isn't part of MPI. You would use something else, like POSIX threads or OpenMP.
                                               
_________________________________________________________________
Ô¼»á˵²»ÇåµØ·½£¿À´ÊÔÊÔ΢ÈíµØͼ×îÐÂmsn»¥¶¯¹¦ÄÜ£¡
http://ditu.live.com/?form=TL&swm=1
--_7d81decd-326f-438d-ace7-ceac7a925781_
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'>
The reason I asked the background thread is that I need to make MPI calls in this thread and this is also why I got errors in the little&nbsp;testing program. <BR>&nbsp;<BR>
<HR id=stopSpelling>
Date: Sun, 27 Sep 2009 14:00:00 -0700<BR>From: Eugene.Loh_at_[hidden]<BR>To: users_at_[hidden]<BR>Subject: Re: [OMPI users] How to create multi-thread parallel program using thread-safe send and recv?<BR><BR>guosong wrote:
<BLOCKQUOTE cite=midCOL102-W53595083E63C66A1D18823A8D70_at_phx.gbl>
<STYLE>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</STYLE>
I used MPI_Init_thread(&amp;argc,&amp;argv, MPI_THREAD_MULTIPLE, &amp;provided); in my program and got provided = 0 which turns out to be the MPI_THREAD_SINGLE. Does this mean that I can not use MPI_THREAD_MULTIPLE model?</BLOCKQUOTE>Right.&nbsp; I've not done much multithreaded MPI work.&nbsp; Someone else on this list can advise you better what you need to do to get provided=MPI_THREAD_MULTIPLE.<BR>
<BLOCKQUOTE cite=midCOL102-W53595083E63C66A1D18823A8D70_at_phx.gbl>I write a little program to test the multithreading and it worked sometimes and failed sometimes. It also hang&nbsp;there sometimes.&nbsp;Does this only because the MPI_THREAD_MULTIPLE is not supported or&nbsp;there are some bugs in the program?</BLOCKQUOTE>I don't know if there are bugs in the program, but without the MPI threads support you can't really test it.&nbsp; <BR>
<BLOCKQUOTE cite=midCOL102-W53595083E63C66A1D18823A8D70_at_phx.gbl>BTW, if&nbsp;I want to create a background thread which is&nbsp;sort of&nbsp;like a deamon&nbsp;thread,&nbsp;how can I&nbsp;achieve that in&nbsp;MPI programs? Thanks.<BR></BLOCKQUOTE>I'm not sure I understand the question.&nbsp; Creating a background thread isn't part of MPI.&nbsp; You would use something else, like POSIX threads or OpenMP.<BR> <br /><hr />¸ü¶àÈÈÀ±×ÊѶ¾¡ÔÚаæMSNÊ×Ò³£¡ <a href='http://cn.msn.com/' target='_new'>Á¢¿Ì·ÃÎÊ£¡</a></body>
</html>
--_7d81decd-326f-438d-ace7-ceac7a925781_--