Finally get through OpenCL's Hello World in Kotlin. Computing 3 million times sin and cos using GPU, total time is 456ms, 105ms is used to compute and read result back to CPU. On the other hand, CPU takes whole 891ms to compute cos and sin. Which I guess it's more convinced for me to just say "GPU is good for parallel computing". The result is more vivid than sentences.
After doing this, I though LWJGL's document on OpenCL is really bad. What all I referenced are Java test codes and C++ codes. And I rely on my experience a lot to debug it. It looks like JOCL's binding is more object oriented and more user friendly. But LWJGL is offering a integrated package of OpenGL, GLFW and OpenCL binding, which I guess I have to stick with it for now.
Besides auto converting Java bytecode to OpenCL kernel, Aparapi seems much easier to get start with. Without dealing a lot of data copying and buffer creating things, life is much simpler.
I might write a blog(in Chinese of course, since I'm a Chinese, maybe I'll commit this program to LWJGL as a OpenCL HelloWorld) to describe where you should take a good care with LWJGL's OpenCL binding, where I actually crash the JVM by doing it wrong. (BTW, using println to locate the crash point is way faster than step through XD)
QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.
@skyblond good night too.