diff src/parallel_execution/examples/twice.cbc @ 364:a0a3301bac4d

Add Time interface
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Thu, 29 Jun 2017 18:04:33 +0900
parents 3aab69fc4c28
children 62a88864e1e2
line wrap: on
line diff
--- a/src/parallel_execution/examples/twice.cbc	Thu Jun 29 01:14:21 2017 +0900
+++ b/src/parallel_execution/examples/twice.cbc	Thu Jun 29 18:04:33 2017 +0900
@@ -48,7 +48,7 @@
     while(! cuda_initialized) {};
 #endif
 #endif
-    goto meta(context, C_createTask1);
+    goto meta(context, C_code1);
 }
 
 __code initDataGears_stub(struct Context* context) {
@@ -81,17 +81,14 @@
     /* puts("tree"); */
     /* print_tree(context->data[Tree]->tree.root); */
     /* puts("result"); */
-
-    time->next = C_code2;
-    goto meta(context, C_code2);
+    time->time = (union Data*)createTimeImpl(context);
+    time->next = C_createTask1;
+    goto meta(context, time->time->Time.start);
+    //goto meta(context, C_createTask1);
     //goto meta(context, C_exit_code);
     //goto meta(context, C_start_time);
 }
 
-__code code1_stub(struct Context* context) {
-    goto code1(context, Gearef(context, Time));
-}
-
 __code code2(struct LoopCounter* loopCounter) {
     int i = loopCounter->i;
 
@@ -108,7 +105,7 @@
     goto meta(context, C_exit_code);
 }
 
-__code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager) {
+__code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager, struct Time* time) {
     int i = loopCounter->i;
 
     if ((length/split*i) < length) {
@@ -116,7 +113,8 @@
     }
 
     loopCounter->i = 0;
-    taskManager->next = C_code1;
+    taskManager->next = time->time->Time.end;
+    time->next = C_code2;
 #if ( defined(USE_CUDAWorker) && defined(USE_CUDA_MAIN_THREAD))
 sleep(5);
 #endif