Mercurial > hg > Game > Cerium
changeset 1573:2a8826934b03 draft
adjust time measurement
author | Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 19 Mar 2013 14:20:15 +0900 |
parents | 0bd4598f5a65 |
children | d8f25aa30cac |
files | TaskManager/kernel/ppe/TaskManager.h example/multiply/main.cc |
diffstat | 2 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/kernel/ppe/TaskManager.h Mon Mar 18 15:34:19 2013 +0900 +++ b/TaskManager/kernel/ppe/TaskManager.h Tue Mar 19 14:20:15 2013 +0900 @@ -11,8 +11,8 @@ typedef struct nd_range { nd_range() { dimension = 1; - gws[0]=1; gws[0]=1; gws[0]=1; - lws[0]=1; lws[0]=1; lws[0]=1; + gws[0]=1; gws[1]=1; gws[2]=1; + lws[0]=1; lws[1]=1; lws[2]=1; } cl_uint dimension; size_t gws[3];
--- a/example/multiply/main.cc Mon Mar 18 15:34:19 2013 +0900 +++ b/example/multiply/main.cc Tue Mar 19 14:20:15 2013 +0900 @@ -8,6 +8,7 @@ extern void task_init(void); static int task = 1; static int length = DATA_NUM; +CPU_TYPE spe_cpu = SPE_ANY; const char *usr_help_str = "Usage: ./multiply \n"; void TMend(TaskManager *); @@ -31,18 +32,18 @@ printf("Multiplication went wrong.\n"); return; } - printf("Multiplication was succeeded.\n"); - return; } + printf("Multiplication was succeeded.\n"); + return; } - + static void print_result() { - printf("---\n"); + /* printf("---\n"); for (int i =0;i<length;i++) { printf("%f * %f = %f \n",A[i],B[i],C[i]); } - printf("---\n"); + printf("---\n");*/ } @@ -51,9 +52,11 @@ for (int i = 1; argv[i]; ++i) { if (strcmp(argv[i], "--length") == 0 || strcmp(argv[i], "-l") == 0) { length = atoi(argv[++i]); + }else if (strcmp(argv[i], "-g") == 0) { + spe_cpu = GPU_0 ; } else if (strcmp(argv[i], "-t") == 0) { task = atoi(argv[++i]); - } + } } } @@ -69,7 +72,6 @@ A[i]=(float)(i+1000); B[i]=(float)i/10.f; } - st_time = getTime(); // set ND_RANGE parameter // 初期値は全部1になっている @@ -80,7 +82,7 @@ multiply = manager->create_task(MULTIPLY_TASK); multiply->nd_range(); - multiply->set_cpu(SPE_ANY); + multiply->set_cpu(spe_cpu); /** * Set of Input Data @@ -99,7 +101,7 @@ * Set 32bits parameter * add_param(32bit parameter); */ - multiply->set_param(1,(memaddr)length); + multiply->set_param(0, (memaddr)length); // add Active Queue multiply->spawn(); @@ -111,7 +113,6 @@ { init(argc, argv); // Task Register - // ppe/task_init.cc task_init(); for (int i = 0; i < task; ++i) { multi_init(manager);