-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
distribution -> distr; filenames in the comments were changed
- Loading branch information
1 parent
fffdd23
commit 6e4714c
Showing
34 changed files
with
7,103 additions
and
0 deletions.
There are no files selected for viewing
131 changes: 131 additions & 0 deletions
131
test/xpu_api/random/device_tests/bernoulli_distr_device_test.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <iostream> | ||
|
||
#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<double>(queue.get_device())) { | ||
int err = 0; | ||
|
||
// testing oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 1>> oneapi::dpl::linear_congruential_engine | ||
std::cout << "---------------------------------------------------------------------" << std::endl; | ||
std::cout << "bernoulli_distribution<sycl::vec<bool, 1>> linear_congruential_engine" << std::endl; | ||
std::cout << "---------------------------------------------------------------------" << std::endl; | ||
err = device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 1>>, oneapi::dpl::linear_congruential_engine<std::uint32_t, a, c, m>>(queue); | ||
#if TEST_LONG_RUN | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 1>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 16>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 1>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 8>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 1>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 4>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 1>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 3>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 1>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 2>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 1>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 1>, a, c, m>>(queue); | ||
#endif // TEST_LONG_RUN | ||
EXPECT_TRUE(!err, "Test FAILED"); | ||
|
||
// testing oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 2>> oneapi::dpl::linear_congruential_engine | ||
std::cout << "---------------------------------------------------------------------" << std::endl; | ||
std::cout << "bernoulli_distribution<sycl::vec<bool, 2>> linear_congruential_engine" << std::endl; | ||
std::cout << "---------------------------------------------------------------------" << std::endl; | ||
err = device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 2>>, oneapi::dpl::linear_congruential_engine<std::uint32_t, a, c, m>>(queue); | ||
#if TEST_LONG_RUN | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 2>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 16>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 2>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 8>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 2>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 4>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 2>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 3>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 2>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 2>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 2>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 1>, a, c, m>>(queue); | ||
#endif // TEST_LONG_RUN | ||
EXPECT_TRUE(!err, "Test FAILED"); | ||
|
||
// testing oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 3>> oneapi::dpl::linear_congruential_engine | ||
std::cout << "---------------------------------------------------------------------" << std::endl; | ||
std::cout << "bernoulli_distribution<sycl::vec<bool, 3>> linear_congruential_engine" << std::endl; | ||
std::cout << "---------------------------------------------------------------------" << std::endl; | ||
err = device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 3>>, oneapi::dpl::linear_congruential_engine<std::uint32_t, a, c, m>>(queue); | ||
#if TEST_LONG_RUN | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 3>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 16>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 3>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 8>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 3>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 4>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 3>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 3>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 3>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 2>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 3>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 1>, a, c, m>>(queue); | ||
#endif // TEST_LONG_RUN | ||
EXPECT_TRUE(!err, "Test FAILED"); | ||
|
||
// testing oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 4>> oneapi::dpl::linear_congruential_engine | ||
std::cout << "---------------------------------------------------------------------" << std::endl; | ||
std::cout << "bernoulli_distribution<sycl::vec<bool, 4>> linear_congruential_engine" << std::endl; | ||
std::cout << "---------------------------------------------------------------------" << std::endl; | ||
err = device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 4>>, oneapi::dpl::linear_congruential_engine<std::uint32_t, a, c, m>>(queue); | ||
#if TEST_LONG_RUN | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 4>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 16>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 4>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 8>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 4>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 4>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 4>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 3>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 4>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 2>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 4>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 1>, a, c, m>>(queue); | ||
#endif // TEST_LONG_RUN | ||
EXPECT_TRUE(!err, "Test FAILED"); | ||
|
||
// testing oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 8>> oneapi::dpl::linear_congruential_engine | ||
std::cout << "---------------------------------------------------------------------" << std::endl; | ||
std::cout << "bernoulli_distribution<sycl::vec<bool, 8>> linear_congruential_engine" << std::endl; | ||
std::cout << "---------------------------------------------------------------------" << std::endl; | ||
err = device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 8>>, oneapi::dpl::linear_congruential_engine<std::uint32_t, a, c, m>>(queue); | ||
#if TEST_LONG_RUN | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 8>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 16>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 8>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 8>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 8>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 4>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 8>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 3>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 8>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 2>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 8>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 1>, a, c, m>>(queue); | ||
#endif // TEST_LONG_RUN | ||
EXPECT_TRUE(!err, "Test FAILED"); | ||
|
||
// testing oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 16>> oneapi::dpl::linear_congruential_engine | ||
std::cout << "---------------------------------------------------------------------" << std::endl; | ||
std::cout << "bernoulli_distribution<sycl::vec<bool, 16>> linear_congruential_engine" << std::endl; | ||
std::cout << "---------------------------------------------------------------------" << std::endl; | ||
err = device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 16>>, oneapi::dpl::linear_congruential_engine<std::uint32_t, a, c, m>>(queue); | ||
#if TEST_LONG_RUN | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 16>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 16>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 16>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 8>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 16>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 4>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 16>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 3>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 16>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 2>, a, c, m>>(queue); | ||
err += device_copyable_test<oneapi::dpl::bernoulli_distribution<sycl::vec<bool, 16>>, oneapi::dpl::linear_congruential_engine<sycl::vec<std::uint32_t, 1>, a, c, m>>(queue); | ||
#endif // TEST_LONG_RUN | ||
EXPECT_TRUE(!err, "Test FAILED"); | ||
} | ||
|
||
#endif // TEST_UNNAMED_LAMBDAS | ||
|
||
return TestUtils::done(TEST_UNNAMED_LAMBDAS); | ||
} |
Oops, something went wrong.