Mercurial > hg > Game > Cerium
changeset 1596:4853dad706f7 draft
merge
author | Masa <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 01 Apr 2013 18:50:58 +0900 |
parents | 50d032af7e9b (current diff) 9bca00b424ef (diff) |
children | 657bb4f87b79 |
files | |
diffstat | 6 files changed, 72 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Mon Apr 01 18:48:51 2013 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Mon Apr 01 18:50:58 2013 +0900 @@ -273,9 +273,9 @@ { task_list->cpu_type = type; if (machineNum==0) - task->cpu_type = CPU_PPE ; + task->cpu_type = CPU_PPE ; else - task->cpu_type = type; + task->cpu_type = type; } #if 0
--- a/TaskManager/kernel/ppe/TaskManagerImpl.h Mon Apr 01 18:48:51 2013 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.h Mon Apr 01 18:50:58 2013 +0900 @@ -69,7 +69,6 @@ virtual void set_task_depend(HTaskPtr master, HTaskPtr slave); virtual void spawn_task(HTaskPtr); virtual void set_task_cpu(HTaskPtr, CPU_TYPE); - virtual int max_cpu()=0; void set_taskList(HTaskPtr htask, QueueInfo<TaskList> * taskList); void free_htask(HTaskPtr htask) {
--- a/TaskManager/kernel/schedule/Scheduler.cc Mon Apr 01 18:48:51 2013 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Mon Apr 01 18:50:58 2013 +0900 @@ -417,13 +417,13 @@ int Scheduler::max_cpu() { // todo - return manager->max_cpu(); + return task_list[0].cpu_type + manager->machineNum-1; } int Scheduler::min_cpu() { // todo - return 0; + return task_list[0].cpu_type; } MemorySegment * @@ -532,5 +532,4 @@ #endif } - /* end */
--- a/example/multiply/ppe/Multi.cc Mon Apr 01 18:48:51 2013 +0900 +++ b/example/multiply/ppe/Multi.cc Mon Apr 01 18:50:58 2013 +0900 @@ -17,6 +17,7 @@ C = (float*)s->get_output(wbuf, 0); long i = (long)s->get_param(0); + printf("%ld\n",i); C[i]=A[i]*B[i]; return 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/regex_masa/ppe/Exec.cc Mon Apr 01 18:50:58 2013 +0900 @@ -0,0 +1,56 @@ +#include <stdio.h> +#include <string.h> +#include "Exec.h" +#include "Func.h" + +/* これは必須 */ +SchedDefineTask(Exec); + +static int +run(SchedTask *s, void *rbuf, void *wbuf) +{ + char *i_data = (char *)rbuf; + unsigned long long *o_data = (unsigned long long*)wbuf; + unsigned long long *head_tail_flag = o_data +2; + int length = (int)s->get_inputSize(0); + int word_num = 0; + int line_num = 0; + int i = 0; + bool word_flag = false; + bool line_flag = false; + bool word_head_a_flag = false; + + //head_tail_flag[0] = (i_data[0] != 0x20) && (i_data[0] != 0x0A); + //word_num -= 1-head_tail_flag[0]; + head_tail_flag[0] = (i_data[0] == 0x62); + + for (; i < length; i++) { + if (i_data[i] == 0x61) { + word_head_a_flag = true; + } else if ((i_data[i] == 0x62) && (word_head_a_flag == true)){ + word_flag = true; + line_flag = true; + word_head_a_flag = true; + } else if (i_data[i] == 0x20) { //空白 + word_num += word_flag; + word_flag = false; + word_head_a_flag = false; + } else if (i_data[i] == 0x0A) { // 改行 + line_num += line_flag; + word_num += word_flag; + line_flag = false; + word_flag = false; + word_head_a_flag = false; + } + } + + //head_tail_flag[1] = (i_data[i-1] != 0x20) && (i_data[i-1] != 0x0A); + head_tail_flag[1] = (i_data[i-1] == 0x61); + + s->printf("SPE include 'ab' %d lines. %d words. \n",line_num,word_num); + + o_data[0] = (unsigned long long)word_num; + o_data[1] = (unsigned long long)line_num; + + return 0; +}
--- a/example/word_count/ppe/Print.cc Mon Apr 01 18:48:51 2013 +0900 +++ b/example/word_count/ppe/Print.cc Mon Apr 01 18:50:58 2013 +0900 @@ -46,17 +46,17 @@ * 担当範囲前の末尾文字が「改行と、スペース以外」(tail_flag = 1)で、 * 担当範囲の先頭文字が「改行とスペース」(head_flag = 0)の場合 * 単語数を +1 することで、整合性がとれる。 - * - * ex. - * task_num 4 - * head_tail_flag[8] + * * ex. + * task_num 2 + * head_tail_flag[5] * - * 0 1 2 3 4 5 6 7 - * ___ ___ ___ ___ ___ ___ ___ ___ - * | h | t | h | t | h | t | h | t | - * |___|___|___|___|___|___|___|___| - * |-------|-------|-------| - * 比較 比較 比較 + * 0 1 | 2 3 4 5 + * ___ ___ ___ ___ ___ ___ ___ ___ + * | W | L | h | t | W | L | h | t | + * |___|___|___|___|___|___|___|___| + * | + * |-----------| + * 比較 * */ @@ -68,7 +68,7 @@ for (int i = 0; i < out_task_num ; i++) { word_data[0] += idata[i*w->out_size+0]; - word_data[1] += idata[i*w->out_size+1]; + word_data[1] +idata[i*w->out_size+1]; unsigned long long *head_tail_flag = &idata[i*w->out_size+2]; if((i!=out_task_num-1)&&