Mercurial > hg > Game > Cerium
changeset 1636:e9cdaf7345d4 draft
merge
author | Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 11 Jun 2013 18:33:03 +0900 |
parents | a11565fea1e5 (current diff) c0841aa109a8 (diff) |
children | a0014faececa |
files | |
diffstat | 3 files changed, 18 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/main.cc Tue Jun 11 18:32:50 2013 +0900 +++ b/example/regex_mas/main.cc Tue Jun 11 18:33:03 2013 +0900 @@ -264,16 +264,16 @@ if (w->size < size) size = w->size; int length = size/sizeof(char); + const int ONE_TASK_LENGTH = w->division_size; t_exec[k] = task_array[k]->next_task_array(TASK_EXEC,t_exec[k]); - t_exec[k]->set_param(0,(memaddr)length); //ここで何文字多く取ってくるかを指定?? - //const int ONE_LOOP_LENGTH = array_task_num*spe_num*length; - //const int ARRAY_LENGTH_SIZE = spe_num * length; - //int offset = ONE_LOOP_LENGTH * i + ARRAY_LENGTH_SIZE*j+length*k; - //t_exec[k]->set_param(1,(memaddr)offset + 4); + t_exec[k]->set_param(0,(memaddr)length); + const int ONE_LOOP_LENGTH = array_task_num*spe_num*ONE_TASK_LENGTH; + const int ARRAY_LENGTH_SIZE = spe_num * ONE_TASK_LENGTH; + int offset = ONE_LOOP_LENGTH * i + ARRAY_LENGTH_SIZE*j + ONE_TASK_LENGTH*k; + t_exec[k]->set_param(1,(memaddr)offset); t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size + EXTRA_LENGTH); //それとも、ここで指定??ここっぽい t_exec[k]->set_outData(0,w->o_data + a*w->out_size, w->division_out_size); - printf("in main\n"); w->size -= size; w->task_num--;
--- a/example/regex_mas/ppe/Exec.cc Tue Jun 11 18:32:50 2013 +0900 +++ b/example/regex_mas/ppe/Exec.cc Tue Jun 11 18:33:03 2013 +0900 @@ -8,7 +8,8 @@ SchedDefineTask(Exec); //ボイヤームーア法による文字列検索アルゴリズム -int BM_method(unsigned char *text,int text_length,unsigned char *pattern,unsigned long long *match_string) +int BM_method(unsigned char *text,int *offset,int text_length, + unsigned char *pattern,unsigned long long *match_string) { int skip[256]; int text_len = text_length; @@ -30,7 +31,9 @@ int j = pattern_len - 1; while (text[i] == pattern[j]){ if (j == 0){ - match_string[k] = text[i]; + match_string[2*k] = text[i]; + int position = (long int)offset + i; + match_string[2*k+1] = position; k++; } --i; @@ -47,11 +50,12 @@ unsigned char *i_data = (unsigned char *)rbuf; unsigned long long *o_data = (unsigned long long*)wbuf; int length = (int)s->get_inputSize(0); -// int *offset = (int*)s->get_param(1); + int *offset = (int*)s->get_param(1); unsigned char search_word[] = "abcd"; -// printf("offset = %d\n",offset); - BM_method(i_data,length,search_word,o_data); + //printf("offset = %ld\n",(long int)offset); + + BM_method(i_data,offset,length,search_word,o_data); s->printf("in Exec.cc\n");
--- a/example/regex_mas/ppe/Print.cc Tue Jun 11 18:32:50 2013 +0900 +++ b/example/regex_mas/ppe/Print.cc Tue Jun 11 18:33:03 2013 +0900 @@ -15,8 +15,9 @@ s->printf("task num : %d\n",w->task_spwaned); - for (int i = 0;i < 8;i++) { - s->printf("%c\n",(char)idata[i]); + for (int i = 0;i < 4;i++) { + s->printf("%d ",(int)idata[2*i+1]); + s->printf("%c\n",(char)idata[2*i]); } return 0; }