cufft 0.1.0.0 → 0.1.0.1
raw patch · 4 files changed
+63/−3 lines, 4 files
Files
- Foreign/CUDA/FFT/Internal/C2HS.hs +57/−0
- Foreign/CUDA/FFT/Plan.chs +1/−1
- configure.ac +1/−0
- cufft.cabal +4/−2
+ Foreign/CUDA/FFT/Internal/C2HS.hs view
@@ -0,0 +1,57 @@++module Foreign.CUDA.FFT.Internal.C2HS (++ -- * Conversion between C and Haskell types+ cIntConv, cFloatConv, cToBool, cFromBool, cToEnum, cFromEnum++) where++-- System+import Foreign+++-- Conversions -----------------------------------------------------------------+--++-- | Integral conversion+--+{-# INLINE cIntConv #-}+cIntConv :: (Integral a, Integral b) => a -> b+cIntConv = fromIntegral++-- | Floating conversion+--+{-# INLINE 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+ #-}++-- | Obtain C value from Haskell 'Bool'.+--+{-# INLINE cFromBool #-}+cFromBool :: Num a => Bool -> a+cFromBool = fromBool++-- | Obtain Haskell 'Bool' from C value.+--+{-# INLINE cToBool #-}+cToBool :: (Eq a, Num a) => a -> Bool+cToBool = toBool++-- | Convert a C enumeration to Haskell.+--+{-# INLINE cToEnum #-}+cToEnum :: (Integral i, Enum e) => i -> e+cToEnum = toEnum . cIntConv++-- | Convert a Haskell enumeration to C.+--+{-# INLINE cFromEnum #-}+cFromEnum :: (Enum e, Integral i) => e -> i+cFromEnum = cIntConv . fromEnum++
Foreign/CUDA/FFT/Plan.chs view
@@ -64,7 +64,7 @@ where peekHdl = liftM Handle . peek - -- | Creates a 3D FFT plan configuration for a specified signal size and data type.+-- | Creates a 3D FFT plan configuration for a specified signal size and data type. -- plan3D :: Int -> Int -> Int -> Type -> IO Handle plan3D nx ny nz t = resultIfOk =<< cufftPlan3d nx ny nz t
configure.ac view
@@ -113,3 +113,4 @@ AC_SUBST([cuda_ldflags]) AC_SUBST([cuda_c2hsflags]) AC_OUTPUT+
cufft.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: cufft-version: 0.1.0.0+version: 0.1.0.1 synopsis: Haskell bindings for the CUFFT library description: The CUFFT library is part of the CUDA developer toolkit. .@@ -13,7 +13,7 @@ homepage: http://github.com/robeverest/cufft license: BSD3 license-file: LICENSE-author: Robert Clifton-Everest+author: Robert Clifton-Everest <robertce@cse.unsw.edu.au> maintainer: Robert Clifton-Everest <robertce@cse.unsw.edu.au> category: Foreign@@ -34,6 +34,7 @@ other-modules: Foreign.CUDA.FFT.Error Foreign.CUDA.FFT.Plan Foreign.CUDA.FFT.Execute+ Foreign.CUDA.FFT.Internal.C2HS build-depends: base == 4.*, cuda >= 0.4.1@@ -44,3 +45,4 @@ Source-repository head Type: git Location: git://github.com/robeverest/cufft.git+