changeset 1630:d2581892b8ad draft

fix regex_mas
author Masa <e085726@ie.u-ryukyu.ac.jp>
date Tue, 04 Jun 2013 17:17:16 +0900
parents da928c43c6be
children 39a381fec1e7
files example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc
diffstat 2 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/example/regex_mas/main.cc	Mon Jun 03 19:22:18 2013 +0900
+++ b/example/regex_mas/main.cc	Tue Jun 04 17:17:16 2013 +0900
@@ -12,6 +12,8 @@
 #include "Func.h"
 #include "WordCount.h"
 
+#define EXTRA_LENGTH 3 
+
 /* ;TODO
  * PS3でCPU数が2以上の時に、あまりが計算されてない
  */
@@ -171,7 +173,7 @@
     }
 
     /*sizeをページングサイズの倍数にあわせる*/
-    st_mmap.size = fix_byte(sb.st_size,4096);
+    st_mmap.size = fix_byte(sb.st_size,4096 + EXTRA_LENGTH);  //セグフォ防止
 
     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) {
@@ -264,13 +266,14 @@
                     int length = size/sizeof(char);
 
                     t_exec[k] = task_array[k]->next_task_array(TASK_EXEC,t_exec[k]);
-                    t_exec[k]->set_param(0,(memaddr)length + 1);
-                    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_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_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	Mon Jun 03 19:22:18 2013 +0900
+++ b/example/regex_mas/ppe/Exec.cc	Tue Jun 04 17:17:16 2013 +0900
@@ -3,8 +3,10 @@
 #include "Exec.h"
 #include "Func.h"
 #define max(a,b)((a)>(b)?a:b) 
+
 /* これは必須 */
 SchedDefineTask(Exec);
+
 //ボイヤームーア法による文字列検索アルゴリズム
 int BM_method(unsigned char *text,int text_length,unsigned char *pattern,unsigned long long *match_string)
 {
@@ -45,11 +47,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);
+    s->printf("in Exec.cc\n");
 
    
     return 0;