-
-
Save bast/29627e8c50c8d4b6dfe9 to your computer and use it in GitHub Desktop.
Basic CUDA kernel construct.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2015 Radovan Bast | |
// Licensed under the MIT license - http://opensource.org/licenses/MIT | |
__global__ void foo_kernel(int n, | |
double *a, | |
double *b, | |
double *c) | |
{ | |
int tid = threadIdx.x + blockIdx.x*blockDim.x; | |
while (tid < n) { | |
c[tid] = a[tid]*b[tid]; | |
tid += blockDim.x*gridDim.x; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment