Mercurial > hg > Game > Cerium
changeset 1647:0dcdaa4dfecb draft
fix bugs regex/mas
author | Masa <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 24 Jun 2013 20:44:27 +0900 |
parents | ab6b11476e02 |
children | 89b24515fabf |
files | example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc example/regex_mas/ppe/Print.cc |
diffstat | 3 files changed, 16 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/main.cc Mon Jun 24 19:45:45 2013 +0900 +++ b/example/regex_mas/main.cc Mon Jun 24 20:44:27 2013 +0900 @@ -12,7 +12,7 @@ #include "Func.h" #include "WordCount.h" -#define EXTRA_LENGTH 4 //多く取ってくる文字数(search word length - 1) +#define EXTRA_LENGTH 2 //多く取ってくる文字数(search word length - 1) /* ;TODO * PS3でCPU数が2以上の時に、あまりが計算されてない @@ -174,7 +174,7 @@ } /*sizeをページングサイズの倍数にあわせる*/ - st_mmap.size = fix_byte(sb.st_size,4096 + EXTRA_LENGTH); + st_mmap.size = fix_byte(sb.st_size,4096); st_mmap.file_mmap = (char*)mmap(NULL,st_mmap.size,PROT_READ,map,fd,(off_t)0); if (st_mmap.file_mmap == (caddr_t)-1) { @@ -269,12 +269,17 @@ t_exec[k] = task_array[k]->next_task_array(TASK_EXEC,t_exec[k]); t_exec[k]->set_param(0,(memaddr)length); + 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); //printf("%s\n",search_word); - t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size + EXTRA_LENGTH); //ここっぽい + if(size != w->size){ //ラストのタスクかどうかの判定 + t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size+EXTRA_LENGTH); + }else{ + t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size); + } t_exec[k]->set_outData(0,w->o_data + a*w->out_size, w->division_out_size); w->size -= size;
--- a/example/regex_mas/ppe/Exec.cc Mon Jun 24 19:45:45 2013 +0900 +++ b/example/regex_mas/ppe/Exec.cc Mon Jun 24 20:44:27 2013 +0900 @@ -53,7 +53,7 @@ unsigned long long *o_data = (unsigned long long*)wbuf; int length = (int)s->get_inputSize(0); int *offset = (int*)s->get_param(1); - unsigned char search_word[] = "Pakis"; + unsigned char search_word[] = "aba"; //printf("offset = %ld\n",(long int)offset); BM_method(i_data,offset,length,search_word,o_data);
--- a/example/regex_mas/ppe/Print.cc Mon Jun 24 19:45:45 2013 +0900 +++ b/example/regex_mas/ppe/Print.cc Mon Jun 24 20:44:27 2013 +0900 @@ -14,19 +14,21 @@ unsigned long long *idata = w->o_data; unsigned int idata_task_num = w->out_size * w->out_task_num; int match_count = 0; - - s->printf("task num : %d\n",w->task_spwaned); s->printf("position\n"); for (int i = 0;i < idata_task_num/2;i++) { - if(idata[2*i] != 0x00){ - //s->printf("%d ",(int)idata[2*i+1]); - //s->printf("%c\n",(unsigned char)idata[2*i]); + if(idata[2*i] == 0x61){ + + s->printf("%d ",(int)idata[2*i+1]); + s->printf("%c\n",(unsigned char)idata[2*i]); + //s->printf("%d:%c\n",2*i,(unsigned char)idata[2*i]); + //s->printf("%d:%d ",2*i+1,(int)idata[2*i+1]); match_count++; } } s->printf("HIT:%d\n",match_count); + s->printf("task num : %d\n",w->task_spwaned); return 0; }