[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    [CMake] CMAKE doesn't pass NVCC flags?
From:       Quang Ha <quang.t.ha.20 () gmail ! com>
Date:       2018-07-24 20:47:57
Message-ID: CAGfE9+M0KouWihAN5f+j0i00rFoTuUUxAoq0DxZwkdggmU=trA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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

[Attachment #5 (text/html)]

<div dir="ltr"><div>So, it doesn&#39;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=&quot;__host__ \
__device__&quot;)<br>           set(CUDA_NVCC_FLAGS \
${CUDA_NVCC_FLAGS};-Xcompiler=&quot;-fopenmp -fPIC&quot;)<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 &quot;CUDA include directories \
${CUDA_INCLUDE_DIRS}&quot;)<br>           message(STATUS &quot;Overwriting THRUST_DIR \
to point to ${CUDA_INCLUDE_DIRS}/thrust&quot;)<br>           set(THRUST_DIR \
&quot;${CUDA_INCLUDE_DIRS}&quot;)<br>           set(EXTRA_LIBS ${CUDA_LIBRARIES})<br> \
message(&quot;CUDA flags&quot; ${CUDA_NVCC_FLAGS})<br>       else(CUDA_FOUND)<br>     \
message(FATAL &quot;CUDA not found&quot;)<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=&quot;-fopenmp \
-fPIC&quot;--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 &amp;&amp; \
/projects/opt/centos7/cuda/9.0/bin/nvcc   -DCUDA_CALLABLE=&quot;\&quot;__host__ \
__device__\&quot;&quot; -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">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.">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>



-- 

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



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic