view 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 source

extern "C" {

#include <stdio.h>
    __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;
        }
    }
}