Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/lamont/src/compiler/c-target/fragments/par-kdtree.in
ViewVC logotype

Diff of /branches/lamont/src/compiler/c-target/fragments/par-kdtree.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2564, Wed Mar 12 16:39:20 2014 UTC revision 2565, Thu Mar 13 16:08:44 2014 UTC
# Line 89  Line 89 
89    
90          SpatialWorkerArgs_t * retWorker = 0;          SpatialWorkerArgs_t * retWorker = 0;
91          pthread_mutex_lock (&sched->lock);          pthread_mutex_lock (&sched->lock);
92                   for(int i = sched->nextWorker; i < sched->numWorkers-1; i++){                   for(int i = sched->nextWorker; i < sched->numWorkers; i++){
93                                  if(sched->workerData[i].isIdle){                                  if(sched->workerData[i].isIdle){
94                                           sched->workerData[i].isIdle = false;                                           sched->workerData[i].isIdle = false;
95                                           sched->workerData[i].data = nodeData;                                           sched->workerData[i].data = nodeData;
# Line 98  Line 98 
98                                          retWorker = &sched->workerData[i];                                          retWorker = &sched->workerData[i];
99                                          pthread_cond_signal (&sched->workerData[i].runWait);                                          pthread_cond_signal (&sched->workerData[i].runWait);
100                                          sched->nextWorker++;                                          sched->nextWorker++;
101                                          if(sched->nextWorker == sched->numWorkers-2)                                          if(sched->nextWorker == sched->numWorkers-1)
102                                                  sched->nextWorker = 0;                                                  sched->nextWorker = 0;
103                                          break;                                          break;
104                                  }                                  }
# Line 336  Line 336 
336          }          }
337          return newNode;          return newNode;
338  }  }
339  /* Debugging purpoes  //Debugging purpoes
340  void printTree(KDNode_t* newNode){  void printTree(KDNode_t* newNode){
341          if(newNode != NULL){          if(newNode != NULL){
342                  printf("id=%d\n",newNode->strandId);                  printf("id=%d\n",newNode->strandId);
343                  printTree(newNode->right);                  printTree(newNode->right);
344                  printTree(newNode->left);                  printTree(newNode->left);
345          }          }
346  }*/  }
   
347  void Diderot_KDTree_Build(@PREFIX@World_t *wrld, uint32_t id, double * spatialTotalTime)  void Diderot_KDTree_Build(@PREFIX@World_t *wrld, uint32_t id, double * spatialTotalTime)
348  {  {
349      SpatialScheduler_t * sched  =  wrld->spatialSched;      SpatialScheduler_t * sched  =  wrld->spatialSched;
# Line 358  Line 357 
357      Diderot_KDTree_PoolClear(tree);      Diderot_KDTree_PoolClear(tree);
358      tree->root = Diderot_KDTree_BuildHelper(wrld, wrld->spatialSched,0,*(tree->numOfStrands),0);      tree->root = Diderot_KDTree_BuildHelper(wrld, wrld->spatialSched,0,*(tree->numOfStrands),0);
359      wrld->spatialSched->buildIsDone=true;      wrld->spatialSched->buildIsDone=true;
360          for(unsigned int i = 0; i < sched->numWorkers-1; i++){          for(unsigned int i = 0; i < sched->numWorkers; i++){
361                   pthread_cond_signal (&sched->workerData[i].runWait);                   pthread_cond_signal (&sched->workerData[i].runWait);
362          }          }
363            //printTree(tree->root);
364            sched->numWorkers+= 1;
365          *(spatialTotalTime) = *(spatialTotalTime) + (airTime() - spatialT0);          *(spatialTotalTime) = *(spatialTotalTime) + (airTime() - spatialT0);
366  }  }
367  void Diderot_KDTree_Init(@PREFIX@World_t *wrld)  void Diderot_KDTree_Init(@PREFIX@World_t *wrld)

Legend:
Removed from v.2564  
changed lines
  Added in v.2565

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0