-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compiling NVCC 11 with C++17 #3085
Fix compiling NVCC 11 with C++17 #3085
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3085 +/- ##
=========================================
- Coverage 85.6% 85.6% -0.1%
=========================================
Files 122 122
Lines 10391 10391
=========================================
- Hits 8905 8904 -1
- Misses 1486 1487 +1
Continue to review full report at Codecov.
|
For me, all tests pass locally using |
@@ -202,11 +202,11 @@ do | |||
cuda_args="$cuda_args $1" | |||
;; | |||
#Handle unsupported standard flags | |||
--std=c++1y|-std=c++1y|--std=c++1z|-std=c++1z|--std=gnu++1y|-std=gnu++1y|--std=gnu++1z|-std=gnu++1z|--std=c++2a|-std=c++2a|--std=c++17|-std=c++17) | |||
--std=c++1y|-std=c++1y|--std=gnu++1y|-std=gnu++1y|--std=c++1z|-std=c++1z|--std=gnu++1z|-std=gnu++1z|--std=c++2a|-std=c++2a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't going to work for compilers that support C++17 with CUDA < 11. CMake is going to do a version test expecting to find C++17 support and will then fail the feature tests.
I think we are going to have to move c++17 into its own special case and make this version-dependent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested with
CUDA 9.1.85: gcc-6.5.0
CUDA 10.2: gcc-6.5.0, gcc-7.5.0, gcc-8.4.0
CUDA 11.0.167: gcc-6.5.0, gcc-7.5.0, gcc-8.4.0, gcc-9.3.0
and they all configure correctly.
bin/nvcc_wrapper
Outdated
@@ -224,7 +224,7 @@ do | |||
std_flag=$corrected_std_flag | |||
shared_args="$shared_args $std_flag" | |||
;; | |||
--std=c++11|-std=c++11|--std=c++14|-std=c++14) | |||
--std=c++11|-std=c++11|--std=c++14|-std=c++14|--std=c++17|-std=c++17) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you build with, e.g. CUDA 10 and GCC 8, CMake expects to have C++17 support but nvcc won't allow it. This undoes our trick of converting c++17 to c++14 for CMake feature tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... I don't have a problem with this combination
-- The CXX compiler identification is GNU 8.4.0
-- Check for working CXX compiler: /tmp/kokkos_new/bin/nvcc_wrapper
-- Check for working CXX compiler: /tmp/kokkos_new/bin/nvcc_wrapper -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The project name is: Kokkos
-- Compiler Version: 10.2.89
-- SERIAL backend is being turned on to ensure there is at least one Host space. To change this, you must enable another host execution space and configure with -DKokkos_ENABLE_SERIAL=OFF or change CMakeCache.txt
-- Using -std=c++14 for C++14 standard as feature
-- Execution Spaces:
-- Device Parallel: CUDA
-- Host Parallel: NONE
-- Host Serial: SERIAL
--
-- Architectures:
-- VOLTA70
-- Found CUDAToolkit: /tmp/cuda-10.2/include (found version "10.2.89")
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Found TPLCUDA: TRUE
-- Found TPLLIBDL: /usr/lib/x86_64-linux-gnu/libdl.so
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/kokkos_new/build_nvcc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't we fix it in the cmake, where we do something special with the feature test stuff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fixed in CMake 3.17 after they changed how feature detection works. This doesn't work in < 3.16, which is what we are stuck on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing we don't have a CMake < 3.16, GCC 8, CUDA 10 build in Jenkins/Travis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... I still can't reproduce any problem:
$ cmake --version
cmake version 3.10.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
$ cmake -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_VOLTA70=ON -DKokkos_CXX_STANDARD=14 ..
-- The CXX compiler identification is GNU 8.4.0
-- Check for working CXX compiler: /tmp/kokkos_new/bin/nvcc_wrapper
-- Check for working CXX compiler: /tmp/kokkos_new/bin/nvcc_wrapper -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The project name is: Kokkos
-- Compiler Version: 10.2.89
-- SERIAL backend is being turned on to ensure there is at least one Host space. To change this, you must enable another host execution space and configure with -DKokkos_ENABLE_SERIAL=OFF or change CMakeCache.txt
-- Using -std=c++14 for C++14 standard as feature
-- Execution Spaces:
-- Device Parallel: CUDA
-- Host Parallel: NONE
-- Host Serial: SERIAL
--
-- Architectures:
-- VOLTA70
-- Found CUDAToolkit: /tmp/cuda-10.2/include (found version "10.2.89")
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Found TPLCUDA: TRUE
-- Found TPLLIBDL: /usr/lib/x86_64-linux-gnu/libdl.so
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/kokkos_new/build_nvcc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-- Compiler Version: 10.1.243
-- SERIAL backend is being turned on to ensure there is at least one Host space. To change this, you must enable another host execution space and configure with -DKokkos_ENABLE_SERIAL=OFF or change CMakeCache.txt
-- Using -std=c++11 for C++11 standard as feature
CMake Error at cmake/kokkos_test_cxx_std.cmake:47 (MESSAGE):
Compiler NVIDIA should support cxx_std_11, but CMake reports feature not
supported
Call Stack (most recent call first):
cmake/kokkos_test_cxx_std.cmake:63 (kokkos_set_cxx_standard_feature)
cmake/kokkos_tribits.cmake:201 (INCLUDE)
CMakeLists.txt:161 (KOKKOS_SETUP_BUILD_ENVIRONMENT)
Fascinating. Does not happen with 3.10. Does happen with 3.12.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I can confirm that it fails for 3.12, 3.13 and 3.14. I now pushed another case to nvcc_wrapper
that handles -std=c++17
for NVCC
version < 11 and version >= 11.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for taking care of this.
Squash to single commit?
89a82fc
to
e2165a5
Compare
The CI failure is unrelated and fixed in #3114. Checking NVCC 11 with older compilers, I saw that |
I'll squash when people are happy with this (and the correct driver versions are installed everywhere). |
Retest this please. |
6528089
to
79bfe90
Compare
Please cleanup history and I will merge |
c7c2832
to
0c7d8f1
Compare
Rebased, squashed and CI passing. |
Fixes #3083. This is what I need to compile with NVCC 11 with
Kokkos_CXX_STANDARD=17
.