common errors while programming CUDA

  1. Unknown Error (often doesn't show up unless you call cutilSafeCall)

    • Writing out of bounds: Check that each of your arrays has been initialized to appropriate sizes. ESPECIALLY SHARED MEMORY.
  2. Driver crash (Windows 7) or Frozen screen (XP and before)

    • Infinite loop in the code: Make sure all code is guaranteed to terminate.
    • Trying to read from unallocated memory: Make sure every location you access has been allocated appropriately.
    • Too many printfs
    • Deadlocks due to locks / atomics
  3. Registers don't retain values, read NaN

    • Conflicting CUDA drivers: Reinstall GPU drivers and use appropriate CUDA SDK. 
      Known problem with recent (Oct 2011) CUDA drivers. Rolling back to 260 driver helped Stanley Tzeng.
  4. Kernel Launch Failure

    • Incorrect grid / block size
    • Uninitialized dynamic shared memory or incorrect size (thanks Kerry!)
  5. Insufficient Resources Requested

    • Too much shared memory
  6. Constant memory reads incorrect values / zeroes

    • Do not use &var in cudaMemcpyToSymbol; just use var.
  7. Weird CPU-GPU (PCIE) memory transfer rates (decreasing with data size, too low, etc)

    • Try defaulting to stream ID other than 0, and see if that works (verified by Pinar on a GeForce GT 555M Alienware M14x. Thanks!)
  8. nvcc fatal : A single input file is required for a non-link phase when an output file is specified (when compiling using Visual Studio)

    • Remove quotations from the nvcc include directories list
    • Taken from here.

猜你喜欢

转载自blog.csdn.net/chao56789/article/details/77484153