Mercurial > hg > Members > Moririn
comparison src/parallel_execution/examples/twice/CUDAtwice.cu @ 438:7679093bdd72
Work CUDAtwice
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 06 Nov 2017 00:11:43 +0900 |
parents | 764c92c3b181 |
children |
comparison
equal
deleted
inserted
replaced
437:2c1b1d56bf1e | 438:7679093bdd72 |
---|---|
1 extern "C" { | 1 extern "C" { |
2 __global__ void twice(int* array, int* prefixPtr) { | 2 struct Array { |
3 int prefix; | |
4 int* array; | |
5 } Array; | |
6 | |
7 __global__ void twice(int* array, struct Array* inputArray) { | |
3 int i = 0; | 8 int i = 0; |
4 int prefix = *prefixPtr; | 9 int prefix = inputArray->prefix; |
5 C_twice: | 10 C_twice: |
6 if (i < prefix) { | 11 if (i < prefix) { |
7 array[i+(blockIdx.x*blockDim.x+threadIdx.x)*prefix] = array[i+(blockIdx.x*blockDim.x+threadIdx.x)*prefix]*2; | 12 array[i+(blockIdx.x*blockDim.x+threadIdx.x)*prefix] = array[i+(blockIdx.x*blockDim.x+threadIdx.x)*prefix]*2; |
8 i++; | 13 i++; |
9 goto C_twice; | 14 goto C_twice; |