Recent Kokkos changes require -std=c++11 flag with CUDA 8.0 & GCC 5.3
Created by: mhoemmen
@trilinos/framework
It looks like C++11 is not being enabled by default in a CUDA 8.0 + GCC 5.3 build with TpetraCore enabled. When I omit -std=c++11
from CMAKE_CXX_FLAGS
in a CUDA 8.0 + GCC 5.3 build with TpetraCore enabled, I get the following configure-time error:
-- MPI_EXEC='/projects/sems/install/rhel6-x86_64/kokkos/compiler/gcc/5.3.0/openmpi/2.0.1/cuda/8.0.44/bin/mpiexec'
-- The C compiler identification is GNU 5.3.0
-- Check for working C compiler: /projects/sems/install/rhel6-x86_64/kokkos/compiler/gcc/5.3.0/openmpi/2.0.1/cuda/8.0.44/bin/mpicc
-- Check for working C compiler: /projects/sems/install/rhel6-x86_64/kokkos/compiler/gcc/5.3.0/openmpi/2.0.1/cuda/8.0.44/bin/mpicc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- CMAKE_C_COMPILER_ID='GNU'
-- CMAKE_C_COMPILER_VERSION='5.3.0'
-- The CXX compiler identification is unknown
-- Check for working CXX compiler: /projects/sems/install/rhel6-x86_64/kokkos/compiler/gcc/5.3.0/openmpi/2.0.1/cuda/8.0.44/bin/mpicxx
-- Check for working CXX compiler: /projects/sems/install/rhel6-x86_64/kokkos/compiler/gcc/5.3.0/openmpi/2.0.1/cuda/8.0.44/bin/mpicxx -- broken
CMake Error at /projects/sems/install/rhel6-x86_64/sems/utility/cmake/3.3.2/share/cmake-3.3/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler
"/projects/sems/install/rhel6-x86_64/kokkos/compiler/gcc/5.3.0/openmpi/2.0.1/cuda/8.0.44/bin/mpicxx"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: .../Trilinos/CHECKIN-CUDA-8.0/MPI_DEBUG_REAL/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_64169/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_64169.dir/build.make
CMakeFiles/cmTC_64169.dir/build
gmake[1]: Entering directory
`.../Trilinos/CHECKIN-CUDA-8.0/MPI_DEBUG_REAL/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_64169.dir/testCXXCompiler.cxx.o
/projects/sems/install/rhel6-x86_64/kokkos/compiler/gcc/5.3.0/openmpi/2.0.1/cuda/8.0.44/bin/mpicxx
-Wall -expt-extended-lambda -o
CMakeFiles/cmTC_64169.dir/testCXXCompiler.cxx.o -c
.../Trilinos/CHECKIN-CUDA-8.0/MPI_DEBUG_REAL/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
/projects/sems/install/rhel6-x86_64/kokkos/compiler/cuda/8.0.44/bin/..//include/cuda_runtime.h:140:1:
warning: identifier ‘static_assert’ is a keyword in C++11
[-Wc++0x-compat]
/projects/sems/install/rhel6-x86_64/kokkos/compiler/cuda/8.0.44/bin/..//include/cuda_runtime.h:156:1:
warning: identifier ‘decltype’ is a keyword in C++11 [-Wc++0x-compat]
*
^
/projects/sems/install/rhel6-x86_64/kokkos/compiler/cuda/8.0.44/bin/..//include/cuda_runtime.h:133:29:
error: template argument 1 is invalid
#if defined(__cplusplus) && !defined(__CUDACC_RTC__)
^
/projects/sems/install/rhel6-x86_64/kokkos/compiler/cuda/8.0.44/bin/..//include/cuda_runtime.h:138:32:
warning: variadic templates only available with -std=c++11 or -std=gnu++11
* *
^
/projects/sems/install/rhel6-x86_64/kokkos/compiler/cuda/8.0.44/bin/..//include/cuda_runtime.h:140:15:
error: expected identifier before ‘sizeof’
/projects/sems/install/rhel6-x86_64/kokkos/compiler/cuda/8.0.44/bin/..//include/cuda_runtime.h:140:15:
error: expected ‘,’ or ‘...’ before ‘sizeof’
/projects/sems/install/rhel6-x86_64/kokkos/compiler/cuda/8.0.44/bin/..//include/cuda_runtime.h:140:104:
error: ISO C++ forbids declaration of ‘static_assert’ with no type
[-fpermissive]
/projects/sems/install/rhel6-x86_64/kokkos/compiler/cuda/8.0.44/bin/..//include/cuda_runtime.h:145:19:
warning: variadic templates only available with -std=c++11 or -std=gnu++11
/projects/sems/install/rhel6-x86_64/kokkos/compiler/cuda/8.0.44/bin/..//include/cuda_runtime.h:146:18:
warning: variadic templates only available with -std=c++11 or -std=gnu++11
/projects/sems/install/rhel6-x86_64/kokkos/compiler/cuda/8.0.44/bin/..//include/cuda_runtime.h:148:49:
warning: variadic templates only available with -std=c++11 or -std=gnu++11
....
When I add -std=c++11
to CMAKE_CXX_FLAGS
, I am able to configure Trilinos and build TpetraCore library, tests, and examples.