diff src/parallel_execution/context.h @ 438:7679093bdd72

Work CUDAtwice
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Mon, 06 Nov 2017 00:11:43 +0900
parents 08a93fc2f0d3
children 5a737c3df91c
line wrap: on
line diff
--- a/src/parallel_execution/context.h	Sat Nov 04 08:30:25 2017 +0900
+++ b/src/parallel_execution/context.h	Mon Nov 06 00:11:43 2017 +0900
@@ -75,7 +75,7 @@
 
 // (SingleLinkedStack *)context->data[D_Stack]->Stack.stack->Stack.stack
 
-#define GearImpl(context, intf, name) (Gearef(context, intf)->name->intf.name) 
+#define GearImpl(context, intf, name) (Gearef(context, intf)->name->intf.name)
 
 #include "c/enumCode.h"
 
@@ -110,7 +110,7 @@
     int num_exec;
     CUmodule module;
     CUfunction function;
-#endif 
+#endif
     union Data **data;
 
     /* multi dimension parameter */
@@ -118,6 +118,10 @@
     struct Iterator* iterator;
 };
 
+typedef int Int;
+#ifndef USE_CUDAWorker
+typedef unsigned long long CUdeviceptr;
+#endif
 union Data {
     struct Meta {
         enum DataType type;
@@ -140,7 +144,7 @@
     } LoopCounter;
     struct TaskManager {
 #ifdef USE_CUDA_MAIN_THREAD
-        volatile 
+        volatile
 #endif
         union Data* taskManager;
         enum Code spawn;      // start NEW context on the worker
@@ -234,7 +238,7 @@
         union Data* stack;
         union Data* data;
         union Data* data1;
-        enum Code whenEmpty; 
+        enum Code whenEmpty;
         enum Code clear;
         enum Code push;
         enum Code pop;
@@ -259,9 +263,8 @@
         struct Element* next;
     } Element;
     struct Array {
-        int size; 
-        int prefix; 
-        int* array;
+        int prefix;
+        Int* array;
     } Array;
     struct Tree {
         union Data* tree;
@@ -278,7 +281,7 @@
         struct Node* previous; // parent of reading node of original tree
         struct Node* newNode; // writing node of new tree
         struct Node* parent;
-        struct Node* grandparent; 
+        struct Node* grandparent;
         struct Stack* nodeStack;
         int result;
     } RedBlackTree;
@@ -359,19 +362,22 @@
         CUdeviceptr** kernelParams;
         struct CUDABuffer* buffer;
     } CUDAExecutor;
-    CUdeviceptr CUdeviceptr;
-#else
-    struct CUDAExecutor {
-    } CUDAExecutor;
-#endif
     struct CUDABuffer {
         int inputLen;
         int outputLen;
         union Data** inputData;
         union Data** outputData;
     } CUDABuffer;
+    CUdeviceptr CUdeviceptr;
+#else
+    struct CUDAExecutor {
+    } CUDAExecutor;
+    struct CUDABuffer {
+    } CUDABuffer;
+    CUdeviceptr CUdeviceptr;
+#endif
+    Int Int;
 }; // union Data end       this is necessary for context generator
-
 typedef union Data Data;
 
 #include "c/typedefData.h"