34 IndexType sizeDim1 = 2;
35 IndexType sizeDim2 = 3;
36 IndexType sizeDim3 = 5;
37 IndexType sizeDim4 = 7;
49 const size_t tensorBuffSize = tensor.size() *
sizeof(DataType);
50 DataType* gpu_data_tensor =
static_cast<DataType*
>(sycl_device.allocate(tensorBuffSize));
51 DataType* gpu_data_no_stride =
static_cast<DataType*
>(sycl_device.allocate(tensorBuffSize));
56 sycl_device.memcpyHostToDevice(gpu_data_tensor, tensor.data(), tensorBuffSize);
57 gpu_no_stride.device(sycl_device) = gpu_tensor.inflate(
strides);
58 sycl_device.memcpyDeviceToHost(no_stride.data(), gpu_data_no_stride, tensorBuffSize);
65 for (IndexType
i = 0;
i < 2; ++
i) {
66 for (IndexType
j = 0;
j < 3; ++
j) {
67 for (IndexType
k = 0;
k < 5; ++
k) {
68 for (IndexType l = 0; l < 7; ++l) {
80 IndexType inflatedSizeDim1 = 3;
81 IndexType inflatedSizeDim2 = 9;
82 IndexType inflatedSizeDim3 = 9;
83 IndexType inflatedSizeDim4 = 19;
84 array<IndexType, 4> inflatedTensorRange = {{inflatedSizeDim1, inflatedSizeDim2, inflatedSizeDim3, inflatedSizeDim4}};
88 const size_t inflatedTensorBuffSize = inflated.size() *
sizeof(DataType);
89 DataType* gpu_data_inflated =
static_cast<DataType*
>(sycl_device.allocate(inflatedTensorBuffSize));
91 gpu_inflated.device(sycl_device) = gpu_tensor.inflate(
strides);
92 sycl_device.memcpyDeviceToHost(inflated.data(), gpu_data_inflated, inflatedTensorBuffSize);
99 for (IndexType
i = 0;
i < inflatedSizeDim1; ++
i) {
100 for (IndexType
j = 0;
j < inflatedSizeDim2; ++
j) {
101 for (IndexType
k = 0;
k < inflatedSizeDim3; ++
k) {
102 for (IndexType l = 0; l < inflatedSizeDim4; ++l) {
113 sycl_device.deallocate(gpu_data_tensor);
114 sycl_device.deallocate(gpu_data_no_stride);
115 sycl_device.deallocate(gpu_data_inflated);
int i
Definition: BiCGSTAB_step_by_step.cpp:9
A tensor expression mapping an existing array of data.
Definition: TensorMap.h:33
The tensor class.
Definition: Tensor.h:68
char char char int int * k
Definition: level2_impl.h:374
#define VERIFY_IS_EQUAL(a, b)
Definition: main.h:367
EIGEN_ALWAYS_INLINE DSizes< IndexType, NumDims > strides(const DSizes< IndexType, NumDims > &dimensions)
Definition: TensorBlock.h:29
std::array< T, N > array
Definition: EmulateArray.h:231
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2