<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">Hello all,
</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><br></span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">There are
some spawn commands in my program. Now I want to specify the nodes of my new
spawned processes. <span style> </span>I am trying to use a
hostfile for this but<span style> </span>I couldn’t do it successfully.
<span style> </span>New processes are still spawned on next
available nodes. </span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">I added my
code and outputs of my console. </span></p>
<p class="MsoNoSpacing"><b style><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">My hostfile: </span></b></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">root@rck00:~>
cat /shared/mpihosts</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">rck03</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">rck04</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">rck05</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span></p>
<p class="MsoNoSpacing"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">Can somebody
help me? What is the problem? Can this be a bug? <br></span></p><p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><br></span></p>
<p class="MsoNoSpacing"><b><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">Here is
my code and output of my program:</span></b><br></p><p class="MsoNoSpacing">#include
"mpi.h"</p><p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">#include
<stdio.h></span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">#include
<stdlib.h></span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">#define
NUM_SPAWNS 3</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">int main(
int argc, char *argv[] )</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">{</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>int errcodes[NUM_SPAWNS];</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>MPI_Comm parentcomm, intercomm;</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>int len; </span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>char name[MPI_MAX_PROCESSOR_NAME];</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>int rank; </span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>MPI_Init( &argc, &argv );</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>MPI_Comm_get_parent( &parentcomm );</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"> <span style> </span>MPI_Comm_rank(MPI_COMM_WORLD,&rank);</span></p>
<p class="MsoNoSpacing"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span></p><p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>if (parentcomm == MPI_COMM_NULL)</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>{</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>MPI_Info info; </span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>MPI_Info_create( &info );</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>MPI_Info_set(info,
"hostfile", "/shared/mpihosts");</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span><span style> </span>MPI_Comm_spawn(
"/shared/spawn/./spawn", MPI_ARGV_NULL, NUM_SPAWNS, info, 0,
MPI_COMM_WORLD, &intercomm, errcodes );</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>MPI_Get_processor_name(name,
&len);</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>printf("I am parent process %d
on %s.<span style> </span>\n", rank,<span style> </span>name);</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>}</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>else</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>{</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>MPI_Get_processor_name(name,
&len);</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>printf("I am a spawned process
%d on %s.\n", rank,<span style> </span>name);</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>}</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>fflush(stdout);</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>MPI_Finalize();</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"><span style> </span>return 0;</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">}</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif""> </span></p>
<p class="MsoNoSpacing"><b style><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">output of my program:</span></b></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">root@rck00:~>
mpirun -np 1 /shared/spawn/./spawn </span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">I am
parent process 0 on rck00.<span style> </span></span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">I am a
spawned process 0 on rck01.</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">I am a
spawned process 1 on rck02.</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">I am a
spawned process 2 on rck03.</span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US">Thanks in
advance, </span></p>
<p class="MsoNoSpacing"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span></p>