66//
77// ===---------------------------------------------------------------------===//
88
9- #include < CL /sycl.hpp>
9+ #include < sycl /sycl.hpp>
1010
1111#include < array>
1212#include < iostream>
1313
14- constexpr cl:: sycl::access::mode sycl_read = cl:: sycl::access::mode::read;
15- constexpr cl:: sycl::access::mode sycl_write = cl:: sycl::access::mode::write;
14+ constexpr sycl::access::mode sycl_read = sycl::access::mode::read;
15+ constexpr sycl::access::mode sycl_write = sycl::access::mode::write;
1616
1717template <typename T> class SimpleVadd ;
1818
1919template <typename T, size_t N>
2020void simple_vadd (const std::array<T, N> &VA, const std::array<T, N> &VB,
2121 std::array<T, N> &VC) {
22- cl:: sycl::queue deviceQueue ([](cl:: sycl::exception_list ExceptionList) {
22+ sycl::queue deviceQueue ([](sycl::exception_list ExceptionList) {
2323 for (std::exception_ptr ExceptionPtr : ExceptionList) {
2424 try {
2525 std::rethrow_exception (ExceptionPtr);
26- } catch (cl:: sycl::exception &E) {
26+ } catch (sycl::exception &E) {
2727 std::cerr << E.what ();
2828 } catch (...) {
2929 std::cerr << " Unknown async exception was caught." << std::endl;
3030 }
3131 }
3232 });
3333
34- cl:: sycl::range<1 > numOfItems{N};
35- cl:: sycl::buffer<T, 1 > bufferA (VA.data (), numOfItems);
36- cl:: sycl::buffer<T, 1 > bufferB (VB.data (), numOfItems);
37- cl:: sycl::buffer<T, 1 > bufferC (VC.data (), numOfItems);
34+ sycl::range<1 > numOfItems{N};
35+ sycl::buffer<T, 1 > bufferA (VA.data (), numOfItems);
36+ sycl::buffer<T, 1 > bufferB (VB.data (), numOfItems);
37+ sycl::buffer<T, 1 > bufferC (VC.data (), numOfItems);
3838
39- deviceQueue.submit ([&](cl:: sycl::handler &cgh) {
39+ deviceQueue.submit ([&](sycl::handler &cgh) {
4040 auto accessorA = bufferA.template get_access <sycl_read>(cgh);
4141 auto accessorB = bufferB.template get_access <sycl_read>(cgh);
4242 auto accessorC = bufferC.template get_access <sycl_write>(cgh);
4343
44- cgh.parallel_for <class SimpleVadd <T>>(numOfItems,
45- [=](cl::sycl::id<1 > wiID) {
44+ cgh.parallel_for <class SimpleVadd <T>>(numOfItems, [=](sycl::id<1 > wiID) {
4645 accessorC[wiID] = accessorA[wiID] + accessorB[wiID];
4746 });
4847 });
@@ -52,10 +51,10 @@ void simple_vadd(const std::array<T, N> &VA, const std::array<T, N> &VB,
5251
5352int main () {
5453 const size_t array_size = 4 ;
55- std::array<cl:: sycl::cl_int, array_size> A = {{1 , 2 , 3 , 4 }},
56- B = {{ 1 , 2 , 3 , 4 }}, C;
57- std::array<cl:: sycl::cl_float, array_size> D = {{1 .f , 2 .f , 3 .f , 4 .f }},
58- E = {{1 .f , 2 .f , 3 .f , 4 .f }}, F;
54+ std::array<sycl::cl_int, array_size> A = {{ 1 , 2 , 3 , 4 }}, B = {{1 , 2 , 3 , 4 }},
55+ C;
56+ std::array<sycl::cl_float, array_size> D = {{1 .f , 2 .f , 3 .f , 4 .f }},
57+ E = {{1 .f , 2 .f , 3 .f , 4 .f }}, F;
5958 simple_vadd (A, B, C);
6059 simple_vadd (D, E, F);
6160 for (unsigned int i = 0 ; i < array_size; i++) {
0 commit comments