I have some C++ code that compiled just fine with nvcc from CUDA 12.6.1 and Boost 1.84.0. After updating to Boost 1.88.0, which includes the GPU math changes from Boost 1.87.0, I'm now seeing the following error message:
/usr/include/boost/multiprecision/detail/functions/pow.hpp(789): error: namespace "boost::math" has no member "rounding_error"
catch(const boost::math::rounding_error&)
^
If I'm understanding Boost's macro and include header structure correctly, boost/multiprecision/detail/functions/pow.hpp is inlined with boost/multiprecision/detail/default_ops.hpp. pow.hpp is always included no matter what in default_ops.hpp. boost::math::rounding_error is defined in boost/math/policies/error_handling.hpp, which is only included by default_ops.hpp if BOOST_MP_MATH_AVAILABLE is defined. This is the same macro that's used for guarding BOOST_MP_CATCH(const boost::math::rounding_error&) {} in pow.hpp (the same code not compiling), so all seems good. But, boost::math::rounding_error is only defined when BOOST_MATH_NO_EXCEPTIONS is NOT defined. And, when compiling with nvcc, BOOST_MATH_NO_EXCEPTIONS DOES get defined, according to boost/math/tools/config.hpp, because we've got __CUDACC__ defined by simply using nvcc.
Should we be adjusting pow.hpp, and possibly any other cases like this in either boost::math or boost::multiprecision, to have something like this instead?
#if defined(BOOST_MP_MATH_AVAILABLE) && !defined(BOOST_MATH_NO_EXCEPTIONS)
BOOST_MP_CATCH(const boost::math::rounding_error&)
{ /* Fallthrough */
}
#endif
That way we only define this catch condition when we have exception support and multiprecision math is available?
I have some C++ code that compiled just fine with
nvccfrom CUDA 12.6.1 and Boost 1.84.0. After updating to Boost 1.88.0, which includes the GPU math changes from Boost 1.87.0, I'm now seeing the following error message:If I'm understanding Boost's macro and include header structure correctly, boost/multiprecision/detail/functions/pow.hpp is inlined with boost/multiprecision/detail/default_ops.hpp. pow.hpp is always included no matter what in default_ops.hpp.
boost::math::rounding_erroris defined in boost/math/policies/error_handling.hpp, which is only included by default_ops.hpp ifBOOST_MP_MATH_AVAILABLEis defined. This is the same macro that's used for guardingBOOST_MP_CATCH(const boost::math::rounding_error&) {}in pow.hpp (the same code not compiling), so all seems good. But,boost::math::rounding_erroris only defined whenBOOST_MATH_NO_EXCEPTIONSis NOT defined. And, when compiling withnvcc,BOOST_MATH_NO_EXCEPTIONSDOES get defined, according to boost/math/tools/config.hpp, because we've got__CUDACC__defined by simply usingnvcc.Should we be adjusting pow.hpp, and possibly any other cases like this in either
boost::mathorboost::multiprecision, to have something like this instead?That way we only define this catch condition when we have exception support and multiprecision math is available?