From a332112317450457c715675686386ec81214b863 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 18 Dec 2015 10:27:04 +0100 Subject: [PATCH 1/9] 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/9] 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/9] 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 From f384d058f9eb30a4c3033f90362802997550c58c Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 21 Dec 2015 09:58:51 -0800 Subject: [PATCH 4/9] Update Version number to 1.61 --- include/boost/version.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/version.hpp b/include/boost/version.hpp index fce02ec7..ce6f79f8 100644 --- a/include/boost/version.hpp +++ b/include/boost/version.hpp @@ -19,7 +19,7 @@ // BOOST_VERSION / 100 % 1000 is the minor version // BOOST_VERSION / 100000 is the major version -#define BOOST_VERSION 106000 +#define BOOST_VERSION 106100 // // BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION @@ -27,6 +27,6 @@ // number, y is the minor version number, and z is the patch level if not 0. // This is used by to select which library version to link to. -#define BOOST_LIB_VERSION "1_60" +#define BOOST_LIB_VERSION "1_61" #endif From af5351f42beed4dcadf43bd8a03d912836aa9f7b Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 1 Jan 2016 13:35:12 +0000 Subject: [PATCH 5/9] works in later libc++ releases. See also https://github.com/boostorg/config/pull/85/files --- include/boost/config/stdlib/libcpp.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/boost/config/stdlib/libcpp.hpp b/include/boost/config/stdlib/libcpp.hpp index ab5d1235..66642e72 100644 --- a/include/boost/config/stdlib/libcpp.hpp +++ b/include/boost/config/stdlib/libcpp.hpp @@ -53,6 +53,9 @@ # define BOOST_NO_CXX11_HDR_FUNCTIONAL # define BOOST_NO_CXX11_STD_ALIGN # define BOOST_NO_CXX11_ADDRESSOF +# if _LIBCPP_VERSION < 3700 +# define BOOST_NO_CXX11_HDR_ATOMIC +# endif #endif // @@ -62,7 +65,6 @@ # define BOOST_NO_CXX11_HDR_FUTURE # define BOOST_NO_CXX11_HDR_TYPE_TRAITS # define BOOST_NO_CXX11_ATOMIC_SMART_PTR -# define BOOST_NO_CXX11_HDR_ATOMIC // libc++ uses a non-standard messages_base #define BOOST_NO_STD_MESSAGES From b1df465870205a007fb6766ff9318c6ec27e6346 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 1 Jan 2016 16:01:16 +0000 Subject: [PATCH 6/9] Second try to get BOOST_NO_CXX11_HDR_ATOMIC set correctly. See https://github.com/boostorg/config/pull/85#issuecomment-168313984 --- include/boost/config/stdlib/libcpp.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/config/stdlib/libcpp.hpp b/include/boost/config/stdlib/libcpp.hpp index 66642e72..c32eddf4 100644 --- a/include/boost/config/stdlib/libcpp.hpp +++ b/include/boost/config/stdlib/libcpp.hpp @@ -53,9 +53,9 @@ # define BOOST_NO_CXX11_HDR_FUNCTIONAL # define BOOST_NO_CXX11_STD_ALIGN # define BOOST_NO_CXX11_ADDRESSOF -# if _LIBCPP_VERSION < 3700 -# define BOOST_NO_CXX11_HDR_ATOMIC -# endif +# define BOOST_NO_CXX11_HDR_ATOMIC +#elif _LIBCPP_VERSION < 3700 +# define BOOST_NO_CXX11_HDR_ATOMIC #endif // From 6d46b18e3bf7f4b6866fc11a4d00d4f71b74a29d Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 3 Jan 2016 14:12:01 +0000 Subject: [PATCH 7/9] Fix up std lib config for clang-3.8 and later --- include/boost/config/stdlib/libcpp.hpp | 18 ++++++++++++------ test/boost_no_cxx11_hdr_atomic.ipp | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/include/boost/config/stdlib/libcpp.hpp b/include/boost/config/stdlib/libcpp.hpp index c32eddf4..645bb63b 100644 --- a/include/boost/config/stdlib/libcpp.hpp +++ b/include/boost/config/stdlib/libcpp.hpp @@ -54,20 +54,26 @@ # define BOOST_NO_CXX11_STD_ALIGN # define BOOST_NO_CXX11_ADDRESSOF # define BOOST_NO_CXX11_HDR_ATOMIC +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_FUTURE #elif _LIBCPP_VERSION < 3700 -# define BOOST_NO_CXX11_HDR_ATOMIC -#endif - // // These appear to be unusable/incomplete so far: // -# define BOOST_NO_CXX11_HDR_CHRONO -# define BOOST_NO_CXX11_HDR_FUTURE -# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_ATOMIC # define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_FUTURE +#endif + +#if _LIBCPP_VERSION < 3700 // libc++ uses a non-standard messages_base #define BOOST_NO_STD_MESSAGES +#endif #if defined(__has_include) #if !__has_include() diff --git a/test/boost_no_cxx11_hdr_atomic.ipp b/test/boost_no_cxx11_hdr_atomic.ipp index b8e18766..edede3fc 100644 --- a/test/boost_no_cxx11_hdr_atomic.ipp +++ b/test/boost_no_cxx11_hdr_atomic.ipp @@ -29,7 +29,7 @@ int test() std::atomic a1; std::atomic a2; - std::atomic a3; + std::atomic a3; a1.is_lock_free(); a1.store(1); a1.load(); From 2090da494ebe0bd79997234a9733191eac425564 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 12 Jan 2016 16:40:54 +0000 Subject: [PATCH 8/9] Tentative fix for nvcc compiler. See https://svn.boost.org/trac/boost/ticket/11897. --- include/boost/config/compiler/nvcc.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/boost/config/compiler/nvcc.hpp b/include/boost/config/compiler/nvcc.hpp index bbe81f6e..5a047070 100644 --- a/include/boost/config/compiler/nvcc.hpp +++ b/include/boost/config/compiler/nvcc.hpp @@ -14,3 +14,11 @@ // NVIDIA Specific support // BOOST_GPU_ENABLED : Flag a function or a method as being enabled on the host and device #define BOOST_GPU_ENABLED __host__ __device__ + +// A bug in version 7.0 of CUDA prevents use of variadic templates in some occasions +// https://svn.boost.org/trac/boost/ticket/11897 +// This is fixed in 7.5. As the following version macro was introduced in 7.5 an existance +// check is enough to detect versions < 7.5 +#if !defined(__CUDACC_VER__) || (__CUDACC_VER__ < 70500) +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#endif From 9dd2b3afff6bdc01347bf6ae4d1a4eeabc632873 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 12 Jan 2016 16:41:20 +0000 Subject: [PATCH 9/9] Add nvcc macro info. --- test/config_info.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/config_info.cpp b/test/config_info.cpp index bb512ac3..bd3e849d 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -330,6 +330,13 @@ void print_compiler_macros() PRINT_MACRO(_NTO_VERSION); PRINT_MACRO(__OPEN64__); PRINT_MACRO(__open64); + PRINT_MACRO(__NVCC__); + PRINT_MACRO(__CUDACC__); + PRINT_MACRO(__CUDACC_RDC__); + PRINT_MACRO(__CUDACC_VER_MAJOR__); + PRINT_MACRO(__CUDACC_VER_MINOR__); + PRINT_MACRO(__CUDACC_VER_BUILD__); + PRINT_MACRO(__CUDACC_VER__); } void print_stdlib_macros()