I am developing a high level OpenCL binding in Haskell, and I need peer-review and testing.
Currently It currently only get Platformgets platform and Devicedevice info from OpenCL.
http://github.com/zhensydow/opencl
Thanks a lot!
Edit: Code smell example 1
I have lots of functions that only change the returned type and the size of the type passed to the C library. But i, but I don't know whohow to fix it.
getDeviceInfoUlong :: CLDeviceInfo_ -> CLDeviceID -> IO (Either CLError CLulong)
getDeviceInfoUlong infoid device = alloca $ \(dat :: Ptr CLulong) -> do
whenSuccess (raw_clGetDeviceInfo device infoid size (castPtr dat) nullPtr)
$ peek dat
where
size = fromIntegral $ sizeOf (0::CLulong)
getDeviceInfoSizet :: CLDeviceInfo_ -> CLDeviceID -> IO (Either CLError CSize)
getDeviceInfoSizet infoid device = alloca $ \(dat :: Ptr CSize) -> do
whenSuccess (raw_clGetDeviceInfo device infoid size (castPtr dat) nullPtr)
$ peek dat
where
size = fromIntegral $ sizeOf (0::CSize)