<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7036.0">
<TITLE>RE: [mpich-discuss] mpi program with argumets</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

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

</BODY>
</HTML>