Skip to content

Commit

Permalink
Update 07-sycl-intro.md
Browse files Browse the repository at this point in the history
  • Loading branch information
csccva authored Nov 28, 2024
1 parent 460377c commit ec12e08
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions docs/07-sycl-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,6 @@ lang: en
- Nvidia GPUs (via CUDA), AMD GPUs (via ROCM)


# Anatomy of a SYCL code

<small>
```cpp
#include <sycl/sycl.hpp>
using namespace sycl;

template <typename T>
void axpy(queue &q, const T &a, const std::vector<T> &x, std::vector<T> &y) {
range<1> N{x.size()};
buffer x_buf(x.data(), N);
buffer y_buf(y.data(), N);

q.submit([&](handler &h) {
auto x = x_buf.template get_access<access::mode::read>(h); // accessor x(x_buf, h, read_only);
auto y = y_buf.template get_access<access::mode::read_write>(h); // accessor y(y_buf, h, read_write);

h.parallel_for(N, [=](id<1> i) {
y[i] += a * x[i];
});
});
q.wait_and_throw();
}
```
</small>

# Summary

Expand Down

0 comments on commit ec12e08

Please sign in to comment.