changeset 1936:e8ca9cae59fc draft

merge
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Sun, 02 Feb 2014 18:34:31 +0900
parents 67e50779feb4 (current diff) 3d54a6c26caa (diff)
children 71cb3365d9fb f19885ea776d
files example/regex_mas/bigfile.pl
diffstat 3 files changed, 37 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/example/regex_mas/WordCount.h	Sun Feb 02 18:33:54 2014 +0900
+++ b/example/regex_mas/WordCount.h	Sun Feb 02 18:34:31 2014 +0900
@@ -6,15 +6,14 @@
     int read_division_size;
     int read_task_number;
     int read_task_num;
-    int read_left_task_num;
-    int read_filesize;
-    int read_left_size;
+    long long read_filesize;
+    long long read_left_size;
     int read_task_blocks;
     char *read_text;
     CPU_TYPE read_cpu;
 
 
-    int size;             // remaining file size
+    long long size;             // remaining file size
     int division_size;    // for each word count task
     int division_out_size;
     int out_size;
@@ -26,7 +25,7 @@
     unsigned long long *o_data;
     int out_task_num;
     char *file_mmap;
-    int file_size;
+    long long file_size;
 
     /*set input Data variables*/
     int last_task_size;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/regex_mas/bigfile.pl	Sun Feb 02 18:34:31 2014 +0900
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+my $loop_counter = 0;
+my $exec_result = 0;
+
+my $original_filename = $ARGV[0];
+my $make_filename = $ARGV[1];
+my $make_filesize = $ARGV[2] * 1024 * 1024 * 1024;
+
+if (@ARGV != 3) {
+    print("Usage: ./bigfile.pl [original filename] [make filename] [make filesilze(GB)]\n");
+    exit(0);
+}
+
+my $original_filesize = -s $original_filename;
+my $loop_num = $make_filesize / $original_filesize;
+
+
+print "original file name : $original_filename\n";
+print "original file size : $original_filesize\n";
+print "make     file name : $make_filename\n";
+print "make     file size : $make_filesize\n";
+print "make file size(GB) : $ARGV[2] GB\n";
+
+while ($loop_counter < $loop_num) {
+    $exec_result = `cat $original_filename >> $make_filename`;
+    $loop_counter++;
+}
+
--- a/example/regex_mas/main.cc	Sun Feb 02 18:33:54 2014 +0900
+++ b/example/regex_mas/main.cc	Sun Feb 02 18:34:31 2014 +0900
@@ -54,22 +54,9 @@
     off_t size;
 } st_mmap_t;
 
-typedef struct fileread {
-   struct filesize *self;
-   long fd;
-   long division_size;
-   long task_number;
-   long task_num;
-   long filesize;
-   long left_size;
-   int task_blocks;
-   char *read_text;
-   CPU_TYPE cpu;
-} Fileread, *FilereadPtr;
-
 /*与えられたsizeをfix_byte_sizeの倍数にする(丸め込むっていうのかな?)*/
-static int
-fix_byte(int size,int fix_byte_size)
+static unsigned long long
+fix_byte(unsigned long long size,int fix_byte_size)
 {
     size = (size/fix_byte_size)*fix_byte_size  + ((size%fix_byte_size)!= 0)*fix_byte_size;
 
@@ -197,7 +184,7 @@
                 h_exec->set_cpu(spe_cpu);
                 h_exec->spawn();
             }
-            w->size -= size;
+            w->size -= w->division_size;
             w->task_num--;
         }
         if (use_task_array) {
@@ -289,7 +276,7 @@
     w->read_task_num = w->read_filesize / READ_DIVISION_SIZE;
     w->read_task_num += ((w->read_filesize % READ_DIVISION_SIZE) != 0);
 
-    printf("filesize     : %d\n",w->read_filesize);
+    printf("filesize     : %lld\n",w->read_filesize);
     printf("one_task_size: %d\n",w->read_division_size);
     printf("task_num     : %d\n",w->read_task_num);