Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/overview/gpu.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ And lastly on SYCL:
});
}

When using SYCL you must define BOOST_MATH_ENABLE_SYCL, since device support is opt-in on that platform.
For NVCC and NVRTC device support is enabled automatically.

Once your kernel function has been written then use the framework mechanism for launching the kernel.

[endsect] [/section:gpu Support for GPU programming in Boost.Math]
Expand Down
6 changes: 1 addition & 5 deletions include/boost/math/tools/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,15 +702,11 @@ namespace boost{ namespace math{
# undef BOOST_MATH_FORCEINLINE
# define BOOST_MATH_FORCEINLINE __forceinline__

#elif defined(SYCL_LANGUAGE_VERSION)
#elif defined(BOOST_MATH_ENABLE_SYCL)

# define BOOST_MATH_SYCL_ENABLED SYCL_EXTERNAL
# define BOOST_MATH_HAS_GPU_SUPPORT

# ifndef BOOST_MATH_ENABLE_SYCL
# define BOOST_MATH_ENABLE_SYCL
# endif

# ifndef BOOST_MATH_NO_EXCEPTIONS
# define BOOST_MATH_NO_EXCEPTIONS
# endif
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if(HAVE_BOOST_TEST)

enable_testing()

boost_test_jamfile(FILE sycl_jamfile LINK_LIBRARIES Boost::math Boost::assert Boost::concept_check Boost::config Boost::core Boost::integer Boost::lexical_cast Boost::multiprecision Boost::predef Boost::random Boost::static_assert Boost::throw_exception Boost::unit_test_framework sycl COMPILE_OPTIONS -fsycl )
boost_test_jamfile(FILE sycl_jamfile LINK_LIBRARIES Boost::math Boost::assert Boost::concept_check Boost::config Boost::core Boost::integer Boost::lexical_cast Boost::multiprecision Boost::predef Boost::random Boost::static_assert Boost::throw_exception Boost::unit_test_framework sycl COMPILE_DEFINITIONS BOOST_MATH_ENABLE_SYCL=1 COMPILE_OPTIONS -fsycl )
else()

boost_test(SOURCES check_cmake_version.cpp ARGUMENTS ${PROJECT_VERSION} LINK_LIBRARIES Boost::core Boost::config)
Expand Down
2 changes: 1 addition & 1 deletion test/gegenbauer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
#include "sycl/sycl.hpp"
#endif

Expand Down
2 changes: 1 addition & 1 deletion test/pow_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "../include_private/boost/math/tools/test.hpp"
#define BOOST_TEST_MAIN

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
#include "sycl/sycl.hpp"
#endif

Expand Down
4 changes: 2 additions & 2 deletions test/test_airy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch_light.hpp>
#else
#include "sycl/sycl.hpp"
Expand Down Expand Up @@ -60,7 +60,7 @@ void test_airy(T, const char* name)
if (boost::math::tools::digits<T>() > 100)
tol *= 2;

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
tol *= 5;
#endif

Expand Down
2 changes: 1 addition & 1 deletion test/test_arcsine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// Tests for the arcsine Distribution.

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch.hpp> // Must be 1st include, and include_directory /libs/math/src/tr1/ is needed.
#else
#include "sycl/sycl.hpp"
Expand Down
2 changes: 1 addition & 1 deletion test/test_bernoulli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# pragma warning (disable : 4127) // conditional expression is constant.
#endif

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
#include "sycl/sycl.hpp"
#endif

Expand Down
6 changes: 3 additions & 3 deletions test/test_bessel_i.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch_light.hpp>
#else
#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false
Expand Down Expand Up @@ -97,7 +97,7 @@ void expected_results()
"linux", // platform
largest_type, // test type(s)
".*Random.*", // test data group
#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
".*", 600, 200);
#else
".*", 400, 200); // test function
Expand Down Expand Up @@ -130,7 +130,7 @@ void expected_results()
".*", // platform
largest_type, // test type(s)
".*", // test data group
#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
".*", 400, 200);
#else
".*", 20, 10); // test function
Expand Down
2 changes: 1 addition & 1 deletion test/test_bessel_i.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void test_bessel(T, const char* name)
}
}
T tolerance = boost::math::tools::epsilon<T>() * 100;
#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
if ((boost::math::tools::digits<T>() <= std::numeric_limits<double>::digits) && (std::numeric_limits<T>::max_exponent > 1000))
{
BOOST_CHECK_CLOSE_FRACTION(boost::math::cyl_bessel_i(T(0.5), T(710)), SC_(3.3447452278080108123142599104927325061327359278058601201179e306), tolerance);
Expand Down
2 changes: 1 addition & 1 deletion test/test_bessel_j.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch_light.hpp>
#else
#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false
Expand Down
2 changes: 1 addition & 1 deletion test/test_bessel_j.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ void test_bessel(T, const char* name)
BOOST_MATH_CHECK_THROW(boost::math::sph_bessel(2, T(-2.0)), std::domain_error);
BOOST_CHECK_EQUAL(boost::math::cyl_bessel_j(T(0), T(2.5)), boost::math::cyl_bessel_j(T(0), T(-2.5)));
BOOST_CHECK_EQUAL(boost::math::cyl_bessel_j(T(1), T(2.5)), -boost::math::cyl_bessel_j(T(1), T(-2.5)));
#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
BOOST_CHECK_CLOSE_FRACTION(boost::math::cyl_bessel_j(364, T(38.5)), SC_(1.793940496519190500748409872348034004417458734118663909894e-309), tolerance);
#endif
//
Expand Down
2 changes: 1 addition & 1 deletion test/test_bessel_k.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch_light.hpp>
#else
#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false
Expand Down
2 changes: 1 addition & 1 deletion test/test_bessel_k.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void test_bessel(T, const char* name)
//
// Extra test coverage:
//
#ifndef SYCL_LANGUAGE_VERSION // SYCL doesn't throw
#ifndef BOOST_MATH_ENABLE_SYCL // SYCL doesn't throw
BOOST_CHECK_THROW(boost::math::cyl_bessel_k(T(2), T(-1)), std::domain_error);
BOOST_CHECK_THROW(boost::math::cyl_bessel_k(T(2.2), T(-1)), std::domain_error);
BOOST_IF_CONSTEXPR(std::numeric_limits<T>::has_infinity)
Expand Down
4 changes: 2 additions & 2 deletions test/test_bessel_y.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch_light.hpp>
#else
#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false
Expand Down Expand Up @@ -248,7 +248,7 @@ void expected_results()
".*", // platform
largest_type, // test type(s)
".*(Y[nv]|y).*Random.*", // test data group
#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
".*", 2000, 1000);
#else
".*", 1500, 1000); // test function
Expand Down
2 changes: 1 addition & 1 deletion test/test_beta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch_light.hpp>
#else
#include "sycl/sycl.hpp"
Expand Down
2 changes: 1 addition & 1 deletion test/test_beta_dist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# pragma warning (disable : 4224) // nonstandard extension used : formal parameter 'arg' was previously defined as a type.
#endif

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
#include "sycl/sycl.hpp"
#endif

Expand Down
2 changes: 1 addition & 1 deletion test/test_beta_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
#include "sycl/sycl.hpp"
#endif

Expand Down
6 changes: 3 additions & 3 deletions test/test_cauchy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# pragma warning(disable: 4127) // conditional expression is constant
#endif

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false
#include "sycl/sycl.hpp"
#include <boost/math/tools/config.hpp>
Expand Down Expand Up @@ -137,7 +137,7 @@ void test_spots(RealType T)
static_cast<RealType>(0.000000021220659078919346664504384865488560725L),
tolerance); // %

#ifndef SYCL_LANGUAGE_VERSION // Returns infinity
#ifndef BOOST_MATH_ENABLE_SYCL // Returns infinity
BOOST_CHECK_CLOSE(
// Test the CDF at -max_value()/4.
// For an input x of this magnitude, the reference value is 4/|x|/pi.
Expand Down Expand Up @@ -220,7 +220,7 @@ void test_spots(RealType T)
static_cast<RealType>(0.000000021220659078919346664504384865488560725L),
tolerance); // %

#ifndef SYCL_LANGUAGE_VERSION // Returns infinity
#ifndef BOOST_MATH_ENABLE_SYCL // Returns infinity
BOOST_CHECK_CLOSE(
// Test the complemented CDF at max_value()/4.
// For an input x of this magnitude, the reference value is 4/x/pi.
Expand Down
2 changes: 1 addition & 1 deletion test/test_cbrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# pragma warning (disable : 4224)
#endif

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch_light.hpp> // include /libs/math/src/
#else
#include "sycl/sycl.hpp"
Expand Down
2 changes: 1 addition & 1 deletion test/test_chi_squared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# pragma warning(disable: 4127) // conditional expression is constant
#endif

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
#include "sycl/sycl.hpp"
#endif

Expand Down
2 changes: 1 addition & 1 deletion test/test_digamma_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
#include "sycl/sycl.hpp"
#endif

Expand Down
2 changes: 1 addition & 1 deletion test/test_ellint_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch_light.hpp> // include /libs/math/src/
#else
#include "sycl/sycl.hpp"
Expand Down
4 changes: 2 additions & 2 deletions test/test_ellint_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch_light.hpp> // include /libs/math/src/
#else
#include "sycl/sycl.hpp"
Expand Down Expand Up @@ -77,7 +77,7 @@ void expected_results()
".*", // platform
largest_type, // test type(s)
".*", // test data group
#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
".*", 20, 6); // test function
#else
".*", 15, 6); // test function
Expand Down
2 changes: 1 addition & 1 deletion test/test_ellint_d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch_light.hpp> // include /libs/math/src/
#else
#include "sycl/sycl.hpp"
Expand Down
2 changes: 1 addition & 1 deletion test/test_erf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch_light.hpp>
#else
#include "sycl/sycl.hpp"
Expand Down
4 changes: 2 additions & 2 deletions test/test_expint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch_light.hpp>
#else
#include "sycl/sycl.hpp"
Expand Down Expand Up @@ -87,7 +87,7 @@ void expected_results()
".*", // platform
"float|double|long double", // test type(s)
".*Ei.*", // test data group
#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
".*", 6, 3); // test function
#else
".*", 10, 3);
Expand Down
2 changes: 1 addition & 1 deletion test/test_expm1_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
#include "sycl/sycl.hpp"
#endif

Expand Down
2 changes: 1 addition & 1 deletion test/test_exponential_dist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// test_exponential_dist.cpp

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
#include "sycl/sycl.hpp"
#endif

Expand Down
2 changes: 1 addition & 1 deletion test/test_extreme_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// test_extreme_value.cpp

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
#include "sycl/sycl.hpp"
#endif

Expand Down
2 changes: 1 addition & 1 deletion test/test_fisher_f.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
#include "sycl/sycl.hpp"
#endif

Expand Down
2 changes: 1 addition & 1 deletion test/test_gamma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch_light.hpp>
#else
#include "sycl/sycl.hpp"
Expand Down
2 changes: 1 addition & 1 deletion test/test_gamma_dist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// From MathWorld--A Wolfram Web Resource.
// http://mathworld.wolfram.com/GammaDistribution.html

#ifndef SYCL_LANGUAGE_VERSION
#ifndef BOOST_MATH_ENABLE_SYCL
#include <pch.hpp> // include directory libs/math/src/tr1/ is needed.
#else
#include "sycl/sycl.hpp"
Expand Down
2 changes: 1 addition & 1 deletion test/test_geometric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# pragma warning(disable: 4127) // conditional expression is constant.
#endif

#ifdef SYCL_LANGUAGE_VERSION
#ifdef BOOST_MATH_ENABLE_SYCL
#include "sycl/sycl.hpp"
#endif

Expand Down
Loading
Loading