     --
     -- Memory management
     --
-    malloc,
+    malloc, mallocPitch,
+    memcpy, memcpyAsync,
+    memset,
+
 
     --
     -- Stream management
     --
-    streamCreate, streamDestroy, streamQuery, streamSynchronize
+    streamCreate,
+    streamDestroy,
+    streamQuery,
+    streamSynchronize
   ) where
 
 import Foreign.CUDA.Types

getDeviceProperties n =  resultIfOk `fmap` cudaGetDeviceProperties n

{# fun unsafe cudaGetDeviceProperties
    { alloca- `DeviceProperties' peek*,
              `Int'                   } -> `Result' cToEnum #}

--
-- Set device to be used for GPU execution

        _       -> return.Left $ getErrorString rv

{# fun unsafe cudaMalloc
    { alloca-  `Ptr ()'  peek* ,
      cIntConv `Integer'       } -> `Result' cToEnum #}

--
-- Allocate pitched memory on the device
--
mallocPitch              :: Integer -> Integer -> IO (Either String (DevicePtr,Integer))
mallocPitch width height =  do
    (rv,ptr,pitch) <- cudaMallocPitch width height
    case rv of
        Success -> doAutoRelease cudaFree_ >>= \fp ->
                   newDevicePtr fp ptr >>= \dp -> return.Right $ (dp,pitch)
        _       -> return.Left $ getErrorString rv

{# fun unsafe cudaMallocPitch
    { alloca-  `Ptr ()' peek*         ,
      alloca-  `Integer' peekIntConv* ,
      cIntConv `Integer'              ,
      cIntConv `Integer'              } -> `Result' cToEnum #}

--
-- Free previously allocated memory on the device
