Mercurial > hg > Game > Cerium
changeset 1825:82c2b9eec625 draft
remove error and warning fileread(but cannot running)
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 14 Dec 2013 20:04:04 +0900 |
parents | 016746241fc7 |
children | d3a9772074d6 |
files | TaskManager/ChangeLog example/fileread/Func.h example/fileread/main.cc example/fileread/ppe/task_init.cc |
diffstat | 4 files changed, 19 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/ChangeLog Sat Dec 14 18:31:15 2013 +0900 +++ b/TaskManager/ChangeLog Sat Dec 14 20:04:04 2013 +0900 @@ -1,8 +1,8 @@ -2013-12-14 Masataka Kohagura <kohagura@ie.u-ryukyu.ac.jp> +2013-12-14 Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> fileを分割してmap reduce を行うAPIを作成する。 mapreduce(const char *filename , long division_size, int task_blocks, - int map_cmd, int reduce_cmd, long size_param); + int map_cmd, int reduce_cmd, long size_param); 2013-12-12 Shohei KOKUBO <kokubo@ie.u-ryukyu.ac.jp>
--- a/example/fileread/Func.h Sat Dec 14 18:31:15 2013 +0900 +++ b/example/fileread/Func.h Sat Dec 14 20:04:04 2013 +0900 @@ -2,5 +2,6 @@ #include "SysTasks.h" Read_task, Print_task, + RUN_BLOCKS, };
--- a/example/fileread/main.cc Sat Dec 14 18:31:15 2013 +0900 +++ b/example/fileread/main.cc Sat Dec 14 20:04:04 2013 +0900 @@ -33,15 +33,16 @@ SchedDefineTask1(RUN_BLOCKS,run16); static int -run16(SchedTask *m, void *in, void *out){ +run16(SchedTask *m, void *in, void *out) { + FilereadPtr fr = (FilereadPtr)in; HTaskPtr wait; for (int task_number = 0; fr->left_size > 0 && task_number < fr->task_blocks; task_number++) { HTaskPtr read = manager->create_task(Read_task); - read->set_cpu(fr->spe_cpu); + read->set_cpu(fr->cpu); - if (task_number == fr->task_blocks / 2) wait = read; + if (task_number == fr->task_blocks / 2) wait = read; //ファイルディスクリプタをそのままタスクに渡してあげる @@ -59,10 +60,11 @@ } if (fr->left_size > 0) { - HTaskPtr next = manager->create_task(RUN_BLOCKS, (memaddr)&fr->self, sizeof(memaddr),0,0); - next->wait_for(wait); - next->spawn(); + HTaskPtr next = manager->create_task(RUN_BLOCKS, (memaddr)&fr->self, sizeof(memaddr),0,0); + next->wait_for(wait); + next->spawn(); } + return 0; } static double @@ -105,7 +107,6 @@ static void run_start(TaskManager *manager,char *filename) { - HTask *read; int fd; struct stat *sb = (struct stat*)manager->allocate(sizeof(struct stat)); @@ -120,18 +121,20 @@ FilereadPtr fr = (FilereadPtr)manager->allocate(sizeof(Fileread)); + fr->cpu = spe_cpu; fr->task_blocks = 16; fr->filesize = sb->st_size; - fr->left_size = filesize; + fr->left_size = fr->filesize; fr->division_size = DIVISION_SIZE; fr->task_num = fr->filesize / DIVISION_SIZE; fr->task_num += ((fr->filesize % DIVISION_SIZE) != 0); - printf("filesize : %d\n",fr->filesize); - printf("one_task_size: %d\n",fr->DIVISION_SIZE); - printf("task_num : %d\n",fr->task_num); + printf("filesize : %ld\n",fr->filesize); + printf("one_task_size: %ld\n",fr->division_size); + printf("task_num : %ld\n",fr->task_num); HTaskPtr run = manager->create_task(RUN_BLOCKS, (memaddr)&fr->self, sizeof(memaddr),0,0); + run->spawn(); }
--- a/example/fileread/ppe/task_init.cc Sat Dec 14 18:31:15 2013 +0900 +++ b/example/fileread/ppe/task_init.cc Sat Dec 14 20:04:04 2013 +0900 @@ -4,6 +4,7 @@ /* 必ずこの位置に書いて */ SchedExternTask(Read_task); SchedExternTask(Print_task); +SchedExternTask(RUN_BLOCKS); /** * この関数は ../spe/spe-main と違って @@ -16,4 +17,5 @@ { SchedRegister(Read_task); SchedRegister(Print_task); + SchedRegister(RUN_BLOCKS); }