I am learning dpc++ and trying to implement 2d array matrix program. I am stuck in between the program. Please check the blow code and support me. Need help.
#include<CL/sycl.hpp>
#include<stdio.h>
#define N 2
using namespace sycl;
int main(){
int ha[N][N] = {1,2,3,4};
int hb[N][N] = {1,2,3,4};
int hc[N][N];
//printing ha and hb arrays here
//synchronization block start
{
queue q;
buffer my_buf1(ha);
buffer my_buf2(hb);
buffer my_buf3(hc);
q.submit([&](handler &h) {
stream out(1024,256,h);
accessor dev_acs1(my_buf1,h);
accessor dev_acs2(my_buf2,h);
accessor dev_acs3(my_buf3,h);
I am not getting how to write parallel_for
function to add ha[i][j]
and hb[i][j]
and put it in hc[i][j]
h.parallel_for(range{N,N},[=](id<2> idx){
----------------------
});
host_accessor host_hc(my_buf3);
for(int i=0;i<N;i++)
for(int j=0;j<N;j++)
std::cout<<host_hc[i][j];
}
return 0;
}