OpenCL- Haskell high-level wrapper for OpenCL

Safe HaskellSafe-Infered





data CLContextProperty Source

Specifies a context property name and its corresponding value.



Specifies the platform to use.


Specifies the CGL share group to use.

CL_WGL_HDC_KHR (Ptr ()) 

Context Functions

clCreateContext :: [CLContextProperty] -> [CLDeviceID] -> (String -> IO ()) -> IO CLContextSource

Creates an OpenCL context. An OpenCL context is created with one or more devices. Contexts are used by the OpenCL runtime for managing objects such as command-queues, memory, program and kernel objects and for executing kernels on one or more devices specified in the context.

clCreateContextFromType :: [CLContextProperty] -> [CLDeviceType] -> (String -> IO ()) -> IO CLContextSource

Create an OpenCL context from a device type that identifies the specific device(s) to use.

clRetainContext :: CLContext -> IO BoolSource

Increment the context reference count. clCreateContext and clCreateContextFromType perform an implicit retain. This is very helpful for 3rd party libraries, which typically get a context passed to them by the application. However, it is possible that the application may delete the context without informing the library. Allowing functions to attach to (i.e. retain) and release a context solves the problem of a context being used by a library no longer being valid. Returns True if the function is executed successfully, or False if context is not a valid OpenCL context.

clReleaseContext :: CLContext -> IO BoolSource

Decrement the context reference count. After the context reference count becomes zero and all the objects attached to context (such as memory objects, command-queues) are released, the context is deleted. Returns True if the function is executed successfully, or False if context is not a valid OpenCL context.

clGetContextReferenceCount :: CLContext -> IO CLuintSource

Return the context reference count. The reference count returned should be considered immediately stale. It is unsuitable for general use in applications. This feature is provided for identifying memory leaks.

This function execute OpenCL clGetContextInfo with CL_CONTEXT_REFERENCE_COUNT.

clGetContextDevices :: CLContext -> IO [CLDeviceID]Source

Return the list of devices in context.

This function execute OpenCL clGetContextInfo with CL_CONTEXT_DEVICES.