OpenCL: Difference between revisions

No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 6: Line 6:
===Linux===
===Linux===
https://gist.github.com/Brainiarc7/dc80b023af5b4e0d02b33923de7ba1ed
https://gist.github.com/Brainiarc7/dc80b023af5b4e0d02b33923de7ba1ed
<pre>
sudo apt install ocl-icd-opencl-dev opencl-headers
sudo apt install opencl-c-headers opencl-clhpp-headers
</pre>


==Getting Started==
==Getting Started==
Line 242: Line 246:
</syntaxhighlight>
</syntaxhighlight>
}}
}}
===Python===
See [https://documen.tician.de/pyopencl/index.html pyopencl].


===Julia===
===Julia===
Line 271: Line 278:


In C++, you can use [https://github.khronos.org/OpenCL-CLHPP/classcl_1_1_image_g_l.html <code>cl::ImageGL</code>] to access textures in OpenGL.   
In C++, you can use [https://github.khronos.org/OpenCL-CLHPP/classcl_1_1_image_g_l.html <code>cl::ImageGL</code>] to access textures in OpenGL.   
Note that <code>cl::Image</code> and <code>cl::Buffer</code> are not the same thing. A buffer is a contiguous section of memory whereas an image is a mipmapped texture. Interchanging them will result in <code>CL_INVALID_MEM_OBJECT</code> errors or similar.
Note that <code>cl::Image</code> and <code>cl::Buffer</code> are not the same thing. Interchanging them will result in <code>CL_INVALID_MEM_OBJECT</code> errors or similar.
I recommend writing to a separate buffer and copying to images.
I recommend writing to a separate buffer and copying to images.


Line 283: Line 290:
==Advanced Topics==
==Advanced Topics==
====Local Memory v. Global Memory====
====Local Memory v. Global Memory====
[[Category:Programming languages]]
[[Category:GPU Programming languages]]