Mercurial > hg > Game > Cerium
changeset 1700:9009204d1e18 draft
add Multi1.cc
author | kkb |
---|---|
date | Mon, 07 Oct 2013 15:23:13 +0900 |
parents | 0a70abda2ab6 |
children | 4a3b3ec582f2 |
files | TaskManager/test/UtilizationTest/main.o TaskManager/test/UtilizationTest/ppe/Multi.o TaskManager/test/UtilizationTest/ppe/Multi1.cc TaskManager/test/UtilizationTest/ppe/task_init.o |
diffstat | 4 files changed, 32 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/test/UtilizationTest/ppe/Multi1.cc Mon Oct 07 15:23:13 2013 +0900 @@ -0,0 +1,32 @@ +#include <stdio.h> +#include "SchedTask.h" +#include "Multi.h" +#include "Func.h" +#include "GpuScheduler.h" + +/* これは必須 */ +SchedDefineTask(Multiply1); + +extern long current_task_id; + +static int +run(SchedTask *s,void *rbuf, void *wbuf) +{ + float *A,*B,*C; + + A = (float*)s->get_input(rbuf, 0); + B = (float*)s->get_input(rbuf, 1); + C = (float*)s->get_output(wbuf, 0); + // sleep(30); + + long task_id = (long)s->get_param(0); + current_task_id = task_id; + // long i = s->x; + for(int i=0; i<DATA_NUM; i++) { + C[i]=A[i]*B[i]; + } + if(current_task_id != task_id) + fprintf(stderr,"duplicate task %ld %ld\n",current_task_id,task_id); + + return 0; +}