Respected all,
I am doing some code in cuda. I am new in cuda so i do not know much things related to that.
I want to ask that “Can we pass structure pointer to kernel ?”
waiting for response
Respected all,
I am doing some code in cuda. I am new in cuda so i do not know much things related to that.
I want to ask that “Can we pass structure pointer to kernel ?”
waiting for response
Yes, if the structure lives on the device. You can’t pass a pointer to a HOST structure without first copying over the structure to the device.
[There’s a fancy exception to the need to copy the structure using zero-copy memory, but even in that case the pointer you pass in a device pointer.]
can i do like this?
Pixel is the structure having 4 bytes
Pixel *p;
cudaMalloc((PIXEL **)p,size);
//i thing above line will create the buffer on GPU of sizeof(PIXEL)*size
//is it correct? then can i do like this
kernel<<<dimGrid,dimBlock>>>(p,…);
//passing pointer to the kernel