CUDA reduction - basics

后端 未结 2 1425
北恋
北恋 2021-01-03 14:41

I\'m trying to sum an array with this code and I am stuck. I probably need some \"CUDA for dummies tutorial\", because I spent so much time with such basic operation and I c

相关标签:
2条回答
  • 2021-01-03 15:18

    Okay, I think you need to start fresh. Take a look into this step-by-step process guide from NVIDiA on reduction

    0 讨论(0)
  • 2021-01-03 15:26

    Calling the kernel like this fixes the problem.

    dim3 dimBlock(128);
    dim3 dimGrid(N/dimBlock.x);
    int smemSize = dimBlock.x * sizeof(int);
    sum_reduction<<<dimGrid, dimBlock, smemSize>>>(in, out, N);    
    
    0 讨论(0)
提交回复
热议问题