Adding support for compiling NVIDIA CUDA .cu files with nvcc to DOLFIN build system

Asked by Florian Rathgeber

Hi,

I want to add some CUDA code to my custom DOLFIN branch and hope to get some help on how to integrate that into the DOLFIN build process. Currently I compile all my .cu files separately and link them to a shared library which I then link against my application next to libdolfin. However I would like to integrate this code more tightly and not have to work with two separate libraries. Especially when it comes to la backends, I need to couple this code to DOLFIN in order to use it with the same syntax and semantics.

More concise, my question is: which part the DOLFIN build system would I need to touch to integrate support for compiling .cu files with nvcc?

For using nvcc and the CUDA runtime with SCons I use a custom tool. Since it seems not possible to attach files to questions I'll send it to the mailing list later if that's useful.

I made one attempt to build DOLFIN entirely with nvcc, but that failed due to some shortcomings in nvcc and bugs with gcc integration (nvcc is a compiler driver, it basically splits the code into CUDA code handled by the NVIDIA compiler cudafe and C++ code passed to gcc, but this still doesn't work reliably). So I assume the best way to go is to keep using mpicxx for all the cpp files and only use nvcc for cu files.

Florian

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Garth Wells (garth-wells) said :
#1

The easiest solution is probably to build things separately if using nvcc for everything doesn't work. Creating a custom pkg-config (.pc) file might help. It would be tricky/complicated to have the DOLFIN build system use different compilers for different components.

I plan to play around with nvcc soon, so let me know how you get along. I'll let you know if I find an easy way to integrate nvcc.

Revision history for this message
Garth Wells (garth-wells) said :
#2

It would be worth revisiting this with the new CMake build system. There is a CMake module 'FindCUDA.cmake' which should help to get all the bits and pieces.

Can you help with this problem?

Provide an answer of your own, or ask Florian Rathgeber for more information if necessary.

To post a message you must log in.