Skip to content

Commit 3dd720d

Browse files
committed
Add testing and fixes for SYCL
1 parent 351374d commit 3dd720d

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

include/boost/math/special_functions/pow1p.hpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
// For cuda we would rather use builtin nextafter than unsupported boost::math::nextafter
2020
// NVRTC does not support the forward declarations header
21-
#ifndef BOOST_MATH_ENABLE_CUDA
21+
#ifndef BOOST_MATH_HAS_GPU_SUPPORT
2222
# include <boost/math/special_functions/next.hpp>
2323
# ifndef BOOST_MATH_HAS_NVRTC
2424
# include <utility>
@@ -31,7 +31,7 @@ namespace math {
3131

3232
namespace detail {
3333

34-
#ifndef BOOST_MATH_ENABLE_CUDA
34+
#ifndef BOOST_MATH_HAS_GPU_SUPPORT
3535

3636
template <typename T>
3737
using fma_t = decltype(fma(std::declval<T>(), std::declval<T>(), std::declval<T>()));
@@ -52,7 +52,7 @@ BOOST_MATH_FORCEINLINE BOOST_MATH_GPU_ENABLED T local_fma(const T x, const T y,
5252
return x * y + z;
5353
}
5454

55-
#endif // BOOST_MATH_ENABLE_CUDA
55+
#endif // BOOST_MATH_HAS_GPU_SUPPORT
5656

5757
template <typename T, typename Policy>
5858
BOOST_MATH_GPU_ENABLED T pow1p_imp(const T x, const T y, const Policy& pol)
@@ -150,7 +150,7 @@ BOOST_MATH_GPU_ENABLED T pow1p_imp(const T x, const T y, const Policy& pol)
150150
t = x - (s - T(1));
151151
if (t > 0)
152152
{
153-
#ifdef BOOST_MATH_ENABLE_CUDA
153+
#ifdef BOOST_MATH_HAS_GPU_SUPPORT
154154
s = ::nextafter(s, T(1));
155155
#else
156156
s = boost::math::nextafter(s, T(1));
@@ -165,7 +165,7 @@ BOOST_MATH_GPU_ENABLED T pow1p_imp(const T x, const T y, const Policy& pol)
165165
t = x - (s - T(1));
166166
if (t < 0)
167167
{
168-
#ifdef BOOST_MATH_ENABLE_CUDA
168+
#ifdef BOOST_MATH_HAS_GPU_SUPPORT
169169
s = ::nextafter(s, T(0));
170170
#else
171171
s = boost::math::nextafter(s, T(0));
@@ -180,7 +180,7 @@ BOOST_MATH_GPU_ENABLED T pow1p_imp(const T x, const T y, const Policy& pol)
180180
t = T(1) - (s - x);
181181
if (t < 0)
182182
{
183-
#ifdef BOOST_MATH_ENABLE_CUDA
183+
#ifdef BOOST_MATH_HAS_GPU_SUPPORT
184184
s = ::nextafter(s, T(0));
185185
#else
186186
s = boost::math::nextafter(s, T(0));
@@ -207,7 +207,7 @@ BOOST_MATH_GPU_ENABLED T pow1p_imp(const T x, const T y, const Policy& pol)
207207
// Then exp(y*u) == exp(z)*exp(w).
208208
T z = y * u;
209209

210-
#ifdef BOOST_MATH_ENABLE_CUDA
210+
#ifdef BOOST_MATH_HAS_GPU_SUPPORT
211211
T w = fma(y, u, -z);
212212
#else
213213
T w = local_fma(y, u, -z);

test/sycl_jamfile

+1
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ run test_digamma_simple.cpp ;
3434
run test_trigamma.cpp ;
3535
run test_erf.cpp ;
3636
run test_gamma.cpp ;
37+
run test_pow1p.cpp ;

test/test_pow1p.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ void test()
2020
CHECK_EQUAL(boost::math::pow1p(T(1), T(0)), T(1));
2121

2222
// pow(0, y)
23+
#ifndef BOOST_MATH_NO_EXCEPTIONS
2324
CHECK_THROW(boost::math::pow1p(T(-1), T(-1)), std::domain_error);
25+
#endif
2426
CHECK_EQUAL(boost::math::pow1p(T(-1), T(1)), T(0));
2527

2628
// pow(-1, inf)

0 commit comments

Comments
 (0)