Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26757 Discussions

Parallel Studio XE 2017 on MS Visual Studio CONFIGURATION

Alexandre_M_1
Beginner
243 Views

I am very confused when it comes to use the mpi library under the Visual Studio environment.

I have several folders with mpi stuff under IntelSWTools and have no clue if I even need an additional one besides the original installation.

I tried to include the path for each of these folders to the Project Properties (Fortran, Linker etc) but nothing seems to work.

 

Would anyone have a straight forward way to solve this?

I am trying Intel's example and the log is below.

 

Many thanks!

=============================================================

!
! Copyright 2003-2013 Intel Corporation.  All Rights Reserved.
!
! The source code contained or described herein and all documents
! related to the source code ("Material") are owned by Intel Corporation
! or its suppliers or licensors.  Title to the Material remains with
! Intel Corporation or its suppliers and licensors.  The Material is
! protected by worldwide copyright and trade secret laws and treaty
! provisions.  No part of the Material may be used, copied, reproduced,
! modified, published, uploaded, posted, transmitted, distributed, or
! disclosed in any way without Intel's prior express written permission.
!
! No license under any patent, copyright, trade secret or other
! intellectual property right is granted to or conferred upon you by
! disclosure or delivery of the Materials, either expressly, by
! implication, inducement, estoppel or otherwise.  Any license under
! such intellectual property rights must be express and approved by
! Intel in writing.
!
        program main
        use mpi
        implicit none

        integer i, size, rank, namelen, ierr
        character (len=MPI_MAX_PROCESSOR_NAME) :: name
        integer stat(MPI_STATUS_SIZE)

        call MPI_INIT (ierr)

        call MPI_COMM_SIZE (MPI_COMM_WORLD, size, ierr)
        call MPI_COMM_RANK (MPI_COMM_WORLD, rank, ierr)
        call MPI_GET_PROCESSOR_NAME (name, namelen, ierr)

        if (rank.eq.0) then

            print *, 'Hello world: rank ', rank, ' of ', size, ' running on ', name

            do i = 1, size - 1
                call MPI_RECV (rank, 1, MPI_INTEGER, i, 1, MPI_COMM_WORLD, stat, ierr)
                call MPI_RECV (size, 1, MPI_INTEGER, i, 1, MPI_COMM_WORLD, stat, ierr)
                call MPI_RECV (namelen, 1, MPI_INTEGER, i, 1, MPI_COMM_WORLD, stat, ierr)
                name = ''
                call MPI_RECV (name, namelen, MPI_CHARACTER, i, 1, MPI_COMM_WORLD, stat, ierr)
                print *, 'Hello world: rank ', rank, ' of ', size, ' running on ', name
            enddo

        else

            call MPI_SEND (rank, 1, MPI_INTEGER, 0, 1, MPI_COMM_WORLD, ierr)
            call MPI_SEND (size, 1, MPI_INTEGER, 0, 1, MPI_COMM_WORLD, ierr)
            call MPI_SEND (namelen, 1, MPI_INTEGER, 0, 1, MPI_COMM_WORLD, ierr)
            call MPI_SEND (name, namelen, MPI_CHARACTER, 0, 1, MPI_COMM_WORLD, ierr)

        endif

        call MPI_FINALIZE (ierr)

        end

 

====================================================================

Build Log
   
 

Build started: Project: ex3, Configuration: Debug|x64

Output
   
Linking...
Link /OUT:"x64\Debug\ex3.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mpi\intel64\lib\<configuration>" /MANIFEST /MANIFESTFILE:"x64\Debug\ex3.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex3\ex3\ex3\x64\Debug\ex3.pdb" /SUBSYSTEM:CONSOLE /IMPLIB:"D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex3\ex3\ex3\x64\Debug\ex3.lib" /qoffload-ldopts="-mkl=parallel" "x64\Debug\test.obj"
ipo: warning #11082: D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex3\ex3\ex3\x64\Debug\test.obj: locally defined symbol __imp_MPIFCMB5 imported
ipo: warning #11082: D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex3\ex3\ex3\x64\Debug\test.obj: locally defined symbol __imp_MPIFCMB9 imported
ipo: warning #11082: D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex3\ex3\ex3\x64\Debug\test.obj: locally defined symbol __imp_MPIPRIV1 imported
ipo: warning #11082: D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex3\ex3\ex3\x64\Debug\test.obj: locally defined symbol __imp_MPIPRIV2 imported
ipo: warning #11082: D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex3\ex3\ex3\x64\Debug\test.obj: locally defined symbol __imp_MPIPRIVC imported
test.obj : warning LNK4049: locally defined symbol MPIFCMB5 imported
test.obj : warning LNK4049: locally defined symbol MPIFCMB9 imported
test.obj : warning LNK4049: locally defined symbol MPIPRIV1 imported
test.obj : warning LNK4049: locally defined symbol MPIPRIV2 imported
test.obj : warning LNK4049: locally defined symbol MPIPRIVC imported
test.obj : error LNK2019: unresolved external symbol MPI_INIT referenced in function MAIN__
test.obj : error LNK2019: unresolved external symbol MPI_COMM_SIZE referenced in function MAIN__
test.obj : error LNK2019: unresolved external symbol MPI_COMM_RANK referenced in function MAIN__
test.obj : error LNK2019: unresolved external symbol MPI_GET_PROCESSOR_NAME referenced in function MAIN__
test.obj : error LNK2019: unresolved external symbol MPI_RECV referenced in function MAIN__
test.obj : error LNK2019: unresolved external symbol MPI_SEND referenced in function MAIN__
test.obj : error LNK2019: unresolved external symbol MPI_FINALIZE referenced in function MAIN__
x64\Debug\ex3.exe : fatal error LNK1120: 7 unresolved externals


ex3 - 8 error(s), 10 warning(s)

 

0 Kudos
1 Solution
Kevin_D_Intel
Employee
243 Views

With the example you provided try this:

  • Create a new (empty) Fortran Console project.
  • Add an x64 configuration and set that as the default configuration.
  • Under source files, add the source file corresponding to the example you've shown.
  • Under Properties set (for all Configurations) set:
  •      Fortran > General > Additional Include Directories to $(I_MPI_ROOT)\intel64\include
  •      Linker > General > Additional Library Directories: $(I_MPI_ROOT)\intel64\lib\release
  •      Linker > Input > Additional Dependencies to impi.lib
  • Build the solution/project

With a successful build:

  • Open a pre-initialized Fortran Command prompt window (these are what you found in your earlier thread)
  • Run the mpivars.bat  (Note: Adjust the path to the version of MPI you have installed)   For example:

                 C:\>  "C:\Program Files (x86)\IntelSWTools\mpi\5.1.3.246\intel64\bin\mpivars.bat"

  • Change directory to the Debug or Release folder for your solution and run: mpiexec –np 4 Console.exe

Here are some getting started guides:
https://software.intel.com/en-us/get-started-with-mpi-for-windows
https://software.intel.com/en-us/node/610381

The latter one has the three keys VS settings needed that are mentioned above.

There is additional documentation available at: https://software.intel.com/en-us/intel-software-technical-documentation  (Use the left-side Products Filter to select Intel MPI Library)

From your build output, it looks like you may only need to replace <configuration> under Additional Library Directories with a selection of the libraries you want to use i.e. debug, release, debug_mt, release_mt as discussed on the page I noted earlier, https://software.intel.com/en-us/node/610381

View solution in original post

9 Replies
Steve_Lionel
Black Belt Retired Employee
243 Views

I suggest you ask this in https://software.intel.com/en-us/forums/intel-clusters-and-hpc-technology

Kevin_D_Intel
Employee
244 Views

With the example you provided try this:

  • Create a new (empty) Fortran Console project.
  • Add an x64 configuration and set that as the default configuration.
  • Under source files, add the source file corresponding to the example you've shown.
  • Under Properties set (for all Configurations) set:
  •      Fortran > General > Additional Include Directories to $(I_MPI_ROOT)\intel64\include
  •      Linker > General > Additional Library Directories: $(I_MPI_ROOT)\intel64\lib\release
  •      Linker > Input > Additional Dependencies to impi.lib
  • Build the solution/project

With a successful build:

  • Open a pre-initialized Fortran Command prompt window (these are what you found in your earlier thread)
  • Run the mpivars.bat  (Note: Adjust the path to the version of MPI you have installed)   For example:

                 C:\>  "C:\Program Files (x86)\IntelSWTools\mpi\5.1.3.246\intel64\bin\mpivars.bat"

  • Change directory to the Debug or Release folder for your solution and run: mpiexec –np 4 Console.exe

Here are some getting started guides:
https://software.intel.com/en-us/get-started-with-mpi-for-windows
https://software.intel.com/en-us/node/610381

The latter one has the three keys VS settings needed that are mentioned above.

There is additional documentation available at: https://software.intel.com/en-us/intel-software-technical-documentation  (Use the left-side Products Filter to select Intel MPI Library)

From your build output, it looks like you may only need to replace <configuration> under Additional Library Directories with a selection of the libraries you want to use i.e. debug, release, debug_mt, release_mt as discussed on the page I noted earlier, https://software.intel.com/en-us/node/610381

View solution in original post

Alexandre_M_1
Beginner
243 Views

Many thanks you both. I will give it a try tomorrow. I am about to reach that "uninstall everything and re-start from the beginning point"...

Alexandre_M_1
Beginner
243 Views

Why not give it a try?

When I told it to build, I got an error related to the impi.lib, below. I have loads of impi.lib under the root folder but unsure if I am telling the compiler its path...

 

Build Log
   
 

Build started: Project: ex0, Configuration: Debug|x64

Output
   
Linking...
Link /OUT:"x64\Debug\ex0.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mpi\intel64\include" /MANIFEST /MANIFESTFILE:"x64\Debug\ex0.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex0\ex0\ex0\x64\Debug\ex0.pdb" /SUBSYSTEM:CONSOLE /IMPLIB:"D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex0\ex0\ex0\x64\Debug\ex0.lib" impi.lib "x64\Debug\test.obj"
ipo: error #11018: Cannot open impi.lib
ipo: warning #11082: D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex0\ex0\ex0\x64\Debug\test.obj: locally defined symbol __imp_MPIFCMB5 imported
ipo: warning #11082: D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex0\ex0\ex0\x64\Debug\test.obj: locally defined symbol __imp_MPIFCMB9 imported
ipo: warning #11082: D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex0\ex0\ex0\x64\Debug\test.obj: locally defined symbol __imp_MPIPRIV1 imported
ipo: warning #11082: D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex0\ex0\ex0\x64\Debug\test.obj: locally defined symbol __imp_MPIPRIV2 imported
ipo: warning #11082: D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex0\ex0\ex0\x64\Debug\test.obj: locally defined symbol __imp_MPIPRIVC imported
LINK : fatal error LNK1181: cannot open input file 'impi.lib'


ex0 - 2 error(s), 5 warning(s)
Alexandre_M_1
Beginner
243 Views

A solution:

I copied one of these files into the project folder and the build was successful...   I will look at the other details later but I am sure this is not the best way forward... I put an .f90 in the end so I could upload it...

Kevin_D_Intel
Employee
243 Views

The first line of the build output shows for LIBPATH that you added the include path for MPI into the linker's Additional Libraries setting and not the MPI library path. Compare your project settings to those that I posted earlier. This only requires the three settings that I noted. It doesn't require copying MPI files. Your is working as a by-product of the linker searching the current build directory.

Alexandre_M_1
Beginner
243 Views

Many thanks again.

Please note below:

/OUT:"x64\Debug\ex0.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mpi\intel64\include" /MANIFEST /MANIFESTFILE:"x64\Debug\ex0.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex0\ex0\ex0\x64\Debug\ex0.pdb" /SUBSYSTEM:CONSOLE /IMPLIB:"D:\_1 - shared\_Arquivos\Alexandre\_Tecnicos\Pós-Doutorado\Exercicios MPI\ex0\ex0\ex0\x64\Debug\ex0.lib" impi.lib

 

> There is no impi.lib under that folder (Intel08.png) - strange? The folder intel64 under 2017.1.143 only has bin and etc - no include nor lib...

 

Also, I double checked that I included the entries as indicated - another strange thing?

  • Under Properties set (for all Configurations) set:
  •      Fortran > General > Additional Include Directories to $(I_MPI_ROOT)\intel64\include
  •      Linker > General > Additional Library Directories: $(I_MPI_ROOT)\intel64\lib\release
  •      Linker > Input > Additional Dependencies to impi.lib

 

Many thanks again!

Kevin_D_Intel
Employee
243 Views

You are just overlooking the incorrect setting in the properties settings. The Intel09A.png shows where you have the wrong setting. The Linker > General > Additional Library Directories setting needs to be:  $(I_MPI_ROOT)\intel64\lib\release     (it is incorrectly set to the MPI include path)

 

Alexandre_M_1
Beginner
243 Views

I am sorry the delay but I would like to thank you for your help. All is working fine now! :-)

Reply