GPU Workshop Sample Code
 All Data Structures Namespaces Files Functions Variables Macros Pages
myfun.cu
Go to the documentation of this file.
1 
4 
5 __global__ void
6 myfun( float * z, const float * x, const float * y, int n, int m ) {
7  int tid = blockIdx.x*blockDim.x+threadIdx.x;
8  int nthreads = blockDim.x*gridDim.x;
9 
10  for (int i=tid; i<n; i+=nthreads) {
11  z[i] = x[i] + y[i];
12  }
13 }
14 
15 
16 
17