Mercurial > hg > Game > Cerium
changeset 1790:6790d1d83bb7 draft
change iterator to spawn in string_args
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 03 Dec 2013 22:00:56 +0900 |
parents | 82f8250f23d5 |
children | 2cf6b9020b06 |
files | example/HelloWorld/Makefile.def example/string_args/main.cc example/string_args/ppe/Exec.cc |
diffstat | 3 files changed, 18 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/example/HelloWorld/Makefile.def Tue Dec 03 18:14:24 2013 +0900 +++ b/example/HelloWorld/Makefile.def Tue Dec 03 22:00:56 2013 +0900 @@ -8,7 +8,7 @@ CERIUM = ../../../Cerium CC = g++ -CFLAGS = -g -Wall -O9 +CFLAGS = -g -Wall -O3 INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. LIBS = -L${CERIUM}/TaskManager
--- a/example/string_args/main.cc Tue Dec 03 18:14:24 2013 +0900 +++ b/example/string_args/main.cc Tue Dec 03 22:00:56 2013 +0900 @@ -1,6 +1,4 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <sys/time.h> #include "TaskManager.h" @@ -44,14 +42,16 @@ { HTask *exec; - exec = manager->create_task(TASK_EXEC); - exec->set_cpu(spe_cpu); - - //ファイルディスクリプタをそのままタスクに渡してあげる - exec->set_inData(0,search_word,search_word_len); - - exec->set_param(0,(unsigned long long)one_task_size); //1つのタスクが読み込む量 - exec->iterate(task_num); //タスク数分イテレートする + for(int i = 0; i < task_num; i++){ + //ファイルディスクリプタをそのままタスクに渡してあげる + exec = manager->create_task(TASK_EXEC); + exec->set_cpu(spe_cpu); + exec->set_inData(0,search_word,search_word_len); + exec->set_inData(1,search_word,search_word_len); + exec->set_inData(2,intTable,5); + exec->set_param(0,(unsigned long long)one_task_size); //1つのタスクが読み込む量 + exec->spawn(); //タスク数分イテレートする + } }
--- a/example/string_args/ppe/Exec.cc Tue Dec 03 18:14:24 2013 +0900 +++ b/example/string_args/ppe/Exec.cc Tue Dec 03 22:00:56 2013 +0900 @@ -18,14 +18,17 @@ static int run(SchedTask *s, void *rbuf, void *wbuf) { - const char *search_word = (char *)s->get_input(rbuf,0); + const char *search_word1 = (char *)s->get_input(rbuf,0); + const char *search_word2 = (char *)s->get_input(rbuf,1); + const int *table = (int *)s->get_input(rbuf,2); long task_size = (long)s->get_param(0); //s->xはiteraterで繰り返した数 - s->printf("test num : %d\n",task_size); - s->printf("arg word : %s\n",search_word); + s->printf("test num : %d\n",task_size); + s->printf("arg1 word : %s\n",search_word1); + s->printf("arg2 word : %s\n",search_word2); return 0; }