I have built a simple CMake CUDA project, and the content of the CMakeLists.txt is as follows:
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
if (NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES native)
endif()
project(cuda-test LANGUAGES CXX CUDA)
set(CMAKE_CXX_STANDARD 14)
#Boost
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.80.0 REQUIRED)
add_executable(cuda-test src/main.cu)
There exists an ‘src’ directory at the same level as the CMakeLists.txt, which includes a main.cu file, the contents are as follows:
#include <boost/math/constants/constants.hpp>
int main(){
}
When compiling, the following error is reported:
**/usr/local/include/boost/math/constants/constants.hpp:** In static member function ‘**static const T& boost::math::constants::detail::constant_half<T>::get(const std::integral_constant<int, 4>&)**’:
**/usr/local/include/boost/math/constants/constants.hpp:246:1024:** **error:** template argument 2 is invalid
BOOST_DEFINE_MATH_CONSTANT(half, 5.000000000000000000000000000000000000e-01, "5.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-01")
But if the main.cu file is changed to main.cpp, the compilation does not report any errors.
OS: Ubuntu 18.04.6 LTS
Cuda Toolkit: Cuda compilation tools, release 12.1, V12.1.105, Build cuda_12.1.r12.1/compiler.32688072_0
gcc: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
boost:1.80.0
I am not sure if I have set something incorrectly or if this is a bug in CUDA.