changeset 1978:8fbe022126e1 draft

add Blocked Read files
author Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
date Thu, 13 Mar 2014 02:15:06 +0900
parents 126b28fdae50
children 889472b0e6d5
files example/word_count/Func.h example/word_count/ppe/Read.cc example/word_count/ppe/Read.h example/word_count/task_init.cc
diffstat 4 files changed, 45 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/example/word_count/Func.h	Tue Mar 04 18:11:06 2014 +0900
+++ b/example/word_count/Func.h	Thu Mar 13 02:15:06 2014 +0900
@@ -1,5 +1,7 @@
 enum {
 #include "SysTasks.h"
+    BREAD_RUN_TASK_BLOCKS,
+    READ_TASK,
     TASK_EXEC,
     TASK_EXEC_DATA_PARALLEL,
     RUN_TASK_BLOCKS,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/word_count/ppe/Read.cc	Thu Mar 13 02:15:06 2014 +0900
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <iostream>
+#include <vector>
+#include <cstdlib>
+
+#include "SchedTask.h"
+#include "Print.h"
+#include "Func.h"
+#include "WordCount.h"
+
+/* これは必須 */
+SchedDefineTask1(READ_TASK,read_task);
+
+static int
+read_task(SchedTask *s, void *rbuf, void *wbuf)
+{
+    long fd = (long)s->get_param(0);
+    long start_read_position = (long)s->get_param(1);
+    long end_read_position = (long)s->get_param(2);
+    char *read_text = (char*)s->get_output(wbuf,0);
+
+    long read_size = end_read_position - start_read_position;
+
+    pread(fd, read_text, read_size , start_read_position);
+
+    return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/word_count/ppe/Read.h	Thu Mar 13 02:15:06 2014 +0900
@@ -0,0 +1,7 @@
+#ifndef INCLUDED_TASK_HELLO
+#define INCLUDED_TASK_HELLO
+
+#include "SchedTask.h"
+
+
+#endif
--- a/example/word_count/task_init.cc	Tue Mar 04 18:11:06 2014 +0900
+++ b/example/word_count/task_init.cc	Thu Mar 13 02:15:06 2014 +0900
@@ -8,6 +8,8 @@
 #endif
 
 /* 必ずこの位置に書いて */
+SchedExternTask(READ_TASK);
+SchedExternTask(BREAD_RUN_TASK_BLOCKS);
 SchedExternTask(Exec);
 SchedExternTask(Exec_Data_Parallel);
 SchedExternTask(Print);
@@ -29,10 +31,13 @@
     CudaSchedRegister(TASK_EXEC, "cuda/Exec.ptx", "wordcount");
     CudaSchedRegister(TASK_EXEC_DATA_PARALLEL, "cuda/Exec_Data_Parallel.ptx","wordcount_parallel");
 #endif
-    
+
     SchedRegisterTask(TASK_EXEC, Exec);
     SchedRegisterTask(TASK_EXEC_DATA_PARALLEL, Exec_Data_Parallel);
 
+    SchedRegister(READ_TASK);
+    SchedRegister(BREAD_RUN_TASK_BLOCKS);
+
     SchedRegisterTask(TASK_PRINT, Print);
     SchedRegister(RUN_TASK_BLOCKS);
 }