Copyright | (c) [2009..2012] Trevor L. McDonell |
---|---|
License | BSD |
Safe Haskell | None |
Language | Haskell98 |
Module management for low-level driver interface
- data Module
- data JITOption
- = MaxRegisters !Int
- | ThreadsPerBlock !Int
- | OptimisationLevel !Int
- | Target !Compute
- | FallbackStrategy !JITFallback
- | GenerateDebugInfo
- | GenerateLineInfo
- | Verbose
- data JITTarget
- data JITResult = JITResult {
- jitTime :: !Float
- jitInfoLog :: !ByteString
- jitModule :: !Module
- getFun :: Module -> String -> IO Fun
- getPtr :: Module -> String -> IO (DevicePtr a, Int)
- getTex :: Module -> String -> IO Texture
- loadFile :: FilePath -> IO Module
- loadData :: ByteString -> IO Module
- loadDataFromPtr :: Ptr Word8 -> IO Module
- loadDataEx :: ByteString -> [JITOption] -> IO JITResult
- loadDataFromPtrEx :: Ptr Word8 -> [JITOption] -> IO JITResult
- unload :: Module -> IO ()
Module Management
A reference to a Module object, containing collections of device functions
Just-in-time compilation options
MaxRegisters !Int | maximum number of registers per thread |
ThreadsPerBlock !Int | number of threads per block to target for |
OptimisationLevel !Int | level of optimisation to apply (1-4, default 4) |
Target !Compute | compilation target, otherwise determined from context |
FallbackStrategy !JITFallback | fallback strategy if matching cubin not found |
GenerateDebugInfo | generate debug info (-g) (requires cuda >= 5.5) |
GenerateLineInfo | generate line number information (-lineinfo) (requires cuda >= 5.5) |
Verbose | verbose log messages (requires cuda >= 5.5) |
Results of online compilation
JITResult | |
|
Querying module inhabitants
getPtr :: Module -> String -> IO (DevicePtr a, Int) Source
Return a global pointer, and size of the global (in bytes)
Loading and unloading modules
loadFile :: FilePath -> IO Module Source
Load the contents of the specified file (either a ptx or cubin file) to create a new module, and load that module into the current context.
loadData :: ByteString -> IO Module Source
Load the contents of the given image into a new module, and load that module into the current context. The image is (typically) the contents of a cubin or PTX file.
Note that the ByteString
will be copied into a temporary staging area so
that it can be passed to C.
loadDataFromPtr :: Ptr Word8 -> IO Module Source
As loadData
, but read the image data from the given pointer. The image is a
NULL-terminated sequence of bytes.
loadDataEx :: ByteString -> [JITOption] -> IO JITResult Source
Load the contents of the given image into a module with online compiler
options, and load the module into the current context. The image is
(typically) the contents of a cubin or PTX file. The actual attributes of the
compiled kernel can be probed using requires
.
Note that the ByteString
will be copied into a temporary staging area so
that it can be passed to C.
loadDataFromPtrEx :: Ptr Word8 -> [JITOption] -> IO JITResult Source
As loadDataEx
, but read the image data from the given pointer. The image is
a NULL-terminated sequence of bytes.