cufft 0.1.1.0 → 0.1.2.0
raw patch · 7 files changed
+96/−44 lines, 7 filesdep ~cuda
Dependency ranges changed: cuda
Files
- Foreign/CUDA/FFT.hs +5/−2
- Foreign/CUDA/FFT/Error.chs +18/−13
- Foreign/CUDA/FFT/Internal/C2HS.hs +13/−8
- Foreign/CUDA/FFT/Plan.chs +1/−0
- Foreign/CUDA/FFT/Stream.chs +35/−0
- cbits/wrap.h +2/−0
- cufft.cabal +22/−21
Foreign/CUDA/FFT.hs view
@@ -2,11 +2,14 @@ module Foreign.CUDA.FFT ( module Foreign.CUDA.FFT.Error,- module Foreign.CUDA.FFT.Plan, module Foreign.CUDA.FFT.Execute,+ module Foreign.CUDA.FFT.Plan,+ module Foreign.CUDA.FFT.Stream ) where import Foreign.CUDA.FFT.Error-import Foreign.CUDA.FFT.Plan import Foreign.CUDA.FFT.Execute+import Foreign.CUDA.FFT.Plan+import Foreign.CUDA.FFT.Stream+
Foreign/CUDA/FFT/Error.chs view
@@ -22,22 +22,26 @@ -- Describe each error code -- describe :: Result -> String-describe Success = "success"-describe InvalidPlan = "invalid plan handle"-describe AllocFailed = "resource allocation failed"-describe InvalidType = "no longer used"-describe InvalidValue = "unsupported value or parameter passed to a function"-describe InternalError = "internal error"-describe ExecFailed = "failed to execute an FFT on the GPU"-describe SetupFailed = "the CUFFT library failed to initialize"-describe InvalidSize = "invalid transform size"-describe UnalignedData = "no longer used"+describe Success = "success"+describe InvalidPlan = "invalid plan handle"+describe AllocFailed = "resource allocation failed"+describe InvalidType = "no longer used"+describe InvalidValue = "unsupported value or parameter passed to a function"+describe InternalError = "internal error"+describe ExecFailed = "failed to execute an FFT on the GPU"+describe SetupFailed = "the CUFFT library failed to initialize"+describe InvalidSize = "invalid transform size"+describe UnalignedData = "no longer used" #if CUDA_VERSION >= 6000 describe IncompleteParameterList = "missing parameters in call"-describe InvalidDevice = "execution of a plan was on different GPU than plan creation"-describe ParseError = "internal plan database error"-describe NoWorkspace = "no workspace has been provided prior to plan execution"+describe InvalidDevice = "execution of a plan was on a different GPU than plan creation"+describe ParseError = "internal plan database error"+describe NoWorkspace = "no workspace has been provided prior to plan execution" #endif+#if CUDA_VERSION >= 6050+describe NotImplemented = "not implemented"+describe LicenseError = "cufft license error"+#endif -- Exceptions ------------------------------------------------------------------@@ -78,3 +82,4 @@ case status of Success -> return () _ -> throwIO (ExitCode status)+
Foreign/CUDA/FFT/Internal/C2HS.hs view
@@ -8,6 +8,7 @@ -- System import Foreign+import Foreign.C -- Conversions -----------------------------------------------------------------@@ -15,42 +16,46 @@ -- | Integral conversion ---{-# INLINE cIntConv #-}+{-# INLINE [1] cIntConv #-} cIntConv :: (Integral a, Integral b) => a -> b cIntConv = fromIntegral -- | Floating conversion ---{-# INLINE[1] cFloatConv #-}+{-# INLINE [1] cFloatConv #-} cFloatConv :: (RealFloat a, RealFloat b) => a -> b cFloatConv = realToFrac -- As this conversion by default goes via `Rational', it can be very slow... {-# RULES- "cFloatConv/Float->Float" forall (x::Float). cFloatConv x = x;- "cFloatConv/Double->Double" forall (x::Double). cFloatConv x = x+ "cFloatConv/Float->Float" forall (x::Float). cFloatConv x = x;+ "cFloatConv/Double->Double" forall (x::Double). cFloatConv x = x;+ "cFloatConv/Float->CFloat" forall (x::Float). cFloatConv x = CFloat x;+ "cFloatConv/CFloat->Float" forall (x::Float). cFloatConv CFloat x = x;+ "cFloatConv/Double->CDouble" forall (x::Double). cFloatConv x = CDouble x;+ "cFloatConv/CDouble->Double" forall (x::Double). cFloatConv CDouble x = x #-} -- | Obtain C value from Haskell 'Bool'. ---{-# INLINE cFromBool #-}+{-# INLINE [1] cFromBool #-} cFromBool :: Num a => Bool -> a cFromBool = fromBool -- | Obtain Haskell 'Bool' from C value. ---{-# INLINE cToBool #-}+{-# INLINE [1] cToBool #-} cToBool :: (Eq a, Num a) => a -> Bool cToBool = toBool -- | Convert a C enumeration to Haskell. ---{-# INLINE cToEnum #-}+{-# INLINE [1] cToEnum #-} cToEnum :: (Integral i, Enum e) => i -> e cToEnum = toEnum . cIntConv -- | Convert a Haskell enumeration to C. ---{-# INLINE cFromEnum #-}+{-# INLINE [1] cFromEnum #-} cFromEnum :: (Enum e, Integral i) => e -> i cFromEnum = cIntConv . fromEnum
Foreign/CUDA/FFT/Plan.chs view
@@ -124,3 +124,4 @@ {# fun unsafe cufftDestroy { useHandle `Handle' } -> `Result' cToEnum #}+
+ Foreign/CUDA/FFT/Stream.chs view
@@ -0,0 +1,35 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE ForeignFunctionInterface #-}++module Foreign.CUDA.FFT.Stream (++ -- * Streamed transforms+ setStream,++) where++-- friends+import Foreign.CUDA.Types+import Foreign.CUDA.FFT.Plan+import Foreign.CUDA.FFT.Error+import Foreign.CUDA.FFT.Internal.C2HS++-- system+import Foreign+import Foreign.C++#include <cbits/wrap.h>+{# context lib="cufft" #}++-- | Associates a CUDA stream with a CUFFT plan. All kernel launches made during+-- plan execution are now done through the associated stream, enabling overlap+-- with activity in other streams (e.g. data copying). The association remains+-- until the plan is destroyed or the stream is changed.+--+setStream :: Handle -> Stream -> IO ()+setStream ctx st = nothingIfOk =<< cufftSetStream ctx st++{# fun unsafe cufftSetStream+ { useHandle `Handle'+ , useStream `Stream' } -> `Result' cToEnum #}+
cbits/wrap.h view
@@ -13,9 +13,11 @@ #define __AVAILABILITY__ #define __OSX_AVAILABLE_STARTING(_mac, _iphone) #define __OSX_AVAILABLE_BUT_DEPRECATED(_macIntro, _macDep, _iphoneIntro, _iphoneDep)+#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) #endif #include <cuda.h> #include <cufft.h> #endif+
cufft.cabal view
@@ -1,24 +1,24 @@--- Initial cufft.cabal generated by cabal init. For further documentation,--- see http://haskell.org/cabal/users-guide/+name: cufft+version: 0.1.2.0+synopsis: Haskell bindings for the CUFFT library+description:+ The CUFFT library is part of the CUDA developer toolkit.+ .+ <http://developer.nvidia.com/cuda-downloads>+ .+ It contains a highly optimised, FFTW compatible, Fast-Fourier Transform+ implementation that can execute on NVIDIA GPUs.+ . -name: cufft-version: 0.1.1.0-synopsis: Haskell bindings for the CUFFT library-description: The CUFFT library is part of the CUDA developer toolkit.- .- <http://developer.nvidia.com/cuda-downloads>- .- It contains a highly optimised, FFTW compatible, Fast-Fourier Transform- implementation that can execute on NVIDIA GPUs.-homepage: http://github.com/robeverest/cufft-license: BSD3-license-file: LICENSE-author: Robert Clifton-Everest <robertce@cse.unsw.edu.au>-maintainer: Robert Clifton-Everest <robertce@cse.unsw.edu.au>+homepage: http://github.com/robeverest/cufft+license: BSD3+license-file: LICENSE+author: Robert Clifton-Everest <robertce@cse.unsw.edu.au>+maintainer: Robert Clifton-Everest <robertce@cse.unsw.edu.au> -category: Foreign-build-type: Custom-cabal-version: >=1.8+category: Foreign+build-type: Custom+cabal-version: >=1.8 Extra-tmp-files: cufft.buildinfo config.status config.log Extra-source-files: configure@@ -33,12 +33,13 @@ exposed-modules: Foreign.CUDA.FFT other-modules: Foreign.CUDA.FFT.Error- Foreign.CUDA.FFT.Plan Foreign.CUDA.FFT.Execute+ Foreign.CUDA.FFT.Plan+ Foreign.CUDA.FFT.Stream Foreign.CUDA.FFT.Internal.C2HS build-depends: base == 4.*,- cuda >= 0.4.1+ cuda >= 0.6.6 build-tools: c2hs >= 0.16 ghc-options: -Wall -O2 -funbox-strict-fields -fwarn-tabs