Using cudafor (community edition) with another compiler


I am interested in using the cudafor module, as it seems to provide a very useful inline abstraction for cuda kernels. However, I require some very specific functionality from a compiler other than pgfortran for this particular project. I initially tried to link the code with the cudafor.mod, but was unable to find this file in my installation. Is this file available somewhere? Also, is this type of usage as simple as I am anticipating, or will the compiler need to be specially designed to handle the cudafor code?

Hi m.davis,

Currently two compilers, PGI and IBM’s XL, support CUDA Fortran. The “cudafor” module is the interface module to the CUDA Fortran API.

Are you just using the cudafor module as an interface to the CUDA C API or are you using CUDA Fortran features such as the “device” attribute?

You can write you’re own interface module, but without the interoperability between CUDA Fortran and CUDA C, it can be a challenge dealing with C device pointers in Fortran. You may need to instead write a C bridge between Fortran and CUDA C to handle the translation.

If you are using CUDA Fortran features, then you’ll need to use PGI or XL.