Mercurial > hg > Members > Moririn
comparison 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 |
comparison
equal
deleted
inserted
replaced
363:3aab69fc4c28 | 364:a0a3301bac4d |
---|---|
46 #ifdef USE_CUDAWorker | 46 #ifdef USE_CUDAWorker |
47 #ifdef USE_CUDA_MAIN_THREAD | 47 #ifdef USE_CUDA_MAIN_THREAD |
48 while(! cuda_initialized) {}; | 48 while(! cuda_initialized) {}; |
49 #endif | 49 #endif |
50 #endif | 50 #endif |
51 goto meta(context, C_createTask1); | 51 goto meta(context, C_code1); |
52 } | 52 } |
53 | 53 |
54 __code initDataGears_stub(struct Context* context) { | 54 __code initDataGears_stub(struct Context* context) { |
55 struct TaskManager* taskManager = Gearef(context, TaskManager); | 55 struct TaskManager* taskManager = Gearef(context, TaskManager); |
56 taskManager->taskManager = 0; | 56 taskManager->taskManager = 0; |
79 /* puts("queue"); */ | 79 /* puts("queue"); */ |
80 /* print_queue(context->data[ActiveQueue]->queue.first); */ | 80 /* print_queue(context->data[ActiveQueue]->queue.first); */ |
81 /* puts("tree"); */ | 81 /* puts("tree"); */ |
82 /* print_tree(context->data[Tree]->tree.root); */ | 82 /* print_tree(context->data[Tree]->tree.root); */ |
83 /* puts("result"); */ | 83 /* puts("result"); */ |
84 | 84 time->time = (union Data*)createTimeImpl(context); |
85 time->next = C_code2; | 85 time->next = C_createTask1; |
86 goto meta(context, C_code2); | 86 goto meta(context, time->time->Time.start); |
87 //goto meta(context, C_createTask1); | |
87 //goto meta(context, C_exit_code); | 88 //goto meta(context, C_exit_code); |
88 //goto meta(context, C_start_time); | 89 //goto meta(context, C_start_time); |
89 } | |
90 | |
91 __code code1_stub(struct Context* context) { | |
92 goto code1(context, Gearef(context, Time)); | |
93 } | 90 } |
94 | 91 |
95 __code code2(struct LoopCounter* loopCounter) { | 92 __code code2(struct LoopCounter* loopCounter) { |
96 int i = loopCounter->i; | 93 int i = loopCounter->i; |
97 | 94 |
106 } | 103 } |
107 | 104 |
108 goto meta(context, C_exit_code); | 105 goto meta(context, C_exit_code); |
109 } | 106 } |
110 | 107 |
111 __code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { | 108 __code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager, struct Time* time) { |
112 int i = loopCounter->i; | 109 int i = loopCounter->i; |
113 | 110 |
114 if ((length/split*i) < length) { | 111 if ((length/split*i) < length) { |
115 goto meta(context, C_createTask2); | 112 goto meta(context, C_createTask2); |
116 } | 113 } |
117 | 114 |
118 loopCounter->i = 0; | 115 loopCounter->i = 0; |
119 taskManager->next = C_code1; | 116 taskManager->next = time->time->Time.end; |
117 time->next = C_code2; | |
120 #if ( defined(USE_CUDAWorker) && defined(USE_CUDA_MAIN_THREAD)) | 118 #if ( defined(USE_CUDAWorker) && defined(USE_CUDA_MAIN_THREAD)) |
121 sleep(5); | 119 sleep(5); |
122 #endif | 120 #endif |
123 goto meta(context, taskManager->taskManager->TaskManager.shutdown); | 121 goto meta(context, taskManager->taskManager->TaskManager.shutdown); |
124 } | 122 } |