Linux/OpenCL: crash when reading memory from device

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);

Thank you very much.

flappy bird really challenges me because one small mistake means starting all over again.

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.

Create custom levels in Geometry Dash and share your creations with the global player community

The article is written with great depth, and I have learned a lot of practical knowledge. The Study ITIL-4-Specialist-Create-Deliver-and-Support tool helped me climb the career ladder and earn a raise. Now, I’m sharing it for free with all of you. Wishing you success!

I gained a lot from reading that article. I’m sharing the C_BCWME_2504 study materials review questions that helped me achieve my promotion and raise—get them for free today!

Thank you for sharing this incredible article, it’s truly breathtaking! Free Reliable AP-222 practice questions book available for improving your IT skills. Wishing you the best!

I’m in awe of this article, thank you for sharing it. Get the New EAPA_2025 exam preparation questions for free—the key to earning a promotion and higher salary!

만약ITDumpsKR를 선택하였다면 여러분은 반은 성공한 것입니다. 여러분은 아주 빠르게 안전하게 또 쉽게HP HPE2-E84인증시험 자격증을 취득하실 수 있습니다. 우리ITDumpsKR에서 제공되는 모든 덤프들은 모두 100%보장 도를 자랑하며 그리고 우리는 일년무료 업데이트를 제공합니다.

I really appreciate your article, it was so thought-provoking. Here are the New CIS-TPRM test cram review materials, free of charge—best of luck!

Your article was such a breath of fresh air, thank you! Test Vault-Associate-002 vce is a free resource, offering rich content to aid your learning experience.