Mixing Intel Fortran and PGI Fortran

Hello.

I’m targeting a machine which has both NVIDIA GPU and Intel Xeon Phi.

Therefore I want to use CUDA Fortran as well as Intel offload directives. (I don’t really prefer using OpenACC for targeting Xeon Phi.)

So, I want to know if mixing Intel Fortran and PGI Fortran is theoretically possible through a C interface.

Although mixing Intel Fortran and PGI Fortran directly does not work, since GCC is interoperable with both Intel and PGI, I think it will be possible.

Or if you have some better ideas instead of mixing compilers, please tell me.

To mix the Intel and PGI fortran objects into the same executable, requires
some care. You have to decide which compiler will compile sources with I/O stmts, and which compiler is only going to compile subroutines or functions
with a Fortran 77 ‘pass by address’ argument interface. Difficult to debug.

Linking with C objects should be done using ISO_C_BINDINGs, which both
compilers will support.

It may be better to use OpenACC '-ta=tesla,multicore ’ with PGI compilers, and
see if the Phi runs the multicore part (when you set ENV variables to run
on the host only).

Or, create a source that compiles for Phi with Intel compilers,
and compiles for OpenACC/CUDA Fortran with pgfortran.

dave