Mercurial > hg > Game > Cerium
changeset 1752:537707f376c8 draft
fix profile
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 22 Nov 2013 02:49:43 +0900 |
parents | 224802aba3bd |
children | c1711deae8c5 |
files | TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Fifo/FifoTaskManagerImpl.cc TaskManager/kernel/ppe/HTask.cc TaskManager/kernel/schedule/SchedTask.cc TaskManager/test/UtilizationTest/Func.h TaskManager/test/UtilizationTest/main.cc TaskManager/test/UtilizationTest/multiply TaskManager/test/UtilizationTest/ppe/Multi.cc TaskManager/test/UtilizationTest/ppe/task_init.cc example/fft/main.cc example/fft/output.pgm example/multiply/gpu/Multi.cl example/multiply/main.cc example/multiply/ppe/Multi.cc |
diffstat | 14 files changed, 57 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Fri Nov 22 02:07:46 2013 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Fri Nov 22 02:49:43 2013 +0900 @@ -369,11 +369,9 @@ t->spawn(); } #endif - for (int id = 0; id < machineNum; id++) { - HTaskPtr t = schedTaskManager->create_task(ShowTime, 0, 0, 0, 0); - t->set_cpu((CPU_TYPE) (id + SPE_0)); - t->spawn(); - } + HTaskPtr t = schedTaskManager->create_task(ShowTime, 0, 0, 0, 0); + t->set_cpu(SPE_ANY); + t->iterate(machineNum); } void CellTaskManagerImpl::start_profile() { @@ -384,11 +382,9 @@ t->spawn(); } #endif - for (int id = 0; id < machineNum; id++) { - HTaskPtr t = schedTaskManager->create_task(StartProfile, 0, 0, 0, 0); - t->set_cpu((CPU_TYPE) (id + SPE_0)); - t->spawn(); - } + HTaskPtr t = schedTaskManager->create_task(StartProfile, 0, 0, 0, 0); + t->set_cpu(SPE_ANY); + t->iterate(machineNum); } void CellTaskManagerImpl::export_task_log() {
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc Fri Nov 22 02:07:46 2013 +0900 +++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc Fri Nov 22 02:49:43 2013 +0900 @@ -311,9 +311,9 @@ void FifoTaskManagerImpl::start_profile() { for (int id = 0; id < machineNum; id++) { - HTaskPtr t = schedTaskManager->create_task(StartProfile, 0, 0, 0, 0); - t->set_cpu((CPU_TYPE) (id + 2)); - t->spawn(); + HTaskPtr t = schedTaskManager->create_task(StartProfile, 0, 0, 0, 0); + t->set_cpu((CPU_TYPE) (id + 2)); + t->spawn(); } }
--- a/TaskManager/kernel/ppe/HTask.cc Fri Nov 22 02:07:46 2013 +0900 +++ b/TaskManager/kernel/ppe/HTask.cc Fri Nov 22 02:49:43 2013 +0900 @@ -3,6 +3,7 @@ #include "TaskManagerImpl.h" #include "strings.h" #include "rdtsc.h" +#include "SysFunc.h" /*! manager->set_task_depend(task1, task2); // task2 は task1 の終了を待つ
--- a/TaskManager/kernel/schedule/SchedTask.cc Fri Nov 22 02:07:46 2013 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Fri Nov 22 02:49:43 2013 +0900 @@ -123,7 +123,7 @@ } (*connector->end_dmawait_profile)(&connector->global_busy_time,&connector->start_time,&connector->stop_time); list->task_end_time = gettime(); - this->printf("%d %s\t%lld\n",list->self->cpu_type,(char *)(task_list[atask->command].name),list->task_end_time-list->task_start_time); + this->printf("cpuid %ld %s\t%lld\n",scheduler->id,(char *)(task_list[atask->command].name),list->task_end_time-list->task_start_time); connector->free_(readbuf); // User 側で作る方法が必要... // 書き込む領域がなければ無視 @@ -143,7 +143,7 @@ long lz = list->z; x=y=z=0; - + long cpu=min; for (;;cpu++) { if (cpu>max) cpu = min;
--- a/TaskManager/test/UtilizationTest/Func.h Fri Nov 22 02:07:46 2013 +0900 +++ b/TaskManager/test/UtilizationTest/Func.h Fri Nov 22 02:49:43 2013 +0900 @@ -2,6 +2,7 @@ #include "SysTasks.h" MULTIPLY_TASK, MULTIPLY_TASK1, + NOP, }; -#define DATA_NUM 50000000 +#define DATA_NUM 100000000
--- a/TaskManager/test/UtilizationTest/main.cc Fri Nov 22 02:07:46 2013 +0900 +++ b/TaskManager/test/UtilizationTest/main.cc Fri Nov 22 02:49:43 2013 +0900 @@ -74,29 +74,35 @@ } long task_id = 0; + + HTask* nop = manager->create_task(NOP); + nop->set_cpu(SPE_ANY); + // nop->spawn(); + HTask *multiply = manager->create_task(MULTIPLY_TASK); - multiply->set_cpu((CPU_TYPE)((int)GPU_0)); + multiply->set_cpu(SPE_ANY); multiply->set_inData(0,(memaddr)A, sizeof(float)*length); multiply->set_inData(1,(memaddr)B, sizeof(float)*length); multiply->set_param(0,task_id++); multiply->set_outData(0,(memaddr)C, sizeof(float)*length); + // multiply->wait_for(nop); multiply->iterate(length); - HTask* previous = multiply; + // HTask* previous = multiply; - // for(int i=1;i<4;i++) { - multiply = manager->create_task(MULTIPLY_TASK); - multiply->set_cpu((CPU_TYPE)((int)GPU_0)); + // // for(int i=1;i<4;i++) { + // multiply = manager->create_task(MULTIPLY_TASK); + // multiply->set_cpu(SPE_0); - multiply->set_inData(0,(memaddr)A, sizeof(float)*length/10); - multiply->set_inData(1,(memaddr)B, sizeof(float)*length/10); - // multiply->set_param(0,task_id++); - multiply->set_outData(0,(memaddr)C, sizeof(float)*length/10); + // multiply->set_inData(0,(memaddr)A, sizeof(float)*length/10); + // multiply->set_inData(1,(memaddr)B, sizeof(float)*length/10); + // // multiply->set_param(0,task_id++); + // multiply->set_outData(0,(memaddr)C, sizeof(float)*length/10); - multiply->wait_for(previous); + // multiply->wait_for(previous); - multiply->iterate(length/10); + // multiply->iterate(length); // previous = multiply; // }
--- a/TaskManager/test/UtilizationTest/ppe/Multi.cc Fri Nov 22 02:07:46 2013 +0900 +++ b/TaskManager/test/UtilizationTest/ppe/Multi.cc Fri Nov 22 02:49:43 2013 +0900 @@ -17,15 +17,15 @@ A = (float*)s->get_input(rbuf, 0); B = (float*)s->get_input(rbuf, 1); C = (float*)s->get_output(wbuf, 0); - - long task_id = (long)s->get_param(0); - current_task_id = task_id; + + // 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); - + // } + // if(current_task_id != task_id) + // fprintf(stderr,"duplicate task %ld %ld\n",current_task_id,task_id); + return 0; }
--- a/TaskManager/test/UtilizationTest/ppe/task_init.cc Fri Nov 22 02:07:46 2013 +0900 +++ b/TaskManager/test/UtilizationTest/ppe/task_init.cc Fri Nov 22 02:49:43 2013 +0900 @@ -4,6 +4,7 @@ /* 必ずこの位置に書いて */ SchedExternTask(Multiply); SchedExternTask(Multiply1); +SchedExternTask(Nop); /** * この関数は ../spe/spe-main と違って * 自分で呼び出せばいい関数なので @@ -15,4 +16,5 @@ { SchedRegisterTask(MULTIPLY_TASK, Multiply); SchedRegisterTask(MULTIPLY_TASK1, Multiply1); + SchedRegisterTask(NOP,Nop) }
--- a/example/fft/main.cc Fri Nov 22 02:07:46 2013 +0900 +++ b/example/fft/main.cc Fri Nov 22 02:49:43 2013 +0900 @@ -30,7 +30,7 @@ cl_context context = NULL; cl_command_queue queue = NULL; cl_program program = NULL; -CPU_TYPE spe_cpu = GPU_0; +CPU_TYPE spe_cpu = SPE_ANY; cl_float2* xm; cl_float2* rm;
--- a/example/multiply/gpu/Multi.cl Fri Nov 22 02:07:46 2013 +0900 +++ b/example/multiply/gpu/Multi.cl Fri Nov 22 02:49:43 2013 +0900 @@ -1,7 +1,9 @@ __kernel void -multi(__global const void *params,__global const float *A, __global const float*B, __global float *C) +multi(__global const long *params,__global const float *A, __global const float*B, __global float *C) { - int i=get_global_id(0); - - C[i]=A[i]*B[i]; + // int i=get_global_id(0); + long length = (long)params[0]; + for(int i=0;i<length;i++) { + C[i]=A[i]*B[i]; + } }
--- a/example/multiply/main.cc Fri Nov 22 02:07:46 2013 +0900 +++ b/example/multiply/main.cc Fri Nov 22 02:49:43 2013 +0900 @@ -79,7 +79,7 @@ A[i]=(float)(i+1000); B[i]=(float)(i+1)/10.f; } - + // set ND_RANGE parameter // 初期値は全部1になっている // ndr = new ND_RANGE_T; @@ -87,9 +87,10 @@ // ndr->gws[0] = length; // manager->set_NDRange(ndr); + // for(int i=0;i<10;i++) { multiply = manager->create_task(MULTIPLY_TASK); multiply->set_cpu(spe_cpu); - + /** * Set of Input Data * add_inData(address of input data, size of input data); @@ -103,7 +104,10 @@ */ multiply->set_outData(0,(memaddr)C, sizeof(float)*length); // param 0に0~length-1をsetしたtaskをlength個spawnする + multiply->set_param(0,(long)length); multiply->iterate(length); + // multiply->spawn(); + // } }
--- a/example/multiply/ppe/Multi.cc Fri Nov 22 02:07:46 2013 +0900 +++ b/example/multiply/ppe/Multi.cc Fri Nov 22 02:49:43 2013 +0900 @@ -16,7 +16,10 @@ B = (float*)s->get_input(rbuf, 1); C = (float*)s->get_output(wbuf, 0); - long i = s->x; + // long length = (long)s->get_param(0); + long i = (long)s->x; + //for(int i=0;i<length;i++) { C[i]=A[i]*B[i]; + //} return 0; }