Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Compiling MPI applications with MS-MPI and Intel Fortran for 64-bit

Sampath_Vanimisetti
3,285 Views

I am trying to compile an MPI application using Intel Fortran (Parallel Studio XE 2011 with VS2010) and MS-MPI. I have been able to successfully compile using 32-bit MS-MPI libraries. The following settings (changes from defaults) are what I used.

Visual Studio Project Creation

  • File -> New -> Intel Visual Fortran -> Console Application -> Empty Project
  • Added source from here
  • Added mpif.h, mpifptr.h and mpi.f90 from <path-to-msmpi-include/lib-dir>

Project Settings

  • Fortran -> General -> Additional Include Directory  :: <path-to-msmpi-include-dir>
  • Linker -> General -> Additional Library Directories :: <path-to-msmpi-32bit-lib-dir>
  • Linker -> Input -> Additional Dependencies          :: msmpi.lib msmpifec.lib
  • [only debug mode] Linker -> Input -> Ignore Specific Library :: LIBCMT

I was able to build project in both debug and release mode and successfully run the application. The MPI execution and output are below.

C:\MPITest\MPITest_win32\Release>mpiexec -n 4 MPITest_win32.exe

Hello from task  3 on <my-computer-name>
Hello from task  0 on <my-computer-name>
Hello from task  2 on <my-computer-name>
Hello from task  1 on <my-computer-name>
MASTER: Number of MPI tasks is:  4

When I try to compile using the 64-bit libraries that MS-MPI provides, I am able to compile the project successfully. However, when I execute the program, I get the following error.

"The procedure entry point mpi_pack_size__ could not be located in the dynamic link library msmpi.dll".

I have verified that this entry point is tabluated in msmpi.dll using Dependency Walker. See attached images. The function entry point is listed in both Parent Import and Export function list, so, I do not understand why windows is throwing an error message.

Thanks & regard,
Sampath

0 Kudos
3 Replies
Steven_L_Intel1
Employee
3,285 Views

You missed some steps. When you configure your x64 project, you have to change the properties for include and library directories to reference the x64 folders, not x86. I also found I had to add the x86 (or x64) subfolder of the MSMPI include directory to the list of include directories.  When I did these things, the 64-bit program ran fine.

0 Kudos
Sampath_Vanimisetti
3,285 Views

Hello Steve,

Thanks for your comments. The changes to include were implicit in my description. I do change the from x86 to x64 (for both include and lib) when I try to build for x64 configuration. I have tried to compile the code again based on your inputs - but I still do not have any luck - compilation is successful, but the resulting exe does not work.

Please not that I am using MS-MPI version 7 - and I use the 64-bit version of mpiexec.exe and msmpi.dll for running both x86 and x64 executables.

I notice that the MS-MPI v7 distribution has split the mpif.h file - the only portion that different between x86 and x64 now resides in mpifptr.h in respective folders (C:\Program Files\Microsoft MPI\Include\x86 or x64). These files define MPI_AINT parameter for x86 and x64. Is this something that I should worry about. The previous versions of MS-MPI used to use a __WIN64 directive for appropriate assignment to MPI_AINT. If I list two include folders in the project settigns (Fortran -> General -> Additional Include Directory), which include file will be considered by Intel Fortran?

Nonetheless, what bothers me is that the executable import and DLL (msmpi.dll) export names are present and consistent. Then why is there an issue? Is there a need for using a specific naming convention (c/stdref/stdcall) when compiling for 64-bit?

Thanks & regards,
Sampath

0 Kudos
Steven_L_Intel1
Employee
3,285 Views

As I can't reproduce your problem, I don't know what is happening specifically in your case. On x64 there is only one calling/naming convention so you don't have to worry about STDCALL.

I will comment that Dependency Walker may be finding the 32-bit MSMPI.DLL if it happens to be first in the search path, even though Windows will pass it over when loading your 64-bit EXE. However, I found that entry point in both 32-bit and 64-bit DLLs. It might be useful to ask Dependency Walker for the full path to the MSMPI.DLL it found.

If you put multiple folders in the Fortran property, the compiler will search in all of them, in order.

0 Kudos
Reply