changeset 1699:0a70abda2ab6 draft

profile for gpu
author kkb
date Fri, 04 Oct 2013 20:05:17 +0900
parents 7673e2ad2623
children 9009204d1e18
files TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Gpu/GpuScheduler.cc
diffstat 2 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc	Fri Oct 04 19:44:09 2013 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.cc	Fri Oct 04 20:05:17 2013 +0900
@@ -362,6 +362,13 @@
 }
 
 void CellTaskManagerImpl::show_profile() {
+#ifdef __CERIUM_GPU__
+    for (int id = 0; i < gpuNum; id++) {
+        HTaskPtr t = schedTaskManager->create_task(ShowTime, 0, 0, 0, 0);
+        t->set_cpu((CPU_TYPE) (id + GPU_0));
+        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));
@@ -370,6 +377,13 @@
 }
 
 void CellTaskManagerImpl::start_profile() {
+#ifdef __CERIUM_GPU__
+    for (int id = 0; i < gpuNum; id++) {
+        HTaskPtr t = schedTaskManager->create_task(StartProfile, 0, 0, 0, 0);
+        t->set_cpu((CPU_TYPE) (id + GPU_0));
+        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));
--- a/TaskManager/Gpu/GpuScheduler.cc	Fri Oct 04 19:44:09 2013 +0900
+++ b/TaskManager/Gpu/GpuScheduler.cc	Fri Oct 04 20:05:17 2013 +0900
@@ -117,6 +117,7 @@
             return ;
         }
 
+        (*connector->start_dmawait_profile)();
         while (params_addr) {
             // since we are on the same memory space, we don't has to use dma_load here
             TaskListPtr tasklist = (TaskListPtr)connector->dma_load(this, params_addr,
@@ -131,7 +132,14 @@
             }
             
             for (TaskPtr nextTask = tasklist->tasks;nextTask < tasklist->last(); nextTask = nextTask->next()) {
-                
+                if(nextTask->command==ShowTime) {
+                    connector->show_profile();
+                    continue;
+                }
+                if(nextTask->command==StartProfile) {
+                    connector->start_profile();
+                    continue;
+                }
                 load_kernel(nextTask->command);
                 cl_program& program = *gpu_task_list[nextTask->command].gputask->program;
                 const char *function = gpu_task_list[nextTask->command].name;
@@ -281,6 +289,7 @@
         wait_for_event(event,reply,cur);
         //clFlush(command_queue); // waiting for queued task
         //clFinish(command_queue); // waiting for queued task
+        (*connector->end_dmawait_profile)();
         connector->mail_write((memaddr)MY_SPE_STATUS_READY);
     }
     // TaskArrayの処理