changeset 1676:342c36d5582e draft

fix bug
author Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
date Tue, 23 Jul 2013 17:02:07 +0900
parents 07ff7ec2a61b
children 3a57dd6e4cb5
files example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc
diffstat 2 files changed, 4 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/example/regex_mas/main.cc	Tue Jul 23 15:46:57 2013 +0900
+++ b/example/regex_mas/main.cc	Tue Jul 23 17:02:07 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以上の時に、あまりが計算されてない
@@ -208,41 +208,7 @@
 
         for (int i = 0; i < loop; i += 1) {
 
-            if (spl > w->task_num) {
-                if (w->task_num >= spe_num) {
-                    array_task_num = w->task_num / spe_num;
-                } else {
-
-                    int task_num = w->task_num;
-
-                    for (int j = 0; j < task_num; j++) {
-                        HTask *h_exec = 0;
-                        int i = w->task_spwaned++;
-
-                        if (w->size < size) size = w->size;
-
-                        h_exec = manager->create_task(TASK_EXEC,
-                                                      (memaddr)(w->file_mmap + i*w->division_size), size,
-                                                      (memaddr)(w->o_data + i*w->out_size), w->division_out_size);
-
-                        if (all) {
-                            w->t_print->wait_for(h_exec);
-                        } else {
-                            t_next->wait_for(h_exec);
-                        }
-
-                        h_exec->set_cpu(spe_cpu);
-                        h_exec->spawn();
-
-                        w->size -= size;
-                        if (w->size == 0) break;
-                        w->task_num--;
-
-                    }
-
-                    return;
-                }
-            }
+            if (w->task_num < spe_num) spe_num = w->task_num;
 
             // ここから
             HTask **task_array = (HTask**)manager->allocate(sizeof(HTask*)*spe_num);
@@ -273,7 +239,6 @@
                     int offset = ONE_LOOP_LENGTH * i + ARRAY_LENGTH_SIZE*j + ONE_TASK_LENGTH*k;
                     t_exec[k]->set_param(0,(memaddr)length);
                     t_exec[k]->set_param(1,(memaddr)offset);
-                    //printf("%s\n",search_word);
                     if(size != w->size){ //ラストのタスクかどうかの判定
                         t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size+EXTRA_LENGTH);
                     }else{
--- a/example/regex_mas/ppe/Exec.cc	Tue Jul 23 15:46:57 2013 +0900
+++ b/example/regex_mas/ppe/Exec.cc	Tue Jul 23 17:02:07 2013 +0900
@@ -49,11 +49,11 @@
     unsigned long long *o_data = (unsigned long long*)wbuf;
     int *length = (int*)s->get_param(0);
     int *offset = (int*)s->get_param(1);
-    unsigned char search_word[] = "doing";
+    unsigned char search_word[] = "aba";
 
     o_data[0] = BM_method(i_data,offset,length,search_word,o_data);
 
-    //s->printf("%d\n",o_data[0]);
+    s->printf("%d\n",o_data[0]);
     //s->printf("in Exec.cc\n");