{-# LINE 1 "src/Foreign/CUDA/Runtime/Utils.chs" #-}
{-# LANGUAGE ForeignFunctionInterface #-}
module Foreign.CUDA.Runtime.Utils (
runtimeVersion,
driverVersion,
) where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp
{-# LINE 20 "src/Foreign/CUDA/Runtime/Utils.chs" #-}
import Foreign.CUDA.Runtime.Error
import Foreign.CUDA.Internal.C2HS
import Foreign
import Foreign.C
{-# INLINEABLE runtimeVersion #-}
runtimeVersion :: IO Int
runtimeVersion = resultIfOk =<< cudaRuntimeGetVersion
{-# INLINE cudaRuntimeGetVersion #-}
cudaRuntimeGetVersion :: IO ((Status), (Int))
cudaRuntimeGetVersion =
alloca $ \a1' ->
cudaRuntimeGetVersion'_ a1' >>= \res ->
let {res' = cToEnum res} in
peekIntConv a1'>>= \a1'' ->
return (res', a1'')
{-# LINE 40 "src/Foreign/CUDA/Runtime/Utils.chs" #-}
{-# INLINEABLE driverVersion #-}
driverVersion :: IO Int
driverVersion = resultIfOk =<< cudaDriverGetVersion
{-# INLINE cudaDriverGetVersion #-}
cudaDriverGetVersion :: IO ((Status), (Int))
cudaDriverGetVersion =
alloca $ \a1' ->
cudaDriverGetVersion'_ a1' >>= \res ->
let {res' = cToEnum res} in
peekIntConv a1'>>= \a1'' ->
return (res', a1'')
{-# LINE 52 "src/Foreign/CUDA/Runtime/Utils.chs" #-}
foreign import ccall unsafe "Foreign/CUDA/Runtime/Utils.chs.h cudaRuntimeGetVersion"
cudaRuntimeGetVersion'_ :: ((C2HSImp.Ptr C2HSImp.CInt) -> (IO C2HSImp.CInt))
foreign import ccall unsafe "Foreign/CUDA/Runtime/Utils.chs.h cudaDriverGetVersion"
cudaDriverGetVersion'_ :: ((C2HSImp.Ptr C2HSImp.CInt) -> (IO C2HSImp.CInt))