Coarrays - "Attempting to use an MPI routine before initializing MPI"

Coarrays - "Attempting to use an MPI routine before initializing MPI"

I just tried to run a very simple code (see below) and got this error message "Attempting to use an MPI routine before initializing MPI".

The problem occurs with IVF 15 Beta, only with a Release x64 configuration.

Do I get a gold star for the smallest bug reproduced ever? :p


10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

It could be smaller, but I can't reproduce the problem. Can you show it from a command prompt? Include all the output from the command window.

Retired 12/31/2016

I slightly modified the code:


and I get the error message (one per image) as seen in the screenshot attached. This does not happen when I select the Debug (x64) configuration, only Release (x64).

Please do this from a command prompt, showing ALL the output from the beginning. Also, do you have any other MPI installed? What is the value of PATH?

Retired 12/31/2016


The sample above was launched from the command line, and that is really all the output there is. Here is the PATH data you requested:

C:\Program Files (x86)\Intel\Trace Analyzer and Collector\\bin;
C:\Program Files (x86)\Intel\MPI\\intel64\bin;
C:\Program Files (x86)\Intel\ICSXE\2015.0.008\bin;
C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\mpirt;
C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;
C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32\mpirt;
C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32\compiler;
C:\Program Files (x86)\Intel\Trace Analyzer and Collector\\dll\impi64;

No, you showed output from running the program in Visual Studio. I want to see a Fortran command prompt build session where the output starts with something like this (this is from 2013 SP1 but 2015 will have something similar):

Intel(R) Parallel Studio XE 2013 SP1
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
Intel(R) Composer XE 2013 SP1 (package 103)

Show the build of the program and running it.

As for PATH, your PATH has to have more in it than that - where did you get that from? From the command prompt window where you do the build (using "ifort /Qcoarray filename.f90") do a:

set path > path.txt

and paste the contents of path.txt (or better, attach it as a file). When pasting text, please use the "CODE" button in the editor (second from right) and select Plain (Text).

Retired 12/31/2016

Thanks Steve - your hint was sufficient for me to troubleshoot this issue; by comparing the path variable set by default on my machine and the path set in the Fortran command build session window.

Quick question though: on a 64-bit machine (assuming only 64-bit code is created), why do some paths to Intel components refer to 32-bit versions of dlls that ship with XE 2015, such as "C:\Program Files (x86)\Intel\Advisor XE 2015\bin32". My guess is that it is due to the integration into the 32-bit Visual Studio (2010) shell I use. Is this correct?


The default on a 64-bit system is that we install support for building and running both 32-bit and 64-bit applications. Windows x64 knows to automatically ignore the "wrong platform" DLLs when it is doing the DLL search, so that's why you'll see both 32-bit and 64-bit DLL locations in PATH. Also, many of the tools are 32-bit applications, so if they need DLLs they would be 32-bit.

Retired 12/31/2016


I spoke too fast and the problem is actually still there, so over the weekend I removed Visual Studio 2010 and all Intel compilers; and upgraded to Visual Studio 2013 and the current Beta version of Composer XE 2015 to see if this would help.

I compiled the code in two different ways: from the command line (ifort...) in the proper build window; and from Visual Studio. I gave a different name to both versions. The version compiled from the command line works; the version compiled from VS does not ("Attempting to use an MPI routine before initializing MPI"), even if I try to run it from the same build window I used to compile (successfully) the code from the command line.

Is there a particular library I should link to to use coarrays with Visual Studio? I note that when the code is built within VS in Debug (x64) mode it behaves properly; only in Release (x64) mode does the problem occur.


FYI: I solved the problem by copying the content of C:\Program Files (x86)\Intel\Composer XE 2015\redist\intel64\compiler into the directory where my executable is located. So as Steve suspected this is a path issue somewhere.

Leave a Comment

Please sign in to add a comment. Not a member? Join today