Re: [CMake] compiling .cpp/.cxx with CUDA compiler

2019-07-03 Thread Kai Germaschewski
Thank. Yeah, I've seen BLT through it's use in RAJA. You're right, it'd work, but I'm reluctant to stray away from "vanilla" cmake too much, since other people will have to deal with this code, and cmake itself is already quite a step up from the regular Makefiles that they're used to. --Kai On

Re: [CMake] compiling .cpp/.cxx with CUDA compiler

2019-07-02 Thread Kai Germaschewski
On Tue, Jul 2, 2019 at 2:48 PM Robert Maynard wrote: > get_target_property(source_files SOURCES) > set_source_files_properties(${source_files} PROPERTIES LANGUAGE CUDA) > Thanks, that'll work for the time being, I can put this into a function/macro and it'll look alright. --Kai -- Powered by

Re: [CMake] compiling .cpp/.cxx with CUDA compiler

2019-07-02 Thread Dmitry Mikushin
Compiling C++ code with CUDA compiler practically means only to implicitly include a bunch of CUDA-specific headers like cuda_runtime_api.h. Other than that, it's the same as compiling with the host C++ compiler. Thus, you can get the desired behavior by explicitly including those headers in case o

Re: [CMake] compiling .cpp/.cxx with CUDA compiler

2019-07-02 Thread Robert Maynard
In general I go with the source property approach, since you can pass it a collection of files to be marked as CUDA. If you are aware of when all sources have been added to a target you can easily mark them all as cuda with: get_target_property(source_files SOURCES) set_source_files_properties(${

[CMake] compiling .cpp/.cxx with CUDA compiler

2019-07-02 Thread Kai Germaschewski
For background, a bunch of projects help writing portable C++ code that can be compiled into CUDA device code as one option, e.g. hemi, kokkos, RAJA ( https://devblogs.nvidia.com/simple-portable-parallel-c-hemi-2/). As a consequence, if available those source files need to be compiled with the CUDA