blob: 8fb5be43cdf6d269f6aac41f6c63ced18c9e46cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include <forstio/test/suite.hpp>
#include "../c++/data.hpp"
namespace {
namespace sch {
using namespace saw::schema;
}
SAW_TEST("Data Ref Basics"){
using namespace saw;
acpp::sycl::queue sycl_q;
data<sch::Array<sch::Float64>, encode::Sycl<encode::Native>> dat{{{100u}},sycl_q};
data<sch::Ref<sch::Array<sch::Float64>>, encode::Sycl<encode::Native>> dat_ref{dat};
auto dat_ptr = dat_ref.get_internal_data();
sycl_q.parallel_for(100u, [=](acpp::sycl::id<1> idx){
size_t i = idx[0];
dat_ptr[i] = {static_cast<double>(i)};
}).wait();
for(uint64_t i = 0u; i < 100u; ++i){
SAW_EXPECT(dat_ptr[i].get() == i, std::string{"Unexpected value: "} + std::to_string(i));
}
}
}
|