Title: Linux/OpenCL: crash when reading memory from device [Print This Page] Author: patricka Time: 7/21/2021 22:36 Title: Linux/OpenCL: crash when reading memory from device Last edited by patricka In 7/21/2021 22:38 Editor
Hello group,
I have written a simple test program that pushes a buffer in an OpenCL command queue, process it and returns it. Nothing fancy here...
The problem raises when I want to read back the result from the command queue. The call to function clEnqueueReadBuffer() crashes internally (no way to investigate what's happening inside the call). It seems that there is some memory corruption or wrong buffer definition, etc... This is also happening with any call like clEnqueueMapBuffer() or clEnqueueReadBuffer() even using images clEnqueueMapImage() or clEnqueueReadImage()...
This code works on other platforms... which makes this really intriguing...
Any idea? What can I possibly do wrong?
I can post the entire code if needed, but here is a summary for the buffers:
// creation
float * data = new float[ARRAY_SIZE];
float * result = new float[ARRAY_SIZE];
cl_mem memObjects[2];
memObjects[0] = clCreateBuffer(
context,
CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
sizeof(float) * ARRAY_SIZE,
data,
NULL);
memObjects[1] = clCreateBuffer(
context,
CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR,
sizeof(float) * ARRAY_SIZE,
NULL,
NULL);
(...)
// processing
(...)
errNum = clEnqueueReadBuffer(
commandQueue,
memObjects[1],
CL_TRUE,
0,
ARRAY_SIZE * sizeof(float),
result,
0,
NULL,
NULL);
Copy the code
Thank you very much.Author: Hughjack91 Time: 2/22/2025 10:23 flappy bird really challenges me because one small mistake means starting all over again.Author: LeonJordan Time: 10/9/2025 15:05
Preparing for the Certified Kubernetes Security Specialist exam requires focus and the right materials. These study resources cover all essential topics, including cluster setup, hardening, and runtime security. The CKS Exam Questions available at MyExamCollection are expertly verified and regularly updated to match the real exam pattern. With these authentic questions, you can strengthen your Kubernetes security skills and boost your chances of passing the CKS exam on your first attempt.
Welcome Firefly Open Source Community (https://bbs.t-firefly.com/)