<!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.16735" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=123244520-08122008>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=123244520-08122008> Looks to me to be some issue with permissions for
the user registered to run the MPI job (mpiexec -register). What does the script
do (Note that you cannot access network drives when you run your program using
mpiexec, unless you use the "-map" option of mpiexec to explicitly map the
network drive)?</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=123244520-08122008> I just tried running a program that loads a dll
and executes a procedure from the dll using mpiexec (mpiexec -n 2 foo.exe) and
it worked fine. </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=123244520-08122008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=123244520-08122008>Regards,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=123244520-08122008>Jayesh</SPAN></FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Vivian [mailto:viviantj@gmail.com]
<BR><B>Sent:</B> Friday, December 05, 2008 6:11 PM<BR><B>To:</B> Jayesh
Krishna<BR><B>Cc:</B> mpich-discuss@mcs.anl.gov<BR><B>Subject:</B> Re:
[mpich-discuss] problem of calling .dll in mpich<BR></FONT><BR></DIV>
<DIV></DIV>Hi, <BR> It runs fine with the
"-localonly" and "-localroot" option. <BR> Really
don't understand why it cannot call dll using "-n 1" option. (This program
should be run in multiple computers).<BR>Regards,<BR>Vivian<BR><BR>
<DIV class=gmail_quote>On Fri, Dec 5, 2008 at 6:01 PM, Jayesh Krishna <SPAN
dir=ltr><<A
href="mailto:jayesh@mcs.anl.gov">jayesh@mcs.anl.gov</A>></SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2><SPAN>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN> Can
you also try whether the program runs fine with the "-localroot" option
?</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2><SPAN></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2><SPAN>Regards,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2><SPAN>Jayesh</SPAN></FONT></DIV><BR>
<DIV lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2><B>From:</B> Vivian [mailto:<A
href="mailto:viviantj@gmail.com" target=_blank>viviantj@gmail.com</A>]
<BR><B>Sent:</B> Friday, December 05, 2008 11:30 AM<BR><B>To:</B> Jayesh
Krishna<BR><B>Cc:</B> <A href="mailto:mpich-discuss@mcs.anl.gov"
target=_blank>mpich-discuss@mcs.anl.gov</A><BR><B>Subject:</B> Re:
[mpich-discuss] problem of calling .dll in mpich<BR></FONT><BR></DIV>
<DIV>
<DIV></DIV>
<DIV class=Wj3C7c>
<DIV></DIV>Hi, <BR> I attached the
sample test program which fails to call dll when it is run by "mpiexec -n 1
application name". <BR> (Btw, when using "mpiexec
-localonly application name", dll can be
called.)<BR> <BR>The DLL called in the
program is a Dynamic Link Library (DLL) provided by ArcView ( a GIS software)
for use with WinHelp that lets you run a script. The DLL contains two
functions that you can use as WinHelp macros.
<P>AVRun -- this macro sends an Avenue statement from Help to ArcView. For
example, you might send a statement to make a particular view the active
document or run a script contained in the current project.</P>
<P></P>
<P>AVScript -- this macro runs a given script regardless of what ArcView
project is open. The script, in this case, is stored as part of the Help file
and not in an ArcView project.</P>
<P><BR></P>Here's how you could run a script in the current ArcView project
file and pass an argument to it. In this case, the number 5 is passed as an
argument to a script, named script1, in the
project:<BR>AVRun(`av.Run("script1", 5)')
<P></P>
<P><BR></P>
<P> Here is the sample test
code<BR></P>------------------------------------------------------------------------------------------------------------------------------------------------------------------<BR>#include<iostream><BR>#include
<windows.h> <BR><BR>/*Some users may get error messages such
as<BR> SEEK_SET is #defined but must not
be for the C++ binding of MPI<BR> The problem is that both stdio.h
and the MPI C++ interface use SEEK_SET, SEEK_CUR, and SEEK_END.
<BR> This is really a bug in the MPI-2 standard. You can try
adding the following three lines before mpi.h is included<BR>*/<BR>#undef
SEEK_SET<BR>#undef SEEK_END<BR>#undef SEEK_CUR<BR>#include
"mpi.h"<BR><BR>typedef char (__stdcall *AVRUN) (char[100]); <BR>HINSTANCE
ArcviewDLL;<BR>AVRUN AVRun;<BR><BR>int main(int argc,char
**argv)<BR>{<BR><BR> //load avhelp.dll
<BR> ArcviewDLL=
LoadLibraryA("Avhelp.dll"); //It needs a Unicode string.
Therefore, we use LoadLibraryA() instead of LoadLibrary()
<BR> if (ArcviewDLL==NULL)<BR>
{<BR> printf("cannot load the
Avhelp.dll.\n");<BR> printf("Make
sure that the Avhelp.dll is in your \\windows\\system
"<BR>
"directory or in the program's directory.\n");<BR>
}<BR><BR> //get the adress of the AVRun function
<BR> AVRun = (AVRUN) GetProcAddress(ArcviewDLL,
"AVRun");<BR><BR> //================================== Start
MPI =======================================//<BR> //MPI :
Declar Variables<BR> int my_rank;
// Rank of process
<BR> int num_proc;
// Number of
processers<BR>
<BR> //MPI :
Initialize<BR> MPI_Init(&argc,
&argv);<BR> MPI_Comm_rank(MPI_COMM_WORLD,
&my_rank);<BR> MPI_Comm_size(MPI_COMM_WORLD,
&num_proc);<BR><BR><BR> // -------- master Program
----------------//<BR> if
(my_rank==0) // Master processor<BR>
{<BR> //-------------Start call dll
--------------// <BR>
ArcviewDLL= LoadLibraryA("Avhelp.dll");
<BR> AVRun = (AVRUN)
GetProcAddress(ArcviewDLL,
"AVRun");<BR>
std::cout<<"Start Calling DLL"<<std::endl;<BR>
AVRun("av.run(\"HAO_script3\",\"\")");<BR>
std::cout<<"End Calling
DLL"<<std::endl;<BR><BR>
//MasterWork_MPI();<BR>
//-------------End call dll---------------//<BR>
}<BR><BR> // --------slave Program
------------------//<BR> else<BR>
{
<BR>
//SlaveWork_MPI();<BR> }<BR><BR>
MPI_Finalize(); <BR><BR> //================================
End MPI ====================================//<BR> return
0;<BR>}<BR><BR> <BR><SPAN
style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'"></SPAN>Vivian<BR>12/05/2008<BR><BR><BR><BR>
<DIV class=gmail_quote>On Fri, Dec 5, 2008 at 10:03 AM, Jayesh Krishna <SPAN
dir=ltr><<A href="mailto:jayesh@mcs.anl.gov"
target=_blank>jayesh@mcs.anl.gov</A>></SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2><SPAN>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2><SPAN> Can you send us a sample test program that fails
?</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2><SPAN></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2><SPAN>Regards,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2><SPAN>Jayesh</SPAN></FONT></DIV><FONT face=Arial color=#0000ff
size=2></FONT><BR>
<DIV lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2><B>From:</B> <A
href="mailto:mpich-discuss-bounces@mcs.anl.gov"
target=_blank>mpich-discuss-bounces@mcs.anl.gov</A> [mailto:<A
href="mailto:mpich-discuss-bounces@mcs.anl.gov"
target=_blank>mpich-discuss-bounces@mcs.anl.gov</A>] <B>On Behalf Of
</B>Vivian<BR><B>Sent:</B> Friday, December 05, 2008 12:05 AM<BR><B>To:</B>
<A href="mailto:mpich-discuss@mcs.anl.gov"
target=_blank>mpich-discuss@mcs.anl.gov</A><BR><B>Subject:</B>
[mpich-discuss] problem of calling .dll in mpich<BR></FONT><BR></DIV>
<DIV>
<DIV></DIV>
<DIV>
<DIV></DIV>Hi,<BR> I met some problems when I
was trying to call a dll in a mpich program (Language:VS
2005).<BR> (1) MPICH seems to only support
calling convention _cdecl. <BR> When
I change the project setting to _stdcall, the code cannot be successfully
built.<BR> So I set
the project setting back to _cdecl and force the calling convention of the
function pointer to my function on the DLL to be "_stdcall". This time the
program is built. <BR>
Under debugging mode or directly run in command window ( c:>test.ext),
there is no problem to call dll in the code.<BR>
Here is the code:<BR>
--------------------------------------------------------------------------------
<BR> typedef char (__stdcall *AVRUN)
(char[100]); <BR> HINSTANCE ArcviewDLL;
<BR> AVRUN AVRun;<BR>
ArcviewDLL= LoadLibraryA("Avhelp.dll");
<BR> AVRun = (AVRUN) GetProcAddress(ArcviewDLL,
"AVRun");<BR><BR>
AVRun("av.run(\"HAO_script3\",\"\")");<BR>
-------------------------------------------------------------------------------<BR><BR>
(2) However, the program fails to call dll when I use "mpiexec" to run it.
(c:>mpiexec -n 1
test.exe).<BR>
It seems to "stop" right before this line<BR>
-------------------------------------------------------------<BR>
AVRun("av.run(\"HAO_script3\",\"\")");<BR>
-------------------------------------------------------------<BR>
Is there anyone having any idea why this happens?<BR
clear=all><BR>--<BR>Vivian<BR></DIV></DIV></DIV></BLOCKQUOTE></DIV><BR></DIV></DIV></DIV></BLOCKQUOTE></DIV></BODY></HTML>