Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix clEnqueueNDrangeKernel #3

Open
wants to merge 6 commits into from

1 participant

Luis Cabellos
This page is out of date. Refresh to see the latest.
7 System/OpenCL/Raw/V10/Kernel.hs
View
@@ -7,6 +7,7 @@ module System.OpenCL.Raw.V10.Kernel
,clReleaseKernel
,clGetKernelInfo
,clGetKernelWorkGroupInfo
+ ,clSetKernelArg
,clEnqueueNDRangeKernel
,clEnqueueTask
,clEnqueueNativeKernel)
@@ -22,7 +23,7 @@ import Data.Maybe
foreign import ccall "clCreateKernel" raw_clCreateKernel :: Program -> CString -> Ptr CLint -> IO Kernel
-clCreateKernel program kernel_name = wrapErrorEither $ raw_clCreateKernel program kernel_name
+clCreateKernel program kernel_name = withCString kernel_name $ \kn -> wrapErrorEither $ raw_clCreateKernel program kn
foreign import ccall "clCreateKernelsInProgram" raw_clCreateKernelsInProgram :: Program -> CLuint -> Ptr Kernel -> Ptr CLuint -> IO CLint
clCreateKernelsInProgram :: Program -> CLuint -> IO (Either ErrorCode [Kernel])
@@ -66,7 +67,9 @@ clEnqueueNDRangeKernel queue kernel global_work_sizeL local_work_sizeL event_wai
pokeArray global_work_size global_work_sizeL
pokeArray local_work_size local_work_sizeL
pokeArray event_wait_list event_wait_listL
- err <- wrapError $ raw_clEnqueueNDRangeKernel queue kernel (fromIntegral work_dim) nullPtr global_work_size local_work_size (fromIntegral num_events_in_wait_list) event_wait_list event
+ err <- if num_events_in_wait_list > 0
+ then wrapError $ raw_clEnqueueNDRangeKernel queue kernel (fromIntegral work_dim) nullPtr global_work_size local_work_size (fromIntegral num_events_in_wait_list) event_wait_list event
+ else wrapError $ raw_clEnqueueNDRangeKernel queue kernel (fromIntegral work_dim) nullPtr global_work_size local_work_size (fromIntegral num_events_in_wait_list) nullPtr event
if err == Nothing
then Right <$> peek event
else return $ Left . fromJust $ err
1  System/OpenCL/Raw/V10/ProgramObject.hs
View
@@ -6,6 +6,7 @@ module System.OpenCL.Raw.V10.ProgramObject
,clRetainProgram
,clReleaseProgram
,clBuildProgram
+ ,BuildProgramCallback
,clUnloadCompiler
,clGetProgramInfo
,clGetProgramBuildInfo)
2  System/OpenCL/Raw/V10/Utils.hs
View
@@ -24,7 +24,7 @@ wrapGetInfo :: (CLsizei -> Ptr () -> Ptr CLsizei -> IO CLint) -> CLsizei -> IO (
wrapGetInfo raw_infoFn param_size = alloca $ \value_size_ret -> do
param_data <- (mallocForeignPtrBytes . fromIntegral $ param_size) :: IO (ForeignPtr ())
ret <- wrapError $ withForeignPtr param_data $ \param_dataP -> raw_infoFn param_size param_dataP value_size_ret
- if ret == Just clSuccess
+ if ret == Nothing
then peek value_size_ret >>= \valsz -> return . Right $ (param_data,valsz)
else return . Left $ fromJust ret
Something went wrong with that request. Please try again.