Hello everyone.
I’m working on porting a CUDA application to OpenCL and I noticed that CUDA offers the functionality of writing data to its “buffers” by chunks. What I mean by this is the following:
int *vals = new int[N/4];
int *d_vec = nullptr;
cudaMalloc((void**)&d_vec, sizeof(int) * N);
for(int i = 0; i < 4; i++){
cudaMemcpy(d_vec + i*(N/4), vals, sizeof(int) * N/4, cudaMemcpyHostToDevice);
}
What the code above does is to write the vals
array (which has 1/4 of the d_vec
buffer) sequentially to d_vec
. So my question is, is it possible to do the same with OpenCL? That is, allocate a buffer and write values sequentially to it, without having to write an array with the full buffer size?
Thank you!