Mercurial > hg > Game > Cerium
changeset 1610:da6835e6d306 draft
fix regex_mas
author | Masa <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 30 Apr 2013 18:38:32 +0900 |
parents | 5d0b20373d95 |
children | 6c8f9791262e |
files | example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc |
diffstat | 2 files changed, 9 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/main.cc Tue Apr 16 18:28:22 2013 +0900 +++ b/example/regex_mas/main.cc Tue Apr 30 18:38:32 2013 +0900 @@ -119,6 +119,8 @@ for (int k = 0; k < rest; k++) { HTaskPtr t_exec = manager->create_task(command); t_exec->set_param(0,(memaddr)length); + int offset = length*k; + t_exec->set_param(1,(memaddr)offset); t_exec->set_inData(0,(char*)in_data + index*in_data_size, in_data_size); t_exec->set_outData(0,(char*)out_data + index*out_data_size, out_data_size); @@ -263,6 +265,10 @@ 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); 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); @@ -270,7 +276,6 @@ w->task_num--; } } - for (int k = 0; k < spe_num; k++) { task_array[k]->spawn_task_array(t_exec[k]->next()); task_array[k]->set_cpu(spe_cpu); @@ -283,7 +288,6 @@ } - for (int i = 0; i < task_count; i += array_task_num) { HTask *h_exec = 0;
--- a/example/regex_mas/ppe/Exec.cc Tue Apr 16 18:28:22 2013 +0900 +++ b/example/regex_mas/ppe/Exec.cc Tue Apr 30 18:38:32 2013 +0900 @@ -15,6 +15,8 @@ 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 *offset = (int*)s->get_param(1); + printf("offset = %d\n",offset); int word_num = 0; int line_num = 1; int i = 0; @@ -23,19 +25,12 @@ bool match_flag = 0; char line_data[BUFFER_SIZE]; int line_length = 0; - //head_tail_flag[0] = (i_data[0] != 0x20) && (i_data[0] != 0x0A); for (; i < length; i++) { if (i_data[i] == 0x0A) { if (match_flag == true) { - line_print(line_num,line_length,line_data); -/* printf("%d : ",line_num); - for (int k = 0; k < line_length; k++) { - printf("%c",line_data[k]); - } - printf("\n"); -*/ + } match_flag = false; line_length = 0; @@ -53,13 +48,8 @@ } } - //head_tail_flag[1] = (i_data[i-1] != 0x20) && (i_data[i-1] != 0x0A); head_tail_flag[1] = (word_head_a_flag == true); - - o_data[0] = (unsigned long long)word_num; - o_data[1] = (unsigned long long)line_num; - return 0; }