[mpich-discuss] mpi program with argumets

Rajeev Thakur thakur at mcs.anl.gov
Thu Feb 26 15:30:47 CST 2009


See src/mpi/romio/test/simple.c
 

> -----Original Message-----
> From: mpich-discuss-bounces at mcs.anl.gov 
> [mailto:mpich-discuss-bounces at mcs.anl.gov] On Behalf Of Sole Eko
> Sent: Thursday, February 26, 2009 3:25 PM
> To: mpich-discuss at mcs.anl.gov
> Subject: Re: [mpich-discuss] mpi program with argumets
> 
> No, I don't have problems use argc/argv,
> 
> but, can somebody give me example how to make cpi.c to accept one
> argument (number of rectangles) and then broadcast it.. I am realy
> newbe in MPI, so any help will be great for beggining.
> 
> 
> On 2/26/09, Rajeev Thakur <thakur at mcs.anl.gov> wrote:
> > You can do it as you would in any C program. For 
> portability, you should
> > assume that command-line arguments are available only at 
> rank 0, and have
> > rank 0 broadcast them to other ranks.
> >
> > The Fortran example examples/f77/fpi.f shows how to do it 
> using stdin.
> >
> > Rajeev
> >
> >
> >   _____
> >
> > From: mpich-discuss-bounces at mcs.anl.gov
> > [mailto:mpich-discuss-bounces at mcs.anl.gov] On Behalf Of Sole Eko
> > Sent: Thursday, February 26, 2009 7:23 AM
> > To: mpich-discuss at mcs.anl.gov
> > Subject: [mpich-discuss] mpi program with argumets
> >
> >
> > Hi,
> >
> > I would like to make example program cpi.c to be able to 
> run wih one or more
> > arguments, for example:
> >
> > mpiexec cpi.exe 1000
> >
> > where 1000 is, say, number of rectangles.
> >
> > I saw that MPI_Init(&argc,&arv) uses argumets passed to 
> main method, but not
> > more than that..
> >
> > how can I acheve passing number of rectangles to cpi.exe?
> >
> > I attached original version of cpi.c
> >
> > Sole
> >
> >
> >
> >
> 



More information about the mpich-discuss mailing list