diff --git a/test/xpu_api/random/device_tests/bernoulli_distr_device_test.pass.cpp b/test/xpu_api/random/device_tests/bernoulli_distr_device_test.pass.cpp new file mode 100644 index 00000000000..276ee809e58 --- /dev/null +++ b/test/xpu_api/random/device_tests/bernoulli_distr_device_test.pass.cpp @@ -0,0 +1,131 @@ +// -*- C++ -*- +//===-- bernoulli_distr_device_test.pass.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Device copyable tests for bernoulli distribution + +#include "support/utils.h" +#include + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_device_tests.h" +#endif // TEST_UNNAMED_LAMBDAS + +constexpr auto a = 40014u; +constexpr auto c = 200u; +constexpr auto m = 2147483563u; + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { + int err = 0; + + // testing oneapi::dpl::bernoulli_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "bernoulli_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::bernoulli_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "bernoulli_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::bernoulli_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "bernoulli_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::bernoulli_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "bernoulli_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::bernoulli_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "bernoulli_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::bernoulli_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "bernoulli_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(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/device_tests/cauchy_distr_device_test.pass.cpp b/test/xpu_api/random/device_tests/cauchy_distr_device_test.pass.cpp new file mode 100644 index 00000000000..a11317f9cfb --- /dev/null +++ b/test/xpu_api/random/device_tests/cauchy_distr_device_test.pass.cpp @@ -0,0 +1,127 @@ +// -*- C++ -*- +//===-- cauchy_distr_device_test.pass.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Device copyable tests for cauchy distribution + +#include "support/utils.h" +#include + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_device_tests.h" +#endif // TEST_UNNAMED_LAMBDAS + +constexpr auto a = 40014u; +constexpr auto c = 200u; +constexpr auto m = 2147483563u; + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + int err = 0; + + // testing oneapi::dpl::cauchy_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "cauchy_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::cauchy_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "cauchy_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::cauchy_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "cauchy_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::cauchy_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "cauchy_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::cauchy_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "cauchy_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::cauchy_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "cauchy_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(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/device_tests/exponential_distr_device_test.pass.cpp b/test/xpu_api/random/device_tests/exponential_distr_device_test.pass.cpp new file mode 100644 index 00000000000..177cf96a330 --- /dev/null +++ b/test/xpu_api/random/device_tests/exponential_distr_device_test.pass.cpp @@ -0,0 +1,127 @@ +// -*- C++ -*- +//===-- exponential_distr_device_test.pass.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Device copyable tests for exponential distribution + +#include "support/utils.h" +#include + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_device_tests.h" +#endif // TEST_UNNAMED_LAMBDAS + +constexpr auto a = 40014u; +constexpr auto c = 200u; +constexpr auto m = 2147483563u; + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + int err = 0; + + // testing oneapi::dpl::exponential_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "-------------------------------------------------------------------------" << std::endl; + std::cout << "exponential_distribution> linear_congruential_engine" << std::endl; + std::cout << "-------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::exponential_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "-------------------------------------------------------------------------" << std::endl; + std::cout << "exponential_distribution> linear_congruential_engine" << std::endl; + std::cout << "-------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::exponential_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "-------------------------------------------------------------------------" << std::endl; + std::cout << "exponential_distribution> linear_congruential_engine" << std::endl; + std::cout << "-------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::exponential_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "-------------------------------------------------------------------------" << std::endl; + std::cout << "exponential_distribution> linear_congruential_engine" << std::endl; + std::cout << "-------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::exponential_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "-------------------------------------------------------------------------" << std::endl; + std::cout << "exponential_distribution> linear_congruential_engine" << std::endl; + std::cout << "-------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::exponential_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "-------------------------------------------------------------------------" << std::endl; + std::cout << "exponential_distribution> linear_congruential_engine" << std::endl; + std::cout << "-------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(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/device_tests/extreme_value_distr_device_test.pass.cpp b/test/xpu_api/random/device_tests/extreme_value_distr_device_test.pass.cpp new file mode 100644 index 00000000000..4e82c099a74 --- /dev/null +++ b/test/xpu_api/random/device_tests/extreme_value_distr_device_test.pass.cpp @@ -0,0 +1,127 @@ +// -*- C++ -*- +//===-- extreme_value_distr_device_test.pass.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Device copyable tests for extreme value distribution + +#include "support/utils.h" +#include + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_device_tests.h" +#endif // TEST_UNNAMED_LAMBDAS + +constexpr auto a = 40014u; +constexpr auto c = 200u; +constexpr auto m = 2147483563u; + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + int err = 0; + + // testing oneapi::dpl::extreme_value_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------------" << std::endl; + std::cout << "extreme_value_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::extreme_value_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------------" << std::endl; + std::cout << "extreme_value_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::extreme_value_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------------" << std::endl; + std::cout << "extreme_value_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::extreme_value_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------------" << std::endl; + std::cout << "extreme_value_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::extreme_value_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------------" << std::endl; + std::cout << "extreme_value_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::extreme_value_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------------" << std::endl; + std::cout << "extreme_value_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(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/device_tests/geometric_distr_device_test.pass.cpp b/test/xpu_api/random/device_tests/geometric_distr_device_test.pass.cpp new file mode 100644 index 00000000000..bae18ac3d3c --- /dev/null +++ b/test/xpu_api/random/device_tests/geometric_distr_device_test.pass.cpp @@ -0,0 +1,130 @@ +// -*- C++ -*- +//===-- geometric_distr_device_test.pass.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Device copyable tests for geometric distribution + +#include "support/utils.h" +#include + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_device_tests.h" +#endif // TEST_UNNAMED_LAMBDAS + +constexpr auto a = 40014u; +constexpr auto c = 200u; +constexpr auto m = 2147483563u; + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { + int err = 0; + + // testing oneapi::dpl::geometric_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "-------------------------------------------------------------------------" << std::endl; + std::cout << "geometric_distribution> linear_congruential_engine" << std::endl; + std::cout << "-------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::geometric_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "-------------------------------------------------------------------------" << std::endl; + std::cout << "geometric_distribution> linear_congruential_engine" << std::endl; + std::cout << "-------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::geometric_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "-------------------------------------------------------------------------" << std::endl; + std::cout << "geometric_distribution> linear_congruential_engine" << std::endl; + std::cout << "-------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::geometric_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "-------------------------------------------------------------------------" << std::endl; + std::cout << "geometric_distribution> linear_congruential_engine" << std::endl; + std::cout << "-------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::geometric_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "-------------------------------------------------------------------------" << std::endl; + std::cout << "geometric_distribution> linear_congruential_engine" << std::endl; + std::cout << "-------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::geometric_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "-------------------------------------------------------------------------" << std::endl; + std::cout << "geometric_distribution> linear_congruential_engine" << std::endl; + std::cout << "-------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(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/device_tests/lognormal_distr_device_test.pass.cpp b/test/xpu_api/random/device_tests/lognormal_distr_device_test.pass.cpp new file mode 100644 index 00000000000..13acf184fbf --- /dev/null +++ b/test/xpu_api/random/device_tests/lognormal_distr_device_test.pass.cpp @@ -0,0 +1,97 @@ +// -*- C++ -*- +//===-- lognormal_distr_device_test.pass.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Device copyable tests for lognormal distribution + +#include "support/utils.h" +#include + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_device_tests.h" +#endif // TEST_UNNAMED_LAMBDAS + +constexpr auto a = 40014u; +constexpr auto c = 200u; +constexpr auto m = 2147483563u; + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + int err = 0; + + // testing oneapi::dpl::lognormal_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "------------------------------------------------------------------------" << std::endl; + std::cout << "lognormal_distribution> linear_congruential_engine" << std::endl; + std::cout << "------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::lognormal_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "------------------------------------------------------------------------" << std::endl; + std::cout << "lognormal_distribution> linear_congruential_engine" << std::endl; + std::cout << "------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::lognormal_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "------------------------------------------------------------------------" << std::endl; + std::cout << "lognormal_distribution> linear_congruential_engine" << std::endl; + std::cout << "------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::lognormal_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "------------------------------------------------------------------------" << std::endl; + std::cout << "lognormal_distribution> linear_congruential_engine" << std::endl; + std::cout << "------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(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/device_tests/normal_distr_device_test.pass.cpp b/test/xpu_api/random/device_tests/normal_distr_device_test.pass.cpp new file mode 100644 index 00000000000..f7c61ba96b2 --- /dev/null +++ b/test/xpu_api/random/device_tests/normal_distr_device_test.pass.cpp @@ -0,0 +1,97 @@ +// -*- C++ -*- +//===-- normal_distr_device_test.pass.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Device copyable tests for normal distribution + +#include "support/utils.h" +#include + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_device_tests.h" +#endif // TEST_UNNAMED_LAMBDAS + +constexpr auto a = 40014u; +constexpr auto c = 200u; +constexpr auto m = 2147483563u; + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + int err = 0; + + // testing oneapi::dpl::normal_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "normal_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::normal_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "normal_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::normal_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "normal_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::normal_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "normal_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(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/device_tests/uniform_int_distr_device_test.pass.cpp b/test/xpu_api/random/device_tests/uniform_int_distr_device_test.pass.cpp new file mode 100644 index 00000000000..0bf156167ae --- /dev/null +++ b/test/xpu_api/random/device_tests/uniform_int_distr_device_test.pass.cpp @@ -0,0 +1,130 @@ +// -*- C++ -*- +//===-- uniform_int_distr_device_test.pass.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Device copyable tests for uniform int distribution + +#include "support/utils.h" +#include + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_device_tests.h" +#endif // TEST_UNNAMED_LAMBDAS + +constexpr auto a = 40014u; +constexpr auto c = 200u; +constexpr auto m = 2147483563u; + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { + int err = 0; + + // testing oneapi::dpl::uniform_int_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------------" << std::endl; + std::cout << "uniform_int_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::uniform_int_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------------" << std::endl; + std::cout << "uniform_int_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::uniform_int_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------------" << std::endl; + std::cout << "uniform_int_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::uniform_int_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------------" << std::endl; + std::cout << "uniform_int_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::uniform_int_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------------" << std::endl; + std::cout << "uniform_int_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::uniform_int_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------------" << std::endl; + std::cout << "uniform_int_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(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/device_tests/uniform_real_distr_device_test.pass.cpp b/test/xpu_api/random/device_tests/uniform_real_distr_device_test.pass.cpp new file mode 100644 index 00000000000..9ba03c3775d --- /dev/null +++ b/test/xpu_api/random/device_tests/uniform_real_distr_device_test.pass.cpp @@ -0,0 +1,127 @@ +// -*- C++ -*- +//===-- uniform_real_distr_device_test.pass.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Device copyable tests for uniform real distribution + +#include "support/utils.h" +#include + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_device_tests.h" +#endif // TEST_UNNAMED_LAMBDAS + +constexpr auto a = 40014u; +constexpr auto c = 200u; +constexpr auto m = 2147483563u; + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + int err = 0; + + // testing oneapi::dpl::uniform_real_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "--------------------------------------------------------------------------" << std::endl; + std::cout << "uniform_real_distribution> linear_congruential_engine" << std::endl; + std::cout << "--------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::uniform_real_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "--------------------------------------------------------------------------" << std::endl; + std::cout << "uniform_real_distribution> linear_congruential_engine" << std::endl; + std::cout << "--------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::uniform_real_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "--------------------------------------------------------------------------" << std::endl; + std::cout << "uniform_real_distribution> linear_congruential_engine" << std::endl; + std::cout << "--------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::uniform_real_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "--------------------------------------------------------------------------" << std::endl; + std::cout << "uniform_real_distribution> linear_congruential_engine" << std::endl; + std::cout << "--------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::uniform_real_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "--------------------------------------------------------------------------" << std::endl; + std::cout << "uniform_real_distribution> linear_congruential_engine" << std::endl; + std::cout << "--------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::uniform_real_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "--------------------------------------------------------------------------" << std::endl; + std::cout << "uniform_real_distribution> linear_congruential_engine" << std::endl; + std::cout << "--------------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(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/device_tests/weibull_distr_device_test.pass.cpp b/test/xpu_api/random/device_tests/weibull_distr_device_test.pass.cpp new file mode 100644 index 00000000000..243f1893b59 --- /dev/null +++ b/test/xpu_api/random/device_tests/weibull_distr_device_test.pass.cpp @@ -0,0 +1,127 @@ +// -*- C++ -*- +//===-- weibull_distr_device_test.pass.cpp ---------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Device copyable tests for weibull distribution + +#include "support/utils.h" +#include + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_device_tests.h" +#endif // TEST_UNNAMED_LAMBDAS + +constexpr auto a = 40014u; +constexpr auto c = 200u; +constexpr auto m = 2147483563u; + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + int err = 0; + + // testing oneapi::dpl::weibull_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "weibull_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::weibull_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "weibull_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::weibull_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "weibull_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::weibull_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "weibull_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::weibull_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "weibull_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); +#endif // TEST_LONG_RUN + EXPECT_TRUE(!err, "Test FAILED"); + + // testing oneapi::dpl::weibull_distribution> oneapi::dpl::linear_congruential_engine + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "weibull_distribution> linear_congruential_engine" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + err = device_copyable_test>, oneapi::dpl::linear_congruential_engine>(queue); +#if TEST_LONG_RUN + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(queue); + err += device_copyable_test>, oneapi::dpl::linear_congruential_engine, a, c, m>>(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/common_for_distrs_methods.hpp b/test/xpu_api/random/interface_tests/common_for_distrs_methods.hpp new file mode 100644 index 00000000000..54e40879307 --- /dev/null +++ b/test/xpu_api/random/interface_tests/common_for_distrs_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_DISTRS_COMMON_H +#define _ONEDPL_RANDOM_INTERFACE_TESTS_DISTRS_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_DISTRS_COMMON_H diff --git a/test/xpu_api/random/interface_tests/distrs_methods_dp.pass.cpp b/test/xpu_api/random/interface_tests/distrs_methods_dp.pass.cpp new file mode 100644 index 00000000000..8748063ddb1 --- /dev/null +++ b/test/xpu_api/random/interface_tests/distrs_methods_dp.pass.cpp @@ -0,0 +1,205 @@ +// -*- C++ -*- +//===-- distrs_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_distrs_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/distrs_methods_sp.pass.cpp b/test/xpu_api/random/interface_tests/distrs_methods_sp.pass.cpp new file mode 100644 index 00000000000..5ec8a3e848f --- /dev/null +++ b/test/xpu_api/random/interface_tests/distrs_methods_sp.pass.cpp @@ -0,0 +1,130 @@ +// -*- C++ -*- +//===-- distrs_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_distrs_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/statistics_tests/bernoulli_distr_test.pass.cpp b/test/xpu_api/random/statistics_tests/bernoulli_distr_test.pass.cpp new file mode 100644 index 00000000000..97b045eb3a7 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/bernoulli_distr_test.pass.cpp @@ -0,0 +1,378 @@ +// -*- C++ -*- +//===-- bernoulli_distr_test.pass.cpp ------------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of bernoulli_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; + +int +statistics_check(int nsamples, double p, bool* samples) +{ + // theoretical moments + double tM = p; + double tD = p * (1 - p); + double tQ = p; + + std::vector samples_vec (samples, samples + nsamples); + return compare_moments(nsamples, samples_vec, tM, tD, tQ); +} + +template +int +test(sycl::queue& queue, double p, int nsamples) +{ + + // memory allocation + std::unique_ptr samples(new bool[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 buffer(samples.get(), 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::bernoulli_distribution distr(p); + + sycl::vec res = distr(engine); + res.store(idx.get_linear_id(), acc); + }); + }); + } + + // statistics check + int err = statistics_check(nsamples, p, samples.get()); + + 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) +{ + + // memory allocation + std::unique_ptr samples(new bool[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 buffer(samples.get(), 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::bernoulli_distribution distr(p); + + sycl::vec 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.get()); + + 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 << "bernoulli_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; + + sycl::vec p_array[nparams] = {0.2, 0.9}; + + // Test for all non-zero parameters + for (int i = 0; i < nparams; ++i) + { + std::cout << "bernoulli_distribution test, p = " << p_array[i] << ", nsamples = " << nsamples + << ", part = " << part; + if (test_portion(queue, p_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(); + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { + 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/common_for_distrs.hpp b/test/xpu_api/random/statistics_tests/common_for_distrs.hpp new file mode 100644 index 00000000000..5212e5a8cdc --- /dev/null +++ b/test/xpu_api/random/statistics_tests/common_for_distrs.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_distr_dp_test.pass.cpp b/test/xpu_api/random/statistics_tests/exponential_distr_dp_test.pass.cpp new file mode 100644 index 00000000000..b06f1e9acef --- /dev/null +++ b/test/xpu_api/random/statistics_tests/exponential_distr_dp_test.pass.cpp @@ -0,0 +1,242 @@ +// -*- C++ -*- +//===-- exponential_distr_dp_test.pass.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_distrs.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_distr_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/exponential_distr_sp_test.pass.cpp new file mode 100644 index 00000000000..b1a6278fb6a --- /dev/null +++ b/test/xpu_api/random/statistics_tests/exponential_distr_sp_test.pass.cpp @@ -0,0 +1,223 @@ +// -*- C++ -*- +//===-- exponential_distr_sp_test.pass.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_distrs.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/extreme_value_distr_dp_portion_test.pass.cpp b/test/xpu_api/random/statistics_tests/extreme_value_distr_dp_portion_test.pass.cpp new file mode 100644 index 00000000000..4e4dcd83257 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/extreme_value_distr_dp_portion_test.pass.cpp @@ -0,0 +1,183 @@ +// -*- C++ -*- +//===-- extreme_value_distr_dp_portion_test.pass.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_distrs.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_distr_dp_test.pass.cpp b/test/xpu_api/random/statistics_tests/extreme_value_distr_dp_test.pass.cpp new file mode 100644 index 00000000000..d55d03b0dab --- /dev/null +++ b/test/xpu_api/random/statistics_tests/extreme_value_distr_dp_test.pass.cpp @@ -0,0 +1,131 @@ +// -*- C++ -*- +//===-- extreme_value_distr_dp_test.pass.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_distrs.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_distr_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/extreme_value_distr_sp_test.pass.cpp new file mode 100644 index 00000000000..a35cd53bcf0 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/extreme_value_distr_sp_test.pass.cpp @@ -0,0 +1,223 @@ +// -*- C++ -*- +//===-- extreme_value_distr_sp_test.pass.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_distrs.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/geometric_distr_test.pass.cpp b/test/xpu_api/random/statistics_tests/geometric_distr_test.pass.cpp new file mode 100644 index 00000000000..8a7fc4d4e6d --- /dev/null +++ b/test/xpu_api/random/statistics_tests/geometric_distr_test.pass.cpp @@ -0,0 +1,225 @@ +// -*- C++ -*- +//===-- geometric_distr_test.pass.cpp ------------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of geometric_distribution - check statistical properties of the distribution + +#include "support/utils.h" + +#if TEST_UNNAMED_LAMBDAS +#include "common_for_distrs.hpp" + +template +using Distr = oneapi::dpl::geometric_distribution; + +#endif // TEST_UNNAMED_LAMBDAS + +int +main() +{ + +#if TEST_UNNAMED_LAMBDAS + + sycl::queue queue = TestUtils::get_test_queue(); + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { + 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_distr_dp_portion_test.pass.cpp b/test/xpu_api/random/statistics_tests/lognormal_distr_dp_portion_test.pass.cpp new file mode 100644 index 00000000000..712730aaf60 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/lognormal_distr_dp_portion_test.pass.cpp @@ -0,0 +1,182 @@ +// -*- C++ -*- +//===-- lognormal_distr_dp_portion_test.pass.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_distrs.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_distr_dp_test.pass.cpp b/test/xpu_api/random/statistics_tests/lognormal_distr_dp_test.pass.cpp new file mode 100644 index 00000000000..c176e8a3246 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/lognormal_distr_dp_test.pass.cpp @@ -0,0 +1,129 @@ +// -*- C++ -*- +//===-- lognormal_distr_dp_test.pass.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_distrs.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_distr_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/lognormal_distr_sp_test.pass.cpp new file mode 100644 index 00000000000..6bd2b99257c --- /dev/null +++ b/test/xpu_api/random/statistics_tests/lognormal_distr_sp_test.pass.cpp @@ -0,0 +1,221 @@ +// -*- C++ -*- +//===-- lognormal_distr_sp_test.pass.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_distrs.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/normal_distr_dp_portion_test.pass.cpp b/test/xpu_api/random/statistics_tests/normal_distr_dp_portion_test.pass.cpp new file mode 100644 index 00000000000..73f46ce1a62 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/normal_distr_dp_portion_test.pass.cpp @@ -0,0 +1,182 @@ +// -*- C++ -*- +//===-- normal_distr_dp_portion_test.pass.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_distrs.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_distr_dp_test.pass.cpp b/test/xpu_api/random/statistics_tests/normal_distr_dp_test.pass.cpp new file mode 100644 index 00000000000..efd4fb92b46 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/normal_distr_dp_test.pass.cpp @@ -0,0 +1,129 @@ +// -*- C++ -*- +//===-- normal_distr_dp_test.pass.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_distrs.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_distr_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/normal_distr_sp_test.pass.cpp new file mode 100644 index 00000000000..b9454ce4985 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/normal_distr_sp_test.pass.cpp @@ -0,0 +1,221 @@ +// -*- C++ -*- +//===-- normal_distr_sp_test.pass.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_distrs.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/philox_uniform_real_distr_dp_test.pass.cpp b/test/xpu_api/random/statistics_tests/philox_uniform_real_distr_dp_test.pass.cpp new file mode 100644 index 00000000000..8f9c8afbff4 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/philox_uniform_real_distr_dp_test.pass.cpp @@ -0,0 +1,250 @@ +// -*- C++ -*- +//===-- philox_uniform_real_distr_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_distrs.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_distr_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/philox_uniform_real_distr_sp_test.pass.cpp new file mode 100644 index 00000000000..483b396e72a --- /dev/null +++ b/test/xpu_api/random/statistics_tests/philox_uniform_real_distr_sp_test.pass.cpp @@ -0,0 +1,354 @@ +// -*- C++ -*- +//===-- philox_uniform_real_distr_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_distrs.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/uniform_int_distr_test.pass.cpp b/test/xpu_api/random/statistics_tests/uniform_int_distr_test.pass.cpp new file mode 100644 index 00000000000..5fe336a9bc6 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/uniform_int_distr_test.pass.cpp @@ -0,0 +1,368 @@ +// -*- C++ -*- +//===-- uniform_int_distr_test.pass.cpp ----------------------------------===// +// +// Copyright (C) Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Abstract: +// +// Test of uniform_int_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 = 2147483647u; +constexpr auto seed = 777; + +template +std::int32_t statistics_check(int nsamples, IntType left, IntType right, + const std::vector& samples) +{ + // theoretical moments + double tM = (left + right - 1.0) / 2.0; + double tD = ((right - left) * (right - left) - 1.0) / 12.0; + double tQ = (((right - left) * (right - left)) * ((1.0 / 80.0) * (right - left) * (right - left) - + (1.0 / 24.0))) + (7.0 / 240.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 std::int32_t 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_int_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 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::uniform_int_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, -10}; + oneapi::dpl::internal::element_type_t right_array [nparams] = {1000, 10}; + + // Test for all non-zero parameters + for(int i = 0; i < nparams; ++i) { + std::cout << "uniform_int_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, -10}; + oneapi::dpl::internal::element_type_t right_array [nparams] = {1000, 10}; + + // Test for all non-zero parameters + for(int i = 0; i < nparams; ++i) { + std::cout << "uniform_int_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(); + // Skip tests if DP is not supported + if (TestUtils::has_type_support(queue.get_device())) { + 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_distr_dp_test.pass.cpp b/test/xpu_api/random/statistics_tests/uniform_real_distr_dp_test.pass.cpp new file mode 100644 index 00000000000..3aba029d04d --- /dev/null +++ b/test/xpu_api/random/statistics_tests/uniform_real_distr_dp_test.pass.cpp @@ -0,0 +1,224 @@ +// -*- C++ -*- +//===-- uniform_real_distr_dp_test.pass.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_distrs.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_distr_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/uniform_real_distr_sp_test.pass.cpp new file mode 100644 index 00000000000..c310088ab00 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/uniform_real_distr_sp_test.pass.cpp @@ -0,0 +1,221 @@ +// -*- C++ -*- +//===-- uniform_real_distr_sp_test.pass.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_distrs.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/weibull_distr_dp_test.pass.cpp b/test/xpu_api/random/statistics_tests/weibull_distr_dp_test.pass.cpp new file mode 100644 index 00000000000..90ca0245f76 --- /dev/null +++ b/test/xpu_api/random/statistics_tests/weibull_distr_dp_test.pass.cpp @@ -0,0 +1,227 @@ + +// -*- C++ -*- +//===-- weibull_distr_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_distrs.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_distr_sp_test.pass.cpp b/test/xpu_api/random/statistics_tests/weibull_distr_sp_test.pass.cpp new file mode 100644 index 00000000000..3a36df0af1b --- /dev/null +++ b/test/xpu_api/random/statistics_tests/weibull_distr_sp_test.pass.cpp @@ -0,0 +1,223 @@ +// -*- C++ -*- +//===-- weibull_distr_sp_test.pass.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_distrs.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); +}