-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathvector_add_buffer.cpp
43 lines (35 loc) · 1000 Bytes
/
vector_add_buffer.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: MIT
#include <iostream>
#include <sycl/sycl.hpp>
using namespace sycl;
int main() {
// Set up queue on any available device
//TODO
// Initialize input and output memory on the host
constexpr size_t N = 256;
std::vector<int> a(N), b(N), c(N);
std::fill(a.begin(), a.end(), 1);
std::fill(b.begin(), b.end(), 2);
std::fill(c.begin(), c.end(), 0);
{
// Create buffers for the
// TODO
// Submit the kernel to the queue
q.submit([&](handler& h) {
// Create accessors
//TODO
h.parallel_for(
//TODO
);
});
//TODO after the submission works
//Checking inside the scope of the buffers
}
// Check that all outputs match expected value
bool passed = std::all_of(c.begin(), c.end(),
[](int i) { return (i == 3); });
std::cout << ((passed) ? "SUCCESS" : "FAILURE")
<< std::endl;
return (passed) ? 0 : 1;
}