Unable to link msmpi with Visual studio 2008

Hi,
For MPI codes, using Visual studio with Intel compulers, I used to work with Dieno MPI on my PC. After downloading PGI Accelerator Visual Fortran, To debug codes with MPI, In project properties, In Language, It specifies: Microsoft MPI (-Mmpi=msmpi) . So I downloaded Microsoft HPC Pack 2008 SDK, and made following changes in project properties:

  1. Fortran> General> Additional include directories>C:\Program Files\Microsoft HPC Pack 2008 SDK\Include
  2. Linker>Additional library directories> C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\i386
  3. Linker > input> Additional dependencies> msmpi.lib

On building, I am getting following errors:
Error 1 unresolved external symbol _MPI_ALLGATHER@32 referenced in function _CREATE@0 create.obj
Error 2 unresolved external symbol _MPI_ALLGATHER@32 read.obj
Error 3 unresolved external symbol _MPI_ALLGATHER@32 weights.obj
Error 4 unresolved external symbol _MPI_INIT@4 referenced in function MAIN main.obj
Error 5 unresolved external symbol _MPI_COMM_RANK@12 referenced in function MAIN main.obj
Error 6 unresolved external symbol _MPI_COMM_SIZE@12 referenced in function MAIN main.obj
Error 7 unresolved external symbol _MPI_BARRIER@8 referenced in function MAIN main.obj
Error 8 unresolved external symbol _MPI_BARRIER@8 read.obj

Regards
Kaustubh

Hi Kaustubh,

The only thing you should have to do is add the “-Mmpi=msmpi” flag. Once set, the compilers know how to link with MSMPI. My guess is by adding the library paths and msmpi.lib, the linker is somehow getting confused and linking in the wrong library. Try taking all this out and only set “-Mmpi=msmpi”.

If you still have issues, double check that Microsoft HPC Pack 2008 SDK was successfully installed and that you have rebooted after installation. The need HPC environment variables don’t get set until reboot.

  • Mat

Yes. It works. I didn’t reboot. Now it is able to build properly.
Thanks for help
Regards
Kaustubh