view paper/src/twice_cuda.cu @ 28:85d3468efecc default tip

fix
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Thu, 25 Feb 2016 16:40:05 +0900
parents 958634b9fa32
children
line wrap: on
line source

__global__ void
twice(int* input, int* output)
{
    /**
     * Get index(x, y, z)
     *   kernel built-in variables
     *   x : blockIdx.x * blockDim.x + threadIdx.x
     *   y : blockIdx.y * blockDim.y + threadIdx.y
     *   z : blockIdx.z * blockDim.z + threadIdx.z
     */
    long i = blockIdx.x * blockDim.x + threadIdx.x;

    output[i] = input[i]*2;
    
    return 0;
}