Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Sebastiano_P_
Beginner
117 Views

Intel Visual Studio MPI setup

Dear all,

I'm trying to set up and compile a code in Fortran with MPI libreries.This is the sample code:

 

PROGRAM main

USE MPI

IMPLICIT NONE

 TYPE tMPI
    INTEGER                           :: rank, nCPU, iErr, status
 END TYPE tMPI
 !
 TYPE(tMPI)                        :: MPIdata
 
    CALL MPI_INIT(MPIdata%iErr)
    CALL MPI_COMM_RANK(MPI_COMM_WORLD, MPIdata%rank, MPIdata%iErr)
    CALL MPI_COMM_SIZE(MPI_COMM_WORLD, MPIdata%nCPU, MPIdata%iErr)
    WRITE(*,*) 'Hallo world'

STOP
END PROGRAM

And this is what I did:

  1. Debugging>Command: mpiexec.exe
  2. Debugging>Command Arguments: -n 4
  3. Linker > General>Additional Library Directories: $(MSMPI_LIB32)
  4. Linker Input>Additional Dependenciesmsmpi.lib msmpifec.lib
  5. I also added mpi.f90 from “C:\Program Files\Microsoft HPC Pack 2008 R2\Inc” to my Source Files folder.

I obtained the following errors:

error LNK2019: unresolved external symbol MPI_INIT referenced in function MAIN__	main.obj	
error LNK2019: unresolved external symbol MPI_COMM_RANK referenced in function MAIN__	main.obj	
error LNK2019: unresolved external symbol MPI_COMM_SIZE referenced in function MAIN__	main.obj	
fatal error LNK1120: 3 unresolved externals	x64\Release\prova.exe	

Thanks,

Sebastiano

 

0 Kudos
1 Reply
Dmitry_S_Intel
Employee
117 Views

Dear Sebastiano,

It looks like you are trying to use Microsoft* MPI with Microsoft Visual Studio*.

Please try Intel(R) MPI Library for Windows OS. How to use it with Microsoft Visual Studio described at the page https://software.intel.com/ru-ru/node/535525 .

In other case, if you need to use Microsoft MPI, the following can be useful for you

http://blogs.technet.com/b/windowshpc/archive/2015/02/02/how-to-compile-and-run-a-simple-ms-mpi-prog...

 

--

Dmitry

Reply