I did as what you said., get the value of argc and argv[], set them as global variables in the source code,also set the number pf processes as a global variable,<br><br>Then I compile it again and run it with mpiexec successfully.<br>
then I try to run it as a binary like this: ./mpi_array. I got the following error:<br><br>"Quitting. Number of MPI tasks must be divisible by 4.<br>application called MPI_Abort(MPI_COMM_WORLD, 0) - process 0<br>"<br>
THis is because the program requires there should be 4 processes., while there is actually 1 process created. I t seems that MPI_Comm_size(MPI_COMM_WORLD, &numtasks) DOES NOT accept the prevalued numtasks; Maybe the numtasks can only be got from the command line? <br>
<br>If I delete the function MPI_Comm_size(MPI_COMM_WORLD, &numtasks); I compile it again and run it with mpiexec successfully.<br> <br>Then I try to run it as a binary like this: ./mpi_array<br><br>And i got the following errors:<br>
<br>MPI task 0 has started...<br>Initialized array sum = 1.280000e+14<br>
Fatal error in MPI_Send: Invalid rank, error stack:<br>MPI_Send(174): MPI_Send(buf=0xbfeaee88, count=1, MPI_INT, dest=1, tag=2, MPI_COMM_WORLD) failed<br>MPI_Send(99).: Invalid rank has value 1 but must be nonnegative and less than 1<br>
<br>It seems that MPI has only boot one process. So when process 1 tries to send message to process 2, there is an error.<br><br> MPI_Comm_size and MPI_Comm_rank(MPI_COMM_WORLD,&taskid) start the fixed number of processes together. <br>
<br>How can we create more that one processes as needed without the MPI_Comm_size and MPI_Comm_rank? I wonder also that even if we can create some number of processes. Can the MPI_send(), MPI_receive .etc. work without mpiexec?<br>
<br><div class="gmail_quote">
2009/11/23 M¨¢rio Costa <span dir="ltr"><<a href="mailto:mario.silva.costa@gmail.com" target="_blank">mario.silva.costa@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I have never done it but, I would say try it with mpiexec and print<br>
the arv/arc contents then use the values sent by mpiexec to initialize<br>
them inside your code, then pass them to MPI_Init() ...<br>
<br>
Let me know if it works ....<br>
<br>
Regards,<br>
M¨¢rio<br>
<br>
2009/11/20 junli gu <<a href="mailto:gujunli@gmail.com" target="_blank">gujunli@gmail.com</a>>:<br>
<div><div></div><div>> I need to run multi-process mpi programs. Is it possible that run them<br>
> without mpirun command? to include everything needed into one stand alone<br>
> binary?<br>
><br>
> 2009/11/20 <<a href="mailto:chan@mcs.anl.gov" target="_blank">chan@mcs.anl.gov</a>><br>
>><br>
>> ----- "junli gu" <<a href="mailto:gujunli@gmail.com" target="_blank">gujunli@gmail.com</a>> wrote:<br>
>><br>
>> > Hi everyone:<br>
>> ><br>
>> > I want to run mpi program like a normal binary without<br>
>> > mpirun/mpiexec<br>
>> > command, like this: ./mpi_hello . Is this possible?<br>
>><br>
>> Yes. but without mpiexec, you can only run 1 process.<br>
>><br>
>> > This is possible only that I can compile mpi program and put all the<br>
>> > runtime<br>
>> > information into a stand alone binary. I don't know if it is<br>
>> > possible.<br>
>><br>
>> Hmm... Since you are using a cross-compiler, alpha-gcc, not sure how<br>
>> you built it... Trying adding -static during linking to see if it<br>
>> links OK.<br>
>><br>
>> A.Chan<br>
>><br>
>> > Thank you very much!<br>
>> ><br>
>> > --<br>
>> > ************************************************<br>
>> > Junli Gu--¹È¿¡Àö<br>
>> > Coordinate Science Lab<br>
>> > University of Illinois at Urbana-Champaign<br>
>> > ************************************************<br>
>> ><br>
>> > _______________________________________________<br>
>> > mpich-discuss mailing list<br>
>> > <a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br>
>> > <a href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss" target="_blank">https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</a><br>
>> _______________________________________________<br>
>> mpich-discuss mailing list<br>
>> <a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br>
>> <a href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss" target="_blank">https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</a><br>
><br>
><br>
><br>
> --<br>
> ************************************************<br>
> Junli Gu--¹È¿¡Àö<br>
> Coordinate Science Lab<br>
> University of Illinois at Urbana-Champaign<br>
> ************************************************<br>
><br>
> _______________________________________________<br>
> mpich-discuss mailing list<br>
> <a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br>
> <a href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss" target="_blank">https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</a><br>
><br>
><br>
<br>
<br>
<br>
</div></div><font color="#888888">--<br>
M¨¢rio Costa<br>
<br>
Laborat¨®rio Nacional de Engenharia Civil<br>
LNEC.CTI.NTIEC<br>
Avenida do Brasil 101<br>
1700-066 Lisboa, Portugal<br>
Tel : ++351 21 844 3911<br>
</font><div><div></div><div>_______________________________________________<br>
mpich-discuss mailing list<br>
<a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br>
<a href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss" target="_blank">https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>************************************************<br>Junli Gu--¹È¿¡Àö<br>Coordinate Science Lab<br>University of Illinois at Urbana-Champaign<br>************************************************<br>