I see - thanks! This is working now for 3.11 with CMAKE_CUDA_FLAGS. On Tue, 24 Jul 2018 at 15:55, Stephen McDowell <sjm...@cornell.edu> wrote:
> I think you are mixing old and new approaches. Since you have enabled the > CUDA language (via your project(...) call), you should be using either > CUDAFLAGS or CMAKE_CUDA_FLAGS. > > I think CUDA_NVCC_FLAGS is only used for the old cuda_add_library or > executable functions. > > Note that finding the cuda package should no longer be necessary. If you > support non-CUDA builds you should use CheckLanguage and > enable_language(CUDA), and remove CUDA from the project(...) call. > Currently if nvcc is not found, configuration will fail because you have > CUDA in the project command which makes it required. > > Hope that helps! > > -Stephen > > On Tue, Jul 24, 2018, 1:48 PM Quang Ha <quang.t.ha...@gmail.com> wrote: > >> 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 >> -- >> >> 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: >> https://cmake.org/mailman/listinfo/cmake >> >
-- 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: https://cmake.org/mailman/listinfo/cmake