when and where blockIdx.x, blockDim.x and threadIdx.x are defined and assigned?

171 views
Skip to first unread message

seven...@gmail.com

unread,
Nov 21, 2017, 1:45:06 AM11/21/17
to Caffe Users
there's a piece of code in caffe/util/device_alternate.hpp:


// CUDA: grid stride looping
#define CUDA_KERNEL_LOOP(i, n) \
 
for (int i = blockIdx.x * blockDim.x + threadIdx.x; \
       i
< (n); \
       i
+= blockDim.x * gridDim.x)

I do not know when and where blockIdx.x, blockDim.x and threadIdx.x are defined and assigned. 
Anyone can give some advises? thank you very much~

Przemek D

unread,
Nov 21, 2017, 4:23:09 AM11/21/17
to Caffe Users
This is specific to CUDA, you should check out some basics tutorial on it, like this one.
Reply all
Reply to author
Forward
0 new messages