Shared Cuda Fortran libraries?

Hello,

I have an existing Fortran library I would like to be able to run using cuda, but call from existing C Cuda code using shared libraries. Is this possible and if so, can I get a basic outline of how to compile the Fortran code such that it’s useable?

Thanks,

-drp

Hi drp,

If you’re calling the Fortran library from host code, then it’s the same as calling Fortran from C. However, you can only call device routines from device code.

  • Mat

So there currently exists no way to call a Fortran Device method from a C kernal?

thanks,

-drp

For both CUDA Fortran and CUDA C, there isn’t a linker for device code. Hence, there is no way to call external device routines from other device routines. Device calls must be inlined at compile time, so must be in the same file scope in CUDA C and module scope in CUDA Fortran.

You can call a CUDA Fortran global kernel from CUDA C host code as well as CUDA C global kernels from CUDA Fortran host code.

  • Mat