Mercurial > hg > Game > Cerium
changeset 1724:d6f18ee58e0e draft
use the method of opencl
author | Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 30 Oct 2013 17:28:20 +0900 |
parents | a07d4773012d |
children | 3692c19847cc |
files | TaskManager/Gpu/GpuScheduler.cc TaskManager/kernel/schedule/Scheduler.cc |
diffstat | 2 files changed, 18 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuScheduler.cc Tue Oct 22 19:19:41 2013 +0900 +++ b/TaskManager/Gpu/GpuScheduler.cc Wed Oct 30 17:28:20 2013 +0900 @@ -49,7 +49,7 @@ exit(EXIT_FAILURE); } context = clCreateContext(NULL, 1, &device_id, NULL, NULL, &ret); - command_queue = clCreateCommandQueue(context, device_id, 0,&ret); + command_queue = clCreateCommandQueue(context, device_id, CL_QUEUE_PROFILING_ENABLE, &ret); if (ret<0) { const char *msg=convert_error_status(ret); error(msg); @@ -68,7 +68,6 @@ GpuScheduler::wait_for_event(cl_event* event,memaddr* reply,int cur) { if (event[1-cur] != NULL) { int ret=clWaitForEvents(1,&event[1-cur]); - clReleaseEvent(event[1-cur]); if (ret<0) { const char *msg=convert_error_status(ret); error(msg); @@ -77,7 +76,6 @@ connector->mail_write(reply[1-cur]); reply[1-cur]=0; } - event[1-cur]=NULL; } } @@ -277,8 +275,14 @@ wait_for_event(event,reply,cur); if (tasklist[1-cur]!=NULL) { - tasklist[1-cur]->task_end_time = gettime(); + cl_ulong start = 0; + cl_ulong end = 0; + clGetEventProfilingInfo(event[1-cur],CL_PROFILING_COMMAND_START, sizeof(cl_ulong), &start, NULL); + clGetEventProfilingInfo(event[1-cur],CL_PROFILING_COMMAND_END, sizeof(cl_ulong), &end, NULL); + tasklist[1-cur]->task_start_time = start; + tasklist[1-cur]->task_end_time = end; } + event[1-cur] = NULL; //clFlush(command_queue); // waiting for queued task // clFlush(command_queue); @@ -294,7 +298,15 @@ cur = 1 - cur; } wait_for_event(event,reply,cur); - tasklist[1-cur]->task_end_time = gettime(); + if (tasklist[cur]!=NULL) { + cl_ulong start = 0; + cl_ulong end = 0; + clGetEventProfilingInfo(event[cur],CL_PROFILING_COMMAND_START, sizeof(cl_ulong), &start, NULL); + clGetEventProfilingInfo(event[cur],CL_PROFILING_COMMAND_END, sizeof(cl_ulong), &end, NULL); + tasklist[cur]->task_start_time = start; + tasklist[cur]->task_end_time = end; + event[cur] = NULL; + } //clFlush(command_queue); // waiting for queued task //clFinish(command_queue); // waiting for queued task unsigned long long wait = 0;
--- a/TaskManager/kernel/schedule/Scheduler.cc Tue Oct 22 19:19:41 2013 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Wed Oct 30 17:28:20 2013 +0900 @@ -184,7 +184,7 @@ if (table) { MemorySegment* here = (MemorySegment*)( manager->allocate(sizeof(MemorySegment))); - here->data = (void*)(table->vma); + here->data = &table->vma; here->size = size; here->address = (memaddr)here; code_segment_pool->addLast(here);