Showing results for 
Search instead for 
Did you mean: 

How to do parallel computing with fortran

Hi, I am not a computer science major, so I am very much confused by lots of the user guide online in this relevant topic, but I have decent knowledge in matlab and fortran coding, just have not done parallel computing with fortran before. I would appreciate if you can provide your replies in layman fashion. 

Here is my situation: I have installed Microsoft Visual Studio 2015 and recently installed Intel Parallel Studio XE Cluster Edition for Windows*, I have windows 10 x64 system and multiple cores in my CPU. I would like to harvest my parallel computer power using fortran. So I got this Hello World sample code for a try and clicked build button on my MS VS: 

    program Console3

    implicit none

    include "mpif.h"
    integer ierr, my_rank, nprocs

    call MPI_INIT(ierr)
    call MPI_COMM_RANK(MPI_COMM_WORLD,my_rank,ierr)
    call MPI_COMM_SIZE(MPI_COMM_WORLD,nprocs,ierr)

    write(*,*) 'Hello from processor ',my_rank,' out of ', nprocs

    call MPI_FINALIZE(ierr)

    end program Console3

But the following errors appeared in the building process:

Severity    Code    Description    Project    File    Line    Suppression State
Error        Compilation Aborted (code 1)        c:\users\wg7\documents\visual studio 2015\Projects\Console3\Console3\Console3.f90    1    
Error        error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MPI]        c:\users\wg7\documents\visual studio 2015\Projects\Console3\Console3\Console3.f90    17    
Error        error #6404: This name does not have a type, and must have an explicit type.   [MPI_COMM_WORLD]        c:\users\wg7\documents\visual studio 2015\Projects\Console3\Console3\Console3.f90    23    


So I figured maybe I need to do something extra to use this MPI library. I tried to read some user guide:, but the language there is all very confusing and unclear to me, I have also tried in command prompt:

C:\Program Files (x86)\IntelSWTools\mpi\\intel64\bin>mpivars

Intel(R) MPI Library 5.1 Update 3 for Windows* Target Build Environment for Intel(R) 64 applications
Copyright (C) 2007-2015 Intel Corporation. All rights reserved.

C:\Program Files (x86)\IntelSWTools\mpi\\intel64\bin>hydra_service -install
OpenSCManager failed:
Access is denied. (error 5)
Unable to remove the previous installation, install failed.

C:\Program Files (x86)\IntelSWTools\mpi\\intel64\bin>hydra_service -start
OpenSCManager failed:
Access is denied. (error 5)

But I am not sure what it did nor whether it helped. Here is what I know and what I do not know:

1) I know the intel cluster edition should already include MPI library which includes everything I need. 

2) I know I need to link MPI library with MS VStudio but I do not know how or whether it is already linked, or how to set the parameters in property. 

3) I know the fortran code needs to include some special lines for MPI, but I do not know how to compile and build it to become an exe application.

4) I know where is the installation folder with the mpi applications and where is my fortran project folder, they are separate folders. But sometimes I do not know which folder to direct to in command prompt, or whether I should add which path to which. 

Searching online always just gets me little pieces for the above problem, but what I really would like is to see a comprehensive step by step guide and examples. If you would help me put things together, I would really appreciate it. Thank you! 

0 Kudos
3 Replies

Hi Grace,

I'd recommend you to learn Getting Started with Intel® MPI Library for Windows* OS at first.

You can find the information how to compile an MPI application in the Intel® MPI Library Developer Guide for Windows* OS with Microsoft* Visual Studio* or through the command line.

Regarding to the error:

C:\Program Files (x86)\IntelSWTools\mpi\\intel64\bin>hydra_service -install
OpenSCManager failed:
Access is denied. (error 5)
Unable to remove the previous installation, install failed.

It's caused by insufficient permissions - you need Administrators permissions to install the Hydra service.

BTW you can find this and other failures in the Intel MPI Troubleshooting Guide.



When you have successfully built your program and are ready to run it, be aware that the requirement for Administrator privileges for the Hydra service can be circumvented in one of three ways, as shown in this post:



Thank you. I was able to configurate MPI following the instruction online.