Hi James,
Thanks for the quick reply. Some thoughts...
FindCUDA only looks for .cu files. In CUDA_WRAP_SRCS:
get_source_file_property(_is_header ${file} HEADER_FILE_ONLY)
if(${file} MATCHES "\\.cu$" AND NOT _is_header)
What benefit is there in keeping cuda code in .cpp files?
It allows us to write code that supports both a host library when there
is no GPU and a CUDA library. We've gotten very good at this, and keep
all our code in .cpp files.
Would it be possible to add a flag or option that disables that
checking? I'd even be happy with it as a global "everything is CUDA"
flag. NVCC does support this with '-x=cu'.
You can't use nvcc to link. CMake makes this difficult, and in VS it is
impossible. Instead what I've done for device linking is to create an
intermediate object file that is the product of linking. FindCUDA
supports separable compilation for a single executable module, but not
for multiple ones. I had an example laying around for doing this, but
I'm not sure where it ended up. Basically you add a prelink custom
command that takes the objects and libraries that contain device code
for your target executable module and link them using nvcc producing
another object file that is then linked into the final executable module
using the host linker.
I follow you here. I do this as well in a different part. I agree it's
hard, so things may be as good as they can be.
I'm not sure what is going wrong. If you do this:
set(CUDA_NVCC_FLAGS -arch sm_20)
add_subdirectory(tests)
then CUDA_NVCC_FLAGS should have "-arch;sm_20" defined in
tests/CMakeLists.txt.
Ah, I meant that the subproject itself can't modify CUDA_NVCC_FLAGS. The
flags itself are passed from the superproject fine. I think this isn't
really an issue though, the device linking is probably good enough.
Irwin
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake