/
OutOfOrder.hs
29 lines (23 loc) · 1.12 KB
/
OutOfOrder.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{-# LANGUAGE ForeignFunctionInterface #-}
{-| Conforms to section 5.8 of the OpenCL 1.0 specification -}
module System.OpenCL.Raw.V10.OutOfOrder
(clEnqueueMarker
,clEnqueueWaitForEvents
,clEnqueueBarrier)
where
import System.OpenCL.Raw.V10.Types
import System.OpenCL.Raw.V10.Utils
import Foreign
foreign import ccall "clEnqueueMarker" raw_clEnqueueMarker :: CommandQueue -> Ptr Event -> IO CLint
clEnqueueMarker :: CommandQueue -> IO Event
clEnqueueMarker queue = fetchPtr $ raw_clEnqueueMarker queue
foreign import ccall "clEnqueueWaitForEvents" raw_clEnqueueWaitForEvents :: CommandQueue -> CLuint -> Ptr Event -> IO CLint
clEnqueueWaitForEvents :: CommandQueue -> [Event] -> IO ()
clEnqueueWaitForEvents queue events =
allocaArray num_events $ \eventsP -> do
pokeArray eventsP events
wrapError $ raw_clEnqueueWaitForEvents queue (fromIntegral num_events) eventsP
where num_events = length events
foreign import ccall "clEnqueueBarrier" raw_clEnqueueBarrier :: CommandQueue -> IO CLint
clEnqueueBarrier :: CommandQueue -> IO ()
clEnqueueBarrier queue = wrapError $ raw_clEnqueueBarrier queue