diff --git a/cuda-flags.file b/cuda-flags.file index 2e4b869e2e5..4767f6c9940 100644 --- a/cuda-flags.file +++ b/cuda-flags.file @@ -15,9 +15,11 @@ # LLVM style for listing the supported CUDA compute architectures %define llvm_cuda_arch %(echo $(for ARCH in %cuda_arch; do echo "$ARCH"; done) | sed -e"s/ /,/g") +# C++ standard to use for building host and device code with nvcc +%define nvcc_stdcxx -std=c++17 -# enable C++17, and generate optimised code -%define cuda_flags_0 -std=c++17 -O3 +# generate optimised code +%define cuda_flags_0 -O3 # generate debugging information for device code %define cuda_flags_1 --generate-line-info --source-in-ptx @@ -38,4 +40,4 @@ %define cuda_flags_6 --cudart shared # collect all CUDA flags -%define cuda_flags %{cuda_flags_0} %{cuda_flags_1} %{cuda_flags_2} %{cuda_flags_3} %{cuda_flags_4} %{cuda_flags_5} %{cuda_flags_6} +%define nvcc_cuda_flags %{nvcc_stdcxx} %{cuda_flags_0} %{cuda_flags_1} %{cuda_flags_2} %{cuda_flags_3} %{cuda_flags_4} %{cuda_flags_5} %{cuda_flags_6} diff --git a/cuda-toolfile.spec b/cuda-toolfile.spec index f3099e50ea1..a3efd8f7917 100644 --- a/cuda-toolfile.spec +++ b/cuda-toolfile.spec @@ -6,7 +6,7 @@ Requires: cuda %install ## INCLUDE cuda-flags -# defines cuda_flags +# defines nvcc_cuda_flags and nvcc_stdcxx mkdir -p %{i}/etc/scram.d cat << \EOF_TOOLFILE >%{i}/etc/scram.d/cuda-stubs.xml @@ -36,10 +36,10 @@ cat << \EOF_TOOLFILE >%{i}/etc/scram.d/cuda.xml - + - + diff --git a/cupla.spec b/cupla.spec index caf34ba280d..b23dbb9fe2b 100644 --- a/cupla.spec +++ b/cupla.spec @@ -10,7 +10,7 @@ Requires: tbb %build ## INCLUDE cuda-flags -# defines cuda_flags +# defines nvcc_cuda_flags and nvcc_stdcxx mkdir build lib @@ -18,8 +18,8 @@ mkdir build lib rm -rf alpaka CXXFLAGS="-DALPAKA_DEBUG=0 -I$CUDA_ROOT/include -I$TBB_ROOT/include -I$BOOST_ROOT/include -I$ALPAKA_ROOT/include -Iinclude" -HOST_FLAGS="-std=c++17 -O2 -pthread -fPIC -Wall -Wextra" -NVCC_FLAGS="%{cuda_flags}" +HOST_FLAGS="%{nvcc_stdcxx} -O2 -pthread -fPIC -Wall -Wextra" +NVCC_FLAGS="%{nvcc_cuda_flags}" FILES=$(find src -type f -name *.cpp) # build the serial CPU backend