cuda- FFI binding to the CUDA interface for programming NVIDIA GPUs

Copyright[2009..2018] Trevor L. McDonell
Safe HaskellNone




Context management for the low-level driver interface


Context Management

newtype Context Source #

A device context




Eq Context Source # 
Instance details

Defined in Foreign.CUDA.Driver.Context.Base


(==) :: Context -> Context -> Bool #

(/=) :: Context -> Context -> Bool #

Show Context Source # 
Instance details

Defined in Foreign.CUDA.Driver.Context.Base

create :: Device -> [ContextFlag] -> IO Context Source #

Create a new CUDA context and associate it with the calling thread. The context is created with a usage count of one, and the caller of create must call destroy when done using the context. If a context is already current to the thread, it is supplanted by the newly created context and must be restored by a subsequent call to pop.

destroy :: Context -> IO () Source #

Destroy the specified context, regardless of how many threads it is current to. The context will be poped from the current thread's context stack, but if it is current on any other threads it will remain current to those threads, and attempts to access it will result in an error.

pop :: IO Context Source #

Pop the current CUDA context from the CPU thread. The context may then be attached to a different CPU thread by calling push.

push :: Context -> IO () Source #

Push the given context onto the CPU's thread stack of current contexts. The specified context becomes the CPU thread's current context, so all operations that operate on the current context are affected.

sync :: IO () Source #

Block until the device has completed all preceding requests. If the context was created with the SchedBlockingSync flag, the CPU thread will block until the GPU has finished its work.

attach :: Context -> [ContextFlag] -> IO () Source #

Deprecated: as of CUDA-4.0

Increments the usage count of the context. API: no context flags are currently supported, so this parameter must be empty.

detach :: Context -> IO () Source #

Deprecated: as of CUDA-4.0

Detach the context, and destroy if no longer used