<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.6000.16525" name=GENERATOR>
<STYLE>
<!--
/* Font Definitions */
@font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Verdana;
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
/* Page Definitions */
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;
        layout-grid:15.6pt;}
div.Section1
        {page:Section1;}
-->
</STYLE>
</HEAD>
<BODY style="FONT-SIZE: 10pt; FONT-FAMILY: verdana">
<DIV dir=ltr align=left><SPAN class=277473315-21092007><FONT
face=verdana>Hi,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007> I am providing
below a simple code (In production code be careful of what/how much you
read and the newlines. This code is *only* for demonstrating the usage of the
"-map" option of mpiexec command.) used to open/read/close a file in
windows,</SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><FONT
face=verdana></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><FONT
face=verdana>/****************** Sample Code
*****************/</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><FONT color=#0000ff
size=2>
<P>#include</FONT><FONT size=2> </FONT><FONT color=#a31515
size=2><stdio.h></P></FONT><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> </FONT><FONT color=#a31515
size=2>"mpi.h"</P></FONT><FONT color=#0000ff size=2>
<P>#define</FONT><FONT size=2> MAX_BUF_LEN 100</P></FONT><FONT color=#0000ff
size=2>
<P>int</FONT><FONT size=2> main(</FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> argc, </FONT><FONT color=#0000ff
size=2>char</FONT><FONT size=2> *argv[]){</P>
<P>MPI_File fh;</P>
<P>MPI_Status st;</P>
<P></FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2>
buf[MAX_BUF_LEN];</P>
<P>MPI_Init(&argc, &argv);</P>
<P></P>
<P>MPI_File_open(MPI_COMM_SELF, </FONT><FONT color=#a31515
size=2>"J:\\testfolder\\testfile"</FONT><FONT size=2>, MPI_MODE_RDONLY,
MPI_INFO_NULL, &fh);</P>
<P>MPI_File_read(fh, buf, </FONT><FONT color=#0000ff size=2>sizeof</FONT><FONT
size=2>(buf), MPI_CHAR, &st);</P>
<P>printf(</FONT><FONT color=#a31515 size=2>"Read %s\n"</FONT><FONT size=2>,
buf);</P>
<P>MPI_File_close(&fh);</P>
<P>MPI_Finalize();</P>
<P>}</P></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><FONT face=verdana><SPAN
class=277473315-21092007><FONT face=verdana>/****************** Sample Code
*****************/</FONT></SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><FONT face=verdana><SPAN
class=277473315-21092007></SPAN></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><FONT face=verdana> You can run the above program
as follows,</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><FONT face=verdana></FONT></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><FONT
face=verdana>Assumptions</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007>---------------</SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007># The executable of the above program is named
"testpgm.exe"</SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007># The machine with machine name "machineA" has a folder
"mappedFolder" which is shared. The folder "mappedFolder" <SPAN
class=277473315-21092007><SPAN class=277473315-21092007>contains a folder
"testfolder" with a file "testfile"</SPAN></SPAN></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><SPAN class=277473315-21092007><SPAN
class=277473315-21092007># The user running the program (running mpiexec) has
permissions to map the folder "mappedFolder" and has access to read the file
"testfile" (You can test this by mapping "mappedFolder" from the windows
explorer and trying to read the file testfile)</SPAN></SPAN></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><FONT
face=verdana></FONT></SPAN></SPAN></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><FONT face=verdana>Executing the
program</FONT></SPAN></SPAN></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><SPAN class=277473315-21092007><SPAN
class=277473315-21092007>------------------------</SPAN></SPAN></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><FONT
face=verdana></FONT></SPAN></SPAN></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><FONT face=verdana>mpiexec -n 1 -map
j:\\machineA\mappedFolder testpgm.exe</FONT></SPAN></SPAN></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><FONT
face=verdana></FONT></SPAN></SPAN></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><FONT
face=verdana></FONT></SPAN></SPAN></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><FONT face=verdana> Let us know if you need any
further assistance. I would recommend that you go through the windows
developer's guide to get a better understanding of the options provided with the
mpiexec command.</FONT></SPAN></SPAN></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><FONT
face=verdana></FONT></SPAN></SPAN></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><FONT
face=verdana></FONT></SPAN></SPAN></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><FONT
face=verdana>Regards,</FONT></SPAN></SPAN></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN
class=277473315-21092007><SPAN class=277473315-21092007><SPAN
class=277473315-21092007>Jayesh</SPAN></SPAN></SPAN></SPAN><FONT
face=verdana></FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma><B>From:</B> menglige [mailto:menglige@gmail.com]
<BR><B>Sent:</B> Friday, September 21, 2007 1:22 AM<BR><B>To:</B> Jayesh
Krishna<BR><B>Subject:</B> Re: RE: [MPICH] A Question about MPI - Use the "-map"
option in mpiexec<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Verdana color=#0000ff>Thank you very
much!!!!!!!!!!!!!</FONT></DIV>
<DIV><FONT color=#0000ff><IMG src="cid:277473315@21092007-207D">could you give
me an example. </FONT></DIV>
<DIV><FONT color=#0000ff>i want to operate a file named"remotefile" which
in folder "E:\test" of remote host "node1".</FONT></DIV>
<DIV><FONT color=#0000ff>1, mpiexec -map ????</FONT></DIV>
<DIV><FONT color=#0000ff>2,in my code .</FONT></DIV>
<DIV><FONT color=#0000ff>MPI_File_Open(????????????)</FONT></DIV>
<DIV><FONT color=#0000ff></FONT> </DIV>
<DIV><FONT face=Verdana></FONT> </DIV>
<DIV align=left>
<DIV align=left><FONT face=Verdana>
<HR style="WIDTH: 122px; HEIGHT: 2px" SIZE=2>
</FONT></DIV>
<DIV><FONT color=#c0c0c0><FONT face=Verdana>menglige</FONT></DIV>
<DIV><FONT face=Verdana>2007-09-21</FONT></FONT></DIV></DIV>
<DIV><FONT face=Verdana>
<HR>
</FONT></DIV>
<DIV><FONT face=Verdana><STRONG>发件人:</STRONG> Jayesh Krishna</FONT></DIV>
<DIV><FONT face=Verdana><STRONG>发送时间:</STRONG>
2007-09-21 02:22:06</FONT></DIV>
<DIV><FONT face=Verdana><STRONG>收件人:</STRONG> 'menglige'</FONT></DIV>
<DIV><FONT face=Verdana><STRONG>抄送:</STRONG> 'mpich-discuss'; 'Robert
Latham'</FONT></DIV>
<DIV><FONT face=Verdana><STRONG>主题:</STRONG> RE: [MPICH] A Question about MPI -
Use the "-map" option in mpiexec</FONT></DIV>
<DIV><FONT face=Verdana></FONT> </DIV>
<DIV><FONT face=Verdana>
<DIV> Hi,</DIV>
<DIV> If you would like to access use a remote machine's file system you will</DIV>
<DIV>have to share the file system using the "-map" option of the mpiexec command</DIV>
<DIV>in MPICH2 on windows (i.e., You cannot access the network shares from within</DIV>
<DIV>the MPI program if you do not use the "-map" option of mpiexec command). You</DIV>
<DIV>can find the details in the window's developer's guide available at</DIV>
<DIV><A
href="http://www-unix.mcs.anl.gov/mpi/mpich/ . Once you map the shared drive, to">http://www-unix.mcs.anl.gov/mpi/mpich/ . Once you map the shared drive, to</A></DIV>
<DIV>say X:, you can access the file in the network share as</DIV>
<DIV>"X:\\folder1\\folder2\\filename" (without the quotes. Also make sure that</DIV>
<DIV>the string containing the filename has a '\0' at the end) from within your</DIV>
<DIV>MPI program.</DIV>
<DIV> Let us know if you need any futher help in this regard.</DIV>
<DIV> </DIV>
<DIV>Regards,</DIV>
<DIV>Jayesh</DIV>
<DIV> </DIV>
<DIV>-----Original Message-----</DIV>
<DIV>From: owner-mpich-discuss@mcs.anl.gov</DIV>
<DIV>[mailto:owner-mpich-discuss@mcs.anl.gov] On Behalf Of Robert Latham</DIV>
<DIV>Sent: Thursday, September 20, 2007 12:34 PM</DIV>
<DIV>To: menglige</DIV>
<DIV>Cc: mpich-discuss</DIV>
<DIV>Subject: Re: [MPICH] A Question about MPI</DIV>
<DIV> </DIV>
<DIV>On Thu, Sep 20, 2007 at 05:18:00PM +0800, menglige wrote:</DIV>
<DIV>> </DIV>
<DIV>> int MPI_File_open(MPI_Comm comm, char * filename, int amode, MPI_Info </DIV>
<DIV>> info, ??MPI_File * fh)</DIV>
<DIV>> </DIV>
<DIV>> I want to open a file on the remote host.the host name is "node1" and file</DIV>
<DIV>name is "remotefile" in folder "E:\test" .</DIV>
<DIV>> How can i write the parameter "filename"?</DIV>
<DIV> </DIV>
<DIV>Simce most MPI implementations are based on ROMIO, I'll tell you what ROMIO</DIV>
<DIV>can do about that, and it will likely work for you.</DIV>
<DIV> </DIV>
<DIV>The NTFS driver for ROMIO doesn't go out and access remote machines.</DIV>
<DIV>Maybe Jayesh knows a trick or two, but you'll have to first export that</DIV>
<DIV>remote machine's file system to your client code (maybe a network shared</DIV>
<DIV>drive or shared folder. </DIV>
<DIV> </DIV>
<DIV>Once you've done that, specify the path like you would in windows Explorer.</DIV>
<DIV>I don't regularly use windows, so the following is</DIV>
<DIV>untested:</DIV>
<DIV> </DIV>
<DIV>If you used a shared drive, something like char * filename = "y:\test" ;</DIV>
<DIV> </DIV>
<DIV>or if you used a network folder then maybe char * filename =</DIV>
<DIV>\\remote_machine\test;</DIV>
<DIV> </DIV>
<DIV>==rob</DIV>
<DIV> </DIV>
<DIV>--</DIV>
<DIV>Rob Latham</DIV>
<DIV>Mathematics and Computer Science Division A215 0178 EA2D B059 8CDF</DIV>
<DIV>Argonne National Lab, IL USA B29D F333 664A 4280 315B</DIV>
<DIV> </DIV>
<DIV> </DIV></FONT></DIV></BODY></HTML>