From a332112317450457c715675686386ec81214b863 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 18 Dec 2015 10:27:04 +0100 Subject: [PATCH 1/3] Fix Trac 11852: GCC & CUDA __float128 Fix trac issue https://svn.boost.org/trac/boost/ticket/11852 Similar to https://svn.boost.org/trac/boost/ticket/8048 `__float128` is still unsupported when compiling with nvcc (tested with `CUDA 7.5.18`). First noticed with the latest release (`1.60.0`) and `GCC 4.8.5` but should affect all previous releases depending on used modules. In my case, I triggered it with the components `program_options regex filesystem system thread math_tr1` enabled . --- include/boost/config/compiler/gcc.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/boost/config/compiler/gcc.hpp b/include/boost/config/compiler/gcc.hpp index d9dd59dc..8683dbd1 100644 --- a/include/boost/config/compiler/gcc.hpp +++ b/include/boost/config/compiler/gcc.hpp @@ -134,7 +134,7 @@ // Recent GCC versions have __int128 when in 64-bit mode. // // We disable this if the compiler is really nvcc as it -// doesn't actually support __int128 as of CUDA_VERSION=5000 +// doesn't actually support __int128 as of CUDA_VERSION=7500 // even though it defines __SIZEOF_INT128__. // See https://svn.boost.org/trac/boost/ticket/8048 // Only re-enable this for nvcc if you're absolutely sure @@ -148,12 +148,16 @@ // include a std lib header to detect this - not ideal, but we'll // be including later anyway when we select the std lib. // +// Nevertheless, as of CUDA 7.5, using __float128 with the host +// compiler is still not supported. +// See https://svn.boost.org/trac/boost/ticket/11852 +// #ifdef __cplusplus #include #else #include #endif -#if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) +#if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) && !defined(__CUDACC__) # define BOOST_HAS_FLOAT128 #endif From e5b21fb9b47e2e8c69a31237dc326d5282c42513 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 18 Dec 2015 10:50:50 +0100 Subject: [PATCH 2/3] Refactor int/float128: NVCC -std=c++11 refactor the previous solution: nvcc with c++11 supports __int128 and __float128 --- include/boost/config/compiler/gcc.hpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/include/boost/config/compiler/gcc.hpp b/include/boost/config/compiler/gcc.hpp index 8683dbd1..fbd3dd9c 100644 --- a/include/boost/config/compiler/gcc.hpp +++ b/include/boost/config/compiler/gcc.hpp @@ -133,14 +133,23 @@ // // Recent GCC versions have __int128 when in 64-bit mode. // -// We disable this if the compiler is really nvcc as it +// We disable this if the compiler is really nvcc with C++03 as it // doesn't actually support __int128 as of CUDA_VERSION=7500 // even though it defines __SIZEOF_INT128__. // See https://svn.boost.org/trac/boost/ticket/8048 +// https://svn.boost.org/trac/boost/ticket/11852 // Only re-enable this for nvcc if you're absolutely sure // of the circumstances under which it's supported: // -#if defined(__SIZEOF_INT128__) && !defined(__CUDACC__) +#if defined(__CUDACC__) +# if defined(BOOST_GCC_CXX11) +# define BOOST_NVCC_CXX11 +# else +# define BOOST_NVCC_CXX03 +# endif +#endif + +#if defined(__SIZEOF_INT128__) && !defined(BOOST_NVCC_CXX03) # define BOOST_HAS_INT128 #endif // @@ -149,7 +158,7 @@ // be including later anyway when we select the std lib. // // Nevertheless, as of CUDA 7.5, using __float128 with the host -// compiler is still not supported. +// compiler in pre-C++11 mode is still not supported. // See https://svn.boost.org/trac/boost/ticket/11852 // #ifdef __cplusplus @@ -157,7 +166,7 @@ #else #include #endif -#if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) && !defined(__CUDACC__) +#if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) && !defined(BOOST_NVCC_CXX03) # define BOOST_HAS_FLOAT128 #endif From 73ee4f5b031a02871b1f4d3e608ebd2c2dd54288 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 18 Dec 2015 11:41:56 +0100 Subject: [PATCH 3/3] int128 & CUDA C++03: Update ICC and Clang --- include/boost/config/compiler/clang.hpp | 15 ++++++++++++--- include/boost/config/compiler/intel.hpp | 10 +++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/include/boost/config/compiler/clang.hpp b/include/boost/config/compiler/clang.hpp index 5481e5ee..01355bb7 100644 --- a/include/boost/config/compiler/clang.hpp +++ b/include/boost/config/compiler/clang.hpp @@ -57,16 +57,25 @@ #define BOOST_HAS_LONG_LONG // -// We disable this if the compiler is really nvcc as it -// doesn't actually support __int128 as of CUDA_VERSION=5000 +// We disable this if the compiler is really nvcc with C++03 as it +// doesn't actually support __int128 as of CUDA_VERSION=7500 // even though it defines __SIZEOF_INT128__. // See https://svn.boost.org/trac/boost/ticket/10418 +// https://svn.boost.org/trac/boost/ticket/11852 // Only re-enable this for nvcc if you're absolutely sure // of the circumstances under which it's supported. // Similarly __SIZEOF_INT128__ is defined when targetting msvc // compatibility even though the required support functions are absent. // -#if defined(__SIZEOF_INT128__) && !defined(__CUDACC__) && !defined(_MSC_VER) +#if defined(__CUDACC__) +# if defined(BOOST_GCC_CXX11) +# define BOOST_NVCC_CXX11 +# else +# define BOOST_NVCC_CXX03 +# endif +#endif + +#if defined(__SIZEOF_INT128__) && !defined(BOOST_NVCC_CXX03) && !defined(_MSC_VER) # define BOOST_HAS_INT128 #endif diff --git a/include/boost/config/compiler/intel.hpp b/include/boost/config/compiler/intel.hpp index 7789b944..88ac023a 100644 --- a/include/boost/config/compiler/intel.hpp +++ b/include/boost/config/compiler/intel.hpp @@ -514,7 +514,15 @@ template<> struct assert_intrinsic_wchar_t {}; # define BOOST_HAS_STDINT_H #endif -#if defined(__LP64__) && defined(__GNUC__) && (BOOST_INTEL_CXX_VERSION >= 1310) && !defined(__CUDACC__) +#if defined(__CUDACC__) +# if defined(BOOST_GCC_CXX11) +# define BOOST_NVCC_CXX11 +# else +# define BOOST_NVCC_CXX03 +# endif +#endif + +#if defined(__LP64__) && defined(__GNUC__) && (BOOST_INTEL_CXX_VERSION >= 1310) && !defined(BOOST_NVCC_CXX03) # define BOOST_HAS_INT128 #endif