Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.
2154 Discussions

Trying to make MPI work in a QuickWin application

Anders_S_1
New Contributor III
900 Views

Hi,

This is my first try to enter MPI into a simple QuickWin program under Visual Studio 2010

I first installed Cluster Studio 2015 update 4 on my i7 4910MQ Dell laptop as an x64 project. The simple code compiled, linked and run directly.

Then I just added INCLUDE *mpif.h' on a new line after the IMPLICIT NONE line and got the compiler message error #5102 cannot open include file

'mpif.h'.

I then tried a number of ways to inform the compiler about the location of the mpif.h file but instead got a number of warnings and errors. 

I have scanned a number of install documents and videos but I found no solution.

So, how do I solve this?

Best regards

Anders S

0 Kudos
1 Solution
Gergana_S_Intel
Employee
900 Views

Hey Anders,

Thanks for the update.  I'm glad you have it working but I might suggest a shorter solution.  Start with step #1 and #2 above (by running mpivars.bat).  This should setup your environment so that the operating system can find all necessary include and link paths.

Which compile command are you using?  If, for example, you're doing 'ifort', simply replace that by 'mpiifort' on your command line.  That will potentially replace your steps 3 to 6.  The mpiifort command is a wrapper around ifort that does things like "add <install_path>\include" to the x64 compiler includes directory list".  Your new list will look like this:

  1. Install Cluster Studio XE 2015 Update 4
  2. Go to C:\Program Files (x86)\Intel\MPI\5.0.3.048\intel64\bin and run mpivars.bat
  3. Run "mpiifort test.c -o test"

After these steps, you should have an executable called 'test' which would be an MPI code.

Let me know if this helps.

~Gergana

View solution in original post

0 Kudos
7 Replies
Gergana_S_Intel
Employee
900 Views

Hi Anders,

If you're just getting started, I would take a look at the simply Hello World applications we ship with the Intel MPI Library under the test/ directory (check out C:\Program Files (x86)\Intel\impi_5.0.3\test or C:\Program Files (x86)\Intel\impi_5.0.3\intel64\test).

In your case, if it's not recognizing mpif.h, it might be that it just can't find it.  Make sure you run the mpivars.bat script prior to compiling or running your Intel MPI applications since that'll set your environment properly.  The mpivars.bat script should be located in the intel64/bin directory.

Let me know how this helps.

Regards,
~Gergana

0 Kudos
Anders_S_1
New Contributor III
900 Views

Hi Gergana,

After your answer I have run mpivars.bat. I can find mpif.h in three directories, which puzzles me. In directory

C:\Program Files (x86)\Intel I find

MPI,  IMPI  and impi_5.0.3 and all three have got mpif.h in a subdirectory.

See my Quickwin project in attachment CS1.

See my include information in CS2.

See my lib information in CS3.

What have I missed?

What I told you above is all I have done after installing the Cluster Studio.

Best regards

Anders S

0 Kudos
Anders_S_1
New Contributor III
900 Views

Hi Gergana,

I had a look in the "Intel MPI Library for Windows OS Installation Guide" and finally got the supplied test program to work.

So here is my recipi:

1. Install the Cluster Studio 2015 version 4 in Developer Studio 2010

2. Enter the command mode, goto  C:\Program Files (x86)\Intel\MPI\5.0.3.048\intel64\bin and run mpivars.bat (necessary ?)

3. Add C:\Program Files (x86)\Intel\MPI\5.0.3.048\intel64\include to the x64 compiler Includes directory list

4. Add  C:\Program Files (x86)\Intel\MPI\5.0.3.048\intel64\lib to the x64 compiler libraries directory list

5. Add impi.lib to the Additional dependencies in the Linker Input page found in the Project Property pages.

6. Now compilation and link shall work for the Fortran Hello World example named test found in C:\Program Files (x86)\Intel\MPI\5.0.3.048\test

Best regards

Anders S

0 Kudos
Gergana_S_Intel
Employee
901 Views

Hey Anders,

Thanks for the update.  I'm glad you have it working but I might suggest a shorter solution.  Start with step #1 and #2 above (by running mpivars.bat).  This should setup your environment so that the operating system can find all necessary include and link paths.

Which compile command are you using?  If, for example, you're doing 'ifort', simply replace that by 'mpiifort' on your command line.  That will potentially replace your steps 3 to 6.  The mpiifort command is a wrapper around ifort that does things like "add <install_path>\include" to the x64 compiler includes directory list".  Your new list will look like this:

  1. Install Cluster Studio XE 2015 Update 4
  2. Go to C:\Program Files (x86)\Intel\MPI\5.0.3.048\intel64\bin and run mpivars.bat
  3. Run "mpiifort test.c -o test"

After these steps, you should have an executable called 'test' which would be an MPI code.

Let me know if this helps.

~Gergana

0 Kudos
Anders_S_1
New Contributor III
900 Views

Hi Gergana,

I tried your suggested 3-step way but step 3 failed (see attached prinout)

Best regards

Anders S

0 Kudos
Gergana_S_Intel
Employee
900 Views

Ok, you found the 1 weakness in my list :)  I actually thought you were already using the Intel compilers so you were sourcing the compilervars.bat script.

Here's the new list:

  1. Install Cluster Studio XE 2015 Update 4
  2. Go to C:\Program Files (x86)\Intel\MPI\5.0.3.048\intel64\bin and run "mpivars.bat"
  3. Go to C:\Program Files (x86)\Intel\Composer XE 2015\bin and run "compilervars.bat intel64"
  4. Run "mpiifort test.c -o test"

Let me know how that goes.  And let me know if you were instead using a different compiler.

Regards,
~Gergana

0 Kudos
Anders_S_1
New Contributor III
900 Views

Hi Gergana,

I tried the 4-step recipe but still point 4 failed. I noticed that no additions were made in the compiler include and lib parts (see attached file).

Best regards

Anders S

0 Kudos
Reply