diff src/parallel_execution/examples/twice/CUDAtwice.cu @ 410:85b0ddbf458e

Fix CudaWorker
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Thu, 14 Sep 2017 02:35:20 +0900
parents b81492c74d2b
children 0eba9a04633f
line wrap: on
line diff
--- a/src/parallel_execution/examples/twice/CUDAtwice.cu	Wed Sep 06 22:01:27 2017 +0900
+++ b/src/parallel_execution/examples/twice/CUDAtwice.cu	Thu Sep 14 02:35:20 2017 +0900
@@ -1,33 +1,8 @@
 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;
+    __global__ void twice(int* array) {
+        printf("array %p",array);
+        array[blockIdx.x] = array[blockIdx.x]*2;
     }
-
-
 }