Using cudafor (community edition) with another compiler

Post Reply
m.davis
Posts: 1
Joined: Apr 22 2020

Using cudafor (community edition) with another compiler

Post by m.davis » Wed Apr 22, 2020 8:10 pm

Hello,

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?

mkcolg
Posts: 8382
Joined: Jun 30 2004

Re: Using cudafor (community edition) with another compiler

Post by mkcolg » Thu Apr 23, 2020 10:00 am

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.

-Mat

Post Reply