hopencl-0.2.0: Haskell bindings for OpenCL

Portabilitynon-portable (GHC extensions)
MaintainerMartin Dybdal <dybber@dybber.dk>



OpenCL kernel creation, invocation and scheduling.





:: Program

The program that contains the kernel code

-> String

The name of the kernel (as written in the program source)

-> IO Kernel

The newly created kernel

Create a program from a string containing the source code

kernelContext :: Kernel -> IO Context

The Context associated with a Kernel

kernelFunctionName :: Kernel -> IO String

The function name (in the OpenCL C source code) of a Kernel

kernelNumArgs :: Kernel -> IO Int

The number of arguments that needs to be set before invoking a Kernel

kernelWorkGroupSize :: Kernel -> DeviceID -> IO CSize

The maximum work-group size that can be used to execute a kernel on a specific device given by device. The OpenCL implementation uses the resource requirements of the kernel (register usage etc.) to determine what this work group size should be.

kernelCompileWorkGroupSize :: Kernel -> DeviceID -> IO CSize

Returns the work-group size specified by the __attribute__((reqd_work_group_size(X, Y, Z))) qualifier. Refer to section 6.8.2 of the OpenCL 1.1 specification If undefined, this function returns (0,0,0)

kernelLocalMemSize :: Kernel -> DeviceID -> IO Word64

Returns the amount of local memory in bytes being used by a kernel. This includes local memory that may be needed by an implementation to execute the kernel, variables declared inside the kernel with the __local address qualifier and local memory to be allocated for arguments to the kernel declared as pointers with the __local address qualifier and whose size is specified with setKernelArg.

If the local memory size, for any pointer argument to the kernel declared with the __local address qualifier, is not specified, its size is assumed to be 0.

kernelPreferredWorkGroupSizeMultiple :: Kernel -> DeviceID -> IO CSize

Returns the preferred multiple of work-group size for launch. This is a performance hint. Specifying a work-group size that is not a multiple of the value returned by this query as the value of the local work size argument to enqueueNDRangeKernel will not fail to enqueue the kernel for execution unless the work-group size specified is larger than the device maximum.

kernelPrivateMemSize :: Kernel -> DeviceID -> IO Word64

Returns the minimum amount of private memory, in bytes, used by each work-item in the kernel. This value may include any private memory needed by an implementation to execute the kernel, including that used by the language built-ins and variable declared inside the kernel with the __private qualifier.



:: CommandQueue 
-> Kernel 
-> [ClSize]

Global work offsets

-> [ClSize]

Global work sizes

-> [ClSize]

Local work sizes

-> [Event] 
-> IO Event 

Enqueues a command to execute a given kernel on a device. See section 5.8 in the OpenCL 1.1 specification

enqueueTask :: CommandQueue -> Kernel -> [Event] -> IO Event

Enqueue a command to execute a kernel using a single work-item.

data KernelArg where


MObjArg :: MemObject a -> KernelArg 
LocalArrayArg :: Storable a => a -> Int -> KernelArg 
VArg :: Storable a => a -> KernelArg 
StructArg :: Storable a => [a] -> KernelArg 

setKernelArg :: Kernel -> Int -> KernelArg -> IO ()

Invoking setKernelArg krn n arg sets argument n of the kernel krn

setKernelArgs :: Kernel -> [KernelArg] -> IO ()

Sets all arguments of a kernel to the parameters in the list