Mercurial > hg > Members > Moririn
comparison 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 |
comparison
equal
deleted
inserted
replaced
410:85b0ddbf458e | 411:0eba9a04633f |
---|---|
1 extern "C" { | 1 extern "C" { |
2 | 2 |
3 #include <stdio.h> | 3 #include <stdio.h> |
4 __global__ void twice(int* array) { | 4 __global__ void twice(int* array, int* prefixPtr) { |
5 printf("array %p",array); | 5 int i = 0; |
6 array[blockIdx.x] = array[blockIdx.x]*2; | 6 int prefix = *prefixPtr; |
7 C_twice: | |
8 if (i < prefix) { | |
9 array[i+blockIdx.x*prefix] = array[i+blockIdx.x*prefix]*2; | |
10 i++; | |
11 goto C_twice; | |
12 } | |
7 } | 13 } |
8 } | 14 } |