<div dir="ltr">People, help me. <br> Like I said in my previous message, my application worked when I compile the library with the options:<br><br>./configure&nbsp; --enable-romio --without-mpe --with-pm=mpd
--with-device=ch3:sock --enable-threads=multiple
--with-thread-package=posix <br><br>I did a safe copy of the version that is working. <br><br> But when I test remove all .o&nbsp; and executable files, and&nbsp; compile again, the application stops working.<br>(and my safe copy is working)<br>
<br>In my makefile I put:<br><br>CFLAGS = -g<br>CLIBS = -lpthread -lm<br><br>I need to compile with more options to make it work?<br><br><div class="gmail_quote">2008/9/19 Gisele Machado de Souza <span dir="ltr">&lt;<a href="mailto:giselemachad@gmail.com" target="_blank">giselemachad@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr">People, thank you all!!!<br>I find a solution. I used mpich2-1.0.7 and compiled with this options:<br><br>&gt; ./configure&nbsp; --enable-romio --without-mpe --with-pm=mpd --with-device=ch3:sock --enable-threads=multiple --with-thread-package=posix&nbsp; <br>


<br>and I included  this instructions from phtreads:<br><br>&gt; pthread_attr_init(&amp;attr);<br>&nbsp;&nbsp; pthread_attr_setdetachstate(&amp;attr, PTHREAD_CREATE_DETACHED);<br>&nbsp;&nbsp; rc = pthread_create(&amp;threads[t], &amp;attr, threadfunc, (void *) listParam);<br>


<br>It works!!!<br><br><div dir="ltr">I hope not have more problems and I hope that the library is really stable for this type of situation.<br><br>If I have any other problem I turn to send messages. <br>
 Thank you for helping!!!!<br><br></div><br><br><br><br><br><div class="gmail_quote">2008/9/19 Rajeev Thakur <span dir="ltr">&lt;<a href="mailto:thakur@mcs.anl.gov" target="_blank">thakur@mcs.anl.gov</a>&gt;</span><div><div>

</div><div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">




<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Can you send us a small test case to reproduce the 
problem?</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Rajeev</font></span></div><br>
<blockquote dir="ltr" style="border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px; margin-right: 0px;">
  <div dir="ltr" align="left" lang="en-us">
  <hr>
  <font face="Tahoma" size="2"><b>From:</b> <a href="mailto:owner-mpich-discuss@mcs.anl.gov" target="_blank">owner-mpich-discuss@mcs.anl.gov</a> 
  [mailto:<a href="mailto:owner-mpich-discuss@mcs.anl.gov" target="_blank">owner-mpich-discuss@mcs.anl.gov</a>] <b>On Behalf Of </b>Gisele Machado de 
  Souza<br><b>Sent:</b> Thursday, September 18, 2008 11:04 PM<br><b>To:</b> 
  <a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br><b>Subject:</b> [mpich-discuss] Multithread 
  server using MPICH-2<br></font><br></div><div><div></div><div>
  <div></div>
  <div dir="ltr">Hello,<br><br>I&#39;m implementing a server in MPI that accepts more 
  than one connection from clients at the same time.<br>For do that I used 
  MPI(mpich2-1.1.0a1.tar.gz) and pthreads.<br><br>What I want to do is a server 
  that stays in a infinity loop waiting for connections (MPI_Comm_accept(portMD, 
  MPI_INFO_NULL, 0, MPI_COMM_WORLD, newCommClient);). When a connection is 
  established, he creates a new thread and return to wait more 
  connections.&nbsp; That means, the server and the thread will work in 
  parallel.<br><br>The function that the thread will execute calls mpi 
  functions, like MPI_probe, MPI_Get_count, MPI_Recv, MPI_Send,&nbsp; MPI_Pack 
  and&nbsp; MPI_Unpack.<br><br>The problem I&#39;m having is that the server and the 
  thread are not working in parallel successfully. Sometimes, the program hangs, 
  do nothing, and in another times a fatal error appears (Assertion failed in 
  file sock_wait.i at line 236: (pollfd-&gt;events &amp; (0x001 | 0x004)) || 
  pollfd-&gt;fd == -1).<br><br>When I put the server to sleep for a moment, 
  before he will wait another connection, during the time he was sleeping the 
  created thread works fine. Once the server wakes up and starts to wait for a 
  connection, things stop working.<br><br>A peace of my code 
  (Server):<br>-----------------------------------------------------------------------------------------------------------------------------<br>// 
  arguments passed to a thread<br>typedef struct<br>{ MPI_Comm 
  communicator;<br>&nbsp; char * path1;<br>&nbsp; char * path2;<br>&nbsp; char * 
  port;&nbsp;&nbsp; <br>} ThreadParam;<br><br>&nbsp;pthread_t 
  threads[10];<br>&nbsp;int t =0;<br>&nbsp;int rc;<br><br><br>&nbsp;ThreadParam 
  * listParam = NULL;<br>&nbsp;MPI_Comm * newCommClient;<br>&nbsp;&nbsp;&nbsp; 
  <br><br>&nbsp; /* server&nbsp; infinity loop */<br>&nbsp;while (time_out &gt; 
  10)<br>&nbsp;{<br>&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp; newCommClient = 
  malloc(sizeof(MPI_Comm));<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 
  <br>&nbsp;&nbsp;&nbsp;&nbsp; /* waiting for a connection 
  */<br>&nbsp;&nbsp;&nbsp;&nbsp; MPI_Comm_accept(portMD, MPI_INFO_NULL, 0, 
  MPI_COMM_WORLD, 
  newCommClient);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  <br>&nbsp;&nbsp;&nbsp;&nbsp; listParam = 
  malloc(sizeof(ThreadParam));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  <br>&nbsp;&nbsp;&nbsp;&nbsp; listParam-&gt;communicator = *newCommClient; 
  //with this communicator the thread will talk with 
  the&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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am);<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp; if 
  (rc){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;ERROR; 
  return code from pthread_create() is %d\n&quot;, 
  rc);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  exit(-1);<br>&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp; 
  //sleep(1); <br>&nbsp;&nbsp;&nbsp;&nbsp; t++;<br>&nbsp; 
  }<br><br>-----------------------------------------------------------------------------------------------------------------------------<br>Please, 
  I need help to solve this problem!!<br><br>Thanks very 
  mych!<br><br>Gisele<br></div></div></div></blockquote></div>
</blockquote></div></div></div><br></div>
</blockquote></div><br></div>