<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16809" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=633322518-26022009><FONT face=Arial 
color=#0000ff size=2>You can do it as you would in any C program. For 
portability, you should assume that command-line arguments are available 
only&nbsp;at rank 0, and have rank 0 broadcast them to other 
ranks.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=633322518-26022009><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=633322518-26022009><FONT face=Arial 
color=#0000ff size=2>The Fortran example examples/f77/fpi.f shows how to do it 
using stdin.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=633322518-26022009><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=633322518-26022009><FONT face=Arial 
color=#0000ff size=2>Rajeev</FONT></SPAN></DIV><BR>
<BLOCKQUOTE 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> mpich-discuss-bounces@mcs.anl.gov 
  [mailto:mpich-discuss-bounces@mcs.anl.gov] <B>On Behalf Of </B>Sole 
  Eko<BR><B>Sent:</B> Thursday, February 26, 2009 7:23 AM<BR><B>To:</B> 
  mpich-discuss@mcs.anl.gov<BR><B>Subject:</B> [mpich-discuss] mpi program with 
  argumets<BR></FONT><BR></DIV>
  <DIV></DIV>Hi, <BR><BR>I would like to make example program cpi.c to be able 
  to run wih one or more arguments, for example:<BR><BR>mpiexec cpi.exe 
  1000<BR><BR>where 1000 is, say, number of rectangles.<BR><BR>I saw that 
  MPI_Init(&amp;argc,&amp;arv) uses argumets passed to main method, but not more 
  than that..<BR><BR>how can I acheve passing number of rectangles to 
  cpi.exe?<BR><BR>I attached original version of 
cpi.c<BR><BR>Sole<BR><BR></BLOCKQUOTE></BODY></HTML>