GPU support in cmake
Context
The (new) CMake build system works fine for CPU in different platforms: linux, windows and MacOS. Nevertheless, gpu - specifically CUDA- support was not considered.
What needs to be done
There are a couple of things that we know in advance that need to be done:
- Search and handle the libraries: CUDA, NVCC.
- Define specific gpu flags.
- Make lists and groups of objects that need to be compiled with the gpu flags. To the best of my knowledge such files are mainly in engines.
- Modify the helper_scripts to allow the users to trigger compilation of openDARTS using gpu.
- Think about how to compile the file
gpu_tools.h
. This one is tricky because is a header file that is included in other files but has cuda specific code. @luisaforozco thinks that maybe in this case is necessary to split this in two one header file and a.cu
file that has actual implementation in CUDA language. Unsuccessfully, tried to bypass this using:
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/gpu_tools.h PROPERTIES LANGUAGE CUDA)
- CUDA version. specifically TRUSTH that use to be in CUDA but not anymore and the open-DARTS code uses/needs it. Best to as @i-l-s-h-a-t who has explored this problem.
Besides these, there might be other bugs and errors that we may find in the process.
📚
Useful resources
@luisaforozco started putting together some modifications in the branch cmake_gpu
Edited by Luisa Orozco