Coarrays and Intel Fortran compiler (ifort)

Hi all,

I’m trying to wrap my head around how the intel compiler (ifort, not ifx) handles coarrays. It seems like when I build a coarray program with ifort -coarray , the resulting binary does depend on the MPI library (according to ldd), but when I run it, it spawns one image per CPU core. If I run it under mpiexec -n 2 then it spawns… TWO images per CPU core. Does anybody know what’s going on? Is it actually using MPI under the hood or not, and either way, how do you control the image count? Thanks.

Yes, Intel coarray implementation is powered by Intel’s MPI run-time libraries.

See their compiler option coarray-num-images=n and what happens when you go with default.


You can also use an environment variable, for example:

$ ifort -coarray myprogram.f90

Ahhh okay, thanks to both of you. So it looks like you aren’t supposed to run coarray programs with mpiexec if they’re built with ifort. Rather you’re supposed to use environment variables or compiler flags to control the MPI configuration and then just launch the program. I have been used to OpenCoarrays, where you invoke mpiexec yourself. Thank you again.

1 Like

With OpenCoarrays, the preferred program launcher is cafrun. Although it is true that it currently wraps mpiexec or mpirun, there have in the past been alternatives such as GASNet and OpenSHMEM and University of Rom “Tor Vergata” Prof. Salvatore Filippone will supervise a graduate student who starts next month on writing an OpenSHMEM implementation atop GASNet with the motivation of reviving these MPI alternatives in a combined form. If that works out, then there could be future options to install OpenCoarrays with MPI or OpenSHMEM/GASnet under the hood. Launching with cafrun could then be the universal way to launch independent of which transport layer is used.


You can use Intel MPI’s mpiexecwith ifort if you specify -coarray=single. The manual doesn’t describe this very well. There’s also -coarray-config-file=filename.

1 Like

Thanks Damian for clarifying. Yes, cafrun is what we should be using to launch OpenCoarray programs.

And thanks Steve, that point about -coarray=single is exactly what I was looking for! I prefer to control the MPI launch parameters via mpiexec.