[mpich-discuss] mpi program with argumets

Jayesh Krishna jayesh at mcs.anl.gov
Thu Feb 26 17:11:35 CST 2009


 
https://svn.mcs.anl.gov/repos/mpi/mpich2/trunk/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 Rajeev Thakur
Sent: Thursday, February 26, 2009 3:31 PM
To: mpich-discuss at mcs.anl.gov
Subject: Re: [mpich-discuss] mpi program with argumets

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
> >
> >
> >
> >
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20090226/54a64612/attachment.htm>


More information about the mpich-discuss mailing list