Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

How to compile and run a parrallel program using intel visiual fortan compiler for windows

ZX_L_
Beginner
3,037 Views

I'm good at programming using FORTRAN language, but I'm a new bird using intel visiual fortan compiler for windows. Can you tell me how to compile and run a parrallel program (ie. test.f or test.f90 in C:\program files (x86)\intelSWTools\compilers_and_libraries_2016.0.110\windows\mpi\test\) using intel visiual fortan compiler for windows? Thanks!

0 Kudos
12 Replies
TimP
Honored Contributor III
3,037 Views

After installing the MPI component of parallel studio, and rebooting, this was simple.   The general idea (if compiling from command line) is to use 'mpiifort.bat test.f90' as the compile command and 'mpiexec -np4 test.exe' to run it.  There is a pop-up window for you to set user and password.

When you ask about parallel programs here, the usual expectation is you mean OpenMP or auto-parallel. This minimal example has nothing in it to use those features of ifort.

 

0 Kudos
ZX_L_
Beginner
3,037 Views

Dear Tim Prince,

   Thank you very much for your kindly help. When I run "mpiifort.bat D:\test1\test2.f90" from command line, there pops up "ifort is neither an internal command, nor an external command, it is also not an excecutable file or a BAT file . ERROR in the compiling/linking [1]"

 

  ZX. Li

0 Kudos
ZX_L_
Beginner
3,037 Views

 I have installed visual studio 2015 (community 2015) and Intel Parallel Studio XE 2016 cluster edition

0 Kudos
TimP
Honored Contributor III
3,037 Views

mpiifort should run in a window where ifort is visible, such as the one opened by a shortcut set up by the compiler installation.  If you can't find the shortcut (according to your Windows version), the more difficult route is to run the ifortvars.bat in your cmd prompt window so that ifort PATH and LIB settings will be added.

0 Kudos
Kevin_D_Intel
Employee
3,037 Views

There is also help available in the Windows specific Getting Started guides for Fortran and Intel MPI.

The guides (and much more) are available here https://software.intel.com/en-us/intel-software-technical-documentation. Filter the content by selecting Intel® Fortran Compiler and Intel® MPI Library under the Products filter category.

0 Kudos
ZX_L_
Beginner
3,037 Views

My Windows version is 8.1. After I had installed  visual studio 2015 (community 2015), and then Intel Parallel Studio XE 2016 cluster edition including all components for Fortan, I have initialized the Intel Parallel Studio XE tools by running psxevars.bat in the directory of C:\Program Files (x86)\IntelSWTools \parallel_studio_xe_2016.0.041\bin

and set the environment settings: in the directory of C:\Program Files (x86)\IntelSWTools \mpi\ 5.1.1.110\intel64\bin, by using the call batch command to run the mpivars.bat batch for the architecture. The Intel MPI Library installation directory is C:\Program Files (x86)\IntelSWTools.

     I can compile and run my programme with sequential architecture successfully, but I don't know how to compile and run a programme with parallel architecture

0 Kudos
Kevin_D_Intel
Employee
3,037 Views

Try the mpiexec.smpd command, https://software.intel.com/en-us/node/528867

Perhaps the simplest form meets your interests/need, mpiexec.smpd -n <# of processes> a.exe

0 Kudos
ZX_L_
Beginner
3,037 Views

Dear Kevin Davis

     Can you tell me how to compile a parallel program using an  intel visual fortran compiler?

         Thank you very much.

          ZX Li

     

0 Kudos
ZX_L_
Beginner
3,037 Views

Tim Prince wrote:

mpiifort should run in a window where ifort is visible, such as the one opened by a shortcut set up by the compiler installation.  If you can't find the shortcut (according to your Windows version), the more difficult route is to run the ifortvars.bat in your cmd prompt window so that ifort PATH and LIB settings will be added.

 

Dear Tim Prince,

    I have run psxevars.bat to set the environmental variables for intel visual fortran compiler, and set the environment settings of mpi libraries by using the call batch command to run the mpivars.bat batch. Can you tell me what should I do next step to compile/run a parallel fortran program.

     Thanks a lot.

      ZX. Li

    

0 Kudos
Kevin_D_Intel
Employee
3,037 Views

The information you need is in the documentation resources referred to earlier, specifically:

Refer to the Compiler’s Getting Started guide, https://software.intel.com/en-us/get-started-with-fortran-compiler-for-windows-parallel-studio-xe, specifically the section on using the Command Line to open the command-prompt window.

Next, refer to the MPI Getting Started guide, https://software.intel.com/en-us/get-started-with-mpi-for-windows. Complete the Perquisites and then following the  steps to Compile and Run your program. Where the guide says “mpicc.bat” substitute “mpiifort.bat”.

The short summary:

With the Parallel Studio XE 2016 Cluster Edition installed, open the Fortran initialized command-prompt, and do the following:

1. mpiexec -register    (Done once only. Prompts for account and password, and enters info into registry to enable use of mpiexec)
2. mpiifort <your program.f90>
3. mpiexec -n <number of ranks> <your program.exe


For example:

program hello_world
use mpi
integer ierr

call MPI_INIT ( ierr )
print *, "Hello world"
call MPI_FINALIZE ( ierr )

stop
end
C:\> mpiexec -register
account (domain\user) [<your user id>]:
password:
confirm password:
Password encrypted into the Registry.
C:\> mpiifort hello_mpi.f90
mpifc.bat for the Intel(R) MPI Library 5.1 Update 1 for Windows*
Copyright(C) 2007-2015, Intel Corporation. All rights reserved.

Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.4.221 Build 20150407
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 12.00.31101.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:hello_mpi.exe
-subsystem:console
"/LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\mpi\intel64\bin\..\..\intel64\lib\release_mt"
"/LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\mpi\intel64\bin\..\..\intel64\lib"
impi.lib
hello_mpi.obj
C:\> mpiexec -n 4 hello_mpi.exe
 Hello world
 Hello world
 Hello world
 Hello world

 

0 Kudos
TimP
Honored Contributor III
3,037 Views

The instructions referred to above for Win 8/10 omit the step of looking in the Apps menu under the Windows Charms Start menu to find the Intel software installations.

0 Kudos
Kevin_D_Intel
Employee
3,037 Views

I suggested to the Doc team they add that detail into step 1 in the Compiler Getting Started under the Using the Command-line section. Thanks.

(Internal tracking id: DPD200376544)

(Resolution Update on 11/19/2015): This change has been for a major release next year)

0 Kudos
Reply