Mercurial > hg > Game > Cerium
changeset 1194:7909536bf611 draft
fix Prime/PrintTask
author | Daichi TOMA <e085740@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 12 Jul 2011 14:58:04 +0900 |
parents | ae3ca6ee94e5 |
children | 63f60bcb01d7 27e35b4098a4 |
files | example/Prime/Makefile.def example/Prime/main.cc example/Prime/ppe/PrintTask.cc example/Prime/spe/PrintTask.cc |
diffstat | 4 files changed, 20 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/example/Prime/Makefile.def Fri Jul 08 19:49:09 2011 +0900 +++ b/example/Prime/Makefile.def Tue Jul 12 14:58:04 2011 +0900 @@ -8,8 +8,8 @@ CERIUM = ../../../Cerium CC = g++ -m64 -CFLAGS = -O9 -Wall -#CFLAGS = -g -Wall +#CFLAGS = -O9 -Wall +CFLAGS = -g -Wall INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. LIBS = -L${CERIUM}/TaskManager
--- a/example/Prime/main.cc Fri Jul 08 19:49:09 2011 +0900 +++ b/example/Prime/main.cc Tue Jul 12 14:58:04 2011 +0900 @@ -11,6 +11,7 @@ extern TaskManager *manager; static int prime_num = 256; /* 素数を出力する範囲 */ +static int print_flag = -1; /* help文章 */ const char *usr_help_str = "Usage: ./prime [-cpu spe_num] [-num N]\n\ @@ -24,6 +25,9 @@ if (strcmp(argv[i], "-num") == 0) { prime_num = atoi(argv[++i]); } + else if (strcmp(argv[i], "-print") == 0) { + print_flag = 0; + } } return 0; } @@ -67,6 +71,8 @@ print->set_inData(0,output,sizeof(int)*prime_num); /* 出力する数を渡す */ print->set_param(0,(memaddr)prime_num); + /* printするかどうかを渡す */ + print->set_param(1,(memaddr)print_flag); /* PPEを使うように指示 */ print->set_cpu(CPU_PPE); /* タスクを登録 */
--- a/example/Prime/ppe/PrintTask.cc Fri Jul 08 19:49:09 2011 +0900 +++ b/example/Prime/ppe/PrintTask.cc Tue Jul 12 14:58:04 2011 +0900 @@ -8,6 +8,12 @@ static int print(SchedTask *smanager, void *rbuf, void *wbuf) { + int print_flag = (long)smanager->get_param(1); //プリントするかどうか + + if (print_flag < 0) { + return 0; + } + int length = (long)smanager->get_param(0); /* 出力する範囲 */ int *input = (int*)smanager->get_input(rbuf, 0); /* 出力する配列 */
--- a/example/Prime/spe/PrintTask.cc Fri Jul 08 19:49:09 2011 +0900 +++ b/example/Prime/spe/PrintTask.cc Tue Jul 12 14:58:04 2011 +0900 @@ -8,6 +8,12 @@ static int print(SchedTask *smanager, void *rbuf, void *wbuf) { + int print_flag = (long)smanager->get_param(1); //プリントするかどうか + + if (print_flag < 0) { + return 0; + } + int length = (int)smanager->get_param(0); /* 出力する範囲 */ int *input = (int*)smanager->get_input(rbuf, 0); /* 出力する配列 */