changeset 317:51aa65676e37

CUDAtwice.cbc is called now
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 15 Feb 2017 16:28:25 +0900
parents 54d203daf06b (current diff) faa746c449c6 (diff)
children 054c47e6ca20
files src/parallel_execution/CUDAWorker.cbc src/parallel_execution/TaskManagerImpl.cbc src/parallel_execution/main.cbc
diffstat 4 files changed, 0 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
Binary file doc/scheduler.graffle has changed
--- a/src/parallel_execution/CUDAWorker.cbc	Wed Feb 15 16:25:23 2017 +0900
+++ b/src/parallel_execution/CUDAWorker.cbc	Wed Feb 15 16:28:25 2017 +0900
@@ -25,12 +25,10 @@
 
     worker->worker = (union Data*)cudaWorker;
     worker->tasks = queue;
-printf("createCUDAWorker %p\n",queue);
     cudaWorker->id = id;
     worker->shutdown = C_shutdownCUDAWorker;
     // pthread_create(&worker->worker->CUDAWorker.thread, NULL, (void*)&start_CUDAworker, worker);
     if (im) {
-printf("im->worker %p\n",im->workers);
         im->workers[0] = worker;
     }
     cuda_initialized = 1;
@@ -42,15 +40,12 @@
     // initialize and load kernel
     cudaWorker->num_stream = 1; // number of stream
 //    cudaWorker->stream = NEWN(cudaWorker->num_stream, CUstream );
-printf("cudaInit 1\n");
    if (phase==0)
     checkCudaErrors(cuInit(0));
    if (phase==0)
     checkCudaErrors(cuDeviceGet(&cudaWorker->device, 0));
-printf("cudaInit 2\n");
    if (phase==0)
     checkCudaErrors(cuCtxCreate(&cudaWorker->cuCtx, CU_CTX_SCHED_SPIN, cudaWorker->device));
-printf("cudaInit 3\n");
 //    if (cudaWorker->num_stream) {
 //        for (int i=0;i<cudaWorker->num_stream;i++)
 //            checkCudaErrors(cuStreamCreate(&cudaWorker->stream[i],0));
@@ -58,7 +53,6 @@
     CUdeviceptr devA;
     checkCudaErrors(cuMemAlloc(&devA, 16));
 
-printf("cudaInit done\n");
 }
 
 static void start_CUDAworker(Worker* worker) {
--- a/src/parallel_execution/TaskManagerImpl.cbc	Wed Feb 15 16:25:23 2017 +0900
+++ b/src/parallel_execution/TaskManagerImpl.cbc	Wed Feb 15 16:28:25 2017 +0900
@@ -22,8 +22,6 @@
     taskManagerImpl -> numWorker = taskManager->maxCPU;
     createWorkers(context, taskManager, taskManagerImpl);
     taskManager->taskManager = (union Data*)taskManagerImpl;
-printf ("create taskManagerImpl %p workers %p\n",taskManagerImpl, taskManagerImpl->workers);
-printf ("create taskManager %p\n",taskManager);
     return taskManager;
 }
 
@@ -38,10 +36,7 @@
 #ifdef USE_CUDAWorker
         Queue* queue = createSynchronizedQueue(context);
         // taskManagerImpl->workers[i] = (Worker*)createCUDAWorker(context, i, queue,0);
-printf("createWorkers q %p\n", queue );
         taskManagerImpl->workers[i] = (Worker*)queue;
-printf("createWorkers im %p\n", taskManagerImpl );
-printf ("createWorkers workers %p\n",taskManagerImpl->workers);
 #else
         Queue* queue = createSynchronizedQueue(context);
         taskManagerImpl->workers[i] = (Worker*)createCPUWorker(context, i, queue);
@@ -57,13 +52,10 @@
     TaskManager *t = (TaskManager *)taskManager->taskManager;
     TaskManagerImpl *im = (TaskManagerImpl *)t->taskManager;
 
-printf ("createTask im %p 1 worker %p q %p \n",im, im->workers, im->workers[0]->tasks);
-
     taskManager->context = NEW(struct Context);
     initContext(taskManager->context);
     taskManager->context->taskManager = taskManager;
     struct Queue* tasks = im->workers[0]->tasks;
-printf ("createTask  q %p\n",tasks);
     goto meta(context, C_setWorker);
 }
 
@@ -81,7 +73,6 @@
 }
 
 __code spawnTaskManager(struct TaskManagerImpl* taskManager, struct Queue* queue, struct Context* task, __code next(...)) {
-printf ("2 %p\n",taskManager->workers[0]->tasks);
     if (task->idgCount == 0) {
         // enqueue activeQueue
         queue->queue = (union Data*)taskManager->activeQueue;
@@ -96,7 +87,6 @@
 
 __code spawnTaskManager_stub(struct Context* context) {
     TaskManagerImpl* taskManager = (TaskManagerImpl*)GearImpl(context, TaskManager, taskManager);
-printf ("3 %p\n",taskManager->workers[0]->tasks);
     pthread_mutex_lock(&taskManager->mutex);
     goto spawnTaskManager(context,
                           taskManager,
@@ -126,7 +116,6 @@
 __code taskSend1(struct TaskManagerImpl* taskManager, struct Queue* queue, struct Context* task, __code next(...)) {
     struct Queue* tasks = taskManager->workers[task->workerId]->tasks;
     queue->queue = (union Data*)tasks;
-printf("taskSend1 workerid %d %p workers %p q %p \n" , task->workerId, taskManager,  taskManager->workers, queue->queue);
     queue->data = (union Data*)task;
     queue->next = next;
     goto meta(context, tasks->put);
--- a/src/parallel_execution/main.cbc	Wed Feb 15 16:25:23 2017 +0900
+++ b/src/parallel_execution/main.cbc	Wed Feb 15 16:28:25 2017 +0900
@@ -43,9 +43,6 @@
 #ifdef USE_CUDAWorker
     while(! cuda_initialized) {};
 #endif
-TaskManager *t = taskManager->taskManager;
-TaskManagerImpl *im = (TaskManagerImpl*)t->taskManager;
-printf("cuda initialized. TaskMangerImpl %p workers %p q %p\n", im, im->workers, im->workers[0]->tasks);
     goto meta(context, C_createTask1);
 }
 
@@ -63,7 +60,6 @@
     TaskManager *t = (TaskManager*)taskManager->taskManager;
     TaskManagerImpl *im = (TaskManagerImpl*)t->taskManager;
     struct Queue *q = (Queue *)im->workers[0];
-printf("init TaskManagerImpl %p workers %p q %p \n",im, im->workers, q);
     createCUDAWorker(context,0,q, im);
     pthread_join(thread,0);
     exit(0);
@@ -110,10 +106,6 @@
 __code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager) {
     int i = loopCounter->i;
 
-TaskManager* t = (TaskManager*)taskManager->taskManager;
-TaskManagerImpl* im = (TaskManagerImpl*)t->taskManager;
-printf("createTask1 %p->workers %p\n", im, im->workers);
-
     if ((length/split*i) < length) {
         taskManager->next = C_createTask2;
         goto meta(context, taskManager->taskManager->TaskManager.createTask);
@@ -148,9 +140,6 @@
     task->maxOdg = task->odg;
     taskManager->next = C_createTask1;
     loopCounter->i++;
-TaskManager* t = (TaskManager*)taskManager->taskManager;
-TaskManagerImpl* im = (TaskManagerImpl*)t->taskManager;
-printf("im %p->workers %p\n", im, im->workers);
     goto meta(context, taskManager->taskManager->TaskManager.spawn);
 }