diff --git a/test/xpu_api/random/conformance_tests/common_for_conformance_tests.hpp b/test/xpu_api/random/conformance_tests/common_for_conformance_tests.hpp index 65375cdb5d6..206d44e16fd 100644 --- a/test/xpu_api/random/conformance_tests/common_for_conformance_tests.hpp +++ b/test/xpu_api/random/conformance_tests/common_for_conformance_tests.hpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/conformance_tests/minstd_rand_rand0_test.pass.cpp b/test/xpu_api/random/conformance_tests/minstd_rand_rand0_test.pass.cpp index a32602a139a..f541554e093 100644 --- a/test/xpu_api/random/conformance_tests/minstd_rand_rand0_test.pass.cpp +++ b/test/xpu_api/random/conformance_tests/minstd_rand_rand0_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/conformance_tests/ranlux_24_48_base_test.pass.cpp b/test/xpu_api/random/conformance_tests/ranlux_24_48_base_test.pass.cpp index f6a406f04e0..c5e19ab06b0 100644 --- a/test/xpu_api/random/conformance_tests/ranlux_24_48_base_test.pass.cpp +++ b/test/xpu_api/random/conformance_tests/ranlux_24_48_base_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/conformance_tests/ranlux_24_48_test.pass.cpp b/test/xpu_api/random/conformance_tests/ranlux_24_48_test.pass.cpp index ab4beeea346..ae470f30775 100644 --- a/test/xpu_api/random/conformance_tests/ranlux_24_48_test.pass.cpp +++ b/test/xpu_api/random/conformance_tests/ranlux_24_48_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/device_tests/bernoulli_distribution_device_test.pass.cpp b/test/xpu_api/random/device_tests/bernoulli_distribution_device_test.pass.cpp index 833200a0c9e..eb537f46ae4 100644 --- a/test/xpu_api/random/device_tests/bernoulli_distribution_device_test.pass.cpp +++ b/test/xpu_api/random/device_tests/bernoulli_distribution_device_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/device_tests/cauchy_distribution_device_test.pass.cpp b/test/xpu_api/random/device_tests/cauchy_distribution_device_test.pass.cpp index 18231d1df3c..a038ce784b8 100644 --- a/test/xpu_api/random/device_tests/cauchy_distribution_device_test.pass.cpp +++ b/test/xpu_api/random/device_tests/cauchy_distribution_device_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/device_tests/common_for_device_tests.h b/test/xpu_api/random/device_tests/common_for_device_tests.h index de2d048d881..2638b6ba503 100644 --- a/test/xpu_api/random/device_tests/common_for_device_tests.h +++ b/test/xpu_api/random/device_tests/common_for_device_tests.h @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/device_tests/engine_device_test.pass.cpp b/test/xpu_api/random/device_tests/engine_device_test.pass.cpp index 40c6d8d1d36..8ac083a387b 100644 --- a/test/xpu_api/random/device_tests/engine_device_test.pass.cpp +++ b/test/xpu_api/random/device_tests/engine_device_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/device_tests/exponential_distribution_device_test.pass.cpp b/test/xpu_api/random/device_tests/exponential_distribution_device_test.pass.cpp index bbad81a9b16..a2185e86b21 100644 --- a/test/xpu_api/random/device_tests/exponential_distribution_device_test.pass.cpp +++ b/test/xpu_api/random/device_tests/exponential_distribution_device_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/device_tests/extreme_value_distribution_device_test.pass.cpp b/test/xpu_api/random/device_tests/extreme_value_distribution_device_test.pass.cpp index aa1a3607777..f71dc135881 100644 --- a/test/xpu_api/random/device_tests/extreme_value_distribution_device_test.pass.cpp +++ b/test/xpu_api/random/device_tests/extreme_value_distribution_device_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/device_tests/geometric_distribution_device_test.pass.cpp b/test/xpu_api/random/device_tests/geometric_distribution_device_test.pass.cpp index 860f311f658..3575bcf0c01 100644 --- a/test/xpu_api/random/device_tests/geometric_distribution_device_test.pass.cpp +++ b/test/xpu_api/random/device_tests/geometric_distribution_device_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/device_tests/lognormal_distribution_device_test.pass.cpp b/test/xpu_api/random/device_tests/lognormal_distribution_device_test.pass.cpp index e6934606ad8..1fbb3d6fe2e 100644 --- a/test/xpu_api/random/device_tests/lognormal_distribution_device_test.pass.cpp +++ b/test/xpu_api/random/device_tests/lognormal_distribution_device_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/device_tests/normal_distribution_device_test.pass.cpp b/test/xpu_api/random/device_tests/normal_distribution_device_test.pass.cpp index 7fa50080387..9d0baa1eca5 100644 --- a/test/xpu_api/random/device_tests/normal_distribution_device_test.pass.cpp +++ b/test/xpu_api/random/device_tests/normal_distribution_device_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/device_tests/uniform_int_distribution_device_test.pass.cpp b/test/xpu_api/random/device_tests/uniform_int_distribution_device_test.pass.cpp index 088b0b3b2f6..37091c8e957 100644 --- a/test/xpu_api/random/device_tests/uniform_int_distribution_device_test.pass.cpp +++ b/test/xpu_api/random/device_tests/uniform_int_distribution_device_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/device_tests/uniform_real_distribution_device_test.pass.cpp b/test/xpu_api/random/device_tests/uniform_real_distribution_device_test.pass.cpp index 07dbae5f098..e2f9811cf2d 100644 --- a/test/xpu_api/random/device_tests/uniform_real_distribution_device_test.pass.cpp +++ b/test/xpu_api/random/device_tests/uniform_real_distribution_device_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/device_tests/weibull_distribution_device_test.pass.cpp b/test/xpu_api/random/device_tests/weibull_distribution_device_test.pass.cpp index 1722f9ab151..5234fe01bbb 100644 --- a/test/xpu_api/random/device_tests/weibull_distribution_device_test.pass.cpp +++ b/test/xpu_api/random/device_tests/weibull_distribution_device_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/interface_tests/common_for_distributions_methods.hpp b/test/xpu_api/random/interface_tests/common_for_distributions_methods.hpp new file mode 100644 index 00000000000..21c3998e707 --- /dev/null +++ b/test/xpu_api/random/interface_tests/common_for_distributions_methods.hpp @@ -0,0 +1,487 @@ +// -*- C++ -*- +//===----------------------------------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------===// + +#ifndef _ONEDPL_RANDOM_INTERFACE_TESTS_DISTRIBUTIONS_COMMON_H +#define _ONEDPL_RANDOM_INTERFACE_TESTS_DISTRIBUTIONS_COMMON_H + +#include +static_assert(ONEDPL_HAS_RANDOM_NUMBERS >= 202409L); + +#include +#include + +constexpr auto SEED = 777; +constexpr auto N_GEN = 960; + +template +using Element_type = typename oneapi::dpl::internal::type_traits_t::element_type; + +template +std::int32_t +check_params(oneapi::dpl::uniform_int_distribution& distr) +{ + Element_type a = Element_type{0}; + Element_type b = std::numeric_limits>::max(); + return ((distr.a() != a) || (distr.b() != b) || (distr.min() != a) || (distr.max() != b) || + (distr.param().a() != a) || (distr.param().b() != b)); +} + +template +std::int32_t +check_params(oneapi::dpl::uniform_real_distribution& distr) +{ + Element_type a = Element_type{0.0}; + Element_type b = Element_type{1.0}; + return ((distr.a() != a) || (distr.b() != b) || (distr.min() != a) || (distr.max() != b) || + (distr.param().a() != a) || (distr.param().b() != b)); +} + +template +std::int32_t +check_params(oneapi::dpl::normal_distribution& distr) +{ + Element_type mean = Element_type{0.0}; + Element_type stddev = Element_type{1.0}; + return ((distr.mean() != mean) || (distr.stddev() != stddev) || + (distr.min() > -std::numeric_limits>::max()) || + (distr.max() < std::numeric_limits>::max()) || (distr.param().mean() != mean) || + (distr.param().stddev() != stddev)); +} + +template +std::int32_t +check_params(oneapi::dpl::exponential_distribution& distr) +{ + Element_type lambda = Element_type{1.0}; + return ((distr.lambda() != lambda) || (distr.min() != 0) || + (distr.max() < std::numeric_limits>::max()) || + (distr.param().lambda() != lambda)); +} + +template +std::int32_t +check_params(oneapi::dpl::bernoulli_distribution& distr) +{ + double p = 0.5; + return ((distr.p() != p) || (distr.min() != false) || + (distr.max() != true) || (distr.param().p() != p)); +} + +template +std::int32_t +check_params(oneapi::dpl::geometric_distribution& distr) +{ + double p = 0.5; + return ((distr.p() != p) || (distr.min() != 0) || + (distr.max() < std::numeric_limits>::max()) || + (distr.param().p() != p)); +} + +template +std::int32_t +check_params(oneapi::dpl::weibull_distribution& distr) +{ + Element_type a = Element_type{1.0}; + Element_type b = Element_type{1.0}; + return ((distr.a() != a) || (distr.b() != b) || (distr.min() != 0) || + (distr.max() < std::numeric_limits>::max()) || + (distr.param().a() != a) || (distr.param().b() != b)); +} + +template +std::int32_t +check_params(oneapi::dpl::lognormal_distribution& distr) +{ + Element_type m = Element_type{0.0}; + Element_type s = Element_type{1.0}; + return ((distr.m() != m) || (distr.s() != s) || + (distr.min() != 0) || (distr.max() < std::numeric_limits>::max()) || + (distr.param().m() != m) || (distr.param().s() != s)); +} + +template +std::int32_t +check_params(oneapi::dpl::cauchy_distribution& distr) +{ + Element_type a = Element_type{0.0}; + Element_type b = Element_type{1.0}; + return ((distr.a() != a) || (distr.b() != b) || + (distr.min() > std::numeric_limits>::lowest()) || + (distr.max() < std::numeric_limits>::max()) || + (distr.param().a() != a) || (distr.param().b() != b)); +} + +template +std::int32_t +check_params(oneapi::dpl::extreme_value_distribution& distr) +{ + Element_type a = Element_type{0.0}; + Element_type b = Element_type{1.0}; + return ((distr.a() != a) || (distr.b() != b) || + (distr.min() > std::numeric_limits>::lowest()) || + (distr.max() < std::numeric_limits>::max()) || + (distr.param().a() != a) || (distr.param().b() != b)); +} + + +template +::std::enable_if_t<::std::is_same_v>> +make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) +{ + params1 = typename Distr::param_type{0, 10}; + params2 = typename Distr::param_type{2, 8}; +} + +template +::std::enable_if_t<::std::is_same_v>> +make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) +{ + params1 = typename Distr::param_type{1.5, 3.0}; + params2 = typename Distr::param_type{-2.1, 2.2}; +} + +template +::std::enable_if_t<::std::is_same_v>> +make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) +{ + params1 = typename Distr::param_type{1.5}; + params2 = typename Distr::param_type{3.0}; +} + +template +::std::enable_if_t<::std::is_same_v>> +make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) +{ + params1 = typename Distr::param_type{0.5}; + params2 = typename Distr::param_type{0.1}; +} + +template +::std::enable_if_t<::std::is_same_v>> +make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) +{ + params1 = typename Distr::param_type{0.5}; + params2 = typename Distr::param_type{0.1}; +} + +template +::std::enable_if_t<::std::is_same_v>> +make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) +{ + params1 = typename Distr::param_type{1.5, 3.0}; + params2 = typename Distr::param_type{2.0, 40}; +} + +template +::std::enable_if_t<::std::is_same_v>> +make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) +{ + params1 = typename Distr::param_type{1.5, 3.5}; + params2 = typename Distr::param_type{-2, 10}; +} + +template +::std::enable_if_t<::std::is_same_v>> +make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) +{ + params1 = typename Distr::param_type{1.5, 3.5}; + params2 = typename Distr::param_type{-2, 10}; +} + +template +::std::enable_if_t<::std::is_same_v>> +make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) +{ + params1 = typename Distr::param_type{1.5, 3.5}; + params2 = typename Distr::param_type{-2, 10}; +} + +template +::std::enable_if_t<::std::is_same_v>> +make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) +{ + params1 = typename Distr::param_type{1.5, 3.5}; + params2 = typename Distr::param_type{-2, 10}; +} + +template +std::int32_t +check_input_output(Distr& distr) +{ + using params_type = typename Distr::scalar_type; + using result_type = typename Distr::result_type; + + std::int32_t status = 0; + + if constexpr (std::is_same_v> + || std::is_same_v>) { + double p = 0.5; + + std::stringstream s; + s << p; + + std::ostringstream out; + std::istringstream in(s.str()); + + in >> distr; + status += check_params(distr); + + out << distr; + if (!(out.str() == s.str())) + { + status += 1; + } + } + else if constexpr (std::is_same_v>) { + params_type lambda{1.0}; + + std::stringstream s; + s << lambda; + + std::ostringstream out; + std::istringstream in(s.str()); + + in >> distr; + status += check_params(distr); + + out << distr; + if (!(out.str() == s.str())) + { + status += 1; + } + } + else if constexpr (std::is_same_v> + || std::is_same_v>) { + params_type mean{0.0}; + params_type stddev{1.0}; + + std::stringstream s; + s << mean << ' ' << stddev; + + bool flag_ = true; + params_type saved_ln_{1.2}; + params_type saved_u2_{1.3}; + + s << ' ' << flag_ << ' ' << saved_ln_ << ' ' << saved_u2_; + + std::ostringstream out; + std::istringstream in(s.str()); + + in >> distr; + status += check_params(distr); + + out << distr; + if (!(out.str() == s.str())) + { + status += 1; + } + } + else if constexpr (std::is_same_v>) { + params_type a{1.0}; + params_type b{1.0}; + + std::stringstream s; + s << a << ' ' << b; + + std::ostringstream out; + std::istringstream in(s.str()); + + in >> distr; + status += check_params(distr); + + out << distr; + if (!(out.str() == s.str())) + { + status += 1; + } + } + else if constexpr (std::is_same_v>) { + params_type a{0}; + params_type b = std::numeric_limits::max(); + + std::stringstream s; + s << a << ' ' << b; + + std::ostringstream out; + std::istringstream in(s.str()); + + in >> distr; + status += check_params(distr); + + out << distr; + if (!(out.str() == s.str())) + { + status += 1; + } + } + else { // uniform_real_distribution, cauchy_distribution, extreme_value_distribution + params_type a{0.0}; + params_type b{1.0}; + + std::stringstream s; + s << a << ' ' << b; + + std::ostringstream out; + std::istringstream in(s.str()); + + in >> distr; + status += check_params(distr); + + out << distr; + if (!(out.str() == s.str())) + { + status += 1; + } + } + + return status; +} + +template +bool +test_vec(sycl::queue& queue) +{ + + typename Distr::param_type params1; + typename Distr::param_type params2; + + make_param(params1, params2); + + int sum = 0; + + // Memory allocation + typename Distr::scalar_type res[N_GEN]; + constexpr std::int32_t num_elems = + oneapi::dpl::internal::type_traits_t::num_elems == 0 + ? 1 + : oneapi::dpl::internal::type_traits_t::num_elems; + + // Random number generation + { + sycl::buffer buffer(res, N_GEN); + + try + { + + queue.submit([&](sycl::handler& cgh) { + sycl::accessor acc(buffer, cgh, sycl::write_only); + + cgh.parallel_for<>(sycl::range<1>(N_GEN / (2 * num_elems)), [=](sycl::item<1> idx) { + unsigned long long offset = idx.get_linear_id() * num_elems; + oneapi::dpl::minstd_rand engine(SEED, offset); + Distr d1; + d1.param(params1); + Distr d2(params2); + d2.reset(); + typename Distr::result_type res0 = d1(engine, params2, 1); + typename Distr::result_type res1 = d1(engine, params1, 1); + for (int i = 0; i < num_elems; ++i) + { + acc[offset * 2 + i] = res0[i]; + acc[offset * 2 + num_elems + i] = res1[i]; + } + }); + }); + } + catch (sycl::exception const& e) + { + std::cout << "\t\tSYCL exception during generation\n" + << e.what() << std::endl; + return 1; + } + + queue.wait_and_throw(); + Distr distr; + sum += check_params(distr); + } + + return sum; +} + +template +bool +test(sycl::queue& queue) +{ + + typename Distr::param_type params1; + typename Distr::param_type params2; + + make_param(params1, params2); + + int status = 0; + + // Memory allocation + typename Distr::scalar_type res[N_GEN]; + + // Random number generation + { + { + Distr _d1(2); + Distr _d2(2); + if (_d1 != _d2) + { + status += 1; + std::cout << "Error: d1 != d2" << std::endl; + } + + status += check_input_output(_d1); + + if (_d1 == _d2) + { + status += 1; + std::cout << "Error: d1 == d2" << std::endl; + } + } + + sycl::buffer buffer(res, N_GEN); + + try + { + queue.submit([&](sycl::handler& cgh) { + sycl::stream out(1024, 256, cgh); + cgh.single_task<>([=]() { + Distr distr; + out << "params: " << distr << sycl::endl; + }); + }); + queue.wait_and_throw(); + + queue.submit([&](sycl::handler& cgh) { + sycl::accessor acc(buffer, cgh, sycl::write_only); + + cgh.parallel_for<>(sycl::range<1>(N_GEN / 2), [=](sycl::item<1> idx) { + unsigned long long offset = idx.get_linear_id(); + oneapi::dpl::minstd_rand engine(SEED, offset); + Distr d1; + d1.param(params1); + Distr d2(params2); + d2.reset(); + typename Distr::scalar_type res0 = d1(engine, params2); + typename Distr::scalar_type res1 = d1(engine, params1); + acc[offset * 2] = res0; + acc[offset * 2 + 1] = res1; + }); + }); + queue.wait_and_throw(); + } + catch (sycl::exception const& e) + { + std::cout << "\t\tSYCL exception during generation\n" + << e.what() << std::endl; + return 1; + } + + Distr distr; + status += check_params(distr); + } + + return status; +} + +#endif // _ONEDPL_RANDOM_INTERFACE_TESTS_DISTRIBUTIONS_COMMON_H diff --git a/test/xpu_api/random/interface_tests/distributions_methods.pass.cpp b/test/xpu_api/random/interface_tests/distributions_methods.pass.cpp deleted file mode 100644 index c2c0d7a7ce8..00000000000 --- a/test/xpu_api/random/interface_tests/distributions_methods.pass.cpp +++ /dev/null @@ -1,781 +0,0 @@ -// -*- C++ -*- -//===-- distributions_methods.pass.cpp -------------------------------------===// -// -// Copyright (C) Intel Corporation -// -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// -//===----------------------------------------------------------------------===// -// -// Abstract: -// -// Testing of different distributions' methods - -#include "support/utils.h" - -#if TEST_UNNAMED_LAMBDAS -#include -static_assert(ONEDPL_HAS_RANDOM_NUMBERS >= 202409L); - -#include -#include -#include - -constexpr auto SEED = 777; -constexpr auto N_GEN = 960; - -template -using Element_type = typename oneapi::dpl::internal::type_traits_t::element_type; - -template -std::int32_t -check_params(oneapi::dpl::uniform_int_distribution& distr) -{ - Element_type a = Element_type{0}; - Element_type b = std::numeric_limits>::max(); - return ((distr.a() != a) || (distr.b() != b) || (distr.min() != a) || (distr.max() != b) || - (distr.param().a() != a) || (distr.param().b() != b)); -} - -template -std::int32_t -check_params(oneapi::dpl::uniform_real_distribution& distr) -{ - Element_type a = Element_type{0.0}; - Element_type b = Element_type{1.0}; - return ((distr.a() != a) || (distr.b() != b) || (distr.min() != a) || (distr.max() != b) || - (distr.param().a() != a) || (distr.param().b() != b)); -} - -template -std::int32_t -check_params(oneapi::dpl::normal_distribution& distr) -{ - Element_type mean = Element_type{0.0}; - Element_type stddev = Element_type{1.0}; - return ((distr.mean() != mean) || (distr.stddev() != stddev) || - (distr.min() > -std::numeric_limits>::max()) || - (distr.max() < std::numeric_limits>::max()) || (distr.param().mean() != mean) || - (distr.param().stddev() != stddev)); -} - -template -std::int32_t -check_params(oneapi::dpl::exponential_distribution& distr) -{ - Element_type lambda = Element_type{1.0}; - return ((distr.lambda() != lambda) || (distr.min() != 0) || - (distr.max() < std::numeric_limits>::max()) || - (distr.param().lambda() != lambda)); -} - -template -std::int32_t -check_params(oneapi::dpl::bernoulli_distribution& distr) -{ - double p = 0.5; - return ((distr.p() != p) || (distr.min() != false) || - (distr.max() != true) || (distr.param().p() != p)); -} - -template -std::int32_t -check_params(oneapi::dpl::geometric_distribution& distr) -{ - double p = 0.5; - return ((distr.p() != p) || (distr.min() != 0) || - (distr.max() < std::numeric_limits>::max()) || - (distr.param().p() != p)); -} - -template -std::int32_t -check_params(oneapi::dpl::weibull_distribution& distr) -{ - Element_type a = Element_type{1.0}; - Element_type b = Element_type{1.0}; - return ((distr.a() != a) || (distr.b() != b) || (distr.min() != 0) || - (distr.max() < std::numeric_limits>::max()) || - (distr.param().a() != a) || (distr.param().b() != b)); -} - -template -std::int32_t -check_params(oneapi::dpl::lognormal_distribution& distr) -{ - Element_type m = Element_type{0.0}; - Element_type s = Element_type{1.0}; - return ((distr.m() != m) || (distr.s() != s) || - (distr.min() != 0) || (distr.max() < std::numeric_limits>::max()) || - (distr.param().m() != m) || (distr.param().s() != s)); -} - -template -std::int32_t -check_params(oneapi::dpl::cauchy_distribution& distr) -{ - Element_type a = Element_type{0.0}; - Element_type b = Element_type{1.0}; - return ((distr.a() != a) || (distr.b() != b) || - (distr.min() > std::numeric_limits>::lowest()) || - (distr.max() < std::numeric_limits>::max()) || - (distr.param().a() != a) || (distr.param().b() != b)); -} - -template -std::int32_t -check_params(oneapi::dpl::extreme_value_distribution& distr) -{ - Element_type a = Element_type{0.0}; - Element_type b = Element_type{1.0}; - return ((distr.a() != a) || (distr.b() != b) || - (distr.min() > std::numeric_limits>::lowest()) || - (distr.max() < std::numeric_limits>::max()) || - (distr.param().a() != a) || (distr.param().b() != b)); -} - -template -::std::enable_if_t<::std::is_same_v>> -make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) -{ - params1 = typename Distr::param_type{0, 10}; - params2 = typename Distr::param_type{2, 8}; -} - -template -::std::enable_if_t<::std::is_same_v>> -make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) -{ - params1 = typename Distr::param_type{1.5, 3.0}; - params2 = typename Distr::param_type{-2.1, 2.2}; -} - -template -::std::enable_if_t<::std::is_same_v>> -make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) -{ - params1 = typename Distr::param_type{1.5}; - params2 = typename Distr::param_type{3.0}; -} - -template -::std::enable_if_t<::std::is_same_v>> -make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) -{ - params1 = typename Distr::param_type{0.5}; - params2 = typename Distr::param_type{0.1}; -} - -template -::std::enable_if_t<::std::is_same_v>> -make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) -{ - params1 = typename Distr::param_type{0.5}; - params2 = typename Distr::param_type{0.1}; -} - -template -::std::enable_if_t<::std::is_same_v>> -make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) -{ - params1 = typename Distr::param_type{1.5, 3.0}; - params2 = typename Distr::param_type{2.0, 40}; -} - -template -::std::enable_if_t<::std::is_same_v>> -make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) -{ - params1 = typename Distr::param_type{1.5, 3.5}; - params2 = typename Distr::param_type{-2, 10}; -} - -template -::std::enable_if_t<::std::is_same_v>> -make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) -{ - params1 = typename Distr::param_type{1.5, 3.5}; - params2 = typename Distr::param_type{-2, 10}; -} - -template -::std::enable_if_t<::std::is_same_v>> -make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) -{ - params1 = typename Distr::param_type{1.5, 3.5}; - params2 = typename Distr::param_type{-2, 10}; -} - -template -::std::enable_if_t<::std::is_same_v>> -make_param(typename Distr::param_type& params1, typename Distr::param_type& params2) -{ - params1 = typename Distr::param_type{1.5, 3.5}; - params2 = typename Distr::param_type{-2, 10}; -} - -template -std::int32_t -check_input_output(Distr& distr) -{ - using params_type = typename Distr::scalar_type; - using result_type = typename Distr::result_type; - - std::int32_t status = 0; - - if constexpr (std::is_same_v> - || std::is_same_v>) { - double p = 0.5; - - std::stringstream s; - s << p; - - std::ostringstream out; - std::istringstream in(s.str()); - - in >> distr; - status += check_params(distr); - - out << distr; - if (!(out.str() == s.str())) - { - status += 1; - } - } - else if constexpr (std::is_same_v>) { - params_type lambda{1.0}; - - std::stringstream s; - s << lambda; - - std::ostringstream out; - std::istringstream in(s.str()); - - in >> distr; - status += check_params(distr); - - out << distr; - if (!(out.str() == s.str())) - { - status += 1; - } - } - else if constexpr (std::is_same_v> - || std::is_same_v>) { - params_type mean{0.0}; - params_type stddev{1.0}; - - std::stringstream s; - s << mean << ' ' << stddev; - - bool flag_ = true; - params_type saved_ln_{1.2}; - params_type saved_u2_{1.3}; - - s << ' ' << flag_ << ' ' << saved_ln_ << ' ' << saved_u2_; - - std::ostringstream out; - std::istringstream in(s.str()); - - in >> distr; - status += check_params(distr); - - out << distr; - if (!(out.str() == s.str())) - { - status += 1; - } - } - else if constexpr (std::is_same_v>) { - params_type a{1.0}; - params_type b{1.0}; - - std::stringstream s; - s << a << ' ' << b; - - std::ostringstream out; - std::istringstream in(s.str()); - - in >> distr; - status += check_params(distr); - - out << distr; - if (!(out.str() == s.str())) - { - status += 1; - } - } - else if constexpr (std::is_same_v>) { - params_type a{0}; - params_type b = std::numeric_limits::max(); - - std::stringstream s; - s << a << ' ' << b; - - std::ostringstream out; - std::istringstream in(s.str()); - - in >> distr; - status += check_params(distr); - - out << distr; - if (!(out.str() == s.str())) - { - status += 1; - } - } - else { // uniform_real_distribution, cauchy_distribution, extreme_value_distribution - params_type a{0.0}; - params_type b{1.0}; - - std::stringstream s; - s << a << ' ' << b; - - std::ostringstream out; - std::istringstream in(s.str()); - - in >> distr; - status += check_params(distr); - - out << distr; - if (!(out.str() == s.str())) - { - status += 1; - } - } - - return status; -} - -template -bool -test_vec(sycl::queue& queue) -{ - - typename Distr::param_type params1; - typename Distr::param_type params2; - - make_param(params1, params2); - - int sum = 0; - - // Memory allocation - typename Distr::scalar_type res[N_GEN]; - constexpr std::int32_t num_elems = - oneapi::dpl::internal::type_traits_t::num_elems == 0 - ? 1 - : oneapi::dpl::internal::type_traits_t::num_elems; - - // Random number generation - { - sycl::buffer buffer(res, N_GEN); - - try - { - - queue.submit([&](sycl::handler& cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(N_GEN / (2 * num_elems)), [=](sycl::item<1> idx) { - unsigned long long offset = idx.get_linear_id() * num_elems; - oneapi::dpl::minstd_rand engine(SEED, offset); - Distr d1; - d1.param(params1); - Distr d2(params2); - d2.reset(); - typename Distr::result_type res0 = d1(engine, params2, 1); - typename Distr::result_type res1 = d1(engine, params1, 1); - for (int i = 0; i < num_elems; ++i) - { - acc[offset * 2 + i] = res0[i]; - acc[offset * 2 + num_elems + i] = res1[i]; - } - }); - }); - } - catch (sycl::exception const& e) - { - std::cout << "\t\tSYCL exception during generation\n" - << e.what() << std::endl; - return 1; - } - - queue.wait_and_throw(); - Distr distr; - sum += check_params(distr); - } - - return sum; -} - -template -bool -test(sycl::queue& queue) -{ - - typename Distr::param_type params1; - typename Distr::param_type params2; - - make_param(params1, params2); - - int status = 0; - - // Memory allocation - typename Distr::scalar_type res[N_GEN]; - - // Random number generation - { - { - Distr _d1(2); - Distr _d2(2); - if (_d1 != _d2) - { - status += 1; - std::cout << "Error: d1 != d2" << std::endl; - } - - status += check_input_output(_d1); - - if (_d1 == _d2) - { - status += 1; - std::cout << "Error: d1 == d2" << std::endl; - } - } - - sycl::buffer buffer(res, N_GEN); - - try - { - queue.submit([&](sycl::handler& cgh) { - sycl::stream out(1024, 256, cgh); - cgh.single_task<>([=]() { - Distr distr; - out << "params: " << distr << sycl::endl; - }); - }); - queue.wait_and_throw(); - - queue.submit([&](sycl::handler& cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(N_GEN / 2), [=](sycl::item<1> idx) { - unsigned long long offset = idx.get_linear_id(); - oneapi::dpl::minstd_rand engine(SEED, offset); - Distr d1; - d1.param(params1); - Distr d2(params2); - d2.reset(); - typename Distr::scalar_type res0 = d1(engine, params2); - typename Distr::scalar_type res1 = d1(engine, params1); - acc[offset * 2] = res0; - acc[offset * 2 + 1] = res1; - }); - }); - queue.wait_and_throw(); - } - catch (sycl::exception const& e) - { - std::cout << "\t\tSYCL exception during generation\n" - << e.what() << std::endl; - return 1; - } - - Distr distr; - status += check_params(distr); - } - - return status; -} - -#endif // TEST_UNNAMED_LAMBDAS - -int -main() -{ - -#if TEST_UNNAMED_LAMBDAS - - sycl::queue queue = TestUtils::get_test_queue(); - std::int32_t err = 0; - - // Skip tests if DP is not supported - if (TestUtils::has_type_support(queue.get_device())) { - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "uniform_int_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "uniform_int_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "uniform_real_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "normal_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "exponential_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "bernoulli_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "geometric_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "geometric_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "weibull_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "lognormal_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "cauchy_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "extreme_value_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - } - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "uniform_real_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "normal_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "exponential_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "weibull_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "lognormal_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "cauchy_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - std::cout << "---------------------------------------------------" << std::endl; - std::cout << "extreme_value_distribution" << std::endl; - std::cout << "---------------------------------------------------" << std::endl; - err += test>(queue); -#if TEST_LONG_RUN - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); - err += test_vec>>(queue); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - -#endif // TEST_UNNAMED_LAMBDAS - - return TestUtils::done(TEST_UNNAMED_LAMBDAS); -} \ No newline at end of file diff --git a/test/xpu_api/random/interface_tests/distributions_methods_dp.pass.cpp b/test/xpu_api/random/interface_tests/distributions_methods_dp.pass.cpp new file mode 100644 index 00000000000..017f4e82c84 --- /dev/null +++ b/test/xpu_api/random/interface_tests/distributions_methods_dp.pass.cpp @@ -0,0 +1,205 @@ +// -*- C++ -*- +//===-- distributions_methods_dp.pass.cpp -------------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Testing of different distributions' methods with integer and double +// whose implementation uses DP inside + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions_methods.hpp" +#endif // TEST_UNNAMED_LAMBDAS + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + std::int32_t err = 0; + + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "uniform_int_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "uniform_int_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "uniform_real_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "normal_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "exponential_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "bernoulli_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "geometric_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "geometric_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "weibull_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "lognormal_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "cauchy_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "extreme_value_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + } + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} \ No newline at end of file diff --git a/test/xpu_api/random/interface_tests/distributions_methods_sp.pass.cpp b/test/xpu_api/random/interface_tests/distributions_methods_sp.pass.cpp new file mode 100644 index 00000000000..02fec2413f8 --- /dev/null +++ b/test/xpu_api/random/interface_tests/distributions_methods_sp.pass.cpp @@ -0,0 +1,130 @@ +// -*- C++ -*- +//===-- distributions_methods_sp.pass.cpp -------------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Testing of different distributions' methods with single precision + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions_methods.hpp" +#endif // TEST_UNNAMED_LAMBDAS + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + std::int32_t err = 0; + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "uniform_real_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "normal_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "exponential_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "weibull_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "lognormal_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "cauchy_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + std::cout << "---------------------------------------------------" << std::endl; + std::cout << "extreme_value_distribution" << std::endl; + std::cout << "---------------------------------------------------" << std::endl; + err += test>(queue); +#if TEST_LONG_RUN + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); + err += test_vec>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/interface_tests/engines_methods.pass.cpp b/test/xpu_api/random/interface_tests/engines_methods.pass.cpp index 3d26a855c1c..6ba158e4977 100644 --- a/test/xpu_api/random/interface_tests/engines_methods.pass.cpp +++ b/test/xpu_api/random/interface_tests/engines_methods.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/statistics_tests/bernoulli_distribution_test.pass.cpp b/test/xpu_api/random/statistics_tests/bernoulli_distribution_test.pass.cpp index aaa3e2ec752..b920dddab88 100644 --- a/test/xpu_api/random/statistics_tests/bernoulli_distribution_test.pass.cpp +++ b/test/xpu_api/random/statistics_tests/bernoulli_distribution_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/statistics_tests/common_for_distributions.hpp b/test/xpu_api/random/statistics_tests/common_for_distributions.hpp new file mode 100644 index 00000000000..5212e5a8cdc --- /dev/null +++ b/test/xpu_api/random/statistics_tests/common_for_distributions.hpp @@ -0,0 +1,525 @@ +// -*- C++ -*- +//===----------------------------------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------===// + +#ifndef _ONEDPL_RANDOM_STATISTICS_TESTS_COMMON_FOR_DISTRS_H +#define _ONEDPL_RANDOM_STATISTICS_TESTS_COMMON_FOR_DISTRS_H + +#include +#include +#include +#include +#include + +#include "statistics_common.h" + +// Engine parameters +constexpr auto a = 40014u; +constexpr auto c = 200u; +constexpr auto m = 2147483563u; +constexpr auto seed = 777; + +template +using Element_type = typename oneapi::dpl::internal::type_traits_t::element_type; + +template +std::enable_if_t>, int> +statistics_check(int nsamples, const std::vector& samples, ScalarRealType lambda) +{ + // theoretical moments + double tM = 1 / lambda; + double tD = 1 / (lambda * lambda); + double tQ = 9 / (lambda * lambda * lambda * lambda); + + return compare_moments(nsamples, samples, tM, tD, tQ); +} + +template +std::enable_if_t>, int> +statistics_check(int nsamples, const std::vector& samples, ScalarRealType _a, ScalarRealType _b) +{ + // theoretical moments + const double y = 0.5772156649015328606065120; + const double pi = 3.1415926535897932384626433; + double tM = _a + _b * y; + double tD = pi * pi / 6.0 * _b * _b; + double tQ = 27.0 / 5.0 * tD * tD; + + return compare_moments(nsamples, samples, tM, tD, tQ); +} + +template +std::enable_if_t>, int> +statistics_check(int nsamples, const std::vector& samples, double p) +{ + // theoretical moments + double tM = (1 - p) / p; + double tD = (1 - p) / (p * p); + double tQ = (9 - 9 * p + p * p) * (1 - p) / (p * p * p * p); + + return compare_moments(nsamples, samples, tM, tD, tQ); +} + +template +std::enable_if_t>, int> +statistics_check(int nsamples, const std::vector& samples, ScalarRealType mean, ScalarRealType stddev) { + // theoretical moments + double tM = exp(mean + stddev * stddev / 2); + double tD = (exp(stddev * stddev) - 1) * exp(2 * mean + stddev * stddev); + double tQ = (exp(4 * stddev * stddev) + 2 * exp(3 * stddev * stddev) + 3 * exp(2 * stddev * stddev) - 3) * tD * tD; + + return compare_moments(nsamples, samples, tM, tD, tQ); +} + +template +std::enable_if_t>, int> +statistics_check(int nsamples, const std::vector& samples, ScalarRealType mean, ScalarRealType stddev) { + // theoretical moments + double tM = mean; + double tD = stddev * stddev; + double tQ = 720.0 * stddev * stddev * stddev * stddev; + + return compare_moments(nsamples, samples, tM, tD, tQ); +} + +template +std::enable_if_t>, int> +statistics_check(int nsamples, const std::vector& samples, ScalarRealType left, ScalarRealType right) +{ + // theoretical moments + double tM = (right + left) / 2.0; + double tD = ((right - left) * (right - left)) / 12.0; + double tQ = ((right - left) * (right - left) * (right - left) * (right - left)) / 80.0; + + return compare_moments(nsamples, samples, tM, tD, tQ); +} + +template +std::enable_if_t>, int> +statistics_check(int nsamples, const std::vector& samples, ScalarRealType _a, ScalarRealType _b) +{ + // theoretical moments + double G1 = sycl::tgamma(1 + 1 / _a); + double G2 = sycl::tgamma(1 + 2 / _a); + double G3 = sycl::tgamma(1 + 3 / _a); + double G4 = sycl::tgamma(1 + 4 / _a); + double tM = _b * G1; + double tD = _b * _b * (G2 - G1 * G1); + double tQ = _b * _b * _b * _b * ((-3) * G1 * G1 * G1 * G1 + 12 * G1 * G1 * G2 - 4 * G1 * G3 + G4 - 6 * G2 * G1 *G1); + + return compare_moments(nsamples, samples, tM, tD, tQ); +} + +template , class... Args> +int +test(sycl::queue& queue, int nsamples, Args... params) +{ + using Type = typename Distr::result_type; + + // memory allocation + std::vector> samples(nsamples); + + constexpr int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 + ? 1 + : oneapi::dpl::internal::type_traits_t::num_elems; + + // generation + { + sycl::buffer, 1> buffer(samples.data(), nsamples); + + queue.submit([&](sycl::handler& cgh) { + auto acc = buffer.template get_access(cgh); + + cgh.parallel_for<>(sycl::range<1>(nsamples / num_elems), [=](sycl::item<1> idx) { + unsigned long long offset = idx.get_linear_id() * num_elems; + Engine engine(seed); + engine.discard(offset); + Distr distr(params...); + + sycl::vec, num_elems> res = distr(engine); + res.store(idx.get_linear_id(), acc); + }); + }); + } + + // statistics check + int err = statistics_check, Distr>(nsamples, samples, params...); + + if (err) + { + std::cout << "\tFailed" << std::endl; + } + else + { + std::cout << "\tPassed" << std::endl; + } + + return err; +} + +template , class... Args> +int +test_portion(sycl::queue& queue, int nsamples, unsigned int part, Args... params) +{ + using Type = typename Distr::result_type; + + // memory allocation + std::vector> samples(nsamples); + constexpr unsigned int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 + ? 1 + : oneapi::dpl::internal::type_traits_t::num_elems; + int n_elems = (part >= num_elems) ? num_elems : part; + + // generation + { + sycl::buffer, 1> buffer(samples.data(), nsamples); + + queue.submit([&](sycl::handler& cgh) { + auto acc = buffer.template get_access(cgh); + + cgh.parallel_for<>(sycl::range<1>(nsamples / n_elems), [=](sycl::item<1> idx) { + unsigned long long offset = idx.get_linear_id() * n_elems; + Engine engine(seed); + engine.discard(offset); + Distr distr(params...); + + sycl::vec, num_elems> res = distr(engine, part); + for (int i = 0; i < n_elems; ++i) + acc[offset + i] = res[i]; + }); + }); + queue.wait_and_throw(); + } + + // statistics check + int err = statistics_check, Distr>(nsamples, samples, params...); + + if (err) + { + std::cout << "\tFailed" << std::endl; + } + else + { + std::cout << "\tPassed" << std::endl; + } + + return err; +} + +template +std::enable_if_t>, int> +tests_set(sycl::queue& queue, int nsamples) +{ + using real_type = typename Distr::result_type; + + constexpr int nparams = 2; + + oneapi::dpl::internal::element_type_t lambda_array[nparams] = {0.5, 1.5}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) + { + std::cout << "exponential_distribution test, lambda = " << lambda_array[i] + << ", nsamples = " << nsamples; + if (test(queue, nsamples, lambda_array[i])) { + return 1; + } + } + return 0; +} + +template +std::enable_if_t>, int> +tests_set(sycl::queue& queue, int nsamples) +{ + using real_type = typename Distr::result_type; + + constexpr int nparams = 2; + + oneapi::dpl::internal::element_type_t a_array [nparams] = {2.0, -10.0}; + oneapi::dpl::internal::element_type_t b_array [nparams] = {1.0, 10.0}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) { + std::cout << "extreme_value_distribution test, a = " << a_array[i] << ", b = " << b_array[i] << + ", nsamples = " << nsamples; + if (test(queue, nsamples, a_array[i], b_array[i])) { + return 1; + } + } + return 0; +} + +template +std::enable_if_t>, int> +tests_set(sycl::queue& queue, int nsamples) +{ + constexpr int nparams = 2; + + double p_array[nparams] = {0.2, 0.9}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) { + std::cout << "geometric_distribution test, p = " << p_array[i] + << ", nsamples = " << nsamples; + if (test(queue, nsamples, p_array[i])) { + return 1; + } + } + return 0; +} + +template +std::enable_if_t>, int> +tests_set(sycl::queue& queue, int nsamples) +{ + using real_type = typename Distr::result_type; + + constexpr int nparams = 2; + + oneapi::dpl::internal::element_type_t mean_array [nparams] = {0.0, 1.0}; + oneapi::dpl::internal::element_type_t stddev_array [nparams] = {1.0, 1000.0}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) { + std::cout << "lognormal_distribution test, mean = " << mean_array[i] << ", stddev = " << stddev_array[i] << + ", nsamples = " << nsamples; + if (test(queue, nsamples, mean_array[i], stddev_array[i])) { + return 1; + } + } + + return 0; +} + +template +std::enable_if_t>, int> +tests_set(sycl::queue& queue, int nsamples) +{ + using real_type = typename Distr::result_type; + + constexpr int nparams = 2; + + oneapi::dpl::internal::element_type_t mean_array [nparams] = {0.0, 1.0}; + oneapi::dpl::internal::element_type_t stddev_array [nparams] = {1.0, 1000.0}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) { + std::cout << "normal_distribution test, mean = " << mean_array[i] << ", stddev = " << stddev_array[i] << + ", nsamples = " << nsamples; + if (test(queue, nsamples, mean_array[i], stddev_array[i])) { + return 1; + } + } + + return 0; +} + +template > +std::enable_if_t>, int> +tests_set(sycl::queue& queue, int nsamples) +{ + using real_type = typename Distr::result_type; + + constexpr int nparams = 2; + + oneapi::dpl::internal::element_type_t left_array [nparams] = {0.0, -10.0}; + oneapi::dpl::internal::element_type_t right_array [nparams] = {1.0, 10.0}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) { + std::cout << "uniform_real_distribution test, left = " << left_array[i] << ", right = " << right_array[i] << + ", nsamples = " << nsamples; + if (test(queue, nsamples, left_array[i], right_array[i])) { + return 1; + } + } + + return 0; +} + +template +std::enable_if_t>, int> +tests_set(sycl::queue& queue, int nsamples) +{ + using real_type = typename Distr::result_type; + + constexpr int nparams = 2; + + oneapi::dpl::internal::element_type_t a_array [nparams] = {2.0, 10.0}; + oneapi::dpl::internal::element_type_t b_array [nparams] = {1.0, 10.0}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) { + std::cout << "weibull_distribution test, a = " << a_array[i] << ", b = " << b_array[i] << + ", nsamples = " << nsamples; + if (test(queue, nsamples, a_array[i], b_array[i])) { + return 1; + } + } + + return 0; +} + +template +std::enable_if_t>, int> +tests_set_portion(sycl::queue& queue, std::int32_t nsamples, unsigned int part) +{ + using real_type = typename Distr::result_type; + + constexpr int nparams = 2; + + oneapi::dpl::internal::element_type_t lambda_array[nparams] = {0.5, 1.5}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) + { + std::cout << "exponential_distribution test, lambda = " << lambda_array[i] << ", nsamples = " << nsamples + << ", part = " << part; + if (test_portion(queue, nsamples, part, lambda_array[i])) { + return 1; + } + } + + return 0; +} + +template +std::enable_if_t>, int> +tests_set_portion(sycl::queue& queue, std::int32_t nsamples, unsigned int part) +{ + using real_type = typename Distr::result_type; + + constexpr int nparams = 2; + + oneapi::dpl::internal::element_type_t a_array [nparams] = {2.0, -10.0}; + oneapi::dpl::internal::element_type_t b_array [nparams] = {1.0, 10.0}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) { + std::cout << "extreme_value_distribution test, a = " << a_array[i] << ", b = " << b_array[i] << + ", nsamples = " << nsamples << ", part = " << part; + if (test_portion(queue, nsamples, part, a_array[i], b_array[i])) { + return 1; + } + } + + return 0; +} + +template +std::enable_if_t>, int> +tests_set_portion(sycl::queue& queue, std::int32_t nsamples, unsigned int part) +{ + using real_type = typename Distr::result_type; + + constexpr int nparams = 2; + + double p_array[nparams] = {0.2, 0.9}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) { + std::cout << "geometric_distribution test, p = " << p_array[i] << ", nsamples = " << nsamples + << ", part = " << part; + if (test_portion(queue, nsamples, part, p_array[i])) { + return 1; + } + } + + return 0; +} + +template +std::enable_if_t>, int> +tests_set_portion(sycl::queue& queue, std::int32_t nsamples, unsigned int part) +{ + using real_type = typename Distr::result_type; + + constexpr int nparams = 2; + + oneapi::dpl::internal::element_type_t mean_array [nparams] = {0.0, 1.0}; + oneapi::dpl::internal::element_type_t stddev_array [nparams] = {1.0, 1000.0}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) { + std::cout << "lognormal_distribution test, mean = " << mean_array[i] << ", stddev = " << stddev_array[i] << + ", nsamples = " << nsamples << ", part = "<< part; + if (test_portion(queue, nsamples, part, mean_array[i], stddev_array[i])) { + return 1; + } + } + return 0; +} + +template +std::enable_if_t>, int> +tests_set_portion(sycl::queue& queue, std::int32_t nsamples, unsigned int part) +{ + using real_type = typename Distr::result_type; + + constexpr int nparams = 2; + + oneapi::dpl::internal::element_type_t mean_array [nparams] = {0.0, 1.0}; + oneapi::dpl::internal::element_type_t stddev_array [nparams] = {1.0, 1000.0}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) { + std::cout << "normal_distribution test, mean = " << mean_array[i] << ", stddev = " << stddev_array[i] << + ", nsamples = " << nsamples << ", part = "<< part; + if (test_portion(queue, nsamples, part, mean_array[i], stddev_array[i])) { + return 1; + } + } + return 0; +} + +template> +std::enable_if_t>, int> +tests_set_portion(sycl::queue& queue, std::int32_t nsamples, unsigned int part) +{ + using real_type = typename Distr::result_type; + + constexpr int nparams = 2; + + oneapi::dpl::internal::element_type_t left_array [nparams] = {0.0, -10.0}; + oneapi::dpl::internal::element_type_t right_array [nparams] = {1.0, 10.0}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) { + std::cout << "uniform_real_distribution test, left = " << left_array[i] << ", right = " << right_array[i] << + ", nsamples = " << nsamples << ", part = " << part; + if (test_portion(queue, nsamples, part, left_array[i], right_array[i])) { + return 1; + } + } + return 0; +} + +template +std::enable_if_t>, int> +tests_set_portion(sycl::queue& queue, std::int32_t nsamples, unsigned int part) +{ + using real_type = typename Distr::result_type; + + constexpr int nparams = 2; + + oneapi::dpl::internal::element_type_t a_array [nparams] = {2.0, 10.0}; + oneapi::dpl::internal::element_type_t b_array [nparams] = {1.0, 10.0}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) { + std::cout << "weibull_distribution test, a = " << a_array[i] << ", b = " << b_array[i] << + ", nsamples = " << nsamples << ", part = " << part; + if (test_portion(queue, nsamples, part, a_array[i], b_array[i])) { + return 1; + } + } + return 0; +} + +#endif // _ONEDPL_RANDOM_STATISTICS_TESTS_COMMON_FOR_DISTRS_H diff --git a/test/xpu_api/random/statistics_tests/exponential_distribution_dp_test.pass.cpp b/test/xpu_api/random/statistics_tests/exponential_distribution_dp_test.pass.cpp new file mode 100644 index 00000000000..36e3377fb19 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/exponential_distribution_dp_test.pass.cpp @@ -0,0 +1,242 @@ +// -*- C++ -*- +//===-- exponential_distribution_dp_test.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of exponential_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::exponential_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { + // testing double and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------" << std::endl; + std::cout << "double, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------" << std::endl; + err += tests_set, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set, sycl::vec>(queue, nsamples); + err += tests_set, sycl::vec>(queue, nsamples); + err += tests_set, sycl::vec>(queue, nsamples); + err += tests_set, sycl::vec>(queue, nsamples); + err += tests_set, sycl::vec>(queue, nsamples); + err += tests_set, sycl::vec>(queue, nsamples); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 99); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set_portion>, std::uint32_t>(queue, 99, 1); + err += tests_set_portion>, std::uint32_t>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 100); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 160, 5); + err += tests_set_portion>, std::uint32_t>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 140, 7); + err += tests_set_portion>, std::uint32_t>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + } + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/exponential_distribution_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/exponential_distribution_sp_test.pass.cpp new file mode 100644 index 00000000000..2c82a6a8138 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/exponential_distribution_sp_test.pass.cpp @@ -0,0 +1,223 @@ +// -*- C++ -*- +//===-- exponential_distribution_sp_test.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of exponential_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::exponential_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 99); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set_portion>, std::uint32_t>(queue, 99, 1); + err += tests_set_portion>, std::uint32_t>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 100); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 160, 5); + err += tests_set_portion>, std::uint32_t>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 140, 7); + err += tests_set_portion>, std::uint32_t>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/exponential_distribution_test.pass.cpp b/test/xpu_api/random/statistics_tests/exponential_distribution_test.pass.cpp deleted file mode 100644 index 0e154e68d2e..00000000000 --- a/test/xpu_api/random/statistics_tests/exponential_distribution_test.pass.cpp +++ /dev/null @@ -1,585 +0,0 @@ -// -*- C++ -*- -//===-- exponential_distribution_test.cpp ---------------------------------===// -// -// Copyright (C) Intel Corporation -// -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// -//===----------------------------------------------------------------------===// -// -// Abstract: -// -// Test of exponential_distribution - check statistical properties of the distribution - -#include "support/utils.h" -#include - -#if TEST_UNNAMED_LAMBDAS -#include -#include -#include -#include -#include "statistics_common.h" - -// Engine parameters -constexpr auto a = 40014u; -constexpr auto c = 200u; -constexpr auto m = 2147483563u; -constexpr auto seed = 777; - -template -int -statistics_check(int nsamples, ScalarRealType lambda, const std::vector& samples) -{ - // theoretical moments - double tM = 1 / lambda; - double tD = 1 / (lambda * lambda); - double tQ = 9 / (lambda * lambda * lambda * lambda); - - return compare_moments(nsamples, samples, tM, tD, tQ); -} - -template -int -test(sycl::queue& queue, oneapi::dpl::internal::element_type_t lambda, int nsamples) -{ - // memory allocation - std::vector> samples(nsamples); - - constexpr int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 - ? 1 - : oneapi::dpl::internal::type_traits_t::num_elems; - - // generation - { - sycl::buffer, 1> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler& cgh) { - auto acc = buffer.template get_access(cgh); - - cgh.parallel_for<>(sycl::range<1>(nsamples / num_elems), [=](sycl::item<1> idx) { - unsigned long long offset = idx.get_linear_id() * num_elems; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::exponential_distribution distr(lambda); - - sycl::vec, num_elems> res = distr(engine); - res.store(idx.get_linear_id(), acc); - }); - }); - } - - // statistics check - int err = statistics_check(nsamples, lambda, samples); - - if (err) - { - std::cout << "\tFailed" << std::endl; - } - else - { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int -test_portion(sycl::queue& queue, oneapi::dpl::internal::element_type_t lambda, int nsamples, unsigned int part) -{ - // memory allocation - std::vector> samples(nsamples); - constexpr unsigned int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 - ? 1 - : oneapi::dpl::internal::type_traits_t::num_elems; - int n_elems = (part >= num_elems) ? num_elems : part; - - // generation - { - sycl::buffer, 1> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler& cgh) { - auto acc = buffer.template get_access(cgh); - - cgh.parallel_for<>(sycl::range<1>(nsamples / n_elems), [=](sycl::item<1> idx) { - unsigned long long offset = idx.get_linear_id() * n_elems; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::exponential_distribution distr(lambda); - - sycl::vec, num_elems> res = distr(engine, part); - for (int i = 0; i < n_elems; ++i) - acc[offset + i] = res[i]; - }); - }); - queue.wait_and_throw(); - } - - // statistics check - int err = statistics_check(nsamples, lambda, samples); - - if (err) - { - std::cout << "\tFailed" << std::endl; - } - else - { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int -tests_set(sycl::queue& queue, int nsamples) -{ - constexpr int nparams = 2; - - oneapi::dpl::internal::element_type_t lambda_array[nparams] = {0.5, 1.5}; - - // Test for all non-zero parameters - for (int i = 0; i < nparams; ++i) - { - std::cout << "exponential_distribution test, lambda = " << lambda_array[i] - << ", nsamples = " << nsamples; - if (test(queue, lambda_array[i], nsamples)) - { - return 1; - } - } - return 0; -} - -template -int -tests_set_portion(sycl::queue& queue, std::int32_t nsamples, unsigned int part) -{ - constexpr int nparams = 2; - - oneapi::dpl::internal::element_type_t lambda_array[nparams] = {0.5, 1.5}; - - // Test for all non-zero parameters - for (int i = 0; i < nparams; ++i) - { - std::cout << "exponential_distribution test, lambda = " << lambda_array[i] << ", nsamples = " << nsamples - << ", part = " << part; - if (test_portion(queue, lambda_array[i], nsamples, part)) - { - return 1; - } - } - return 0; -} - -#endif // TEST_UNNAMED_LAMBDAS - -int -main() -{ - -#if TEST_UNNAMED_LAMBDAS - - sycl::queue queue = TestUtils::get_test_queue(); - - constexpr int nsamples = 100; - int err = 0; - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 99); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set_portion, std::uint32_t>(queue, 99, 1); - err += tests_set_portion, std::uint32_t>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 100); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 160, 5); - err += tests_set_portion, std::uint32_t>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 140, 7); - err += tests_set_portion, std::uint32_t>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // Skip tests if DP is not supported - if (TestUtils::has_type_support(queue.get_device())) { - // testing double and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------" << std::endl; - std::cout << "double, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------" << std::endl; - err += tests_set(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set>(queue, nsamples); - err += tests_set>(queue, nsamples); - err += tests_set>(queue, nsamples); - err += tests_set>(queue, nsamples); - err += tests_set>(queue, nsamples); - err += tests_set>(queue, nsamples); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 99); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set_portion, std::uint32_t>(queue, 99, 1); - err += tests_set_portion, std::uint32_t>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 100); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 160, 5); - err += tests_set_portion, std::uint32_t>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 140, 7); - err += tests_set_portion, std::uint32_t>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - } - -#endif // TEST_UNNAMED_LAMBDAS - - return TestUtils::done(TEST_UNNAMED_LAMBDAS); -} diff --git a/test/xpu_api/random/statistics_tests/extreme_value_distribution_dp_tests_set_portion_test.pass.cpp b/test/xpu_api/random/statistics_tests/extreme_value_distribution_dp_tests_set_portion_test.pass.cpp new file mode 100644 index 00000000000..56c474b0014 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/extreme_value_distribution_dp_tests_set_portion_test.pass.cpp @@ -0,0 +1,183 @@ +// -*- C++ -*- +//===-- extreme_value_distribution_dp_tests_set_portion_test.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of extreme_value_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::extreme_value_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + int err = 0; + + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set_portion>, std::uint32_t>(queue, 99, 1); + err += tests_set_portion>, std::uint32_t>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 160, 5); + err += tests_set_portion>, std::uint32_t>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 140, 7); + err += tests_set_portion>, std::uint32_t>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + } + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/extreme_value_distribution_dp_tests_set_test.pass.cpp b/test/xpu_api/random/statistics_tests/extreme_value_distribution_dp_tests_set_test.pass.cpp new file mode 100644 index 00000000000..60a65a80fd9 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/extreme_value_distribution_dp_tests_set_test.pass.cpp @@ -0,0 +1,131 @@ +// -*- C++ -*- +//===-- extreme_value_distribution_dp_tests_set_test.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of extreme_value_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::extreme_value_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 99); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 100); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + } + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/extreme_value_distribution_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/extreme_value_distribution_sp_test.pass.cpp new file mode 100644 index 00000000000..fc5031f2077 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/extreme_value_distribution_sp_test.pass.cpp @@ -0,0 +1,223 @@ +// -*- C++ -*- +//===-- extreme_value_distribution_sp_test.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of extreme_value_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::extreme_value_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 99); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set_portion>, std::uint32_t>(queue, 99, 1); + err += tests_set_portion>, std::uint32_t>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 100); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 160, 5); + err += tests_set_portion>, std::uint32_t>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 140, 7); + err += tests_set_portion>, std::uint32_t>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/extreme_value_distribution_test.pass.cpp b/test/xpu_api/random/statistics_tests/extreme_value_distribution_test.pass.cpp deleted file mode 100644 index da3727a8c3b..00000000000 --- a/test/xpu_api/random/statistics_tests/extreme_value_distribution_test.pass.cpp +++ /dev/null @@ -1,569 +0,0 @@ -// -*- C++ -*- -//===-- extreme_value_distribution_test.cpp ---------------------------------===// -// -// Copyright (C) Intel Corporation -// -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// -//===----------------------------------------------------------------------===// -// -// Abstract: -// -// Test of extreme_value_distribution - check statistical properties of the distribution - -#include "support/utils.h" -#include - -#if TEST_UNNAMED_LAMBDAS -#include -#include -#include -#include -#include "statistics_common.h" - -// Engine parameters -constexpr auto a = 40014u; -constexpr auto c = 200u; -constexpr auto m = 2147483563u; -constexpr auto seed = 777; - -template -int -statistics_check(int nsamples, ScalarRealType _a, ScalarRealType _b, const std::vector& samples) -{ - // theoretical moments - const double y = 0.5772156649015328606065120; - const double pi = 3.1415926535897932384626433; - double tM = _a + _b * y; - double tD = pi * pi / 6.0 * _b * _b; - double tQ = 27.0 / 5.0 * tD * tD; - - return compare_moments(nsamples, samples, tM, tD, tQ); -} - -template -int -test(sycl::queue& queue, oneapi::dpl::internal::element_type_t _a, oneapi::dpl::internal::element_type_t _b, int nsamples) -{ - - // memory allocation - std::vector> samples(nsamples); - - constexpr int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 - ? 1 - : oneapi::dpl::internal::type_traits_t::num_elems; - - // generation - { - sycl::buffer, 1> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler& cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / num_elems), [=](sycl::item<1> idx) { - unsigned long long offset = idx.get_linear_id() * num_elems; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::extreme_value_distribution distr(_a, _b); - - sycl::vec, num_elems> res = distr(engine); - res.store(idx.get_linear_id(), acc); - }); - }); - } - - // statistics check - int err = statistics_check(nsamples, _a, _b, samples); - - if (err) - { - std::cout << "\tFailed" << std::endl; - } - else - { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int -test_portion(sycl::queue& queue, oneapi::dpl::internal::element_type_t _a, oneapi::dpl::internal::element_type_t _b, - int nsamples, unsigned int part) -{ - // memory allocation - std::vector> samples(nsamples); - constexpr unsigned int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 - ? 1 - : oneapi::dpl::internal::type_traits_t::num_elems; - int n_elems = (part >= num_elems) ? num_elems : part; - - // generation - { - sycl::buffer, 1> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler& cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / n_elems), [=](sycl::item<1> idx) { - unsigned long long offset = idx.get_linear_id() * n_elems; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::extreme_value_distribution distr(_a, _b); - - sycl::vec, num_elems> res = distr(engine, part); - for (int i = 0; i < n_elems; ++i) - acc[offset + i] = res[i]; - }); - }); - queue.wait_and_throw(); - } - - // statistics check - int err = statistics_check(nsamples, _a, _b, samples); - - if (err) - { - std::cout << "\tFailed" << std::endl; - } - else - { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int -tests_set(sycl::queue& queue, int nsamples) -{ - constexpr int nparams = 2; - oneapi::dpl::internal::element_type_t a_array [nparams] = {2.0, -10.0}; - oneapi::dpl::internal::element_type_t b_array [nparams] = {1.0, 10.0}; - - // Test for all non-zero parameters - for(int i = 0; i < nparams; ++i) { - std::cout << "extreme_value_distribution test, a = " << a_array[i] << ", b = " << b_array[i] << - ", nsamples = " << nsamples; - if(test(queue, a_array[i], b_array[i], nsamples)) { - return 1; - } - } - return 0; -} - -template -int -tests_set_portion(sycl::queue& queue, std::int32_t nsamples, unsigned int part) -{ - constexpr int nparams = 2; - oneapi::dpl::internal::element_type_t a_array [nparams] = {2.0, -10.0}; - oneapi::dpl::internal::element_type_t b_array [nparams] = {1.0, 10.0}; - - // Test for all non-zero parameters - for(int i = 0; i < nparams; ++i) { - std::cout << "extreme_value_distribution test, a = " << a_array[i] << ", b = " << b_array[i] << - ", nsamples = " << nsamples << ", part = " << part; - if(test_portion(queue, a_array[i], b_array[i], nsamples, part)) { - return 1; - } - } - return 0; -} - -#endif // TEST_UNNAMED_LAMBDAS - -int -main() -{ - -#if TEST_UNNAMED_LAMBDAS - - sycl::queue queue = TestUtils::get_test_queue(); - - constexpr int nsamples = 100; - int err = 0; - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 99); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set_portion, std::uint32_t>(queue, 99, 1); - err += tests_set_portion, std::uint32_t>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 100); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 160, 5); - err += tests_set_portion, std::uint32_t>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 140, 7); - err += tests_set_portion, std::uint32_t>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // Skip tests if DP is not supported - if (TestUtils::has_type_support(queue.get_device())) { - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 99); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set_portion, std::uint32_t>(queue, 99, 1); - err += tests_set_portion, std::uint32_t>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 100); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 160, 5); - err += tests_set_portion, std::uint32_t>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 140, 7); - err += tests_set_portion, std::uint32_t>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - } - -#endif // TEST_UNNAMED_LAMBDAS - - return TestUtils::done(TEST_UNNAMED_LAMBDAS); -} diff --git a/test/xpu_api/random/statistics_tests/geometric_distribution_test.pass.cpp b/test/xpu_api/random/statistics_tests/geometric_distribution_test.pass.cpp index 9d030accf93..96061269f7a 100644 --- a/test/xpu_api/random/statistics_tests/geometric_distribution_test.pass.cpp +++ b/test/xpu_api/random/statistics_tests/geometric_distribution_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: @@ -18,167 +12,12 @@ // Test of geometric_distribution - check statistical properties of the distribution #include "support/utils.h" -#include #if TEST_UNNAMED_LAMBDAS -#include -#include -#include -#include "statistics_common.h" - -// Engine parameters -constexpr auto a = 40014u; -constexpr auto c = 200u; -constexpr auto m = 2147483563u; -constexpr auto seed = 777; - -template -int -statistics_check(int nsamples, double p, const std::vector& samples) -{ - // theoretical moments - double tM = (1 - p) / p; - double tD = (1 - p) / (p * p); - double tQ = (9 - 9 * p + p * p) * (1 - p) / (p * p * p * p); - - return compare_moments(nsamples, samples, tM, tD, tQ); -} - -template -int -test(sycl::queue& queue, double p, int nsamples) -{ - - // memory allocation - std::vector> samples(nsamples); - - constexpr int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 - ? 1 - : oneapi::dpl::internal::type_traits_t::num_elems; - - // dpstd generation - { - sycl::buffer, 1> buffer(samples.data(), samples.size()); - - queue.submit([&](sycl::handler& cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / num_elems), [=](sycl::item<1> idx) { - unsigned long long offset = idx.get_linear_id() * num_elems; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::geometric_distribution distr(p); - - sycl::vec, num_elems> res = distr(engine); - res.store(idx.get_linear_id(), acc); - }); - }); - } - - // statistics check - int err = statistics_check(nsamples, p, samples); - - if (err) - { - std::cout << "\tFailed" << std::endl; - } - else - { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int -test_portion(sycl::queue& queue, double p, int nsamples, unsigned int part) -{ +#include "common_for_distributions.hpp" - // memory allocation - std::vector> samples(nsamples); - constexpr unsigned int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 - ? 1 - : oneapi::dpl::internal::type_traits_t::num_elems; - int n_elems = (part >= num_elems) ? num_elems : part; - - - // generation - { - sycl::buffer, 1> buffer(samples.data(), samples.size()); - - queue.submit([&](sycl::handler& cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / n_elems), [=](sycl::item<1> idx) { - unsigned long long offset = idx.get_linear_id() * n_elems; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::geometric_distribution distr(p); - - sycl::vec, num_elems> res = distr(engine, part); - for (int i = 0; i < n_elems; ++i) - acc[idx.get_linear_id() * n_elems + i] = res[i]; - }); - }); - queue.wait_and_throw(); - } - - // statistics check - int err = statistics_check(nsamples, p, samples); - - if (err) - { - std::cout << "\tFailed" << std::endl; - } - else - { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int -tests_set(sycl::queue& queue, int nsamples) -{ - constexpr int nparams = 2; - - double p_array[nparams] = {0.2, 0.9}; - - // Test for all non-zero parameters - for (int i = 0; i < nparams; ++i) - { - std::cout << "geometric_distribution test, p = " << p_array[i] - << ", nsamples = " << nsamples; - if (test(queue, p_array[i], nsamples)) - { - return 1; - } - } - return 0; -} - -template -int -tests_set_portion(sycl::queue& queue, std::int32_t nsamples, unsigned int part) -{ - - constexpr int nparams = 2; - - double p_array[nparams] = {0.2, 0.9}; - - // Test for all non-zero parameters - for (int i = 0; i < nparams; ++i) - { - std::cout << "geometric_distribution test, p = " << p_array[i] << ", nsamples = " << nsamples - << ", part = " << part; - if (test_portion(queue, p_array[i], nsamples, part)) - { - return 1; - } - } - return 0; -} +template +using Distr = oneapi::dpl::geometric_distribution; #endif // TEST_UNNAMED_LAMBDAS @@ -198,25 +37,25 @@ main() std::cout << "---------------------------------------------------------------------" << std::endl; std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); + err = tests_set>, std::uint32_t>(queue, nsamples); #if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); #endif // TEST_LONG_RUN EXPECT_TRUE(!err, "Test FAILED"); @@ -224,28 +63,28 @@ main() std::cout << "---------------------------------------------------------------------" << std::endl; std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); + err = tests_set>, std::uint32_t>(queue, nsamples); #if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); #endif // TEST_LONG_RUN EXPECT_TRUE(!err, "Test FAILED"); @@ -253,28 +92,28 @@ main() std::cout << "---------------------------------------------------------------------" << std::endl; std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 99); + err = tests_set>, std::uint32_t>(queue, 99); #if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set_portion, std::uint32_t>(queue, 99, 1); - err += tests_set_portion, std::uint32_t>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set_portion>, std::uint32_t>(queue, 99, 1); + err += tests_set_portion>, std::uint32_t>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); #endif // TEST_LONG_RUN EXPECT_TRUE(!err, "Test FAILED"); @@ -282,28 +121,28 @@ main() std::cout << "---------------------------------------------------------------------" << std::endl; std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 100); + err = tests_set>, std::uint32_t>(queue, 100); #if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); #endif // TEST_LONG_RUN EXPECT_TRUE(!err, "Test FAILED"); @@ -311,35 +150,35 @@ main() std::cout << "---------------------------------------------------------------------" << std::endl; std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); + err = tests_set>, std::uint32_t>(queue, 160); #if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 160, 5); - err += tests_set_portion, std::uint32_t>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 160, 5); + err += tests_set_portion>, std::uint32_t>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); #endif // TEST_LONG_RUN EXPECT_TRUE(!err, "Test FAILED"); @@ -347,35 +186,35 @@ main() std::cout << "---------------------------------------------------------------------" << std::endl; std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); + err = tests_set>, std::uint32_t>(queue, 160); #if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 140, 7); - err += tests_set_portion, std::uint32_t>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 140, 7); + err += tests_set_portion>, std::uint32_t>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); #endif // TEST_LONG_RUN EXPECT_TRUE(!err, "Test FAILED"); } diff --git a/test/xpu_api/random/statistics_tests/lognormal_distribution_dp_tests_set_portion_test.pass.cpp b/test/xpu_api/random/statistics_tests/lognormal_distribution_dp_tests_set_portion_test.pass.cpp new file mode 100644 index 00000000000..b1c8ebb9913 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/lognormal_distribution_dp_tests_set_portion_test.pass.cpp @@ -0,0 +1,182 @@ +// -*- C++ -*- +//===-- lognormal_distribution_dp_tests_set_portion_test.cpp ---------------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===-------------------------------------------------------------------------===// +// +// Abstract: +// +// Test of lognormal_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::lognormal_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int main() { + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err += tests_set_portion>, std::uint32_t>(queue, 99, 1); + err += tests_set_portion>, std::uint32_t>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 160, 5); + err += tests_set_portion>, std::uint32_t>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 140, 7); + err += tests_set_portion>, std::uint32_t>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + } + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/lognormal_distribution_dp_tests_set_test.pass.cpp b/test/xpu_api/random/statistics_tests/lognormal_distribution_dp_tests_set_test.pass.cpp new file mode 100644 index 00000000000..115ac81970c --- /dev/null +++ b/test/xpu_api/random/statistics_tests/lognormal_distribution_dp_tests_set_test.pass.cpp @@ -0,0 +1,129 @@ +// -*- C++ -*- +//===-- lognormal_distribution_dp_tests_set_test.cpp ---------------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===-------------------------------------------------------------------------===// +// +// Abstract: +// +// Test of lognormal_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::lognormal_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int main() { + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 99); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 100); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + } + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/lognormal_distribution_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/lognormal_distribution_sp_test.pass.cpp new file mode 100644 index 00000000000..719f5a0fd49 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/lognormal_distribution_sp_test.pass.cpp @@ -0,0 +1,221 @@ +// -*- C++ -*- +//===-- lognormal_distribution_sp_test.cpp ---------------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===-------------------------------------------------------------------------===// +// +// Abstract: +// +// Test of lognormal_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::lognormal_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int main() { + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 99); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set_portion>, std::uint32_t>(queue, 99, 1); + err += tests_set_portion>, std::uint32_t>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 100); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 160, 5); + err += tests_set_portion>, std::uint32_t>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 140, 7); + err += tests_set_portion>, std::uint32_t>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/lognormal_distribution_test.pass.cpp b/test/xpu_api/random/statistics_tests/lognormal_distribution_test.pass.cpp deleted file mode 100644 index b76b8d3c55c..00000000000 --- a/test/xpu_api/random/statistics_tests/lognormal_distribution_test.pass.cpp +++ /dev/null @@ -1,557 +0,0 @@ -// -*- C++ -*- -//===-- lognormal_distribution_test.cpp ---------------------------------------===// -// -// Copyright (C) Intel Corporation -// -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// -//===-------------------------------------------------------------------------===// -// -// Abstract: -// -// Test of lognormal_distribution - check statistical properties of the distribution - -#include "support/utils.h" -#include - -#if TEST_UNNAMED_LAMBDAS -#include -#include -#include -#include -#include "statistics_common.h" - -// Engine parameters -constexpr auto a = 40014u; -constexpr auto c = 200u; -constexpr auto m = 2147483563u; -constexpr auto seed = 777; - -template -int statistics_check(int nsamples, ScalarRealType mean, ScalarRealType stddev, - const std::vector& samples) { - // theoretical moments - double tM = exp(mean + stddev * stddev / 2); - double tD = (exp(stddev * stddev) - 1) * exp(2 * mean + stddev * stddev); - double tQ = (exp(4 * stddev * stddev) + 2 * exp(3 * stddev * stddev) + 3 * exp(2 * stddev * stddev) - 3) * tD * tD; - - return compare_moments(nsamples, samples, tM, tD, tQ); -} - -template -int test(sycl::queue& queue, oneapi::dpl::internal::element_type_t mean, oneapi::dpl::internal::element_type_t stddev, int nsamples) { - - // memory allocation - std::vector> samples(nsamples); - - constexpr int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 ? 1 : oneapi::dpl::internal::type_traits_t::num_elems; - - // generation - { - sycl::buffer, 1> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler &cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / num_elems), - [=](sycl::item<1> idx) { - - unsigned long long offset = idx.get_linear_id() * num_elems; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::lognormal_distribution distr(mean, stddev); - - sycl::vec, num_elems> res = distr(engine); - res.store(idx.get_linear_id(), acc); - }); - }); - queue.wait(); - } - - // statistics check - int err = statistics_check(nsamples, mean, stddev, samples); - - if(err) { - std::cout << "\tFailed" << std::endl; - } - else { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int test_portion(sycl::queue& queue, oneapi::dpl::internal::element_type_t mean, oneapi::dpl::internal::element_type_t stddev, - int nsamples, unsigned int part) { - - // memory allocation - std::vector> samples(nsamples); - constexpr unsigned int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 ? 1 : oneapi::dpl::internal::type_traits_t::num_elems; - int n_elems = (part >= num_elems) ? num_elems : part; - - // generation - { - sycl::buffer, 1> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler &cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / n_elems), - [=](sycl::item<1> idx) { - - unsigned long long offset = idx.get_linear_id() * num_elems; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::lognormal_distribution distr(mean, stddev); - - sycl::vec, num_elems> res = distr(engine, part); - for(int i = 0; i < n_elems; ++i) - acc[idx.get_linear_id() * n_elems + i] = res[i]; - }); - }); - queue.wait_and_throw(); - } - - // statistics check - int err = statistics_check(nsamples, mean, stddev, samples); - - if(err) { - std::cout << "\tFailed" << std::endl; - } - else { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int tests_set(sycl::queue& queue, int nsamples) { - - constexpr int nparams = 2; - - oneapi::dpl::internal::element_type_t mean_array [nparams] = {0.0, 1.0}; - oneapi::dpl::internal::element_type_t stddev_array [nparams] = {1.0, 1000.0}; - - // Test for all non-zero parameters - for(int i = 0; i < nparams; ++i) { - std::cout << "lognormal_distribution test, mean = " << mean_array[i] << ", stddev = " << stddev_array[i] << - ", nsamples = " << nsamples; - if (test(queue, mean_array[i], stddev_array[i], nsamples)) - return 1; - } - return 0; -} - -template -int tests_set_portion(sycl::queue& queue, std::int32_t nsamples, unsigned int part) { - - constexpr int nparams = 2; - - oneapi::dpl::internal::element_type_t mean_array [nparams] = {0.0, 1.0}; - oneapi::dpl::internal::element_type_t stddev_array [nparams] = {1.0, 1000.0}; - - // Test for all non-zero parameters - for(int i = 0; i < nparams; ++i) { - std::cout << "lognormal_distribution test, mean = " << mean_array[i] << ", stddev = " << stddev_array[i] << - ", nsamples = " << nsamples << ", part = "<< part; - if(test_portion(queue, mean_array[i], stddev_array[i], nsamples, part)) { - return 1; - } - } - return 0; -} - -#endif // TEST_UNNAMED_LAMBDAS - -int main() { - -#if TEST_UNNAMED_LAMBDAS - - sycl::queue queue = TestUtils::get_test_queue(); - - constexpr int nsamples = 100; - int err = 0; - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 99); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set_portion, std::uint32_t>(queue, 99, 1); - err += tests_set_portion, std::uint32_t>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 100); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 160, 5); - err += tests_set_portion, std::uint32_t>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 140, 7); - err += tests_set_portion, std::uint32_t>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // Skip tests if DP is not supported - if (TestUtils::has_type_support(queue.get_device())) { - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 99); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set_portion, std::uint32_t>(queue, 99, 1); - err += tests_set_portion, std::uint32_t>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 100); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 160, 5); - err += tests_set_portion, std::uint32_t>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 140, 7); - err += tests_set_portion, std::uint32_t>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - } - -#endif // TEST_UNNAMED_LAMBDAS - - return TestUtils::done(TEST_UNNAMED_LAMBDAS); -} diff --git a/test/xpu_api/random/statistics_tests/normal_distribution_dp_tests_set_portion_test.pass.cpp b/test/xpu_api/random/statistics_tests/normal_distribution_dp_tests_set_portion_test.pass.cpp new file mode 100644 index 00000000000..f9d7d33cac8 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/normal_distribution_dp_tests_set_portion_test.pass.cpp @@ -0,0 +1,182 @@ +// -*- C++ -*- +//===-- normal_distribution_dp_tests_set_portion_test.cpp ---------------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of normal_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::normal_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int main() { + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err += tests_set_portion>, std::uint32_t>(queue, 99, 1); + err += tests_set_portion>, std::uint32_t>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 160, 5); + err += tests_set_portion>, std::uint32_t>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#if TEST_LONG_RUN + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 140, 7); + err += tests_set_portion>, std::uint32_t>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + } + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/normal_distribution_dp_tests_set_test.pass.cpp b/test/xpu_api/random/statistics_tests/normal_distribution_dp_tests_set_test.pass.cpp new file mode 100644 index 00000000000..1489ed33065 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/normal_distribution_dp_tests_set_test.pass.cpp @@ -0,0 +1,129 @@ +// -*- C++ -*- +//===-- normal_distribution_dp_tests_set_test.cpp ---------------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of normal_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::normal_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int main() { + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 99); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 100); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + } + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/normal_distribution_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/normal_distribution_sp_test.pass.cpp new file mode 100644 index 00000000000..d543bf54673 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/normal_distribution_sp_test.pass.cpp @@ -0,0 +1,221 @@ +// -*- C++ -*- +//===-- normal_distribution_sp_test.cpp ---------------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of normal_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::normal_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int main() { + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 99); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set_portion>, std::uint32_t>(queue, 99, 1); + err += tests_set_portion>, std::uint32_t>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 100); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 160, 5); + err += tests_set_portion>, std::uint32_t>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 140, 7); + err += tests_set_portion>, std::uint32_t>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/normal_distribution_test.pass.cpp b/test/xpu_api/random/statistics_tests/normal_distribution_test.pass.cpp deleted file mode 100644 index dbeadd04613..00000000000 --- a/test/xpu_api/random/statistics_tests/normal_distribution_test.pass.cpp +++ /dev/null @@ -1,620 +0,0 @@ -// -*- C++ -*- -//===-- normal_distribution_test.cpp ---------------------------------------===// -// -// Copyright (C) Intel Corporation -// -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// -//===----------------------------------------------------------------------===// -// -// Abstract: -// -// Test of normal_distribution - check statistical properties of the distribution - -#include "support/utils.h" -#include - -#if TEST_UNNAMED_LAMBDAS -#include -#include -#include -#include -#include "statistics_common.h" - -// Engine parameters -constexpr auto a = 40014u; -constexpr auto c = 200u; -constexpr auto m = 2147483563u; -constexpr auto seed = 777; - -template -int statistics_check(int nsamples, ScalarRealType mean, ScalarRealType stddev, - const std::vector& samples) { - // theoretical moments - double tM = mean; - double tD = stddev * stddev; - double tQ = 720.0 * stddev * stddev * stddev * stddev; - - return compare_moments(nsamples, samples, tM, tD, tQ); -} - -template -int test(sycl::queue& queue, oneapi::dpl::internal::element_type_t mean, oneapi::dpl::internal::element_type_t stddev, int nsamples) { - - // memory allocation - std::vector> samples(nsamples); - - constexpr int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 ? 1 : oneapi::dpl::internal::type_traits_t::num_elems; - constexpr int num_to_skip = num_elems % 2 ? num_elems + 1 : num_elems; - - // generation - { - sycl::buffer, 1> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler &cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / num_elems), - [=](sycl::item<1> idx) { - - unsigned long long offset = idx.get_linear_id() * num_to_skip; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::normal_distribution distr(mean, stddev); - - sycl::vec, num_elems> res = distr(engine); - res.store(idx.get_linear_id(), acc); - }); - }); - queue.wait(); - } - - // statistics check - int err = statistics_check(nsamples, mean, stddev, samples); - - if(err) { - std::cout << "\tFailed" << std::endl; - } - else { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int test_portion(sycl::queue& queue, oneapi::dpl::internal::element_type_t mean, oneapi::dpl::internal::element_type_t stddev, - int nsamples, unsigned int part) { - - // memory allocation - std::vector> samples(nsamples); - constexpr unsigned int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 ? 1 : oneapi::dpl::internal::type_traits_t::num_elems; - int n_elems = (part >= num_elems) ? num_elems : part; - int num_to_skip = n_elems % 2 ? n_elems + 1 : n_elems; - - // generation - { - sycl::buffer, 1> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler &cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / n_elems), - [=](sycl::item<1> idx) { - - unsigned long long offset = idx.get_linear_id() * num_to_skip; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::normal_distribution distr(mean, stddev); - - sycl::vec, num_elems> res = distr(engine, part); - for(int i = 0; i < n_elems; ++i) - acc[idx.get_linear_id() * n_elems + i] = res[i]; - }); - }); - queue.wait_and_throw(); - } - - // statistics check - int err = statistics_check(nsamples, mean, stddev, samples); - - if(err) { - std::cout << "\tFailed" << std::endl; - } - else { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int test_flag(sycl::queue& queue, oneapi::dpl::internal::element_type_t mean, oneapi::dpl::internal::element_type_t stddev, int nsamples) { - - // memory allocation - std::vector> samples(nsamples); - - constexpr int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 ? 1 : oneapi::dpl::internal::type_traits_t::num_elems; - constexpr int num_to_skip = (num_elems + 1) % 2 ? (num_elems + 2) : (num_elems + 1); - - // generation - { - sycl::buffer, 1> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler &cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / (num_elems + 1)), - [=](sycl::item<1> idx) { - - unsigned long long offset = idx.get_linear_id() * num_to_skip; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::normal_distribution distr(mean, stddev); - - // Generate the first element - auto res_1 = distr(engine, 1); - - // Generate the rest elements - auto res = distr(engine); - - acc[idx * (num_elems + 1)] = res_1[0]; - for(int i = 0; i < num_elems; ++i) - acc[idx * (num_elems + 1) + i + 1] = res[i]; - }); - }); - queue.wait(); - } - // statistics check - int err = statistics_check(nsamples, mean, stddev, samples); - - if(err) { - std::cout << "\tFailed" << std::endl; - } - else { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int tests_set(sycl::queue& queue, int nsamples) { - - constexpr int nparams = 2; - - oneapi::dpl::internal::element_type_t mean_array [nparams] = {0.0, 1.0}; - oneapi::dpl::internal::element_type_t stddev_array [nparams] = {1.0, 1000.0}; - - // Test for all non-zero parameters - for(int i = 0; i < nparams; ++i) { - std::cout << "normal_distribution test, mean = " << mean_array[i] << ", stddev = " << stddev_array[i] << - ", nsamples = " << nsamples; - if (test(queue, mean_array[i], stddev_array[i], nsamples)) - return 1; - } - return 0; -} - -template -int tests_set_portion(sycl::queue& queue, std::int32_t nsamples, unsigned int part) { - - constexpr int nparams = 2; - - oneapi::dpl::internal::element_type_t mean_array [nparams] = {0.0, 1.0}; - oneapi::dpl::internal::element_type_t stddev_array [nparams] = {1.0, 1000.0}; - - // Test for all non-zero parameters - for(int i = 0; i < nparams; ++i) { - std::cout << "normal_distribution test, mean = " << mean_array[i] << ", stddev = " << stddev_array[i] << - ", nsamples = " << nsamples << ", part = "<< part; - if(test_portion(queue, mean_array[i], stddev_array[i], nsamples, part)) { - return 1; - } - } - return 0; -} - -template -int tests_set_flag(sycl::queue& queue, int nsamples) { - - // Test for all non-zero parameters - std::cout << "normal_distribution test, mean = " << 0.0 << ", stddev = " << 1.0 << - ", nsamples = " << nsamples << ", flag = true, vec_size = " << oneapi::dpl::internal::type_traits_t::num_elems; - if (test_flag(queue, 0.0, 1.0, nsamples)) - return 1; - - return 0; -} - -#endif // TEST_UNNAMED_LAMBDAS - -int main() { - -#if TEST_UNNAMED_LAMBDAS - - sycl::queue queue = TestUtils::get_test_queue(); - - constexpr int nsamples = 100; - int err = 0; - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 99); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set_portion, std::uint32_t>(queue, 99, 1); - err += tests_set_portion, std::uint32_t>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 100); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 160, 5); - err += tests_set_portion, std::uint32_t>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 140, 7); - err += tests_set_portion, std::uint32_t>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // Skip tests if DP is not supported - if (TestUtils::has_type_support(queue.get_device())) { - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 99); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set_portion, std::uint32_t>(queue, 99, 1); - err += tests_set_portion, std::uint32_t>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 100); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 160, 5); - err += tests_set_portion, std::uint32_t>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 140, 7); - err += tests_set_portion, std::uint32_t>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - } - -#endif // TEST_UNNAMED_LAMBDAS - - return TestUtils::done(TEST_UNNAMED_LAMBDAS); -} diff --git a/test/xpu_api/random/statistics_tests/philox_uniform_real_distribution_dp_test.pass.cpp b/test/xpu_api/random/statistics_tests/philox_uniform_real_distribution_dp_test.pass.cpp new file mode 100644 index 00000000000..39249d4db2e --- /dev/null +++ b/test/xpu_api/random/statistics_tests/philox_uniform_real_distribution_dp_test.pass.cpp @@ -0,0 +1,250 @@ +// -*- C++ -*- +//===-- philox_uniform_real_distribution_dp_test.pass.cpp --------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of philox_engine statistics with uniform_real_distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS + +#include "common_for_distributions.hpp" + +/* ------ Tested the statistics of different engines ------ */ +// n = 2 +using philox2x32 = oneapi::dpl::experimental::philox_engine; +using philox2x64 = oneapi::dpl::experimental::philox_engine; + +template +using Distr = oneapi::dpl::uniform_real_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) + { + // testing sycl::vec and std::uint_fast32_t ... sycl::vec, philox2x32 + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast32_t ... sycl::vec, philox2x32 type" + << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast32_t, philox2x32>(queue, nsamples); +# if TEST_LONG_RUN + err += tests_set>, sycl::vec, philox2x32>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x32>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x32>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x32>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x32>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x32>(queue, nsamples); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 100, 1); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 2); +# endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast64_t ... sycl::vec, philox2x64 + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast64_t ... sycl::vec, philox2x64 type" + << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast64_t, philox2x64>(queue, nsamples); +# if TEST_LONG_RUN + err += tests_set>, sycl::vec, philox2x64>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x64>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x64>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x64>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x64>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x64>(queue, nsamples); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 100, 1); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 2); +# endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast32_t ... sycl::vec, philox2x32 + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast32_t ... sycl::vec, philox2x32 type" + << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast32_t, philox2x32>(queue, 160); +# if TEST_LONG_RUN + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 160, 1); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 160, 5); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 9); +# endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast64_t ... sycl::vec, philox2x64 + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast64_t ... sycl::vec, philox2x64 type" + << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast64_t, philox2x64>(queue, 160); +# if TEST_LONG_RUN + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 160, 1); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 160, 5); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 9); +# endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast32_t ... sycl::vec, philox2x32 + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast32_t ... sycl::vec, philox2x32 type" + << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast32_t, philox2x32>(queue, 160); +# if TEST_LONG_RUN + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 160, 1); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 140, 7); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 17); +# endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast64_t ... sycl::vec, philox2x64 + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast64_t ... sycl::vec, philox2x64 type" + << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast64_t, philox2x64>(queue, 160); +# if TEST_LONG_RUN + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 160, 1); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 140, 7); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 17); +# endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + } + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/philox_uniform_real_distribution_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/philox_uniform_real_distribution_sp_test.pass.cpp new file mode 100644 index 00000000000..7b2806da637 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/philox_uniform_real_distribution_sp_test.pass.cpp @@ -0,0 +1,354 @@ +// -*- C++ -*- +//===-- philox_uniform_real_distribution_sp_test.pass.cpp --------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of philox_engine statistics with uniform_real_distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS + +#include "common_for_distributions.hpp" + +/* ------ Tested the statistics of different engines ------ */ +// n = 2 +using philox2x32 = oneapi::dpl::experimental::philox_engine; +using philox2x64 = oneapi::dpl::experimental::philox_engine; + +// bitsize(result_type) != word_size, test only scalar output +using philox2x32_w5 = oneapi::dpl::experimental::philox_engine; +using philox2x32_w15 = oneapi::dpl::experimental::philox_engine; +using philox2x32_w18 = oneapi::dpl::experimental::philox_engine; +using philox2x32_w30 = oneapi::dpl::experimental::philox_engine; + +using philox2x64_w5 = oneapi::dpl::experimental::philox_engine; +using philox2x64_w15 = oneapi::dpl::experimental::philox_engine; +using philox2x64_w18 = oneapi::dpl::experimental::philox_engine; +using philox2x64_w25 = oneapi::dpl::experimental::philox_engine; +using philox2x64_w49 = oneapi::dpl::experimental::philox_engine; + +using philox4x32_w5 = oneapi::dpl::experimental::philox_engine; +using philox4x32_w15 = oneapi::dpl::experimental::philox_engine; +using philox4x32_w18 = oneapi::dpl::experimental::philox_engine; +using philox4x32_w30 = oneapi::dpl::experimental::philox_engine; + +using philox4x64_w5 = oneapi::dpl::experimental::philox_engine; +using philox4x64_w15 = oneapi::dpl::experimental::philox_engine; +using philox4x64_w18 = oneapi::dpl::experimental::philox_engine; +using philox4x64_w25 = oneapi::dpl::experimental::philox_engine; +using philox4x64_w49 = oneapi::dpl::experimental::philox_engine; + +template +using Distr = oneapi::dpl::uniform_real_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // testing sycl::vec and std::uint_fast32_t ... sycl::vec, philox2x32 + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast32_t ... sycl::vec, philox2x32 type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast32_t, philox2x32>(queue, nsamples); +# if TEST_LONG_RUN + err += tests_set>, sycl::vec, philox2x32>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x32>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x32>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x32>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x32>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x32>(queue, nsamples); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 100, 1); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 100, 2); +# endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast64_t ... sycl::vec, philox2x64 + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast64_t ... sycl::vec, philox2x64 type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast64_t, philox2x64>(queue, nsamples); +# if TEST_LONG_RUN + err += tests_set>, sycl::vec, philox2x64>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x64>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x64>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x64>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x64>(queue, nsamples); + err += tests_set>, sycl::vec, philox2x64>(queue, nsamples); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 100, 1); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 2); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 100, 2); +# endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast32_t ... sycl::vec, philox2x32 + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast32_t ... sycl::vec, philox2x32 type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast32_t, philox2x32>(queue, 160); +# if TEST_LONG_RUN + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 160, 1); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 160, 5); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 9); +# endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast64_t ... sycl::vec, philox2x64 + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast64_t ... sycl::vec, philox2x64 type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast64_t, philox2x64>(queue, 160); +# if TEST_LONG_RUN + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 160, 1); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 160, 5); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 5); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 9); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 9); +# endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast32_t ... sycl::vec, philox2x32 + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast32_t ... sycl::vec, philox2x32 type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast32_t, philox2x32>(queue, 160); +# if TEST_LONG_RUN + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set>, sycl::vec, philox2x32>(queue, 160); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 160, 1); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 140, 7); + err += tests_set_portion>, std::uint_fast32_t, philox2x32>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x32>(queue, 160, 17); +# endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast64_t ... sycl::vec, philox2x64 + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast64_t ... sycl::vec, philox2x64 type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast64_t, philox2x64>(queue, 160); +# if TEST_LONG_RUN + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set>, sycl::vec, philox2x64>(queue, 160); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 160, 1); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 140, 7); + err += tests_set_portion>, std::uint_fast64_t, philox2x64>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 1); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 140, 7); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 17); + err += tests_set_portion>, sycl::vec, philox2x64>(queue, 160, 17); +# endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast32_t philox2x32_w*/philox4x32_w* + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast32_t, philox2x32_w*/philox4x32_w* type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast32_t, philox2x32_w5>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox2x32_w15>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox2x32_w18>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox2x32_w30>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox4x32_w5>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox4x32_w15>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox4x32_w18>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox4x32_w30>(queue, nsamples); + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast64_t philox2x64_w*/philox4x64_w* + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast64_t, philox2x64_w*/philox4x64_w* type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast64_t, philox2x64_w5>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox2x64_w15>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox2x64_w18>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox2x64_w25>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox2x64_w49>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w5>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w15>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w18>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w25>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w49>(queue, nsamples); + + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast32_t philox2x32_w*/philox4x32_w* + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast32_t, philox2x32_w*/philox4x32_w* type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast32_t, philox2x32_w5>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox2x32_w15>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox2x32_w18>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox2x32_w30>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox4x32_w5>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox4x32_w15>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox4x32_w18>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox4x32_w30>(queue, nsamples); + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast64_t philox2x64_w*/philox4x64_w* + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast64_t, philox2x64_w*/philox4x64_w* type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast64_t, philox2x64_w5>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox2x64_w15>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox2x64_w18>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox2x64_w25>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox2x64_w49>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w5>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w15>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w18>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w25>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w49>(queue, nsamples); + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast32_t philox2x32_w*/philox4x32_w* + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast32_t, philox2x32_w*/philox4x32_w* type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast32_t, philox2x32_w5>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox2x32_w15>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox2x32_w18>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox2x32_w30>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox4x32_w5>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox4x32_w15>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox4x32_w18>(queue, nsamples); + err = tests_set>, std::uint_fast32_t, philox4x32_w30>(queue, nsamples); + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint_fast64_t philox2x64_w*/philox4x64_w* + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint_fast64_t, philox2x64_w*/philox4x64_w* type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint_fast64_t, philox2x64_w5>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox2x64_w15>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox2x64_w18>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox2x64_w25>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox2x64_w49>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w5>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w15>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w18>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w25>(queue, nsamples); + err = tests_set>, std::uint_fast64_t, philox4x64_w49>(queue, nsamples); + EXPECT_TRUE(!err, "Test FAILED"); + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/philox_uniform_real_distribution_test.pass.cpp b/test/xpu_api/random/statistics_tests/philox_uniform_real_distribution_test.pass.cpp deleted file mode 100644 index fe18a74e853..00000000000 --- a/test/xpu_api/random/statistics_tests/philox_uniform_real_distribution_test.pass.cpp +++ /dev/null @@ -1,712 +0,0 @@ -// -*- C++ -*- -//===-- philox_uniform_real_distribution_test.pass.cpp --------------------===// -// -// Copyright (C) Intel Corporation -// -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// Abstract: -// -// Test of philox_engine statistics with uniform_real_distribution - -#include "support/utils.h" -#include - -#if TEST_UNNAMED_LAMBDAS -#include -#include -#include -#include "statistics_common.h" - -/* ------ Tested the statistics of different engines ------ */ -// n = 2 -using philox2x32 = oneapi::dpl::experimental::philox_engine; -using philox2x64 = oneapi::dpl::experimental::philox_engine; - -// bitsize(result_type) != word_size, test only scalar output -using philox2x32_w5 = oneapi::dpl::experimental::philox_engine; -using philox2x32_w15 = oneapi::dpl::experimental::philox_engine; -using philox2x32_w18 = oneapi::dpl::experimental::philox_engine; -using philox2x32_w30 = oneapi::dpl::experimental::philox_engine; - -using philox2x64_w5 = oneapi::dpl::experimental::philox_engine; -using philox2x64_w15 = oneapi::dpl::experimental::philox_engine; -using philox2x64_w18 = oneapi::dpl::experimental::philox_engine; -using philox2x64_w25 = oneapi::dpl::experimental::philox_engine; -using philox2x64_w49 = oneapi::dpl::experimental::philox_engine; - -using philox4x32_w5 = oneapi::dpl::experimental::philox_engine; -using philox4x32_w15 = oneapi::dpl::experimental::philox_engine; -using philox4x32_w18 = oneapi::dpl::experimental::philox_engine; -using philox4x32_w30 = oneapi::dpl::experimental::philox_engine; - -using philox4x64_w5 = oneapi::dpl::experimental::philox_engine; -using philox4x64_w15 = oneapi::dpl::experimental::philox_engine; -using philox4x64_w18 = oneapi::dpl::experimental::philox_engine; -using philox4x64_w25 = oneapi::dpl::experimental::philox_engine; -using philox4x64_w49 = oneapi::dpl::experimental::philox_engine; - -template -std::int32_t -statistics_check(int nsamples, RealType left, RealType right, const std::vector& samples) -{ - // theoretical moments - double tM = (right + left) / 2.0; - double tD = ((right - left) * (right - left)) / 12.0; - double tQ = ((right - left) * (right - left) * (right - left) * (right - left)) / 80.0; - - return compare_moments(nsamples, samples, tM, tD, tQ); -} - -template -int -test(sycl::queue& queue, oneapi::dpl::internal::element_type_t left, - oneapi::dpl::internal::element_type_t right, int nsamples) -{ - - // memory allocation - std::vector> samples(nsamples); - - constexpr int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 - ? 1 - : oneapi::dpl::internal::type_traits_t::num_elems; - // generation - { - sycl::buffer> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler& cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / num_elems), [=](sycl::item<1> idx) { - unsigned long long offset = idx.get_linear_id() * num_elems; - Engine engine; - engine.discard(offset); - oneapi::dpl::uniform_real_distribution distr(left, right); - - sycl::vec, num_elems> res = distr(engine); - res.store(idx.get_linear_id(), acc); - }); - }); - queue.wait(); - } - - // statistics check - int err = statistics_check(nsamples, left, right, samples); - - if (err) - { - std::cout << "\tFailed" << std::endl; - } - else - { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int -test_portion(sycl::queue& queue, oneapi::dpl::internal::element_type_t left, - oneapi::dpl::internal::element_type_t right, int nsamples, unsigned int part) -{ - - // memory allocation - std::vector> samples(nsamples); - constexpr int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 - ? 1 - : oneapi::dpl::internal::type_traits_t::num_elems; - int n_elems = (part >= num_elems) ? num_elems : part; - - // generation - { - sycl::buffer> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler& cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / n_elems), [=](sycl::item<1> idx) { - unsigned long long offset = idx.get_linear_id() * n_elems; - Engine engine; - engine.discard(offset); - oneapi::dpl::uniform_real_distribution distr(left, right); - - sycl::vec, num_elems> res = distr(engine, part); - for (int i = 0; i < n_elems; ++i) - acc[offset + i] = res[i]; - }); - }); - queue.wait(); - } - - // statistics check - int err = statistics_check(nsamples, left, right, samples); - - if (err) - { - std::cout << "\tFailed" << std::endl; - } - else - { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int -tests_set(sycl::queue& queue, int nsamples) -{ - - constexpr int nparams = 2; - oneapi::dpl::internal::element_type_t left_array[nparams] = {0.0, -10.0}; - oneapi::dpl::internal::element_type_t right_array[nparams] = {1.0, 10.0}; - - // Test for all non-zero parameters - for (int i = 0; i < nparams; ++i) - { - std::cout << "uniform_real_distribution test, left = " << left_array[i] << ", right = " << right_array[i] - << ", nsamples = " << nsamples; - if (test(queue, left_array[i], right_array[i], nsamples)) - { - return 1; - } - } - return 0; -} - -template -int -tests_set_portion(sycl::queue& queue, int nsamples, unsigned int part) -{ - - constexpr int nparams = 2; - oneapi::dpl::internal::element_type_t left_array[nparams] = {0.0, -10.0}; - oneapi::dpl::internal::element_type_t right_array[nparams] = {1.0, 10.0}; - - // Test for all non-zero parameters - for (int i = 0; i < nparams; ++i) - { - std::cout << "uniform_real_distribution test, left = " << left_array[i] << ", right = " << right_array[i] - << ", nsamples = " << nsamples << ", part = " << part; - if (test_portion(queue, left_array[i], right_array[i], nsamples, part)) - { - return 1; - } - } - return 0; -} - -#endif // TEST_UNNAMED_LAMBDAS - -int -main() -{ - -#if TEST_UNNAMED_LAMBDAS - - sycl::queue queue = TestUtils::get_test_queue(); - - constexpr int nsamples = 100; - int err = 0; - - // testing sycl::vec and std::uint_fast32_t ... sycl::vec, philox2x32 - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast32_t ... sycl::vec, philox2x32 type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast32_t, philox2x32>(queue, nsamples); -# if TEST_LONG_RUN - err += tests_set, sycl::vec, philox2x32>(queue, nsamples); - err += tests_set, sycl::vec, philox2x32>(queue, nsamples); - err += tests_set, sycl::vec, philox2x32>(queue, nsamples); - err += tests_set, sycl::vec, philox2x32>(queue, nsamples); - err += tests_set, sycl::vec, philox2x32>(queue, nsamples); - err += tests_set, sycl::vec, philox2x32>(queue, nsamples); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 100, 1); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 2); -# endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast64_t ... sycl::vec, philox2x64 - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast64_t ... sycl::vec, philox2x64 type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast64_t, philox2x64>(queue, nsamples); -# if TEST_LONG_RUN - err += tests_set, sycl::vec, philox2x64>(queue, nsamples); - err += tests_set, sycl::vec, philox2x64>(queue, nsamples); - err += tests_set, sycl::vec, philox2x64>(queue, nsamples); - err += tests_set, sycl::vec, philox2x64>(queue, nsamples); - err += tests_set, sycl::vec, philox2x64>(queue, nsamples); - err += tests_set, sycl::vec, philox2x64>(queue, nsamples); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 100, 1); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 2); -# endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast32_t ... sycl::vec, philox2x32 - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast32_t ... sycl::vec, philox2x32 type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast32_t, philox2x32>(queue, 160); -# if TEST_LONG_RUN - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 160, 1); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 160, 5); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 9); -# endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast64_t ... sycl::vec, philox2x64 - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast64_t ... sycl::vec, philox2x64 type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast64_t, philox2x64>(queue, 160); -# if TEST_LONG_RUN - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 160, 1); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 160, 5); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 9); -# endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast32_t ... sycl::vec, philox2x32 - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast32_t ... sycl::vec, philox2x32 type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast32_t, philox2x32>(queue, 160); -# if TEST_LONG_RUN - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 160, 1); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 140, 7); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 17); -# endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast64_t ... sycl::vec, philox2x64 - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast64_t ... sycl::vec, philox2x64 type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast64_t, philox2x64>(queue, 160); -# if TEST_LONG_RUN - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 160, 1); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 140, 7); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 17); -# endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // Skip tests if DP is not supported - if (TestUtils::has_type_support(queue.get_device())) - { - // testing sycl::vec and std::uint_fast32_t ... sycl::vec, philox2x32 - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast32_t ... sycl::vec, philox2x32 type" - << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast32_t, philox2x32>(queue, nsamples); -# if TEST_LONG_RUN - err += tests_set, sycl::vec, philox2x32>(queue, nsamples); - err += tests_set, sycl::vec, philox2x32>(queue, nsamples); - err += tests_set, sycl::vec, philox2x32>(queue, nsamples); - err += tests_set, sycl::vec, philox2x32>(queue, nsamples); - err += tests_set, sycl::vec, philox2x32>(queue, nsamples); - err += tests_set, sycl::vec, philox2x32>(queue, nsamples); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 100, 1); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 100, 2); -# endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast64_t ... sycl::vec, philox2x64 - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast64_t ... sycl::vec, philox2x64 type" - << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast64_t, philox2x64>(queue, nsamples); -# if TEST_LONG_RUN - err += tests_set, sycl::vec, philox2x64>(queue, nsamples); - err += tests_set, sycl::vec, philox2x64>(queue, nsamples); - err += tests_set, sycl::vec, philox2x64>(queue, nsamples); - err += tests_set, sycl::vec, philox2x64>(queue, nsamples); - err += tests_set, sycl::vec, philox2x64>(queue, nsamples); - err += tests_set, sycl::vec, philox2x64>(queue, nsamples); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 100, 1); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 2); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 100, 2); -# endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast32_t ... sycl::vec, philox2x32 - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast32_t ... sycl::vec, philox2x32 type" - << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast32_t, philox2x32>(queue, 160); -# if TEST_LONG_RUN - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 160, 1); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 160, 5); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 9); -# endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast64_t ... sycl::vec, philox2x64 - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast64_t ... sycl::vec, philox2x64 type" - << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast64_t, philox2x64>(queue, 160); -# if TEST_LONG_RUN - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 160, 1); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 160, 5); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 5); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 9); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 9); -# endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast32_t ... sycl::vec, philox2x32 - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast32_t ... sycl::vec, philox2x32 type" - << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast32_t, philox2x32>(queue, 160); -# if TEST_LONG_RUN - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set, sycl::vec, philox2x32>(queue, 160); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 160, 1); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 140, 7); - err += tests_set_portion, std::uint_fast32_t, philox2x32>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x32>(queue, 160, 17); -# endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast64_t ... sycl::vec, philox2x64 - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast64_t ... sycl::vec, philox2x64 type" - << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast64_t, philox2x64>(queue, 160); -# if TEST_LONG_RUN - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set, sycl::vec, philox2x64>(queue, 160); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 160, 1); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 140, 7); - err += tests_set_portion, std::uint_fast64_t, philox2x64>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 1); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 140, 7); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 17); - err += tests_set_portion, sycl::vec, philox2x64>(queue, 160, 17); -# endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - } - - // testing sycl::vec and std::uint_fast32_t philox2x32_w*/philox4x32_w* - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast32_t, philox2x32_w*/philox4x32_w* type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast32_t, philox2x32_w5>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox2x32_w15>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox2x32_w18>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox2x32_w30>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox4x32_w5>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox4x32_w15>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox4x32_w18>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox4x32_w30>(queue, nsamples); - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast64_t philox2x64_w*/philox4x64_w* - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast64_t, philox2x64_w*/philox4x64_w* type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast64_t, philox2x64_w5>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox2x64_w15>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox2x64_w18>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox2x64_w25>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox2x64_w49>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w5>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w15>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w18>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w25>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w49>(queue, nsamples); - - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast32_t philox2x32_w*/philox4x32_w* - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast32_t, philox2x32_w*/philox4x32_w* type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast32_t, philox2x32_w5>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox2x32_w15>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox2x32_w18>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox2x32_w30>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox4x32_w5>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox4x32_w15>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox4x32_w18>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox4x32_w30>(queue, nsamples); - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast64_t philox2x64_w*/philox4x64_w* - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast64_t, philox2x64_w*/philox4x64_w* type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast64_t, philox2x64_w5>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox2x64_w15>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox2x64_w18>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox2x64_w25>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox2x64_w49>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w5>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w15>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w18>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w25>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w49>(queue, nsamples); - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast32_t philox2x32_w*/philox4x32_w* - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast32_t, philox2x32_w*/philox4x32_w* type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast32_t, philox2x32_w5>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox2x32_w15>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox2x32_w18>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox2x32_w30>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox4x32_w5>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox4x32_w15>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox4x32_w18>(queue, nsamples); - err = tests_set, std::uint_fast32_t, philox4x32_w30>(queue, nsamples); - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint_fast64_t philox2x64_w*/philox4x64_w* - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint_fast64_t, philox2x64_w*/philox4x64_w* type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint_fast64_t, philox2x64_w5>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox2x64_w15>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox2x64_w18>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox2x64_w25>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox2x64_w49>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w5>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w15>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w18>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w25>(queue, nsamples); - err = tests_set, std::uint_fast64_t, philox4x64_w49>(queue, nsamples); - EXPECT_TRUE(!err, "Test FAILED"); - -#endif // TEST_UNNAMED_LAMBDAS - - return TestUtils::done(TEST_UNNAMED_LAMBDAS); -} diff --git a/test/xpu_api/random/statistics_tests/statistics_common.h b/test/xpu_api/random/statistics_tests/statistics_common.h index 37c283188f2..92e6dbf567a 100644 --- a/test/xpu_api/random/statistics_tests/statistics_common.h +++ b/test/xpu_api/random/statistics_tests/statistics_common.h @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------===// #include diff --git a/test/xpu_api/random/statistics_tests/uniform_int_distribution_test.pass.cpp b/test/xpu_api/random/statistics_tests/uniform_int_distribution_test.pass.cpp index 25aae41c849..985a03a2668 100644 --- a/test/xpu_api/random/statistics_tests/uniform_int_distribution_test.pass.cpp +++ b/test/xpu_api/random/statistics_tests/uniform_int_distribution_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/statistics_tests/uniform_real_distribution_dp_test.pass.cpp b/test/xpu_api/random/statistics_tests/uniform_real_distribution_dp_test.pass.cpp new file mode 100644 index 00000000000..67a6b28318a --- /dev/null +++ b/test/xpu_api/random/statistics_tests/uniform_real_distribution_dp_test.pass.cpp @@ -0,0 +1,224 @@ +// -*- C++ -*- +//===-- uniform_real_distribution_dp_test.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of uniform_real_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::uniform_real_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int main() { + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 99); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set_portion>, std::uint32_t>(queue, 99, 1); + err += tests_set_portion>, std::uint32_t>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 100); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 160, 5); + err += tests_set_portion>, std::uint32_t>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 140, 7); + err += tests_set_portion>, std::uint32_t>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + } + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/uniform_real_distribution_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/uniform_real_distribution_sp_test.pass.cpp new file mode 100644 index 00000000000..daded6a16fc --- /dev/null +++ b/test/xpu_api/random/statistics_tests/uniform_real_distribution_sp_test.pass.cpp @@ -0,0 +1,221 @@ +// -*- C++ -*- +//===-- uniform_real_distribution_sp_test.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of uniform_real_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::uniform_real_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int main() { + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 99); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set_portion>, std::uint32_t>(queue, 99, 1); + err += tests_set_portion>, std::uint32_t>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 100); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 160, 5); + err += tests_set_portion>, std::uint32_t>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 140, 7); + err += tests_set_portion>, std::uint32_t>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/uniform_real_distribution_test.pass.cpp b/test/xpu_api/random/statistics_tests/uniform_real_distribution_test.pass.cpp deleted file mode 100644 index 0758a5dc13e..00000000000 --- a/test/xpu_api/random/statistics_tests/uniform_real_distribution_test.pass.cpp +++ /dev/null @@ -1,555 +0,0 @@ -// -*- C++ -*- -//===-- uniform_real_distribution_test.cpp ---------------------------------===// -// -// Copyright (C) Intel Corporation -// -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// -//===----------------------------------------------------------------------===// -// -// Abstract: -// -// Test of uniform_real_distribution - check statistical properties of the distribution - -#include "support/utils.h" -#include - -#if TEST_UNNAMED_LAMBDAS -#include -#include -#include -#include "statistics_common.h" - -// Engine parameters -constexpr auto a = 40014u; -constexpr auto c = 200u; -constexpr auto m = 2147483563u; -constexpr auto seed = 777; - -template -std::int32_t statistics_check(int nsamples, RealType left, RealType right, - const std::vector& samples) -{ - // theoretical moments - double tM = (right + left) / 2.0; - double tD = ((right - left) * (right - left)) / 12.0; - double tQ = ((right - left) * (right - left) * (right - left) * (right - left)) / 80.0; - - return compare_moments(nsamples, samples, tM, tD, tQ); -} - -template -int test(sycl::queue& queue, oneapi::dpl::internal::element_type_t left, oneapi::dpl::internal::element_type_t right, int nsamples) { - - // memory allocation - std::vector> samples(nsamples); - - constexpr int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 ? 1 : oneapi::dpl::internal::type_traits_t::num_elems; - // generation - { - sycl::buffer, 1> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler &cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / num_elems), - [=](sycl::item<1> idx) { - - unsigned long long offset = idx.get_linear_id() * num_elems; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::uniform_real_distribution distr(left, right); - - sycl::vec, num_elems> res = distr(engine); - res.store(idx.get_linear_id(), acc); - }); - }); - queue.wait(); - } - - // statistics check - int err = statistics_check(nsamples, left, right, samples); - - if(err) { - std::cout << "\tFailed" << std::endl; - } - else { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int test_portion(sycl::queue& queue, oneapi::dpl::internal::element_type_t left, oneapi::dpl::internal::element_type_t right, - int nsamples, unsigned int part) { - - // memory allocation - std::vector> samples(nsamples); - constexpr int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 ? 1 : oneapi::dpl::internal::type_traits_t::num_elems; - int n_elems = (part >= num_elems) ? num_elems : part; - - // generation - { - sycl::buffer, 1> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler &cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / n_elems), - [=](sycl::item<1> idx) { - - unsigned long long offset = idx.get_linear_id() * n_elems; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::uniform_real_distribution distr(left, right); - - sycl::vec, num_elems> res = distr(engine, part); - for(int i = 0; i < n_elems; ++i) - acc[offset + i] = res[i]; - }); - }); - queue.wait_and_throw(); - } - - // statistics check - int err = statistics_check(nsamples, left, right, samples); - - if(err) { - std::cout << "\tFailed" << std::endl; - } - else { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int tests_set(sycl::queue& queue, int nsamples) { - - constexpr int nparams = 2; - oneapi::dpl::internal::element_type_t left_array [nparams] = {0.0, -10.0}; - oneapi::dpl::internal::element_type_t right_array [nparams] = {1.0, 10.0}; - - // Test for all non-zero parameters - for(int i = 0; i < nparams; ++i) { - std::cout << "uniform_real_distribution test, left = " << left_array[i] << ", right = " << right_array[i] << - ", nsamples = " << nsamples; - if(test(queue, left_array[i], right_array[i], nsamples)) { - return 1; - } - } - return 0; -} - -template -int tests_set_portion(sycl::queue& queue, int nsamples, unsigned int part) { - - constexpr int nparams = 2; - oneapi::dpl::internal::element_type_t left_array [nparams] = {0.0, -10.0}; - oneapi::dpl::internal::element_type_t right_array [nparams] = {1.0, 10.0}; - - // Test for all non-zero parameters - for(int i = 0; i < nparams; ++i) { - std::cout << "uniform_real_distribution test, left = " << left_array[i] << ", right = " << right_array[i] << - ", nsamples = " << nsamples << ", part = " << part; - if(test_portion(queue, left_array[i], right_array[i], nsamples, part)) { - return 1; - } - } - return 0; -} - -#endif // TEST_UNNAMED_LAMBDAS - -int main() { - -#if TEST_UNNAMED_LAMBDAS - - sycl::queue queue = TestUtils::get_test_queue(); - - constexpr int nsamples = 100; - int err = 0; - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 99); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set_portion, std::uint32_t>(queue, 99, 1); - err += tests_set_portion, std::uint32_t>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 100); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 160, 5); - err += tests_set_portion, std::uint32_t>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 140, 7); - err += tests_set_portion, std::uint32_t>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // Skip tests if DP is not supported - if (TestUtils::has_type_support(queue.get_device())) { - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 99); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set_portion, std::uint32_t>(queue, 99, 1); - err += tests_set_portion, std::uint32_t>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 100); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 160, 5); - err += tests_set_portion, std::uint32_t>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 140, 7); - err += tests_set_portion, std::uint32_t>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - } - -#endif // TEST_UNNAMED_LAMBDAS - - return TestUtils::done(TEST_UNNAMED_LAMBDAS); -} diff --git a/test/xpu_api/random/statistics_tests/weibull_distribution_dp_test.pass.cpp b/test/xpu_api/random/statistics_tests/weibull_distribution_dp_test.pass.cpp new file mode 100644 index 00000000000..c3fd68292ba --- /dev/null +++ b/test/xpu_api/random/statistics_tests/weibull_distribution_dp_test.pass.cpp @@ -0,0 +1,227 @@ + +// -*- C++ -*- +//===-- weibull_distribution_dp_test.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of weibull_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::weibull_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 99); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set_portion>, std::uint32_t>(queue, 99, 1); + err += tests_set_portion>, std::uint32_t>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 100); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 160, 5); + err += tests_set_portion>, std::uint32_t>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 140, 7); + err += tests_set_portion>, std::uint32_t>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + } + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/weibull_distribution_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/weibull_distribution_sp_test.pass.cpp new file mode 100644 index 00000000000..ad486458ed3 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/weibull_distribution_sp_test.pass.cpp @@ -0,0 +1,223 @@ +// -*- C++ -*- +//===-- weibull_distribution_sp_test.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of weibull_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distributions.hpp" + +template +using Distr = oneapi::dpl::weibull_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + constexpr int nsamples = 100; + int err = 0; + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); + err += tests_set_portion>, sycl::vec>(queue, 100, 2); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, nsamples); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set>, sycl::vec>(queue, nsamples); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); + err += tests_set_portion>, sycl::vec>(queue, 100, 3); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 99); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set>, sycl::vec>(queue, 99); + err += tests_set_portion>, std::uint32_t>(queue, 99, 1); + err += tests_set_portion>, std::uint32_t>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 1); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); + err += tests_set_portion>, sycl::vec>(queue, 99, 4); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 100); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set>, sycl::vec>(queue, 100); + err += tests_set_portion>, std::uint32_t>(queue, 100, 1); + err += tests_set_portion>, std::uint32_t>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 1); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); + err += tests_set_portion>, sycl::vec>(queue, 100, 5); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 160, 5); + err += tests_set_portion>, std::uint32_t>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 5); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); + err += tests_set_portion>, sycl::vec>(queue, 160, 9); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing sycl::vec and std::uint32_t ... sycl::vec + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = tests_set>, std::uint32_t>(queue, 160); +#if TEST_LONG_RUN + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set>, sycl::vec>(queue, 160); + err += tests_set_portion>, std::uint32_t>(queue, 160, 1); + err += tests_set_portion>, std::uint32_t>(queue, 140, 7); + err += tests_set_portion>, std::uint32_t>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 160, 1); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 140, 7); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); + err += tests_set_portion>, sycl::vec>(queue, 160, 17); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + +#endif // TEST_UNNAMED_LAMBDAS + + return TestUtils::done(TEST_UNNAMED_LAMBDAS); +} diff --git a/test/xpu_api/random/statistics_tests/weibull_distribution_test.pass.cpp b/test/xpu_api/random/statistics_tests/weibull_distribution_test.pass.cpp deleted file mode 100644 index de14b73d9c2..00000000000 --- a/test/xpu_api/random/statistics_tests/weibull_distribution_test.pass.cpp +++ /dev/null @@ -1,570 +0,0 @@ -// -*- C++ -*- -//===-- weibull_distribution_test.cpp ---------------------------------===// -// -// Copyright (C) Intel Corporation -// -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// -//===----------------------------------------------------------------------===// -// -// Abstract: -// -// Test of weibull_distribution - check statistical properties of the distribution - -#include "support/utils.h" -#include - -#if TEST_UNNAMED_LAMBDAS -#include -#include -#include -#include -#include "statistics_common.h" - -// Engine parameters -constexpr auto a = 40014u; -constexpr auto c = 200u; -constexpr auto m = 2147483563u; -constexpr auto seed = 777; - -template -int -statistics_check(int nsamples, ScalarRealType _a, ScalarRealType _b, const std::vector& samples) -{ - // theoretical moments - double G1 = sycl::tgamma(1 + 1 / _a); - double G2 = sycl::tgamma(1 + 2 / _a); - double G3 = sycl::tgamma(1 + 3 / _a); - double G4 = sycl::tgamma(1 + 4 / _a); - double tM = _b * G1; - double tD = _b * _b * (G2 - G1 * G1); - double tQ = _b * _b * _b * _b * ((-3) * G1 * G1 * G1 * G1 + 12 * G1 * G1 * G2 - 4 * G1 * G3 + G4 - 6 * G2 * G1 *G1); - - return compare_moments(nsamples, samples, tM, tD, tQ); -} - -template -int -test(sycl::queue& queue, oneapi::dpl::internal::element_type_t _a, oneapi::dpl::internal::element_type_t _b, int nsamples) -{ - // memory allocation - std::vector> samples(nsamples); - - constexpr int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 - ? 1 - : oneapi::dpl::internal::type_traits_t::num_elems; - - // generation - { - sycl::buffer, 1> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler& cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / num_elems), [=](sycl::item<1> idx) { - unsigned long long offset = idx.get_linear_id() * num_elems; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::weibull_distribution distr(_a, _b); - - sycl::vec, num_elems> res = distr(engine); - res.store(idx.get_linear_id(), acc); - }); - }); - } - - // statistics check - int err = statistics_check(nsamples, _a, _b, samples); - - if (err) - { - std::cout << "\tFailed" << std::endl; - } - else - { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int -test_portion(sycl::queue& queue, oneapi::dpl::internal::element_type_t _a, oneapi::dpl::internal::element_type_t _b, - int nsamples, unsigned int part) -{ - // memory allocation - std::vector> samples(nsamples); - constexpr unsigned int num_elems = oneapi::dpl::internal::type_traits_t::num_elems == 0 - ? 1 - : oneapi::dpl::internal::type_traits_t::num_elems; - int n_elems = (part >= num_elems) ? num_elems : part; - - // generation - { - sycl::buffer, 1> buffer(samples.data(), nsamples); - - queue.submit([&](sycl::handler& cgh) { - sycl::accessor acc(buffer, cgh, sycl::write_only); - - cgh.parallel_for<>(sycl::range<1>(nsamples / n_elems), [=](sycl::item<1> idx) { - unsigned long long offset = idx.get_linear_id() * n_elems; - oneapi::dpl::linear_congruential_engine engine(seed, offset); - oneapi::dpl::weibull_distribution distr(_a, _b); - - sycl::vec, num_elems> res = distr(engine, part); - for (int i = 0; i < n_elems; ++i) - acc[offset + i] = res[i]; - }); - }); - queue.wait_and_throw(); - } - - // statistics check - int err = statistics_check(nsamples, _a, _b, samples); - - if (err) - { - std::cout << "\tFailed" << std::endl; - } - else - { - std::cout << "\tPassed" << std::endl; - } - - return err; -} - -template -int -tests_set(sycl::queue& queue, int nsamples) -{ - constexpr int nparams = 2; - oneapi::dpl::internal::element_type_t a_array [nparams] = {2.0, 10.0}; - oneapi::dpl::internal::element_type_t b_array [nparams] = {1.0, 10.0}; - - // Test for all non-zero parameters - for(int i = 0; i < nparams; ++i) { - std::cout << "weibull_distribution test, a = " << a_array[i] << ", b = " << b_array[i] << - ", nsamples = " << nsamples; - if(test(queue, a_array[i], b_array[i], nsamples)) { - return 1; - } - } - return 0; -} - -template -int -tests_set_portion(sycl::queue& queue, std::int32_t nsamples, unsigned int part) -{ - constexpr int nparams = 2; - oneapi::dpl::internal::element_type_t a_array [nparams] = {2.0, 10.0}; - oneapi::dpl::internal::element_type_t b_array [nparams] = {1.0, 10.0}; - - // Test for all non-zero parameters - for(int i = 0; i < nparams; ++i) { - std::cout << "weibull_distribution test, a = " << a_array[i] << ", b = " << b_array[i] << - ", nsamples = " << nsamples << ", part = " << part; - if(test_portion(queue, a_array[i], b_array[i], nsamples, part)) { - return 1; - } - } - return 0; -} - -#endif // TEST_UNNAMED_LAMBDAS - -int -main() -{ - -#if TEST_UNNAMED_LAMBDAS - - sycl::queue queue = TestUtils::get_test_queue(); - - constexpr int nsamples = 100; - int err = 0; - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 99); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set_portion, std::uint32_t>(queue, 99, 1); - err += tests_set_portion, std::uint32_t>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 100); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 160, 5); - err += tests_set_portion, std::uint32_t>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 140, 7); - err += tests_set_portion, std::uint32_t>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // Skip tests if DP is not supported - if (TestUtils::has_type_support(queue.get_device())) { - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); - err += tests_set_portion, sycl::vec>(queue, 100, 2); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, nsamples); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set, sycl::vec>(queue, nsamples); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); - err += tests_set_portion, sycl::vec>(queue, 100, 3); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 99); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set, sycl::vec>(queue, 99); - err += tests_set_portion, std::uint32_t>(queue, 99, 1); - err += tests_set_portion, std::uint32_t>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 1); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); - err += tests_set_portion, sycl::vec>(queue, 99, 4); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 100); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set, sycl::vec>(queue, 100); - err += tests_set_portion, std::uint32_t>(queue, 100, 1); - err += tests_set_portion, std::uint32_t>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 1); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); - err += tests_set_portion, sycl::vec>(queue, 100, 5); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 160, 5); - err += tests_set_portion, std::uint32_t>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 5); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); - err += tests_set_portion, sycl::vec>(queue, 160, 9); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - - // testing sycl::vec and std::uint32_t ... sycl::vec - std::cout << "---------------------------------------------------------------------" << std::endl; - std::cout << "sycl::vec, std::uint32_t ... sycl::vec type" << std::endl; - std::cout << "---------------------------------------------------------------------" << std::endl; - err = tests_set, std::uint32_t>(queue, 160); -#if TEST_LONG_RUN - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set, sycl::vec>(queue, 160); - err += tests_set_portion, std::uint32_t>(queue, 160, 1); - err += tests_set_portion, std::uint32_t>(queue, 140, 7); - err += tests_set_portion, std::uint32_t>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 160, 1); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 140, 7); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); - err += tests_set_portion, sycl::vec>(queue, 160, 17); -#endif // TEST_LONG_RUN - EXPECT_TRUE(!err, "Test FAILED"); - } - -#endif // TEST_UNNAMED_LAMBDAS - - return TestUtils::done(TEST_UNNAMED_LAMBDAS); -} diff --git a/test/xpu_api/random/template_tests/discard_block_std_template_test.pass.cpp b/test/xpu_api/random/template_tests/discard_block_std_template_test.pass.cpp index 54c9e905318..3cc8ecb0c28 100644 --- a/test/xpu_api/random/template_tests/discard_block_std_template_test.pass.cpp +++ b/test/xpu_api/random/template_tests/discard_block_std_template_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/template_tests/linear_congruential_std_template_test.pass.cpp b/test/xpu_api/random/template_tests/linear_congruential_std_template_test.pass.cpp index fc70a45d488..8058015aafc 100644 --- a/test/xpu_api/random/template_tests/linear_congruential_std_template_test.pass.cpp +++ b/test/xpu_api/random/template_tests/linear_congruential_std_template_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: diff --git a/test/xpu_api/random/template_tests/subtract_with_carry_std_template_test.pass.cpp b/test/xpu_api/random/template_tests/subtract_with_carry_std_template_test.pass.cpp index 92163bfce92..07980ce43f6 100644 --- a/test/xpu_api/random/template_tests/subtract_with_carry_std_template_test.pass.cpp +++ b/test/xpu_api/random/template_tests/subtract_with_carry_std_template_test.pass.cpp @@ -5,12 +5,6 @@ // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file incorporates work covered by the following copyright and permission -// notice: -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// //===----------------------------------------------------------------------===// // // Abstract: