- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is my code !
#include <vector>
#include <iostream>
#include <CL/sycl.hpp> // DPC++ header
std::vector<std::vector<double>> filter2d(const std::vector<double>& b, double a, const std::vector<std::vector<double>>& x) {
int rows = x.size();
int cols = x[0].size();
std::vector<std::vector<double>> y(x.size(), std::vector<double>(x[0].size()));
sycl::queue q(sycl::gpu_selector{});
sycl::buffer b_buffer(b);
sycl::buffer y_buffer(x);
sycl::buffer x_buffer(y);
q.submit([&](sycl::handler& h) {
sycl::accessor x_acc(x_buffer,h,sycl::read_only);
sycl::accessor b_acc(b_buffer,h,sycl::read_only);
sycl::accessor y_acc(y_buffer, h, sycl::write_only,sycl::no_init);
h.parallel_for(sycl::range<2>(rows, cols), [=](sycl::id<2> idx) {
int i = idx[0];
int j = idx[1];
y_acc[i][j] = 0.0;
for (int k = 0; k < b.size(); k++) {
if (i - k >= 0) {
y_acc[i][j] += b_acc[k] * x_acc[(i - k) ][j];
}
}
y_acc[i][j] /= a;
});
});
q.wait();
return y;
}
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for posting on Intel communities.
Since this is a duplicate thread of https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/oneapi/m-p/1508594#M3185, we will no longer monitor this thread. We will continue addressing this issue in the other thread.
Thanks & Regards,
Vankudothu Vaishnavi.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page