Mercurial > hg > Members > kono > Cerium
changeset 791:ab12634e6c51
merge
author | Yutaka_Kinjyo |
---|---|
date | Thu, 29 Apr 2010 23:12:48 +0900 |
parents | 493ce9d6439e (current diff) 03e571289ef3 (diff) |
children | f2497e0ecd7c |
files | |
diffstat | 19 files changed, 278 insertions(+), 100 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/ChangeLog Thu Apr 29 22:56:28 2010 +0900 +++ b/TaskManager/ChangeLog Thu Apr 29 23:12:48 2010 +0900 @@ -1,3 +1,41 @@ +2010-4-28 Shinji KONO <kono@ie.u-ryukyu.ac.jp> + + SchedTaskBase のみにインスタンス変数を書かせて、 + SchedTask*.h には method のみを書かせる。 + そうすると、デバッグが楽だし、object のallocateも楽。 + + HTask(list) -> TaskList(array) -> SchedTask + + というcopyだが、SchedTask で最初から作る方が良いのかも。 + それを DataSegment で共有する。 + + SimpleTask のMailを、 + if (mail_is_not_full) send_mail() ; + else if (queue is not full) enqueuue() ; + else wait_mail(); + ってな感じに出来ないの? + + Multi thread にすると、PPEのmail loop が暴走する可能性がある。 + このあたりなんか方法があるはずだが... + +2010-4-24 Shinji KONO <kono@ie.u-ryukyu.ac.jp> + + write T3 T2 T1 TL TA0 TA1 + exec T2 T1 TL TA0 TA1 TA2 + read T1 TL TA TA1 TA2 T2 + next T1 TL TA TA1 TA2* T2 + + *のところで終了mailが出てTaskArrayのデータがfreeされてしまうので、よくない + そうならないように、一段TAN(SchedTaskArrayNop)を挟む。 + + write T3 T2 T1 TL TA0 TA1 TA2 TAN% + exec T2 T1 TL TA0 TA1 TA2 TAN T2 + read T1 TL TA TA1 TA2 TAN T2 T3 + next T1 TL TA TA1 TA2 TAN T2 T3 + + %のところで終了mailを送る。T2のreadのところで、TaskArrayのデータはreadbuff上にあるので + 破壊されてしまう。なので、savedTask->task->self の値はTANにコピーして持っていく必要がある + 2009-12-19 Shinji KONO <kono@ie.u-ryukyu.ac.jp> そうか、TaskList->next は、SPE 側で自分で呼び出しているわけね。
--- a/TaskManager/Doxyfile Thu Apr 29 22:56:28 2010 +0900 +++ b/TaskManager/Doxyfile Thu Apr 29 23:12:48 2010 +0900 @@ -25,20 +25,20 @@ # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. -PROJECT_NAME = "Cerium" +PROJECT_NAME = Cerium # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 0.1 +PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. -OUTPUT_DIRECTORY = ../Document/document +OUTPUT_DIRECTORY = ../Document/document # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output @@ -60,7 +60,7 @@ # Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, # Spanish, Swedish, and Ukrainian. -OUTPUT_LANGUAGE = Japanese-en +OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in @@ -105,7 +105,7 @@ # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. -FULL_PATH_NAMES = NO +FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is @@ -552,7 +552,7 @@ # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = "./" "../include/TaskManager" "./kernel" "./kernel/schedule" "./kernel/ppe" "./kernel/sys_task" "./Fifo" "./Test" "./Test/Sum" "./Test/test_render" "./Test/test_render/xml_file" "./Test/test_render/xml_file/blend" "./Test/test_render/xml_file/blend/images" "./Test/test_render/task" "./Test/test_render/spe" "./Test/test_render/tools" "./Test/simple_render" "./Test/simple_render/task" "./Test/simple_render/test" "./Test/simple_render/test/LoadTexture" "./Test/simple_render/test/LoadTexture/spe" "./Test/simple_render/spe" "./Test/simple_render/trash" "./Test/simple_pack" "./Test/simple_pack/task" "./Test/simple_pack/trash" "./Cell" "./Cell/spe" +INPUT = # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -569,7 +569,7 @@ # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 -FILE_PATTERNS = "*.cc" "*.h" "*.py" +FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. @@ -623,7 +623,7 @@ # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. -EXAMPLE_RECURSIVE = YES +EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see @@ -665,7 +665,7 @@ # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. -SOURCE_BROWSER = YES +SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation.
--- a/TaskManager/Makefile.cell Thu Apr 29 22:56:28 2010 +0900 +++ b/TaskManager/Makefile.cell Thu Apr 29 23:12:48 2010 +0900 @@ -12,6 +12,7 @@ $(CELL_SPE_DIR)/SchedMail.cc \ $(CELL_SPE_DIR)/SchedTask.cc \ $(CELL_SPE_DIR)/SchedTaskArray.cc \ + $(CELL_SPE_DIR)/SchedTaskArrayNop.cc \ $(CELL_SPE_DIR)/SchedTaskArrayLoad.cc \ $(CELL_SPE_DIR)/Scheduler.cc\ $(CELL_SPE_DIR)/SchedNop.cc \
--- a/TaskManager/kernel/ppe/HTask.h Thu Apr 29 22:56:28 2010 +0900 +++ b/TaskManager/kernel/ppe/HTask.h Thu Apr 29 23:12:48 2010 +0900 @@ -5,6 +5,7 @@ #include "types.h" #include "Task.h" #include "TaskQueueInfo.h" +#include <stdio.h> class TaskManagerImpl; class SchedTask; @@ -66,12 +67,20 @@ t->set_outData_t(out_index++, addr,size); } void set_inData_t(int index, memaddr addr, int size) { + if ((unsigned long)addr&0xf) { + printf("inData is not aligned. command = %d, index = %d, addr = 0x%lx, size = %d\n", + command, index, (unsigned long)addr, size); + } Task *t = (Task*)rbuf; t->set_inData_t(index, addr,size); } void set_outData_t(int index, memaddr addr, int size) { + if ((unsigned long)addr&0xf) { + printf("inData is not aligned. command = %d, index = %d, addr = 0x%lx, size = %d\n", + command, index, (unsigned long)addr, size); + } Task *t = (Task*)rbuf; - t->set_inData_t(index, addr,size); + t->set_outData_t(index, addr,size); } void add_param_t(memaddr param) { Task *t = (Task*)rbuf;
--- a/TaskManager/kernel/ppe/Task.h Thu Apr 29 22:56:28 2010 +0900 +++ b/TaskManager/kernel/ppe/Task.h Thu Apr 29 23:12:48 2010 +0900 @@ -6,7 +6,6 @@ #include "ListData.h" #include "SimpleTask.h" - class SchedTask; class Scheduler;
--- a/TaskManager/kernel/schedule/SchedTaskArray.cc Thu Apr 29 22:56:28 2010 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskArray.cc Thu Apr 29 23:12:48 2010 +0900 @@ -1,4 +1,5 @@ #include "SchedTaskArray.h" +#include "SchedTaskArrayNop.h" #include "Scheduler.h" @@ -154,6 +155,12 @@ // Task List が残っているので、次を準備 return new SchedTaskArray(scheduler, savedTask, next, array); } else { + + //このTaskArrayは終わったが、Pipeline 上にread の TaskArray が残っているので + //1ステージを稼ぐ必要がある + + return new SchedTaskArrayNop(scheduler, savedTask, next, array); +#if 0 // このTaskArrayは終り。save していた Task の次を返す。 // savedTask の read/exec は実行されない (command = TaskArray) SchedTaskBase *n = savedTask->next(scheduler, savedTask); @@ -161,6 +168,8 @@ free(array); delete savedTask; return n; +#endif + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/kernel/schedule/SchedTaskArrayNop.cc Thu Apr 29 23:12:48 2010 +0900 @@ -0,0 +1,77 @@ +#include "SchedTaskArrayNop.h" +#include "Scheduler.h" + + +SchedTaskArrayNop::SchedTaskArrayNop(Scheduler *s, SchedTaskBase *savedTask_, Task *curTask_, Task *_array) +{ + savedTask = savedTask_; + atask = (memaddr)savedTask->task->self; + array = _array; + scheduler = s; + + inListData.bound = 0; + inListData.size = 0; + inListData.length = 0; + inListData.element = 0; + outListData.bound = 0; + outListData.size = 0; + outListData.length = 0; + outListData.element = 0; +} + + + +/** + */ +SchedTaskArrayNop::~SchedTaskArrayNop() +{ +} + + +/** + * Task data / code read + */ +void +SchedTaskArrayNop::read() +{ + +} + +/** + * Wait read data and execute task + * Start write DMA + */ +void +SchedTaskArrayNop::exec() +{ + +} + +/** + * Wait write DMA + * send finish mail + */ +void +SchedTaskArrayNop::write() +{ + + scheduler->mail_write((memaddr)atask); + free(array); + +} + +SchedTaskBase* +SchedTaskArrayNop::next(Scheduler *scheduler, SchedTaskBase *p) +{ + + // 最後のTask が exec されて、次の Task を実行してかまわない。 + + SchedTaskBase *n = savedTask->next(scheduler, savedTask); + + delete savedTask; + return n; + +} + + +/* end */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/kernel/schedule/SchedTaskArrayNop.h Thu Apr 29 23:12:48 2010 +0900 @@ -0,0 +1,39 @@ +#ifndef INCLUDED_SCHED_TASK_ARRAY_NOP +#define INCLUDED_SCHED_TASK_ARRAY_NOP + +#include "base.h" +#include "Scheduler.h" +#include "SchedTask.h" + + +class SchedTaskArrayNop : public SchedTask { +public: + BASE_NEW_DELETE(SchedTaskArrayNop); + + /* constructor */ + SchedTaskArrayNop(Scheduler *s, SchedTaskBase *savedTask_, Task *task_, Task *array_); + + virtual ~SchedTaskArrayNop(); + + + SchedTaskBase *savedTask; + Task *array; + +private: + /* variables */ + + memaddr atask; + + /* functions */ + + // override + void read(); + void exec(); + void write(); + SchedTaskBase* next(Scheduler *, SchedTaskBase *); + +}; + + +#endif +
--- a/TaskManager/kernel/schedule/Scheduler.cc Thu Apr 29 22:56:28 2010 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Thu Apr 29 23:12:48 2010 +0900 @@ -437,7 +437,7 @@ int Scheduler::printf(const char * format, ...) { -#if !defined(__SPU__) +#if !defined(__SPU__) || 1 va_list ap; va_start(ap,format); int ret= vprintf0(format, ap); @@ -452,7 +452,7 @@ int Scheduler::vprintf0(const char * format, va_list ap) { -#if !defined(__SPU__) +#if !defined(__SPU__) || 1 int ret= vprintf(format, ap); return ret; #else
--- a/example/Bulk/main.cc Thu Apr 29 22:56:28 2010 +0900 +++ b/example/Bulk/main.cc Thu Apr 29 23:12:48 2010 +0900 @@ -10,12 +10,14 @@ static int length = DATA_NUM; static int task = 3; -static int count = 3; -static int data_count = 3; +static int task_array_num = 3; +static int block_num = 3; -const char *usr_help_str = "Usage: ./twice [-length data_length] [-count task_num]\n\ - -length Number of data (default DATA_NUM (Func.h))\n\ - -count Number of task (default 1)\n"; +const char *usr_help_str = "Usage: ./twice [-length data_length] [-task_array_num task_num]\n\ + -task_array_num Number of data in a block (default 16)\n\ + -block_num Number of block\n\ + -task Number of task\n\ + -block_size Size of a block\n"; static void @@ -36,7 +38,7 @@ { int* data = (int*)a; int* task_buf = (int*)b; - print_data(data, length*count, "after"); + print_data(data, length*task_array_num, "after"); free(data); free(task_buf); } @@ -44,17 +46,19 @@ static int init(int argc, char **argv) { + int block_size = 16; for (int i = 1; argv[i]; ++i) { - if (strcmp(argv[i], "-length") == 0) { - length = atoi(argv[++i]); - } else if (strcmp(argv[i], "-task") == 0) { + if (strcmp(argv[i], "-task") == 0) { task = atoi(argv[++i]); - } else if (strcmp(argv[i], "-count") == 0) { - count = atoi(argv[++i]); - } else if (strcmp(argv[i], "-data_count") == 0) { - data_count = atoi(argv[++i]); + } else if (strcmp(argv[i], "-task_array_num") == 0) { + task_array_num = atoi(argv[++i]); + } else if (strcmp(argv[i], "-block_num") == 0) { + block_num = atoi(argv[++i]); + } else if (strcmp(argv[i], "-block_size") == 0) { + block_size = atoi(argv[++i]); } } + length = task_array_num * block_num * block_size; return 0; } @@ -73,54 +77,54 @@ { - for (int i = 0; i < length*count; i++) { + for (int i = 0; i < length*task_array_num; i++) { data[i] = i; } - print_data(data, length*count, "before"); + print_data(data, length*task_array_num, "before"); /** * Create Task * create_task(Task ID); */ - HTask *twice_main = manager->create_task_array(Twice,count,data_count+1,data_count,data_count); + HTask *twice_main = manager->create_task_array(Twice,task_array_num,block_num+1,block_num,block_num); Task *t = twice_main->next_task_array(Twice, 0); #if 0 printf("allocate task size 0x%0x\n",t->size()); printf("allocate task total size 0x%0x = 0x%0x * %d\n",twice_main->r_size, - t->size(), count); + t->size(), task_array_num); #endif void *task_buf = twice_main->rbuf; twice_main->set_post(twice_result, (void*)data, task_buf); t = 0; - for(int i = 0;i<count;i++) { + for(int i = 0;i<task_array_num;i++) { t = twice_main->next_task_array(Twice, t); - int length2 = length/data_count; - t->set_param(0, (memaddr)data_count); + int block_size = length/block_num; + t->set_param(0, (memaddr)block_num); - for(int j = 0;j<data_count;j++) { + for(int j = 0;j<block_num;j++) { /** * Set 32bits parameter * add_param(32bit parameter); */ - t->set_param(j+1, (memaddr)length2); + t->set_param(j+1, (memaddr)block_size); /** * Set of Input Data * add_inData(address of input data, size of input data); */ - t->set_inData(j,data, sizeof(int)*length2); + t->set_inData(j,data, sizeof(int)*block_size); /** * Set of Output area * add_outData(address of output area, size of output area); */ - t->set_outData(j,data, sizeof(int)*length2); - data += length2; + t->set_outData(j,data, sizeof(int)*block_size); + data += block_size; } #if 0 - print_ListData(data_count,t->inData(0)); - print_ListData(data_count,t->outData(0)); + print_ListData(block_num,t->inData(0)); + print_ListData(block_num,t->outData(0)); printf("pos 0x%0lx size 0x%0x\n",(unsigned long)t, t->size()); #endif } @@ -146,7 +150,7 @@ task_init(); for (int i = 0; i < task; ++i) { - int *data = (int*)manager->allocate(sizeof(int)*length*count); + int *data = (int*)manager->allocate(sizeof(int)*length*task_array_num); twice_init(manager, data, length); }
--- a/example/Bulk/ppe/Twice.cc Thu Apr 29 22:56:28 2010 +0900 +++ b/example/Bulk/ppe/Twice.cc Thu Apr 29 23:12:48 2010 +0900 @@ -4,10 +4,10 @@ #include "Func.h" /* これは必須 */ -SchedDefineTask(Twice); +SchedDefineTask1(Twice,twice_run); static int -run(SchedTask *s,void *rbuf, void *wbuf) +twice_run(SchedTask *s,void *rbuf, void *wbuf) { // SchedTaskArray *a = (SchedTaskArray *)s;
--- a/example/Bulk/spe/Twice.cc Thu Apr 29 22:56:28 2010 +0900 +++ b/example/Bulk/spe/Twice.cc Thu Apr 29 23:12:48 2010 +0900 @@ -14,9 +14,9 @@ int *i_data; int *o_data; long length; - int count = (int)s->get_param(0); + int data_count = (int)s->get_param(0); - for(int j = 0; j<count; j++) { + for(int j = 0; j<data_count; j++) { i_data = (int*)s->get_input(rbuf, j); o_data = (int*)s->get_output(wbuf, j); length = (long)s->get_param(j+1);
--- a/example/HelloWorld/main.cc Thu Apr 29 22:56:28 2010 +0900 +++ b/example/HelloWorld/main.cc Thu Apr 29 23:12:48 2010 +0900 @@ -30,14 +30,15 @@ void hello_init(TaskManager *manager) { - HTask *hello; + for (int i = 0; i < count; i++) { /** * Create Task * create_task(Task ID); */ - hello = manager->create_task(HELLO_TASK); + + HTask *hello = manager->create_task(HELLO_TASK); /** * Select CPU @@ -50,7 +51,7 @@ * Set 32bits parameter * add_param(32bit parameter); */ - hello->add_param((memaddr)i); + hello->set_param(0,(memaddr)i); hello->spawn(); }
--- a/example/hello_array/main.cc Thu Apr 29 22:56:28 2010 +0900 +++ b/example/hello_array/main.cc Thu Apr 29 23:12:48 2010 +0900 @@ -32,8 +32,6 @@ void hello_init(TaskManager *manager) { - - /** * Create Task * create_task(Task ID); @@ -46,7 +44,6 @@ for(int i = 0;i<task_num;i++) { t = twice_main->next_task_array(Hello, t); } - twice_main->spawn_task_array(t->next()); twice_main->set_cpu(SPE_ANY); twice_main->spawn();
--- a/example/word_count/Makefile.def Thu Apr 29 22:56:28 2010 +0900 +++ b/example/word_count/Makefile.def Thu Apr 29 23:12:48 2010 +0900 @@ -7,7 +7,7 @@ # ex linux/ps3 CERIUM = ../../../Cerium -OPT = -O9 +OPT = -g #-O9 CC = g++ CFLAGS = -Wall $(OPT)
--- a/example/word_count/main.cc Thu Apr 29 22:56:28 2010 +0900 +++ b/example/word_count/main.cc Thu Apr 29 23:12:48 2010 +0900 @@ -82,8 +82,8 @@ /* 1task分のデータサイズ(byte) */ int division_size; - if (size >= 4096*4) { - division_size = 4096 * 4;/*16kbyte*/ + if (size >= 1024*16) { + division_size = 1024 * 16;/*16kbyte*/ } else { division_size = size; @@ -111,53 +111,63 @@ /*各SPEの結果を合計して出力するタスク*/ t_print = manager->create_task(TASK_PRINT); - t_print->add_inData(o_data, out_size); - t_print->add_param(out_task_num); - t_print->add_param(status_num); + t_print->set_inData(0,o_data, out_size); + t_print->set_param(0,out_task_num); + t_print->set_param(1,status_num); /*各SPEに処理するデータを割り振る。*/ /*渡すデータの最後が文字かどうか。(スペース、改行以外)*/ int word_flag = 0; - int i; - int task_size = 32; - for (i = 0; i < task_num; i+=task_size) { - HTask *task_main = manager->create_task_array(TASK_EXEC,task_size,2,1,1); + int index = 0; + int array_task_num = 32; + for (int i = 0; i < task_num; i += array_task_num) { + HTask *task_main = manager->create_task_array(TASK_EXEC,array_task_num,2,1,1); + t_print->wait_for(task_main); int j ; Task *t_exec = 0; - for(j = 0; j < task_size; j++) { + for(j = 0; j < array_task_num; j++) { t_exec = task_main->next_task_array(TASK_EXEC,t_exec); - task_main->set_cpu(SPE_ANY); - t_print->wait_for(task_main); // t_exec = manager->create_task(TASK_EXEC); t_exec->set_param(0,division_size); t_exec->set_param(1,word_flag); - t_exec->set_inData(0,file_mmap + i*division_size, division_size); - t_exec->set_outData(0,o_data + i*status_num, division_out_size); + + //printf("%c",file_mmap[index*division_size]); - word_flag = ((file_mmap[(i+1)*division_size-1] != 0x20) && (file_mmap[(i+1)*division_size-1] != 0x0A)); + t_exec->set_inData(0,&file_mmap[index*division_size], division_size); + t_exec->set_outData(0,&o_data[index*status_num], division_out_size); + + word_flag = ((file_mmap[(index+1)*division_size-1] != 0x20) && (file_mmap[(index+1)*division_size-1] != 0x0A)); size -= division_size; + index++; + } + task_main->spawn_task_array(t_exec->next()); + task_main->set_cpu(SPE_ANY); + task_main->spawn(); } + //printf("size %d\n",size); + while (size>0) { t_exec = manager->create_task(TASK_EXEC); t_exec->set_param(0,size); t_exec->set_param(1,word_flag); - t_exec->set_inData(0,file_mmap + i*division_size, size); - t_exec->set_outData(0,o_data + i*status_num, division_out_size); + t_exec->set_inData(0,file_mmap + index*division_size, size); + t_exec->set_outData(0,o_data + index*status_num, division_out_size); t_exec->set_cpu(SPE_ANY); t_print->wait_for(t_exec); t_exec->spawn(); - i++; + index++; size -= division_size; } + //printf("size %d\n", st_mmap.size - index*division_size); t_print->spawn(); }
--- a/example/word_count/ppe/Exec.cc Thu Apr 29 22:56:28 2010 +0900 +++ b/example/word_count/ppe/Exec.cc Thu Apr 29 23:12:48 2010 +0900 @@ -19,29 +19,26 @@ word_num -= word_flag; + for (i=0; i < length; i++) { //s->printf("[SPE%d]%c",id,i_data[i]); - - if((i_data[i] != 0x20) && (i_data[i] != 0x0A)) { - //s->printf("文字 数 = %d\n", word_num + word_flag); - word_num += word_flag; - word_flag = 0; - } - - if (i_data[i] == 0x20) { - //printf("スペース\n"); - word_flag = 1; - } - - if (i_data[i] == 0x0A) { - //printf("改行\n"); - line_num += 1; - word_flag = 1; - } - + + if((i_data[i] != 0x20) && (i_data[i] != 0x0A)) { + //s->printf("文字 数 = %d\n", word_num + word_flag); + word_num += word_flag; + word_flag = 0; + } else if (i_data[i] == 0x20) { + //printf("スペース\n"); + word_flag = 1; + } else if (i_data[i] == 0x0A) { + //printf("改行\n"); + line_num += 1; + word_flag = 1; + } + } - + word_num += word_flag; // printf("PPE word %d line %d\n",word_num,line_num);
--- a/example/word_count/ppe/Print.cc Thu Apr 29 22:56:28 2010 +0900 +++ b/example/word_count/ppe/Print.cc Thu Apr 29 23:12:48 2010 +0900 @@ -26,8 +26,8 @@ } } - for (int i = status_num; i > 0; i--) { - s->printf("%llu ",word_data[i-1]); + for (int i = 0; i < status_num; i++) { + s->printf("%llu ",word_data[status_num - i - 1]); } s->printf("\n");
--- a/example/word_count/spe/Exec.cc Thu Apr 29 22:56:28 2010 +0900 +++ b/example/word_count/spe/Exec.cc Thu Apr 29 23:12:48 2010 +0900 @@ -11,8 +11,9 @@ { char *i_data = (char*)s->get_input(rbuf, 0); unsigned long long *o_data = (unsigned long long*)s->get_output(wbuf, 0); - long length = (long)s->get_param(0); - long word_flag = 1-(long)s->get_param(1); + int length = (int)s->get_param(0); + int word_flag = 1-(int)s->get_param(1); + //int word_flag = (int)s->get_param(1); int word_num = 0; int line_num = 0; int i ; @@ -23,18 +24,14 @@ //s->printf("[SPE%d]%c",id,i_data[i]); - if((i_data[i] != 0x20) && (i_data[i] != 0x0A)) { + if ((i_data[i] != 0x20) && (i_data[i] != 0x0A)) { //s->printf("文字 数 = %d\n", word_num + word_flag); word_num += word_flag; word_flag = 0; - } - - if (i_data[i] == 0x20) { + } else if (i_data[i] == 0x20) { //printf("スペース\n"); word_flag = 1; - } - - if (i_data[i] == 0x0A) { + } else if (i_data[i] == 0x0A) { //printf("改行\n"); line_num += 1; word_flag = 1;