| Copyright | [2009..2014] Trevor L. McDonell |
|---|---|
| License | BSD |
| Safe Haskell | None |
| Language | Haskell98 |
Foreign.CUDA.Driver.Context
Description
Context management for low-level driver interface
- newtype Context = Context {
- useContext :: Ptr ()
- data ContextFlag
- create :: Device -> [ContextFlag] -> IO Context
- attach :: Context -> [ContextFlag] -> IO ()
- detach :: Context -> IO ()
- destroy :: Context -> IO ()
- device :: IO Device
- pop :: IO Context
- push :: Context -> IO ()
- sync :: IO ()
- get :: IO Context
- set :: Context -> IO ()
- data PeerFlag
- accessible :: Device -> Device -> IO Bool
- add :: Context -> [PeerFlag] -> IO ()
- remove :: Context -> IO ()
- data Cache
- data Limit
- getLimit :: Limit -> IO Int
- setLimit :: Limit -> Int -> IO ()
- setCacheConfig :: Cache -> IO ()
Context Management
A device context
Constructors
| Context | |
Fields
| |
data ContextFlag Source
Context creation flags
Constructors
| SchedAuto | |
| SchedSpin | |
| SchedYield | |
| SchedBlockingSync | |
| BlockingSync | Deprecated: use SchedBlockingSync instead |
| SchedMask | |
| MapHost | |
| LmemResizeToMax | |
| FlagsMask |
Instances
create :: Device -> [ContextFlag] -> IO Context Source
Create a new CUDA context and associate it with the calling thread
attach :: Context -> [ContextFlag] -> IO () Source
Deprecated: 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: deprecated as of CUDA-4.0
Detach the context, and destroy if no longer used
destroy :: Context -> IO () Source
Destroy the specified context. This fails if the context is more than a single attachment (including that from initial creation).
push :: Context -> IO () Source
Push the given context onto the CPU's thread stack of current contexts. The
context must be floating (via pop), i.e. not attached to any thread.
Peer Access
Possible option values for direct peer memory access
accessible :: Device -> Device -> IO Bool Source
Queries if the first device can directly access the memory of the second. If
direct access is possible, it can then be enabled with add. Requires
cuda-4.0.
add :: Context -> [PeerFlag] -> IO () Source
If the devices of both the current and supplied contexts support unified addressing, then enable allocations in the supplied context to be accessible by the current context. Requires cuda-4.0.
remove :: Context -> IO () Source
Disable direct memory access from the current context to the supplied context. Requires cuda-4.0.
Cache Configuration
Device cache configuration preference
Constructors
| PreferNone | |
| PreferShared | |
| PreferL1 | |
| PreferEqual |
Device limits flags
setLimit :: Limit -> Int -> IO () Source
Specify the size of the call stack, for compute 2.0 devices. Requires cuda-3.1.
setCacheConfig :: Cache -> IO () Source
On devices where the L1 cache and shared memory use the same hardware resources, this sets the preferred cache configuration for the current context. This is only a preference. Requires cuda-3.2.