Merge pull request #83 from ax3l/fix-nvccFloat128GCC

Fix Trac 11852: CUDA in C++03 Mode and __float128
This commit is contained in:
jzmaddock
2015-12-18 11:56:36 +00:00
3 changed files with 38 additions and 8 deletions

View File

@ -57,16 +57,25 @@
#define BOOST_HAS_LONG_LONG #define BOOST_HAS_LONG_LONG
// //
// 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=5000 // doesn't actually support __int128 as of CUDA_VERSION=7500
// even though it defines __SIZEOF_INT128__. // even though it defines __SIZEOF_INT128__.
// See https://svn.boost.org/trac/boost/ticket/10418 // 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 // Only re-enable this for nvcc if you're absolutely sure
// of the circumstances under which it's supported. // of the circumstances under which it's supported.
// Similarly __SIZEOF_INT128__ is defined when targetting msvc // Similarly __SIZEOF_INT128__ is defined when targetting msvc
// compatibility even though the required support functions are absent. // 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 # define BOOST_HAS_INT128
#endif #endif

View File

@ -133,14 +133,23 @@
// //
// Recent GCC versions have __int128 when in 64-bit mode. // 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=5000 // doesn't actually support __int128 as of CUDA_VERSION=7500
// even though it defines __SIZEOF_INT128__. // even though it defines __SIZEOF_INT128__.
// See https://svn.boost.org/trac/boost/ticket/8048 // 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 // Only re-enable this for nvcc if you're absolutely sure
// of the circumstances under which it's supported: // 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 # define BOOST_HAS_INT128
#endif #endif
// //
@ -148,12 +157,16 @@
// include a std lib header to detect this - not ideal, but we'll // include a std lib header to detect this - not ideal, but we'll
// be including <cstddef> later anyway when we select the std lib. // be including <cstddef> later anyway when we select the std lib.
// //
// Nevertheless, as of CUDA 7.5, using __float128 with the host
// compiler in pre-C++11 mode is still not supported.
// See https://svn.boost.org/trac/boost/ticket/11852
//
#ifdef __cplusplus #ifdef __cplusplus
#include <cstddef> #include <cstddef>
#else #else
#include <stddef.h> #include <stddef.h>
#endif #endif
#if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) #if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) && !defined(BOOST_NVCC_CXX03)
# define BOOST_HAS_FLOAT128 # define BOOST_HAS_FLOAT128
#endif #endif

View File

@ -514,7 +514,15 @@ template<> struct assert_intrinsic_wchar_t<unsigned short> {};
# define BOOST_HAS_STDINT_H # define BOOST_HAS_STDINT_H
#endif #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 # define BOOST_HAS_INT128
#endif #endif