Mercurial > hg > Members > Moririn
diff src/parallel_execution/examples/twice/CUDAtwice.cu @ 411:0eba9a04633f
Work CUDAtwice
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 14 Sep 2017 18:26:52 +0900 |
parents | 85b0ddbf458e |
children | 49159fbdd1fb |
line wrap: on
line diff
--- a/src/parallel_execution/examples/twice/CUDAtwice.cu Thu Sep 14 02:35:20 2017 +0900 +++ b/src/parallel_execution/examples/twice/CUDAtwice.cu Thu Sep 14 18:26:52 2017 +0900 @@ -1,8 +1,14 @@ extern "C" { #include <stdio.h> - __global__ void twice(int* array) { - printf("array %p",array); - array[blockIdx.x] = array[blockIdx.x]*2; + __global__ void twice(int* array, int* prefixPtr) { + int i = 0; + int prefix = *prefixPtr; +C_twice: + if (i < prefix) { + array[i+blockIdx.x*prefix] = array[i+blockIdx.x*prefix]*2; + i++; + goto C_twice; + } } }