Copyright | [2009..2017] Trevor L. McDonell |
---|---|
License | BSD |
Safe Haskell | Safe |
Language | Haskell98 |
Data types that are equivalent and can be shared freely between the CUDA Runtime and Driver APIs.
- newtype DevicePtr a = DevicePtr {
- useDevicePtr :: Ptr a
- newtype HostPtr a = HostPtr {
- useHostPtr :: Ptr a
- newtype Event = Event {}
- data EventFlag
- data WaitFlag
- newtype Stream = Stream {}
- data StreamFlag
- type StreamPriority = Int
- defaultStream :: Stream
Pointers
A reference to data stored on the device.
DevicePtr | |
|
A reference to page-locked host memory.
A HostPtr
is just a plain Ptr
, but the memory has been allocated by CUDA
into page locked memory. This means that the data can be copied to the GPU
via DMA (direct memory access). Note that the use of the system function
mlock
is not sufficient here --- the CUDA version ensures that the
physical address stays this same, not just the virtual address.
To copy data into a HostPtr
array, you may use for example withHostPtr
together with copyArray
or
moveArray
.
HostPtr | |
|
Events
Events are markers that can be inserted into the CUDA execution stream and later queried.
Event creation flags
Streams
A processing stream. All operations in a stream are synchronous and executed in sequence, but operations in different non-default streams may happen out-of-order or concurrently with one another.
Use Event
s to synchronise operations between streams.
data StreamFlag Source #
Execution stream creation flags
type StreamPriority = Int Source #
Priority of an execution stream. Work submitted to a higher priority stream may preempt execution of work already executing in a lower priority stream. Lower numbers represent higher priorities.
defaultStream :: Stream Source #
The main execution stream. No operations overlap with operations in the default stream.