Hi Cheikhou, Sorry for the late answering. I needed to check some stuffs. But the problem is it works only with ByteArray objects.
When I load array of floats to GPU , data are modify and I don't know how and why and results are wrong.
What kind of error are you getting? a NativeBoost error or incorrect results? Since you were originally asking me about FloatArray or IntegerArray, I am assuming you are getting incorrect results or a segmentation fault. The OpenCL package is just a binding with a bit of object orientation to the OpenCL C library that I wrote manually. Those binding don't try to do a lot of magic when receiving a Pharo object. The OpenCL C API when allocating a GPU side buffer is expecting a size in bytes. According to the class comment in IntegerArray and in FloatArray, they are composed of 32 bits elements. So, when passing their size to OpenCL, you have to multiply them by 4. For an actual example, check the new tests that I just added to the OpenCL-Tests packages. I tried using IntegerArray and FloatArray, and it did work. It seems that you found the asCLFloatArray and the asFloatArrayFromCL methods, that are used to convert from an Array into a ByteArray and backwards. For completeness, I just added the following new methods. asCLInt16Array <-> asInt16ArrayFromCL asCLInt32Array <-> asInt32ArrayFromCL asCLInt64Array <-> asInt64ArrayFromCL asCLUInt16Array <-> asUInt16ArrayFromCL asCLUInt32Array <-> asUInt32ArrayFromCL asCLUInt64Array <-> asUInt64ArrayFromCL asCLDoubleArray <-> asDoubleArrayFromCL Unlike passing an IntegerArray or a FloatArray, these are method are creating a new array, looping over all elements and doing marshalling/unmarshalling. These methods can be very inefficient. Be careful when using them. Best regards, Ronie Salgado 2015-06-12 8:09 GMT-03:00 cheikhou <cheikhouka@gmail.com>:
Hello.
I use OpenCL package developed by Ronie Salgado package to program on GPU. When I initialize an array with ByteArray class and load data to GPU memory it works without any problem.
But the problem is it works only with ByteArray objects. When I load array of floats to GPU , data are modify and I don't know how and why and results are wrong.
Please someone have any idea First: how to load integer values upper than 255 (not possible with ByteArray) Second: use float arrays correctly in GPU memory.
Thanks for your help.
----- Cheikhou -- View this message in context: http://forum.world.st/Copy-array-of-float-to-GPU-memory-tp4831970.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.