{-# LINE 1 "./Foreign/CUDA/BLAS/Context.chs" #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE TemplateHaskell #-}
module Foreign.CUDA.BLAS.Context (
Handle(..),
create, destroy,
PointerMode(..), AtomicsMode(..), MathMode(..),
setPointerMode,
getPointerMode,
setAtomicsMode,
getAtomicsMode,
setMathMode,
getMathMode,
) where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import Foreign.CUDA.BLAS.Error
import Foreign.CUDA.BLAS.Internal.C2HS
import Foreign.CUDA.BLAS.Internal.Types
import Foreign
import Foreign.C
import Control.Monad ( liftM )
{-# LINE 42 "./Foreign/CUDA/BLAS/Context.chs" #-}
{-# INLINEABLE create #-}
create :: IO ((Handle))
create =
alloca $ \a1' ->
create'_ a1' >>= \res ->
checkStatus res >>
peekHdl a1'>>= \a1'' ->
return (a1'')
{-# LINE 54 "./Foreign/CUDA/BLAS/Context.chs" #-}
where
peekHdl = liftM Handle . peek
{-# INLINEABLE destroy #-}
destroy :: (Handle) -> IO ((()))
destroy a1 =
let {a1' = useHandle a1} in
destroy'_ a1' >>= \res ->
checkStatus res >>= \res' ->
return (res')
{-# LINE 68 "./Foreign/CUDA/BLAS/Context.chs" #-}
{-# INLINEABLE setPointerMode #-}
setPointerMode :: (Handle) -> (PointerMode) -> IO ((()))
setPointerMode a1 a2 =
let {a1' = useHandle a1} in
let {a2' = cFromEnum a2} in
setPointerMode'_ a1' a2' >>= \res ->
checkStatus res >>= \res' ->
return (res')
{-# LINE 85 "./Foreign/CUDA/BLAS/Context.chs" #-}
{-# INLINEABLE getPointerMode #-}
getPointerMode :: (Handle) -> IO ((PointerMode))
getPointerMode a1 =
let {a1' = useHandle a1} in
alloca $ \a2' ->
getPointerMode'_ a1' a2' >>= \res ->
checkStatus res >>
peekEnum a2'>>= \a2'' ->
return (a2'')
{-# LINE 97 "./Foreign/CUDA/BLAS/Context.chs" #-}
{-# INLINEABLE setAtomicsMode #-}
setAtomicsMode :: (Handle) -> (AtomicsMode) -> IO ((()))
setAtomicsMode a1 a2 =
let {a1' = useHandle a1} in
let {a2' = cFromEnum a2} in
setAtomicsMode'_ a1' a2' >>= \res ->
checkStatus res >>= \res' ->
return (res')
{-# LINE 111 "./Foreign/CUDA/BLAS/Context.chs" #-}
{-# INLINEABLE getAtomicsMode #-}
getAtomicsMode :: (Handle) -> IO ((AtomicsMode))
getAtomicsMode a1 =
let {a1' = useHandle a1} in
alloca $ \a2' ->
getAtomicsMode'_ a1' a2' >>= \res ->
checkStatus res >>
peekEnum a2'>>= \a2'' ->
return (a2'')
{-# LINE 124 "./Foreign/CUDA/BLAS/Context.chs" #-}
{-# INLINEABLE setMathMode #-}
setMathMode :: (Handle) -> (MathMode) -> IO ()
setMathMode a1 a2 =
let {a1' = useHandle a1} in
let {a2' = cFromEnum a2} in
setMathMode'_ a1' a2' >>= \res ->
checkStatus res >>
return ()
{-# LINE 144 "./Foreign/CUDA/BLAS/Context.chs" #-}
{-# INLINEABLE getMathMode #-}
getMathMode :: (Handle) -> IO ((MathMode))
getMathMode a1 =
let {a1' = useHandle a1} in
alloca $ \a2' ->
getMathMode'_ a1' a2' >>= \res ->
checkStatus res >>
peekEnum a2'>>= \a2'' ->
return (a2'')
{-# LINE 164 "./Foreign/CUDA/BLAS/Context.chs" #-}
foreign import ccall unsafe "Foreign/CUDA/BLAS/Context.chs.h cublasCreate_v2"
create'_ :: ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt))
foreign import ccall unsafe "Foreign/CUDA/BLAS/Context.chs.h cublasDestroy_v2"
destroy'_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall unsafe "Foreign/CUDA/BLAS/Context.chs.h cublasSetPointerMode_v2"
setPointerMode'_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))
foreign import ccall unsafe "Foreign/CUDA/BLAS/Context.chs.h cublasGetPointerMode_v2"
getPointerMode'_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr C2HSImp.CInt) -> (IO C2HSImp.CInt)))
foreign import ccall unsafe "Foreign/CUDA/BLAS/Context.chs.h cublasSetAtomicsMode"
setAtomicsMode'_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))
foreign import ccall unsafe "Foreign/CUDA/BLAS/Context.chs.h cublasGetAtomicsMode"
getAtomicsMode'_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr C2HSImp.CInt) -> (IO C2HSImp.CInt)))
foreign import ccall unsafe "Foreign/CUDA/BLAS/Context.chs.h cublasSetMathMode"
setMathMode'_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))
foreign import ccall unsafe "Foreign/CUDA/BLAS/Context.chs.h cublasGetMathMode"
getMathMode'_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr C2HSImp.CInt) -> (IO C2HSImp.CInt)))