[CMake] CMAKE doesn't pass NVCC flags?
Quang Ha
quang.t.ha.20 at gmail.com
Tue Jul 24 16:47:57 EDT 2018
So, it doesn't seem that my setting in NVCC flags is being used:
In CMakeLists.txt:
project(tangram LANGUAGES CXX CUDA)
[...]
FIND_PACKAGE(CUDA REQUIRED)
if(CUDA_FOUND)
add_definitions(-DCUDA_CALLABLE="__host__ __device__")
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-Xcompiler="-fopenmp -fPIC")
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};--std=c++11
--expt-relaxed-constexpr)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode
arch=compute_70,code=sm_70)
set(CUDA_PROPAGATE_HOST_FLAGS ON)
set(CUDA_SEPARABLE_COMPILATION OFF)
message(STATUS "CUDA include directories ${CUDA_INCLUDE_DIRS}")
message(STATUS "Overwriting THRUST_DIR to point to
${CUDA_INCLUDE_DIRS}/thrust")
set(THRUST_DIR "${CUDA_INCLUDE_DIRS}")
set(EXTRA_LIBS ${CUDA_LIBRARIES})
message("CUDA flags" ${CUDA_NVCC_FLAGS})
else(CUDA_FOUND)
message(FATAL "CUDA not found")
endif(CUDA_FOUND)
[...]
Then, at cmake stage:
[...]
-- Overwriting THRUST_DIR to point to
/projects/opt/centos7/cuda/9.0/include/thrust
CUDA flags-Xcompiler="-fopenmp
-fPIC"--std=c++11--expt-relaxed-constexpr-gencodearch=compute_70,code=sm_70
-- Adding application directory app
[...]
But then, build fail, and when I do make VERBOSE=1:
[...]
[ 60%] Building CUDA object
app/simple-vfgen-cuda/CMakeFiles/simple-vfgen-cuda.dir/simple-vfgen-cuda.cu.o
cd /home/qth20/develop/tangram/build/app/simple-vfgen-cuda &&
/projects/opt/centos7/cuda/9.0/bin/nvcc -DCUDA_CALLABLE="\"__host__
__device__\"" -DHAVE_LAPACKE -DTHRUST
-DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CUDA
-DTHRUST_HOST_SYSTEM=THRUST_HOST_SYSTEM_OMP -I/home/qth20/develop/tangram
-I/home/qth20/develop/tangram/build
-I/home/qth20/develop/tangram/cinch/logging
-I/home/qth20/installed/jali/include
-I/home/qth20/installed/jali-tpls/include
-I/home/qth20/installed/jali-tpls/trilinos-12-10-1/include
-I/projects/opt/centos7/openmpi/3.1.0-gcc_8.1.0/include
-I/home/qth20/installed/jali-tpls/trilinos-12-10-1/lib/cmake/Zoltan/../../../include
-I/home/qth20/installed/jali-tpls/include/UnitTest++ -I/usr/include/lapacke
-I/home/qth20/installed/xmof2d/include
-I/projects/opt/centos7/cuda/9.0/include -O3 -DNDEBUG -std=c++11 -x cu
-c /home/qth20/develop/tangram/app/simple-vfgen-cuda/simple-vfgen-cuda.cu
-o CMakeFiles/simple-vfgen-cuda.dir/simple-vfgen-cuda.cu.o
[...]
None of the flags was passed into nvcc. This is with cmake/3.11.1. Does
upgrading to 3.12 recommended to solve the issue?
Thanks,
Quang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180724/aecccec5/attachment.html>
More information about the CMake
mailing list