I am currently working on an application which uses both C and Fortran components, and I am looking ahead to plan GPU optimization on a Tesla Platform. I’m aware that there is a Cuda C and a Cuda Fortran available, but has anyone tried compiling an application of both Cuda C and Cuda Fortran before? Is it the same process as compiling C and Fortran normally? I would like to know so I may be able to plan my architecture a little more carefully to avoid future frustrations.
The book “CUDA Fortran for Scientists and Engineers” by Gregory Ruetsch and Massimiliano Fatica provides a couple of minimal examples in appendix C of CUDA Fortran code calling CUDA library functions as well as custom kernels written in CUDA C. From what I see there, this is straightforward and based on iso_c_binding, which should be familiar to any modern Fortran programmer who needs to interface with C code.
[Full disclosure: I worked closely with both authors while I was at NVIDIA and reviewed portions of the book’s manuscript prior to publication]
Did you check whether the CUDA Fortran documentation covers this topic and/or whether any examples of CUDA C/Fortran interop ship with CUDA Fortran? You may be envisioning other models of mixing code, e.g. linking together separately compiled device code object modules some of which are generated from CUDA C while others are generated from CUDA Fortran; no idea whether that is supported.
Thank You so much for that explanation! I have known about Cuda since it was released, but am only just now diving in to it, so I did not even know where to begin looking. I endeavor to be thoughtful in my research before posting, but sometimes you just have to start asking questions haha