changeset 1742:a35a2780a060 draft

merge
author kkb
date Tue, 12 Nov 2013 17:41:33 +0900
parents e0560291611b (current diff) 5a294d8e5643 (diff)
children 36eb8c21281a
files
diffstat 5 files changed, 26 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/example/fileread/main.cc	Tue Nov 12 17:41:02 2013 +0900
+++ b/example/fileread/main.cc	Tue Nov 12 17:41:33 2013 +0900
@@ -45,7 +45,7 @@
             spe_num = atoi(argv[i+1]);
         } else if (strcmp(argv[i], "-file") == 0) {
             filename = argv[i+1];
-        } 
+        }
     }
 
     if (filename==0){
@@ -61,12 +61,12 @@
 {
     HTask *read;
     int *fd = (int*)manager->allocate(sizeof(int));
-    
+
     struct stat *sb = (struct stat*)manager->allocate(sizeof(struct stat));
 
     if ((*fd=open(filename,O_RDONLY,0666))==0) {
         fprintf(stderr,"can't open %s\n",filename); 
-    }       
+    }
 
     if (fstat(*fd,sb)) {
         fprintf(stderr,"can't fstat %s\n",filename);
@@ -75,14 +75,14 @@
     int filesize = sb->st_size;
     int task_num = filesize / ONE_TASK_SIZE; 
     task_num += ((filesize % ONE_TASK_SIZE) != 0);
-    
+
     printf("filesize     : %d\n",filesize);
     printf("one_task_size: %d\n",ONE_TASK_SIZE);
     printf("task_num     : %d\n",task_num);
 
     read = manager->create_task(READ_TASK);
     read->set_cpu(spe_cpu);
-    
+
     //ファイルディスクリプタをそのままタスクに渡してあげる
     read->set_inData(0,(memaddr)fd,sizeof(int*)); 
 
--- a/example/fileread/ppe/Read.cc	Tue Nov 12 17:41:02 2013 +0900
+++ b/example/fileread/ppe/Read.cc	Tue Nov 12 17:41:33 2013 +0900
@@ -17,13 +17,13 @@
 
 static int
 run(SchedTask *s, void *rbuf, void *wbuf)
-{   
+{
     int *fd = (int *)s->get_input(rbuf,0);  ///ファイルディスクリプタの受取
 
     long readsize = (long)s->get_param(0);
-   
+
     char text[(long int)readsize];
-    
+
     //lseekで読み込む場所を教えてあげる
     //s->xはiteraterで繰り返した数
     lseek(*fd,readsize*s->x,SEEK_SET);  
--- a/example/regex_mas/WordCount.h	Tue Nov 12 17:41:02 2013 +0900
+++ b/example/regex_mas/WordCount.h	Tue Nov 12 17:41:33 2013 +0900
@@ -3,16 +3,14 @@
     struct wordCount *self;
     int size;             // remaining file size
     int division_size;    // for each word count task
-    int division_out_size;    
-    int out_size;    
+    int division_out_size;
+    int out_size;
     int task_num;         // remaining task count
     int task_blocks;      // spawn task one at a time
-    int status_num; 
+    int status_num;
     int task_spwaned;
     unsigned long long *o_data;
-    unsigned long long *head_tail_flag;
     int out_task_num;
-    int pad; 
     char * file_mmap;
     int file_size;
     HTaskPtr t_print;
--- a/example/regex_mas/main.cc	Tue Nov 12 17:41:02 2013 +0900
+++ b/example/regex_mas/main.cc	Tue Nov 12 17:41:33 2013 +0900
@@ -124,26 +124,25 @@
                 for (int k = 0; k < spe_num; k++) {
 
                     int a = w->task_spwaned++;
-                    
+
                     if (w->size < size) size = w->size;
-                    
+
                     int set_one_task_length = size/sizeof(char);
-                    const int ONE_TASK_LENGTH = w->division_size;
-                    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;
-
+                    //const int ONE_TASK_LENGTH = w->division_size;
+                    //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] = task_array[k]->next_task_array(TASK_EXEC,t_exec[k]);
-                    t_exec[k]->set_param(0,(memaddr)offset);
+                    //t_exec[k]->set_inData(1,(memaddr)search_word, sizeof(search_word));
 
                     if(size != w->size){ //最後のタスクかどうかの判定
-                        t_exec[k]->set_param(1,(memaddr)set_one_task_length + EXTRA_LENGTH);
+                        t_exec[k]->set_param(0,(memaddr)set_one_task_length + EXTRA_LENGTH);
                         t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size+EXTRA_LENGTH);
                     }else{
-                        t_exec[k]->set_param(1,(memaddr)set_one_task_length);
+                        t_exec[k]->set_param(0,(memaddr)set_one_task_length);
                         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	Tue Nov 12 17:41:02 2013 +0900
+++ b/example/regex_mas/ppe/Exec.cc	Tue Nov 12 17:41:33 2013 +0900
@@ -9,7 +9,7 @@
 SchedDefineTask(Exec);
 
 //ボイヤームーア法による文字列検索アルゴリズム
-int BM_method(unsigned char *text,int *offset,int *text_length,
+int BM_method(unsigned char *text,int *text_length,
               unsigned char *pattern,unsigned long long *match_string)
 {
     int skip[256];
@@ -47,17 +47,15 @@
 static int
 run(SchedTask *s, void *rbuf, void *wbuf)
 {
-    unsigned char *i_data = (unsigned char *)rbuf;
+    unsigned char *i_data = (unsigned char *)s->get_input(rbuf,0);
     unsigned long long *o_data = (unsigned long long*)wbuf;
-    int *offset = (int*)s->get_param(0);
-    int *length = (int*)s->get_param(1);
-    //unsigned char *search_word = (unsigned char*)s->get_input(2);
+    int *length = (int*)s->get_param(0);
+    //unsigned char *search_word = (unsigned char*)s->get_input(1);
     unsigned char search_word[] = "doing";
 
-    o_data[0] = BM_method(i_data,offset,length,search_word,o_data);
+    o_data[0] = BM_method(i_data,length,search_word,o_data);
 
     //s->printf("in Exec.cc\n");
 
-   
     return 0;
 }