[mpich-discuss] mpi program with argumets

Rajeev Thakur thakur at mcs.anl.gov
Thu Feb 26 12:27:51 CST 2009


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/6860f7a9/attachment.htm>


More information about the mpich-discuss mailing list