I have the simple kernel in file kernel.cu
__global__ void add1( double * pi, double c )
{
*pi += c;
}
and can easily compile it to a ptx file kernel.ptx with:
nvcc -ptx kernel.cu
now, I wanted to reproduce the same behaviour using cmake with the following CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
project(cmake_ptx)
find_package(CUDA REQUIRED)
cuda_compile_ptx(
test
kernel.cu
)
but when I type
cmake . && make
no ptx file is built. How can I reproduce the behavior of the above nvcc command using cmake? In particular, how to:
add the standalone compilation of ptx files to a target (e.g. all): I noticed that when there is another cuda_add_executable inside the same CMakeFile, it also builds the ptx file, otherwise not.
name the file like the source file but with .ptx instead of .cu ending: related to this question: How do I change the output filename of cuda_compile_ptx in CMake?