 {# pointer *CUdevprop as ^ foreign -> CUDevProp nocode #}
 
 
---
--- Properties of the compute device (internal helper)
+#if CUDA_VERSION < 5000
+--
+-- Properties of the compute device (internal helper).
+-- Replaced by cuDeviceGetAttribute in CUDA-5.0 and later.
 --
 data CUDevProp = CUDevProp
   {

      deviceName                        = n,
      computeCapability                 = cc,
      totalGlobalMem                    = gm,
      totalConstMem                     = cuTotalConstMem p,
      sharedMemPerBlock                 = cuSharedMemPerBlock p,
      regsPerBlock                      = cuRegsPerBlock p,
      warpSize                          = cuWarpSize p,
      maxThreadsPerBlock                = cuMaxThreadsPerBlock p,
      maxBlockSize                      = cuMaxBlockSize p,
      maxGridSize                       = cuMaxGridSize p,
      clockRate                         = cuClockRate p,
      multiProcessorCount               = pc,
      memPitch                          = cuMemPitch p,
      textureAlignment                  = cuTextureAlignment p,
      computeMode                       = md,
      deviceOverlap                     = ov,
#if CUDA_VERSION >= 3000

-- |
-- Return the properties of the selected device
--
{-# INLINEABLE props #-}
props :: Device -> IO DeviceProperties
props !d = do

#if CUDA_VERSION < 5000
  -- Old versions of the CUDA API used the separate cuDeviceGetProperties
  -- function to probe some properties, and cuDeviceGetAttribute for
  -- others. As of CUDA-5.0, the former was deprecated and its
  -- functionality subsumed by the latter, which we use below.
  --
  p   <- resultIfOk =<< cuDeviceGetProperties d
  let cm = cuTotalConstMem p
      sm = cuSharedMemPerBlock p
      rb = cuRegsPerBlock p
      ws = cuWarpSize p
      tb = cuMaxThreadsPerBlock p
      bs = cuMaxBlockSize p
      gs = cuMaxGridSize p
      cl = cuClockRate p
      mp = cuMemPitch p
      ta = cuTextureAlignment p
#else
  cm  <- fromIntegral <$> attribute d TotalConstantMemory
  sm  <- fromIntegral <$> attribute d SharedMemoryPerBlock
  mp  <- fromIntegral <$> attribute d MaxPitch
  ta  <- fromIntegral <$> attribute d TextureAlignment
  cl  <- attribute d ClockRate
  ws  <- attribute d WarpSize
  rb  <- attribute d RegistersPerBlock
  tb  <- attribute d MaxThreadsPerBlock
  bs  <- (,,) <$> attribute d MaxBlockDimX
              <*> attribute d MaxBlockDimY
              <*> attribute d MaxBlockDimZ
  gs  <- (,,) <$> attribute d MaxGridDimX
              <*> attribute d MaxGridDimY
              <*> attribute d MaxGridDimZ
#endif

  -- The rest of the properties.
  --
  n   <- name d
  cc  <- capability d
