changeset 1638:aa967337bda2 draft

fix regex_mas
author Masa <e085726@ie.u-ryukyu.ac.jp>
date Tue, 18 Jun 2013 15:33:33 +0900
parents a0014faececa
children 30c1f43493db
files example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc example/regex_mas/ppe/Print.cc
diffstat 3 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/example/regex_mas/main.cc	Tue Jun 18 13:18:37 2013 +0900
+++ b/example/regex_mas/main.cc	Tue Jun 18 15:33:33 2013 +0900
@@ -12,7 +12,7 @@
 #include "Func.h"
 #include "WordCount.h"
 
-#define EXTRA_LENGTH 3 
+#define EXTRA_LENGTH 3 //多く取ってくる文字数
 
 /* ;TODO
  * PS3でCPU数が2以上の時に、あまりが計算されてない
@@ -272,7 +272,7 @@
                     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_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);
 
                     w->size -= size;
@@ -417,10 +417,10 @@
 
     /* out用のdivision_size. statusが2つなので、あわせて16byteになるように、long long(4byte)を使用 */
 
-    w->division_out_size = sizeof(unsigned long long)*4;
+    w->division_out_size = sizeof(unsigned long long)*256;
     int out_size = w->division_out_size*out_task_num;
     w->o_data = (unsigned long long *)manager->allocate(out_size);
-    w->out_size = 4;
+    w->out_size = 256;
 
     /*各SPEの結果を合計して出力するタスク*/
 
--- a/example/regex_mas/ppe/Exec.cc	Tue Jun 18 13:18:37 2013 +0900
+++ b/example/regex_mas/ppe/Exec.cc	Tue Jun 18 15:33:33 2013 +0900
@@ -2,6 +2,7 @@
 #include <string.h>
 #include "Exec.h"
 #include "Func.h"
+#include "SchedTask.h"
 #define max(a,b)((a)>(b)?a:b) 
 
 /* これは必須 */
@@ -34,6 +35,7 @@
                 match_string[2*k] = text[i];
                 int position = (long int)offset + i; 
                 match_string[2*k+1] = position;
+
                 k++;
             }
             --i;
@@ -51,10 +53,9 @@
     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[] = "abcd";
+    unsigned char search_word[] = "aba";
 
     //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 18 13:18:37 2013 +0900
+++ b/example/regex_mas/ppe/Print.cc	Tue Jun 18 15:33:33 2013 +0900
@@ -12,12 +12,17 @@
 {
     WordCount *w = *(WordCount**)rbuf;
     unsigned long long *idata = w->o_data;
+    unsigned int idata_task_num = w->out_size * w->out_task_num;
     
     s->printf("task num : %d\n",w->task_spwaned);
 
-    for (int i = 0;i < 4;i++) {
-        s->printf("%d ",(int)idata[2*i+1]);
-        s->printf("%c\n",(char)idata[2*i]);
+    s->printf("position\n");
+    for (int i = 0;i < idata_task_num ;i++) {
+    
+        if(idata[2*i] == 0x61){
+            s->printf("%d ",(int)idata[2*i+1]);
+            s->printf("%c\n",(char)idata[2*i]);
+        }
     }
     return 0;
 }