Use Coarray within Visual Studio+Intel oneAPI

Hi there,

i am new to the Coarray feature of FORTRAN 2008. I try to practice this powerful function within Visual Studio IDE + intel oneAPI. With the compiler option /Qcoarray:shared, a simple null command-line program always produces Unknown option: -localonly. Did someone happen to experience the same issue and would like to give any hints about it? I would be very appreciated for your help.

I think the shared option requires a network of computers that can cooperate. I have just tested with just -Qcoarray and that works fine.

Hm, -Qcoarray:shared made no difference. I get the same result. But I am running the program in a console window, not in VS. (Note: ifort and ifx both work fine)

Could you post your program’s code and the exact compile/link options? Plus the compiler version, that might at some point be helpful too.

Hi Arjen, thanks for your reply.

Following is my program. Basically, it does nothing but with the switch “Enable Coarrays” on which adds the compiler option /Qcoarray:shared:

program test0

implicit none

write(*,*) 'Hello, World!'

end program test0

I also run it under the command line window on Windows 10. It always outputs Unknown option: -localonly rather than the espected Hello, World!.

I am using the ifx (or specifically Intel® Fortran Compiler 2024.0.2 included in Intel oneAPI 2024). But I also tried ifort. It does not change the result.

the compiler options are

/nologo /debug:full /Od /standard-semantics /Qcoarray:shared /warn:interfaces /module:"x64\Debug\\" /object:"x64\Debug\\" /Fd"x64\Debug\vc170.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c

and the options for the Linker are

/OUT:"..\bin\Win\test0.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST:NO /DEBUG /PDB:"..\bin\Win\test0.pdb" /SUBSYSTEM:CONSOLE /IMPLIB:"..\bin\Win\test0.lib"

Hm, that is really curious. My test program is slightly more complicated (a simple MC calculation), but it definitely runs with 24 images. No complaints about “-localonly” and my command-line options are very comparable as well. I thought the debugging options might get in the way, but that is not the case.

I am using a somewhat older version of Intel oneAPI: 2023.1.0.

The weirdest part is I have no idea which tool the option -localonly belongs to. I can not get any useful information about that after searching around the internet.

This “localonly” has to do with the communication between the various images taking place on the machine itself, but other than that it is beyond my expertise entirely. The underlying mechanisms are a complete terra incognita for me.

So, is it an option of the FORTRAN run-time library?

I found the option in libicaf.dll - one of the runtime libraries - but the omniscinet Google is strangely quiet about the combination “libicaf” and “localonly”. It also occurs in mpiexec.exe. And examining a few CMakeLists.txt files, it turns out to be an option to MPI:

  elseif(NOT APPLE AND MPI_${TEST_LANG}_COMPILER MATCHES ".*intel.*mpi.*")
    set(CURRENT_MPI "intelmpi")
    if(WIN32 AND MPI_LOCALONLY)
      set(MPI_LOCAL_OPT -localonly)
    endif()
  endif()

Perhaps searching for MPI options will help understand the problem?

I am a little confused here. Does this mean that the implementation mechanism of the coarray feature of FORTRAN depends on the MPI specification (in this case, implemented by the Intel MPI library)?

I do find the -localonly option in the page of Global Hydra Options of Intel MPI Library. But still, I have no idea about the relationship between the coarray feature and Intel MPI library. It seems that, when using the coarray feature, the Intel MPI library would be called with the -localonly option. However, that option is not recognized by the MPI command.

MPI is a fairly low-level communication protocol and is often used to implement Coarrays. The standard does not prescribe the use of MPI to implement them, far from it, but it is a convenient choice, I guess. Compare it to high-level programming languages and assembly - coarrays are the high-level part and MPI the assembly part (not my comparison, I have read it somewhere and found it interesting and useful enough to remember it :slight_smile: )

Ah, thanks for your explanation. Somehow, it seems that I went to the wrong direction. I just found that the test program runs successfully under the self-included cmd window Intel oneAPI command prompt for Intel 64 for Visual Studio 2022 (which can be launched from the start menu). Previous error report comes out from the running on a Powershell.
So, I guess this issue relate to the environament configuration, specifically, a different version of MPI might be used when running on different cmd windows.

Oh, yes, that is very well possible. I never use Powershell, but I do know that the MPI version in the program needs to match the runtime stuff. That is quite critical.

Thanks for all your replies, @Arjen. But I decide to just stop digging here as the original purpose is to familiarize myself with the Coarray feature of FORTRAN. It is acceptable to run all test programs under the specific CLI window.