cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

mishka_p
Journeyman III

cl_mem what or how to get a pointer to the memory of the GPU

Hello! please help to get a pointer to the memory of the GPU. Is this possible? What is cl_mem? And yet, there is reason to try to create an equivalent class?
Thanks in advance!

0 Likes
4 Replies
genaganna
Journeyman III

Originally posted by: mishka_p Hello! please help to get a pointer to the memory of the GPU. Is this possible? What is cl_mem? And yet, there is reason to try to create an equivalent class? Thanks in advance!

cl_mem is OpenCL object. You can use clEnqueueMapBuffer/Image to get a host ptr which can be used to write/read data.

You can also use clEnqueueWriteBuffer/Image to write data.

0 Likes

I'm sorry, I meant something else. Rephrase: if I pass into the kernel a pointer to the memory of the GPU is not as arguments to the kernel, but as an element of a array - the array of pointers.

0 Likes

You can't. As a cl_mem object is not really a pointer, it's a data container, it needs preprocessing to get onto the device. There is no way to describe an array or a struct such that the runtime would know how to do that preprocessing.

0 Likes

Thank you!

0 Likes