[mpich-discuss] Can I run MPI program without mpirun/mpiexec?
Dave Goodell
goodell at mcs.anl.gov
Mon Nov 23 21:02:45 CST 2009
You need to use mpiexec to run multiple processes. That's just how it
works. If you want to make it look like there is only one program you
can probably write some sort of script or batch file that invokes the
appropriate mpiexec command.
-Dave
On Nov 23, 2009, at 8:14 PM, junli gu wrote:
> 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,
>
> Then I compile it again and run it with mpiexec successfully.
> then I try to run it as a binary like this: ./mpi_array. I got the
> following error:
>
> "Quitting. Number of MPI tasks must be divisible by 4.
> application called MPI_Abort(MPI_COMM_WORLD, 0) - process 0
> "
> 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?
>
> If I delete the function MPI_Comm_size(MPI_COMM_WORLD, &numtasks); I
> compile it again and run it with mpiexec successfully.
>
> Then I try to run it as a binary like this: ./mpi_array
>
> And i got the following errors:
>
> MPI task 0 has started...
> Initialized array sum = 1.280000e+14
> Fatal error in MPI_Send: Invalid rank, error stack:
> MPI_Send(174): MPI_Send(buf=0xbfeaee88, count=1, MPI_INT, dest=1,
> tag=2, MPI_COMM_WORLD) failed
> MPI_Send(99).: Invalid rank has value 1 but must be nonnegative and
> less than 1
>
> It seems that MPI has only boot one process. So when process 1 tries
> to send message to process 2, there is an error.
>
> MPI_Comm_size and MPI_Comm_rank(MPI_COMM_WORLD,&taskid) start the
> fixed number of processes together.
>
> 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?
>
> 2009/11/23 Mário Costa <mario.silva.costa at gmail.com>
> Hi,
>
> I have never done it but, I would say try it with mpiexec and print
> the arv/arc contents then use the values sent by mpiexec to initialize
> them inside your code, then pass them to MPI_Init() ...
>
> Let me know if it works ....
>
> Regards,
> Mário
>
> 2009/11/20 junli gu <gujunli at gmail.com>:
> > I need to run multi-process mpi programs. Is it possible that run
> them
> > without mpirun command? to include everything needed into one
> stand alone
> > binary?
> >
> > 2009/11/20 <chan at mcs.anl.gov>
> >>
> >> ----- "junli gu" <gujunli at gmail.com> wrote:
> >>
> >> > Hi everyone:
> >> >
> >> > I want to run mpi program like a normal binary without
> >> > mpirun/mpiexec
> >> > command, like this: ./mpi_hello . Is this possible?
> >>
> >> Yes. but without mpiexec, you can only run 1 process.
> >>
> >> > This is possible only that I can compile mpi program and put
> all the
> >> > runtime
> >> > information into a stand alone binary. I don't know if it is
> >> > possible.
> >>
> >> Hmm... Since you are using a cross-compiler, alpha-gcc, not sure
> how
> >> you built it... Trying adding -static during linking to see if it
> >> links OK.
> >>
> >> A.Chan
> >>
> >> > Thank you very much!
> >> >
> >> > --
> >> > ************************************************
> >> > Junli Gu--谷俊丽
> >> > Coordinate Science Lab
> >> > University of Illinois at Urbana-Champaign
> >> > ************************************************
> >> >
> >> > _______________________________________________
> >> > mpich-discuss mailing list
> >> > mpich-discuss at mcs.anl.gov
> >> > https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
> >> _______________________________________________
> >> mpich-discuss mailing list
> >> mpich-discuss at mcs.anl.gov
> >> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
> >
> >
> >
> > --
> > ************************************************
> > Junli Gu--谷俊丽
> > Coordinate Science Lab
> > University of Illinois at Urbana-Champaign
> > ************************************************
> >
> > _______________________________________________
> > mpich-discuss mailing list
> > mpich-discuss at mcs.anl.gov
> > https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
> >
> >
>
>
>
> --
> Mário Costa
>
> Laboratório Nacional de Engenharia Civil
> LNEC.CTI.NTIEC
> Avenida do Brasil 101
> 1700-066 Lisboa, Portugal
> Tel : ++351 21 844 3911
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>
>
>
> --
> ************************************************
> Junli Gu--谷俊丽
> Coordinate Science Lab
> University of Illinois at Urbana-Champaign
> ************************************************
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
More information about the mpich-discuss
mailing list