Mercurial > hg > Game > Cerium
changeset 1858:45139c74dad1 draft
fix schedRegister name
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 22 Dec 2013 23:25:46 +0900 |
parents | 7122e6edce5e |
children | 3ddcd27d4dc2 |
files | example/regex_mas/Func.h example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc example/regex_mas/ppe/Print.cc example/regex_mas/ppe/Read.cc example/regex_mas/task_init.cc |
diffstat | 6 files changed, 23 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/Func.h Sun Dec 22 23:12:35 2013 +0900 +++ b/example/regex_mas/Func.h Sun Dec 22 23:25:46 2013 +0900 @@ -1,10 +1,10 @@ enum { #include "SysTasks.h" - TASK_EXEC, - TASK_READ, + Task_exec, + Task_read, + Task_print, RUN_TASK_BLOCKS, RUN_READ_BLOCKS, - TASK_PRINT, }; #define DATA_NUM 12
--- a/example/regex_mas/main.cc Sun Dec 22 23:12:35 2013 +0900 +++ b/example/regex_mas/main.cc Sun Dec 22 23:25:46 2013 +0900 @@ -82,7 +82,7 @@ HTaskPtr wait; for (int i = 0; (fr->left_size > 0) && (i < fr->task_blocks); i++) { - HTaskPtr read = manager->create_task(TASK_READ); + HTaskPtr read = manager->create_task(Task_read); read->set_cpu(fr->cpu); if (i == fr->task_blocks / 2) wait = read; @@ -192,7 +192,7 @@ if (use_task_array) { int task_num = (w->size+size-1)/size; if (task_num>array_task_num) task_num = array_task_num; - task_array = manager->create_task_array(TASK_EXEC,task_num,1,3,1); + task_array = manager->create_task_array(Task_exec,task_num,1,3,1); if (!all) { t_next->wait_for(task_array); } else { @@ -207,7 +207,7 @@ if (w->size < size) size = w->size; if (size==0) break; if (use_task_array) { - t_exec = task_array->next_task_array(TASK_EXEC,t_exec); + t_exec = task_array->next_task_array(Task_exec,t_exec); t_exec->set_inData(0,w->file_mmap + a*w->division_size, size); t_exec->set_inData(1,w->search_word, w->search_word_len); t_exec->set_inData(2,w->BMskip_table, 256); @@ -216,7 +216,7 @@ t_exec->set_outData(0,w->o_data + a*w->out_size, w->division_out_size); } else if (use_compat) { - h_exec = manager->create_task(TASK_EXEC); + h_exec = manager->create_task(Task_exec); h_exec->set_inData(0,w->file_mmap + i*w->division_size, size); h_exec->set_outData(0,w->o_data + i*w->out_size, w->division_out_size); @@ -225,7 +225,7 @@ h_exec->set_cpu(spe_cpu); h_exec->spawn(); } else { - h_exec = manager->create_task(TASK_EXEC, + h_exec = manager->create_task(Task_exec, (memaddr)(w->file_mmap + i*w->division_size), size, (memaddr)(w->o_data + i*w->out_size), w->division_out_size); t_next->wait_for(h_exec); @@ -362,7 +362,7 @@ /*各SPEの結果を合計して出力するタスク*/ - t_print = manager->create_task(TASK_PRINT, + t_print = manager->create_task(Task_print, (memaddr)&w->self,sizeof(memaddr),0,0); w->t_print = t_print;
--- a/example/regex_mas/ppe/Exec.cc Sun Dec 22 23:12:35 2013 +0900 +++ b/example/regex_mas/ppe/Exec.cc Sun Dec 22 23:25:46 2013 +0900 @@ -6,7 +6,7 @@ #define max(a,b)((a)>(b)?a:b) /* これは必須 */ -SchedDefineTask(Exec); +SchedDefineTask1(Task_exec,task_exec); //ボイヤームーア法による文字列検索アルゴリズム static int BM_method(unsigned char *text,int text_len, @@ -30,7 +30,7 @@ } static int -run(SchedTask *s, void *rbuf, void *wbuf) +task_exec(SchedTask *s, void *rbuf, void *wbuf) { //get_input unsigned char *i_data = (unsigned char *)s->get_input(rbuf, 0);
--- a/example/regex_mas/ppe/Print.cc Sun Dec 22 23:12:35 2013 +0900 +++ b/example/regex_mas/ppe/Print.cc Sun Dec 22 23:25:46 2013 +0900 @@ -5,10 +5,10 @@ #include "WordCount.h" /* これは必須 */ -SchedDefineTask1(Print,run_print); +SchedDefineTask1(Task_print,task_print); static int -run_print(SchedTask *s, void *rbuf, void *wbuf) +task_print(SchedTask *s, void *rbuf, void *wbuf) { WordCount *w = *(WordCount**)rbuf; unsigned long long *idata = w->o_data; @@ -20,6 +20,7 @@ match_counter += idata[i]; //s->printf("idata[%d]=:%d\n",i,idata[i]); } + s->printf("HIT:%d\n",match_counter); return 0; }
--- a/example/regex_mas/ppe/Read.cc Sun Dec 22 23:12:35 2013 +0900 +++ b/example/regex_mas/ppe/Read.cc Sun Dec 22 23:25:46 2013 +0900 @@ -11,10 +11,10 @@ #include "Func.h" /* これは必須 */ -SchedDefineTask1(TASK_READ,Read_task); +SchedDefineTask1(Task_read,task_read); static int -Read_task(SchedTask *s, void *rbuf, void *wbuf) +task_read(SchedTask *s, void *rbuf, void *wbuf) { int *fd = (int *)s->get_input(rbuf,0); ///ファイルディスクリプタの受取
--- a/example/regex_mas/task_init.cc Sun Dec 22 23:12:35 2013 +0900 +++ b/example/regex_mas/task_init.cc Sun Dec 22 23:25:46 2013 +0900 @@ -4,9 +4,10 @@ /* 必ずこの位置に書いて */ #ifndef __CERIUM_GPU__ -SchedExternTask(Exec); +SchedExternTask(Task_exec); #endif -SchedExternTask(Print); +SchedExternTask(Task_print); +SchedExternTask(Task_read); SchedExternTask(RUN_TASK_BLOCKS); SchedExternTask(RUN_READ_BLOCKS); @@ -19,12 +20,13 @@ task_init(void) { #ifdef __CERIUM_GPU__ - GpuSchedRegister(TASK_EXEC, "gpu/Exec.cl", "run"); + GpuSchedRegister(Task_exec, "gpu/Exec.cl", "run"); #else - SchedRegisterTask(TASK_EXEC, Exec); + SchedRegister(Task_exec); #endif - SchedRegisterTask(TASK_PRINT, Print); + SchedRegister(Task_read); + SchedRegister(Task_print); SchedRegister(RUN_TASK_BLOCKS); SchedRegister(RUN_READ_BLOCKS); }