Mercurial > hg > Game > Cerium
changeset 1471:e8db2e2d426c draft
fix not working yet.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 15 Jul 2012 19:25:28 +0900 |
parents | 16731fa768de |
children | 0c5a0a734e55 |
files | TaskManager/Gpu/GpuScheduler.cc TaskManager/Gpu/GpuScheduler.h TaskManager/Gpu/GpuTaskManagerImpl.cc TaskManager/kernel/schedule/Scheduler.cc TaskManager/kernel/schedule/Scheduler.h TaskManager/test/GpuRunTest/GpuRunTest.cc |
diffstat | 6 files changed, 37 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuScheduler.cc Sun Jul 15 18:56:16 2012 +0900 +++ b/TaskManager/Gpu/GpuScheduler.cc Sun Jul 15 19:25:28 2012 +0900 @@ -6,6 +6,11 @@ #include <fcntl.h> #include <sys/stat.h> +GpuScheduler::GpuScheduler() +{ + init_impl(0); +} + void GpuScheduler::init_impl(int useRefDma) { @@ -24,7 +29,6 @@ GpuThreads* gputhreads = GpuThreads::getInstance(); cl_context context = gputhreads->context; cl_command_queue command_queue = gputhreads->command_queue; - cl_int ret; if ((memaddr)params_addr == (memaddr)MY_SPE_COMMAND_EXIT) { clFinish(command_queue); @@ -115,10 +119,13 @@ cl_kernel *kernel = new cl_kernel; *kernel = clCreateKernel(program, functionname, &ret); - task_list[cmd].run = NULL; - task_list[cmd].load = NULL; - task_list[cmd].wait = NULL; + task_list[cmd].run = null_run; + task_list[cmd].load = null_loader; + task_list[cmd].wait = null_loader; task_list[cmd].name = functionname; task_list[cmd].kernel = kernel; } + +/* end */ +
--- a/TaskManager/Gpu/GpuScheduler.h Sun Jul 15 18:56:16 2012 +0900 +++ b/TaskManager/Gpu/GpuScheduler.h Sun Jul 15 19:25:28 2012 +0900 @@ -12,6 +12,8 @@ class GpuScheduler : public Scheduler { public: + GpuScheduler(); + void init_impl(int useRefDma); void run();
--- a/TaskManager/Gpu/GpuTaskManagerImpl.cc Sun Jul 15 18:56:16 2012 +0900 +++ b/TaskManager/Gpu/GpuTaskManagerImpl.cc Sun Jul 15 19:25:28 2012 +0900 @@ -13,13 +13,15 @@ static void send_alloc_reply(GpuTaskManagerImpl *tm, int id, GpuThreads *gpuThreads); +extern QueueInfo<TaskList> *taskListPool; + GpuTaskManagerImpl::~GpuTaskManagerImpl() { } void GpuTaskManagerImpl::init(int spuIdle,int useRefDma) { - gpuTaskList = new QueueInfo<TaskList>; - taskListInfo = new QueueInfo<TaskList>; + gpuTaskList = new QueueInfo<TaskList>(taskListPool); + taskListInfo = new QueueInfo<TaskList>(taskListPool); ppeManager = new FifoTaskManagerImpl(machineNum); MainScheduler *mscheduler = new MainScheduler;
--- a/TaskManager/kernel/schedule/Scheduler.cc Sun Jul 15 18:56:16 2012 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Sun Jul 15 19:25:28 2012 +0900 @@ -26,14 +26,14 @@ delete connector; } -static int +int null_run(SchedTask* smanager, void* r, void *w) { smanager->printf("Calling Undefined Task %d\n", smanager->atask->command); return 0; } -static void null_loader(Scheduler *m, int task_id); +void null_loader(Scheduler *m, int task_id); /*! @brief speTaskの入出力のパイプラインバッファを確保する */ @@ -217,7 +217,7 @@ #endif } -static void +void null_loader(Scheduler *m, int task_id) { }
--- a/TaskManager/kernel/schedule/Scheduler.h Sun Jul 15 18:56:16 2012 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Sun Jul 15 19:25:28 2012 +0900 @@ -154,6 +154,10 @@ }; extern TaskObject task_list[MAX_TASK_OBJECT]; + +int null_run(SchedTask* smanager, void* r, void *w); +void null_loader(Scheduler *m, int task_id); + extern int entry_cmd[MAX_TASK_OBJECT]; inline void
--- a/TaskManager/test/GpuRunTest/GpuRunTest.cc Sun Jul 15 18:56:16 2012 +0900 +++ b/TaskManager/test/GpuRunTest/GpuRunTest.cc Sun Jul 15 19:25:28 2012 +0900 @@ -25,7 +25,7 @@ void -tester(int *indata, int *outdata, int num){ +tester(int *indata, int *outdata, int num) { //チェック int check = 0; @@ -40,13 +40,18 @@ } void -test(TaskManager *manager, long int length){ - - int cmd = 1; +task_init() +{ + int cmd = SchedRun; + GpuThreads* gputhreads = GpuThreads::getInstance(); gputhreads->init(); - + GpuSchedRegister(cmd, "twice.cl", "twice"); +} + +void +test(TaskManager *manager, long int length) { int *indata = (int *)manager->allocate(sizeof(int)*length);//new int[length]; int *outdata = new int[length]; @@ -60,7 +65,7 @@ schedtask->set_inData(0, indata, sizeof (int)*length); schedtask->set_outData(1, outdata, sizeof (int)*length); schedtask->set_inData(2, &count, sizeof (int)); - schedtask->set_cpu(SPE_ANY); + schedtask->set_cpu(SPE_ANY); // これでは、GPU しか使えないではないか。 schedtask->spawn(); } @@ -81,3 +86,5 @@ return 0; } + +/* end */