<div dir="ltr">I see - thanks! This is working now for 3.11 with CMAKE_CUDA_FLAGS.<br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, 24 Jul 2018 at 15:55, Stephen McDowell <<a href="mailto:sjm324@cornell.edu">sjm324@cornell.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>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.</div><div dir="auto"><br></div><div dir="auto">I think CUDA_NVCC_FLAGS is only used for the old cuda_add_library or executable functions.</div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">Hope that helps!</div><div dir="auto"><br></div><div dir="auto">-Stephen<br><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Tue, Jul 24, 2018, 1:48 PM Quang Ha <<a href="mailto:quang.t.ha.20@gmail.com" target="_blank">quang.t.ha.20@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>So, it doesn't seem that my setting in NVCC flags is being used:</div><div><br></div><div>In CMakeLists.txt:</div><div><br></div><div>project(tangram LANGUAGES CXX CUDA)</div><div>[...]</div><div><br></div><div> FIND_PACKAGE(CUDA REQUIRED)<br> if(CUDA_FOUND)<br> add_definitions(-DCUDA_CALLABLE="__host__ __device__")<br> set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-Xcompiler="-fopenmp -fPIC")<br> set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};--std=c++11 --expt-relaxed-constexpr)<br> set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_70,code=sm_70)<br> set(CUDA_PROPAGATE_HOST_FLAGS ON)<br> set(CUDA_SEPARABLE_COMPILATION OFF)<br> message(STATUS "CUDA include directories ${CUDA_INCLUDE_DIRS}")<br> message(STATUS "Overwriting THRUST_DIR to point to ${CUDA_INCLUDE_DIRS}/thrust")<br> set(THRUST_DIR "${CUDA_INCLUDE_DIRS}")<br> set(EXTRA_LIBS ${CUDA_LIBRARIES})<br> message("CUDA flags" ${CUDA_NVCC_FLAGS})<br> else(CUDA_FOUND)<br> message(FATAL "CUDA not found")<br> endif(CUDA_FOUND)<br>[...]</div><div><br></div><div>Then, at cmake stage:</div><div>[...]<br></div><div>-- Overwriting THRUST_DIR to point to /projects/opt/centos7/cuda/9.0/include/thrust<br>CUDA flags-Xcompiler="-fopenmp -fPIC"--std=c++11--expt-relaxed-constexpr-gencodearch=compute_70,code=sm_70<br>-- Adding application directory app<br>[...]</div><div><br></div><div>But then, build fail, and when I do make VERBOSE=1:</div><div>[...]<br></div><div>[ 60%] Building CUDA object app/simple-vfgen-cuda/CMakeFiles/simple-vfgen-cuda.dir/simple-vfgen-cuda.cu.o<br>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/<a href="http://simple-vfgen-cuda.cu" rel="noreferrer" target="_blank">simple-vfgen-cuda.cu</a> -o CMakeFiles/simple-vfgen-cuda.dir/simple-vfgen-cuda.cu.o<br>[...]<br></div><div><br></div><div>None of the flags was passed into nvcc. This is with cmake/<a href="http://3.11.1." rel="noreferrer" target="_blank">3.11.1.</a> Does upgrading to 3.12 recommended to solve the issue?</div><div><br></div><div>Thanks,</div><div>Quang<br></div></div>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div></div></div>
</blockquote></div>