Problem with MPI

Problem with MPI

Dear all

    Recently I am trying to put MPI package into my code but I meet some problems which might be related to environment setting and do not know how to solve it. The MPI package I use is MS HPC Pack 2008 R2. The 3 errors are related to LNK2019. 

My code is like:

Program MPI-Test



call mpi_init(ierr)

call mpi_comm_rank(mpi_comm_world, myid,ierr) 
call mpi_comm_size(mpi_comm_world, numprocs,ierr) 



Environment setting:

Linker -> General The folder that contains msmpi.lib and msmpifec.lib

Linker -> Input msmpi.lib msmpifec.lib

Debuggin -> Action -> Command mpiexec.exe

Fortran -> Libraries Multithread DLL (/libs:dll /threads)

I know I should put something like  -n 4 $(TargetPath) into Debugging -> Action -> Command Argument

But what is $(TargetPath)?

Besides, is there anything else I miss such that compiler complained?



6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Advice for 32-mode mode is posted here:

Strangely, the authors of that post indicated they couldn't get the 64-bit mode working, but you don't give enough detail on what you are trying.

I'm not certain that you will find specific expertise on the Microsoft MPI release on this forum, or possibly on the companion Cluster & HPC forum which deals with Intel MPI.

Thank you for your reply

   The compiler did not complain during compiling but there were error messages when I pressed DEBUG (F5):

Block-Matrix.obj : error LNK2019: unresolved external symbol _MPI_INIT@4 referenced in function _MAIN__
Block-Matrix.obj : error LNK2019: unresolved external symbol _MPI_COMM_RANK@12 referenced in function _MAIN__
Block-Matrix.obj : error LNK2019: unresolved external symbol _MPI_COMM_SIZE@12 referenced in function _MAIN__

Now I just want to make sure that these error messages do not appear. 



This looks as if you may have inconsistency between compile options and the ABI used by the MPI library.

If you compiled with /iface:cvf (which may have been put there by an automatic conversion from CVF project) this would be incompatible with the usual cdecl ABI which I would expect to be used in the libraries.

If this hint doesn't help you, you might attach a full build log here.

You might be able to verify which ABI is used in the library by running dumpbin /symbols on the .lib files.


Now I see the problem. However, I compiled with /iface:cvf due to the NAG library. Is it possible to have these two libraries exist at the same time?



If you must use a library which was built for CVF compatible calling sequence, you could decorate the calls with the  ATTRIBUTES CVF and achieve the same effect as /iface:cvf but limit it to just those calls.

If you are using NAG library for functionality which is supported by ifort (e.g. in MKL) you should consider switching to the currently supported library.

Leave a Comment

Please sign in to add a comment. Not a member? Join today