<!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>&nbsp;I am providing 
below a&nbsp;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.)&nbsp;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>&nbsp;</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>&lt;stdio.h&gt;</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(&amp;argc, &amp;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, &amp;fh);</P>
<P>MPI_File_read(fh, buf, </FONT><FONT color=#0000ff size=2>sizeof</FONT><FONT 
size=2>(buf), MPI_CHAR, &amp;st);</P>
<P>printf(</FONT><FONT color=#a31515 size=2>"Read %s\n"</FONT><FONT size=2>, 
buf);</P>
<P>MPI_File_close(&amp;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>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=277473315-21092007><SPAN 
class=277473315-21092007><FONT face=verdana>&nbsp;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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp; Let us know if you need any 
further assistance. I would&nbsp;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>&nbsp;</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>&nbsp;</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&nbsp; 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&nbsp; 
in&nbsp;folder&nbsp;"E:\test"&nbsp;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>&nbsp;</DIV>
<DIV><FONT face=Verdana></FONT>&nbsp;</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&nbsp;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>&nbsp;</DIV>
<DIV><FONT face=Verdana>
<DIV>&nbsp;Hi,</DIV>
<DIV>&nbsp;&nbsp;If&nbsp;you&nbsp;would&nbsp;like&nbsp;to&nbsp;access&nbsp;use&nbsp;a&nbsp;remote&nbsp;machine's&nbsp;file&nbsp;system&nbsp;you&nbsp;will</DIV>
<DIV>have&nbsp;to&nbsp;share&nbsp;the&nbsp;file&nbsp;system&nbsp;using&nbsp;the&nbsp;"-map"&nbsp;option&nbsp;of&nbsp;the&nbsp;mpiexec&nbsp;command</DIV>
<DIV>in&nbsp;MPICH2&nbsp;on&nbsp;windows&nbsp;(i.e.,&nbsp;You&nbsp;cannot&nbsp;access&nbsp;the&nbsp;network&nbsp;shares&nbsp;from&nbsp;within</DIV>
<DIV>the&nbsp;MPI&nbsp;program&nbsp;if&nbsp;you&nbsp;do&nbsp;not&nbsp;use&nbsp;the&nbsp;"-map"&nbsp;option&nbsp;of&nbsp;mpiexec&nbsp;command).&nbsp;You</DIV>
<DIV>can&nbsp;find&nbsp;the&nbsp;details&nbsp;in&nbsp;the&nbsp;window's&nbsp;developer's&nbsp;guide&nbsp;available&nbsp;at</DIV>
<DIV><A 
href="http://www-unix.mcs.anl.gov/mpi/mpich/&nbsp;.&nbsp;Once&nbsp;you&nbsp;map&nbsp;the&nbsp;shared&nbsp;drive,&nbsp;to">http://www-unix.mcs.anl.gov/mpi/mpich/&nbsp;.&nbsp;Once&nbsp;you&nbsp;map&nbsp;the&nbsp;shared&nbsp;drive,&nbsp;to</A></DIV>
<DIV>say&nbsp;X:,&nbsp;you&nbsp;can&nbsp;access&nbsp;the&nbsp;file&nbsp;in&nbsp;the&nbsp;network&nbsp;share&nbsp;as</DIV>
<DIV>"X:\\folder1\\folder2\\filename"&nbsp;(without&nbsp;the&nbsp;quotes.&nbsp;Also&nbsp;make&nbsp;sure&nbsp;that</DIV>
<DIV>the&nbsp;string&nbsp;containing&nbsp;the&nbsp;filename&nbsp;has&nbsp;a&nbsp;'\0'&nbsp;at&nbsp;the&nbsp;end)&nbsp;from&nbsp;within&nbsp;your</DIV>
<DIV>MPI&nbsp;program.</DIV>
<DIV>&nbsp;&nbsp;Let&nbsp;us&nbsp;know&nbsp;if&nbsp;you&nbsp;need&nbsp;any&nbsp;futher&nbsp;help&nbsp;in&nbsp;this&nbsp;regard.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Regards,</DIV>
<DIV>Jayesh</DIV>
<DIV>&nbsp;</DIV>
<DIV>-----Original&nbsp;Message-----</DIV>
<DIV>From:&nbsp;owner-mpich-discuss@mcs.anl.gov</DIV>
<DIV>[mailto:owner-mpich-discuss@mcs.anl.gov]&nbsp;On&nbsp;Behalf&nbsp;Of&nbsp;Robert&nbsp;Latham</DIV>
<DIV>Sent:&nbsp;Thursday,&nbsp;September&nbsp;20,&nbsp;2007&nbsp;12:34&nbsp;PM</DIV>
<DIV>To:&nbsp;menglige</DIV>
<DIV>Cc:&nbsp;mpich-discuss</DIV>
<DIV>Subject:&nbsp;Re:&nbsp;[MPICH]&nbsp;A&nbsp;Question&nbsp;about&nbsp;MPI</DIV>
<DIV>&nbsp;</DIV>
<DIV>On&nbsp;Thu,&nbsp;Sep&nbsp;20,&nbsp;2007&nbsp;at&nbsp;05:18:00PM&nbsp;+0800,&nbsp;menglige&nbsp;wrote:</DIV>
<DIV>&gt;&nbsp;</DIV>
<DIV>&gt;&nbsp;int&nbsp;MPI_File_open(MPI_Comm&nbsp;comm,&nbsp;char&nbsp;*&nbsp;filename,&nbsp;int&nbsp;amode,&nbsp;MPI_Info&nbsp;</DIV>
<DIV>&gt;&nbsp;info,&nbsp;??MPI_File&nbsp;*&nbsp;fh)</DIV>
<DIV>&gt;&nbsp;</DIV>
<DIV>&gt;&nbsp;I&nbsp;want&nbsp;to&nbsp;open&nbsp;a&nbsp;file&nbsp;on&nbsp;the&nbsp;remote&nbsp;host.the&nbsp;host&nbsp;name&nbsp;is&nbsp;"node1"&nbsp;and&nbsp;file</DIV>
<DIV>name&nbsp;is&nbsp;"remotefile"&nbsp;in&nbsp;folder&nbsp;"E:\test"&nbsp;.</DIV>
<DIV>&gt;&nbsp;How&nbsp;can&nbsp;i&nbsp;write&nbsp;the&nbsp;parameter&nbsp;"filename"?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Simce&nbsp;most&nbsp;MPI&nbsp;implementations&nbsp;are&nbsp;based&nbsp;on&nbsp;ROMIO,&nbsp;I'll&nbsp;tell&nbsp;you&nbsp;what&nbsp;ROMIO</DIV>
<DIV>can&nbsp;do&nbsp;about&nbsp;that,&nbsp;and&nbsp;it&nbsp;will&nbsp;likely&nbsp;work&nbsp;for&nbsp;you.</DIV>
<DIV>&nbsp;</DIV>
<DIV>The&nbsp;NTFS&nbsp;driver&nbsp;for&nbsp;ROMIO&nbsp;doesn't&nbsp;go&nbsp;out&nbsp;and&nbsp;access&nbsp;remote&nbsp;machines.</DIV>
<DIV>Maybe&nbsp;Jayesh&nbsp;knows&nbsp;a&nbsp;trick&nbsp;or&nbsp;two,&nbsp;but&nbsp;you'll&nbsp;have&nbsp;to&nbsp;first&nbsp;export&nbsp;that</DIV>
<DIV>remote&nbsp;machine's&nbsp;file&nbsp;system&nbsp;to&nbsp;your&nbsp;client&nbsp;code&nbsp;(maybe&nbsp;a&nbsp;network&nbsp;shared</DIV>
<DIV>drive&nbsp;or&nbsp;shared&nbsp;folder.&nbsp;&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Once&nbsp;you've&nbsp;done&nbsp;that,&nbsp;specify&nbsp;the&nbsp;path&nbsp;like&nbsp;you&nbsp;would&nbsp;in&nbsp;windows&nbsp;Explorer.</DIV>
<DIV>I&nbsp;don't&nbsp;regularly&nbsp;use&nbsp;windows,&nbsp;so&nbsp;the&nbsp;following&nbsp;is</DIV>
<DIV>untested:</DIV>
<DIV>&nbsp;</DIV>
<DIV>If&nbsp;you&nbsp;used&nbsp;a&nbsp;shared&nbsp;drive,&nbsp;something&nbsp;like&nbsp;char&nbsp;*&nbsp;filename&nbsp;=&nbsp;"y:\test"&nbsp;;</DIV>
<DIV>&nbsp;</DIV>
<DIV>or&nbsp;if&nbsp;you&nbsp;used&nbsp;a&nbsp;network&nbsp;folder&nbsp;then&nbsp;maybe&nbsp;char&nbsp;*&nbsp;filename&nbsp;=</DIV>
<DIV>\\remote_machine\test;</DIV>
<DIV>&nbsp;</DIV>
<DIV>==rob</DIV>
<DIV>&nbsp;</DIV>
<DIV>--</DIV>
<DIV>Rob&nbsp;Latham</DIV>
<DIV>Mathematics&nbsp;and&nbsp;Computer&nbsp;Science&nbsp;Division&nbsp;&nbsp;&nbsp;&nbsp;A215&nbsp;0178&nbsp;EA2D&nbsp;B059&nbsp;8CDF</DIV>
<DIV>Argonne&nbsp;National&nbsp;Lab,&nbsp;IL&nbsp;USA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;B29D&nbsp;F333&nbsp;664A&nbsp;4280&nbsp;315B</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></FONT></DIV></BODY></HTML>