Mercurial > hg > Members > Moririn
view src/parallel_execution/CUDAtwice.cu @ 326:f23f6d0aa4e9 examples_directory
Add examples/calc.cbc and build but not work
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 18 Apr 2017 01:47:42 +0900 |
parents | 7dd5a7d52a67 |
children |
line wrap: on
line source
extern "C" { #include <stdio.h> // __global__ void twice(struct LoopCounter* loopCounter, int prefix ,int* array) { // int index = blockIdx.x * blockDim.x + threadIdx.x; // printf("array %p, blockIdx.x = %d, blockDim.x = %d, threadIdx.x = %d\n"); // int i = 0; // while (i < prefix) { // array[i+index*prefix] = array[i+index*prefix]*2; // } // } struct LoopCounter { int i; } LoopCounter; __global__ void twice(struct LoopCounter* loopCounter, int index, int prefix, int* array) { printf("array %p, index = %d, prefix = %d loopCounter->i %d\n",array,index,prefix,loopCounter->i); C_twice: int i = loopCounter->i; if (i < prefix) { array[i+index*prefix] = array[i+index*prefix]*2; loopCounter->i++; goto C_twice; } loopCounter->i = 0; } }