commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r8015 - in gnuradio/branches/developers/eb/gcell-wip2/


From: eb
Subject: [Commit-gnuradio] r8015 - in gnuradio/branches/developers/eb/gcell-wip2/src: apps lib lib/spu
Date: Thu, 13 Mar 2008 16:54:40 -0600 (MDT)

Author: eb
Date: 2008-03-13 16:54:38 -0600 (Thu, 13 Mar 2008)
New Revision: 8015

Added:
   gnuradio/branches/developers/eb/gcell-wip2/src/apps/benchmark_dma_no_reuse.cc
Modified:
   gnuradio/branches/developers/eb/gcell-wip2/src/apps/
   gnuradio/branches/developers/eb/gcell-wip2/src/apps/Makefile.am
   gnuradio/branches/developers/eb/gcell-wip2/src/apps/benchmark_dma.cc
   gnuradio/branches/developers/eb/gcell-wip2/src/apps/benchmark_nop.cc
   gnuradio/branches/developers/eb/gcell-wip2/src/lib/gc_job_manager.cc
   gnuradio/branches/developers/eb/gcell-wip2/src/lib/gc_job_manager_impl.cc
   gnuradio/branches/developers/eb/gcell-wip2/src/lib/gc_job_manager_impl.h
   gnuradio/branches/developers/eb/gcell-wip2/src/lib/spu/gc_main.c
Log:
work-in-progress.  Will pick up the useful pieces and merge into
gcell-wip after the smoke clears.



Property changes on: gnuradio/branches/developers/eb/gcell-wip2/src/apps
___________________________________________________________________
Name: svn:ignore
   - Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
test_all
benchmark_nop
benchmark_dma

   + Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
test_all
benchmark_nop
benchmark_dma
benchmark_dma_no_reuse


Modified: gnuradio/branches/developers/eb/gcell-wip2/src/apps/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip2/src/apps/Makefile.am     
2008-03-13 18:04:03 UTC (rev 8014)
+++ gnuradio/branches/developers/eb/gcell-wip2/src/apps/Makefile.am     
2008-03-13 22:54:38 UTC (rev 8015)
@@ -33,6 +33,7 @@
 bin_PROGRAMS = \
        test_all \
        benchmark_dma \
+       benchmark_dma_no_reuse \
        benchmark_nop
 
 
@@ -42,5 +43,8 @@
 benchmark_dma_SOURCES = benchmark_dma.cc
 benchmark_dma_LDADD = spu/benchmark_procs $(LIBGCELL) -lmblock
 
+benchmark_dma_no_reuse_SOURCES = benchmark_dma_no_reuse.cc
+benchmark_dma_no_reuse_LDADD = spu/benchmark_procs $(LIBGCELL) -lmblock
+
 benchmark_nop_SOURCES = benchmark_nop.cc
 benchmark_nop_LDADD = spu/benchmark_procs $(LIBGCELL) -lmblock

Modified: gnuradio/branches/developers/eb/gcell-wip2/src/apps/benchmark_dma.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip2/src/apps/benchmark_dma.cc        
2008-03-13 18:04:03 UTC (rev 8014)
+++ gnuradio/branches/developers/eb/gcell-wip2/src/apps/benchmark_dma.cc        
2008-03-13 22:54:38 UTC (rev 8015)
@@ -19,6 +19,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#if defined(HAVE_CONFIG_H)
+#include <config.h>
+#endif
 #include "gc_job_manager.h"
 #include "mb_time.h"
 #include <getopt.h>
@@ -92,7 +95,7 @@
 static void
 run_test(unsigned int nspes, unsigned int usecs, unsigned int dma_size, int 
getput_mask)
 {
-  static const int64_t TOTAL_SIZE_DMA = 5LL << 30;
+  //static const int64_t TOTAL_SIZE_DMA = 5LL << 30;
   static const int NJDS = 64;
   //unsigned int njobs = (unsigned int)(TOTAL_SIZE_DMA / dma_size);
   unsigned int njobs = NJDS * 16;
@@ -135,6 +138,10 @@
       gbi = 0;
 
     all_jds[i] = mgr->alloc_job_desc();
+    if (all_jds[i] == 0){
+      fprintf(stderr, "alloc_job_desc() returned 0.\n");
+      return;
+    }
     init_jd(all_jds[i], usecs, &getbuf[gbi], &putbuf[gbi], dma_size, 
getput_mask);
     gbi += dma_size;
   }
@@ -176,6 +183,10 @@
        }
        else {
          ncompleted++;
+         if (jds[ci][i]->status != JS_OK){
+           printf("js_status = %d, job_id = %d, ncompleted = %d\n",
+                  jds[ci][i]->status, jds[ci][i]->sys.job_id, ncompleted);
+         }
          // printf("ncompleted = %7d\n", ncompleted);
          if (nsubmitted < njobs){                  // submit another one
            if (mgr->submit_job(jds[ci][i])){

Copied: 
gnuradio/branches/developers/eb/gcell-wip2/src/apps/benchmark_dma_no_reuse.cc 
(from rev 7995, 
gnuradio/branches/developers/eb/gcell-wip2/src/apps/benchmark_dma.cc)
===================================================================
--- 
gnuradio/branches/developers/eb/gcell-wip2/src/apps/benchmark_dma_no_reuse.cc   
                            (rev 0)
+++ 
gnuradio/branches/developers/eb/gcell-wip2/src/apps/benchmark_dma_no_reuse.cc   
    2008-03-13 22:54:38 UTC (rev 8015)
@@ -0,0 +1,286 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#if defined(HAVE_CONFIG_H)
+#include <config.h>
+#endif
+#include "gc_job_manager.h"
+#include "mb_time.h"
+#include <getopt.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <boost/scoped_array.hpp>
+#include <assert.h>
+
+// handle to embedded SPU executable that contains benchmark routines
+// (The name of the variable (benchmark_procs) is the name of the spu 
executable.)
+extern spe_program_handle_t benchmark_procs;
+
+static gc_proc_id_t gcp_benchmark_udelay = GCP_UNKNOWN_PROC;
+
+#define        BENCHMARK_PUT           0x1
+#define        BENCHMARK_GET           0x2
+#define        BENCHMARK_GET_PUT       (BENCHMARK_PUT|BENCHMARK_GET)
+
+
+#if 0
+static bool
+power_of_2_p(unsigned long x)
+{
+  int nbits = sizeof(x) * 8;
+  for (int i = 0; i < nbits; i++)
+    if (x == (1UL << i))
+      return true;
+
+  return false;
+}
+#endif
+
+static void
+init_jd(gc_job_desc *jd, unsigned int usecs,
+       unsigned char *getbuf, unsigned char *putbuf, size_t buflen,
+       int getput_mask)
+{
+  jd->proc_id = gcp_benchmark_udelay;
+  jd->input.nargs = 1;
+  jd->input.arg[0].u32 = usecs;
+  jd->output.nargs = 0;
+
+  switch(getput_mask & BENCHMARK_GET_PUT){
+
+  case BENCHMARK_GET:
+    jd->eaa.nargs = 1;
+    jd->eaa.arg[0].direction = GCJD_DMA_GET;
+    jd->eaa.arg[0].ea_addr = ptr_to_ea(getbuf);
+    jd->eaa.arg[0].get_size = buflen;
+    break;
+
+  case BENCHMARK_PUT:
+    jd->eaa.nargs = 1;
+    jd->eaa.arg[0].direction = GCJD_DMA_PUT;
+    jd->eaa.arg[0].ea_addr = ptr_to_ea(putbuf);
+    jd->eaa.arg[0].put_size = buflen;
+    break;
+    
+  case BENCHMARK_GET_PUT:
+    jd->eaa.nargs = 2;
+    jd->eaa.arg[0].direction = GCJD_DMA_GET;
+    jd->eaa.arg[0].ea_addr = ptr_to_ea(getbuf);
+    jd->eaa.arg[0].get_size = buflen;
+    jd->eaa.arg[1].direction = GCJD_DMA_PUT;
+    jd->eaa.arg[1].ea_addr = ptr_to_ea(putbuf);
+    jd->eaa.arg[1].put_size = buflen;
+    break;
+  }
+}
+
+static void
+run_test(unsigned int nspes, unsigned int usecs, unsigned int dma_size, int 
getput_mask)
+{
+  //static const int64_t TOTAL_SIZE_DMA = 5LL << 30;
+  static const int NJDS = 64;
+  //unsigned int njobs = (unsigned int)(TOTAL_SIZE_DMA / dma_size);
+  unsigned int njobs = NJDS * 16;
+  unsigned int nsubmitted = 0;
+  unsigned int ncompleted = 0;
+  gc_job_desc *all_jds[njobs];
+  unsigned int ai;             // all index
+  gc_job_desc *jds[2][NJDS];
+  unsigned int njds[2];
+  unsigned int ci;             // current index
+  bool done[NJDS];
+  
+  static const unsigned int BUFSIZE = (32 << 10) * njobs;
+  unsigned char *getbuf = new unsigned char[BUFSIZE];
+  boost::scoped_array<unsigned char> _getbuf(getbuf);
+  unsigned char *putbuf = new unsigned char[BUFSIZE];
+  boost::scoped_array<unsigned char> _putbuf(putbuf);
+  int gbi = 0;
+
+  // touch all pages to force allocation now
+  for (unsigned int i = 0; i < BUFSIZE; i += 4096){
+    getbuf[i] = 0;
+    putbuf[i] = 0;
+  }
+
+  gc_jm_options opts;
+  opts.program_handle = &benchmark_procs;
+  opts.nspes = nspes;
+  opts.enable_logging = true;
+  opts.log2_nlog_entries = 13;
+  opts.max_jobs = njobs;
+  gc_job_manager *mgr = gc_make_job_manager(&opts);
+
+  if ((gcp_benchmark_udelay = mgr->lookup_proc("benchmark_udelay")) == 
GCP_UNKNOWN_PROC){
+    fprintf(stderr, "lookup_proc: failed to find \"benchmark_udelay\"\n");
+    return;
+  }
+
+  // allocate and init all job descriptors
+  for (unsigned int i = 0; i < njobs; i++){
+    if (gbi + dma_size > BUFSIZE)
+      gbi = 0;
+
+    all_jds[i] = mgr->alloc_job_desc();
+    if (all_jds[i] == 0){
+      fprintf(stderr, "alloc_job_desc() returned 0.\n");
+      return;
+    }
+    init_jd(all_jds[i], usecs, &getbuf[gbi], &putbuf[gbi], dma_size, 
getput_mask);
+    gbi += dma_size;
+  }
+
+  for (int iter = 0; iter < 1; iter++){
+
+    mb_time t_start = mb_time::time();
+
+    ai = 0;
+
+    nsubmitted = 0;
+    ncompleted = 0;
+
+    ci = 0;
+    njds[0] = 0;
+    njds[1] = 0;
+  
+    // submit the first batch
+    for (int i = 0; i < NJDS; i++){
+      if (mgr->submit_job(all_jds[ai])){
+       jds[ci][njds[ci]++] = all_jds[ai];
+       nsubmitted++;
+       ai++;
+       assert(ai <= njobs);
+      }
+      else {
+       printf("submit_job(jds[%d]) failed, status = %d\n",
+              i, all_jds[i]->status);
+      }
+    }
+  
+    while (ncompleted < njobs){
+      njds[ci^1] = 0;
+      int n = mgr->wait_jobs(njds[ci], jds[ci], done, GC_WAIT_ANY);
+      // printf("%2d\n", n);
+      if (n < 0){
+       fprintf(stderr, "mgr->wait_jobs failed\n");
+       break;
+      }
+      for (unsigned int i = 0; i < njds[ci]; i++){
+       if (!done[i]){  // remember for next iteration
+         jds[ci^1][njds[ci^1]++] = jds[ci][i];
+       }
+       else {
+         ncompleted++;
+         if (jds[ci][i]->status != JS_OK){
+           printf("js_status = %d, job_id = %d, ncompleted = %d\n",
+                  jds[ci][i]->status, jds[ci][i]->sys.job_id, ncompleted);
+         }
+         // printf("ncompleted = %7d\n", ncompleted);
+         if (nsubmitted < njobs){                  // submit another one
+           if (mgr->submit_job(all_jds[ai])){
+             jds[ci^1][njds[ci^1]++] = all_jds[ai];  // remember for next iter
+             nsubmitted++;
+             ai++;
+             assert(ai <= njobs);
+           }
+           else {
+             printf("submit_job(jds[%d]) failed, status = %d\n",
+                    i, jds[ci][i]->status);
+           }
+         }
+       }
+      }
+      ci ^= 1; // toggle current
+    }
+
+    assert(ai == njobs);
+
+    // stop timing
+    mb_time t_stop = mb_time::time();
+
+    double delta = (t_stop - t_start).double_time();
+    printf("nspes: %2d  udelay: %4d  elapsed_time: %7.3f  dma_size: %5d  
dma_throughput: %7.3e\n",
+          mgr->nspes(), usecs, delta, dma_size,
+          (double) njobs * dma_size / delta * (getput_mask == 
BENCHMARK_GET_PUT ? 2.0 : 1.0));
+
+  }
+
+  delete mgr;
+}
+
+static void
+usage()
+{
+  fprintf(stderr, "usage: benchmark_dma [-p] [-g] [-n <nspes>] [-u <udelay>] 
[-s <dma_size>]\n");
+  fprintf(stderr, "  you must specify one or both of -p (put) and -g (get)\n");
+}
+
+
+int
+main(int argc, char **argv)
+{
+  unsigned int nspes = 0;
+  unsigned int usecs = 0;
+  unsigned int dma_size = 32 << 10;
+  int getput_mask = 0;
+  int ch;
+
+  while ((ch = getopt(argc, argv, "n:u:s:pg")) != EOF){
+    switch(ch){
+    case 'n':
+      nspes = strtol(optarg, 0, 0);
+      break;
+
+    case 'u':
+      usecs = strtol(optarg, 0, 0);
+      break;
+
+    case 's':
+      dma_size = strtol(optarg, 0, 0);
+      if (dma_size == 0){
+       fprintf(stderr, "-s <dma_size> must be > 0\n");
+       return 1;
+      }
+      break;
+
+    case 'p':
+      getput_mask |= BENCHMARK_PUT;
+      break;
+
+    case 'g':
+      getput_mask |= BENCHMARK_GET;
+      break;
+      
+    case '?':
+    default:
+      usage();
+      return 1;
+    }
+  }
+
+  if (getput_mask == 0){
+    usage();
+    return 1;
+  }
+
+  run_test(nspes, usecs, dma_size, getput_mask);
+  return 0;
+}

Modified: gnuradio/branches/developers/eb/gcell-wip2/src/apps/benchmark_nop.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip2/src/apps/benchmark_nop.cc        
2008-03-13 18:04:03 UTC (rev 8014)
+++ gnuradio/branches/developers/eb/gcell-wip2/src/apps/benchmark_nop.cc        
2008-03-13 22:54:38 UTC (rev 8015)
@@ -19,6 +19,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#if defined(HAVE_CONFIG_H)
+#include <config.h>
+#endif
 #include "gc_job_manager.h"
 #include "mb_time.h"
 #include <getopt.h>

Modified: gnuradio/branches/developers/eb/gcell-wip2/src/lib/gc_job_manager.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip2/src/lib/gc_job_manager.cc        
2008-03-13 18:04:03 UTC (rev 8014)
+++ gnuradio/branches/developers/eb/gcell-wip2/src/lib/gc_job_manager.cc        
2008-03-13 22:54:38 UTC (rev 8015)
@@ -20,7 +20,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 #include "gc_job_manager.h"
 #include "gc_job_manager_impl.h"

Modified: 
gnuradio/branches/developers/eb/gcell-wip2/src/lib/gc_job_manager_impl.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip2/src/lib/gc_job_manager_impl.cc   
2008-03-13 18:04:03 UTC (rev 8014)
+++ gnuradio/branches/developers/eb/gcell-wip2/src/lib/gc_job_manager_impl.cc   
2008-03-13 22:54:38 UTC (rev 8015)
@@ -20,7 +20,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 #include <gc_job_manager_impl.h>
 #include <gc_mbox.h>
@@ -36,6 +36,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <assert.h>
 
 
 static const size_t CACHE_LINE_SIZE = 128;
@@ -129,8 +130,15 @@
     d_eh_cond(&d_eh_mutex), d_eh_thread(0), d_eh_state(EHS_INIT),
     d_shutdown_requested(false),
     d_client_thread(0), d_ea_args_maxsize(0),
-    d_proc_def(0), d_proc_def_ls_addr(0), d_nproc_defs(0)
+    d_proc_def(0), d_proc_def_ls_addr(0), d_nproc_defs(0),
+    d_log0(0), d_log1(0), d_log2(0)
 {
+  if (1){
+    d_log0 = fopen("log0.log", "w");
+    d_log1 = fopen("log1.log", "w");
+    d_log2 = fopen("log2.log", "w");
+  }
+
   if (!s_key_initialized){
     int r = pthread_key_create(&s_client_key, client_key_destructor);
     if (r != 0)
@@ -397,6 +405,7 @@
 inline void
 gc_job_manager_impl::bv_clr(unsigned long *bv, unsigned int bitno)
 {
+  assert(bitno < sizeof(unsigned long) * d_bvlen * 8);
   unsigned int wi = bitno / (sizeof (unsigned long) * 8);
   unsigned int bi = bitno & ((sizeof (unsigned long) * 8) - 1);
   bv[wi] &= ~(1UL << bi);
@@ -405,6 +414,7 @@
 inline void
 gc_job_manager_impl::bv_set(unsigned long *bv, unsigned int bitno)
 {
+  assert(bitno < sizeof(unsigned long) * d_bvlen * 8);
   unsigned int wi = bitno / (sizeof (unsigned long) * 8);
   unsigned int bi = bitno & ((sizeof (unsigned long) * 8) - 1);
   bv[wi] |= (1UL << bi);
@@ -413,6 +423,7 @@
 inline bool
 gc_job_manager_impl::bv_isset(unsigned long *bv, unsigned int bitno)
 {
+  assert(bitno < sizeof(unsigned long) * d_bvlen * 8);
   unsigned int wi = bitno / (sizeof (unsigned long) * 8);
   unsigned int bi = bitno & ((sizeof (unsigned long) * 8) - 1);
   return (bv[wi] & (1UL << bi)) != 0;
@@ -421,6 +432,7 @@
 inline bool
 gc_job_manager_impl::bv_isclr(unsigned long *bv, unsigned int bitno)
 {
+  assert(bitno < sizeof(unsigned long) * d_bvlen * 8);
   unsigned int wi = bitno / (sizeof (unsigned long) * 8);
   unsigned int bi = bitno & ((sizeof (unsigned long) * 8) - 1);
   return (bv[wi] & (1UL << bi)) == 0;
@@ -500,7 +512,7 @@
 bool
 gc_job_manager_impl::submit_job(gc_job_desc *jd)
 {
-  if (unlikely(d_shutdown_requested)){
+  if (d_shutdown_requested){
     jd->status = JS_SHUTTING_DOWN;
     return false;
   }
@@ -516,7 +528,7 @@
   
   gc_client_thread_info *cti =
     (gc_client_thread_info *) pthread_getspecific(s_client_key);
-  if (unlikely(cti == 0)){
+  if (cti == 0){
     if ((cti = alloc_cti()) == 0){
       fprintf(stderr, "gc_job_manager_impl::submit_job: Too many client 
threads.\n");
       jd->status = JS_TOO_MANY_CLIENTS;
@@ -566,21 +578,28 @@
                               bool done[],
                               gc_wait_mode mode)
 {
+  assert(mode == GC_WAIT_ANY || mode == GC_WAIT_ALL);
+
   unsigned int i;
 
   gc_client_thread_info *cti =
     (gc_client_thread_info *) pthread_getspecific(s_client_key);
-  if (unlikely(cti == 0))
+  if (cti == 0)
     return -1;
 
   for (i = 0; i < njobs; i++){
     done[i] = false;
-    if (unlikely(jd[i]->sys.client_id != cti->d_client_id)){
+    if (jd[i]->sys.client_id != cti->d_client_id){
       fprintf(stderr, "gc_job_manager_impl::wait_jobs: can't wait for a job 
you didn't submit\n");
       return -1;
     }
   }
 
+  if (njobs == 0){
+    fprintf(stderr, "wait_jobs: njobs == 0\n");
+    return 0;
+  }
+
   {
     omni_mutex_lock    l(cti->d_mutex);
 
@@ -603,6 +622,8 @@
          bv_clr(cti->d_jobs_done, jd[i]->sys.job_id);
          done[i] = true;
          ndone++;
+         fprintf(d_log2, "%d\n", jd[i]->sys.job_id);
+         fflush(d_log2);
        }
       }
 
@@ -815,6 +836,7 @@
   return a->client_id - b->client_id;
 }
 
+#if 1
 void
 gc_job_manager_impl::notify_clients_jobs_are_done(unsigned int spe_num,
                                                  unsigned int 
completion_info_idx)
@@ -825,6 +847,84 @@
 
   gc_comp_info_t *ci = &d_comp_info[2 * spe_num + (completion_info_idx & 0x1)];
 
+  if (1){
+    static int total_jobs;
+    static int total_msgs;
+    total_msgs++;
+    total_jobs += ci->ncomplete;
+    printf("ppe:     tj = %6d  tm = %6d\n", total_jobs, total_msgs);
+  }
+
+  for (unsigned int i = 0; i < ci->ncomplete; i++){
+    fprintf(d_log1, "%d\n", ci->job_id[i]);
+    fflush(d_log1);
+  }
+
+
+  // FIXME sort by client_id so we only have to lock & signal once / client
+
+  for (unsigned int i = 0; i < ci->ncomplete; i++){
+
+    unsigned int job_id = ci->job_id[i];
+
+    if (job_id >= d_options.max_jobs){
+      // internal error, shouldn't happen
+      fprintf(stderr,"%s: invalid job_id = %d\n", msg, job_id);
+      ci->in_use = 0;          // clear flag so SPE knows we're done with it
+      return;
+    }
+    gc_job_desc *jd = &d_jd[job_id];
+
+    if (jd->sys.client_id >= d_options.max_client_threads){
+      // internal error, shouldn't happen
+      fprintf(stderr, "%s: invalid client_id = %d\n", msg, jd->sys.client_id);
+      ci->in_use = 0;          // clear flag so SPE knows we're done with it
+      return;
+    }
+    gc_client_thread_info *cti = &d_client_thread[jd->sys.client_id];
+    {
+      // omni_mutex_lock       l(cti->d_mutex);
+      cti->d_mutex.lock();
+
+      // mark job done
+      assert(bv_isclr(cti->d_jobs_done, job_id));
+      bv_set(cti->d_jobs_done, job_id);
+
+      // FIXME we could/should distinguish between CT_WAIT_ALL & CT_WAIT_ANY
+
+      switch (cti->d_state){
+      case CT_WAIT_ANY:
+      case CT_WAIT_ALL:
+       //cti->d_cond.signal(); // wake client thread up FIXME use this one
+       cti->d_cond.broadcast(); // wake client thread up
+       break;
+
+      case CT_NOT_WAITING:
+       break;                  // nop
+
+      default:
+       assert(0);
+       break;     
+      }
+      cti->d_mutex.unlock();
+    }
+  }
+
+  ci->in_use = 0;              // clear flag so SPE knows we're done with it
+}
+
+#else
+
+void
+gc_job_manager_impl::notify_clients_jobs_are_done(unsigned int spe_num,
+                                                 unsigned int 
completion_info_idx)
+{
+  const char *msg = "gc_job_manager_impl::notify_client_job_is_done (INTERNAL 
ERROR)";
+
+  smp_rmb();  // order reads so we know that data sent from SPE is here
+
+  gc_comp_info_t *ci = &d_comp_info[2 * spe_num + (completion_info_idx & 0x1)];
+
   if (ci->ncomplete == 0){     // never happens, but ensures code below is 
correct
     ci->in_use = 0;
     return;
@@ -906,6 +1006,7 @@
 
   ci->in_use = 0;              // clear flag so SPE knows we're done with it
 }
+#endif
 
 void
 gc_job_manager_impl::handle_event(spe_event_unit_t *evt)

Modified: 
gnuradio/branches/developers/eb/gcell-wip2/src/lib/gc_job_manager_impl.h
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip2/src/lib/gc_job_manager_impl.h    
2008-03-13 18:04:03 UTC (rev 8014)
+++ gnuradio/branches/developers/eb/gcell-wip2/src/lib/gc_job_manager_impl.h    
2008-03-13 22:54:38 UTC (rev 8015)
@@ -31,7 +31,9 @@
 #include <vector>
 #include <boost/shared_ptr.hpp>
 #include <boost/scoped_array.hpp>
+#include <stdio.h>
 
+
 typedef boost::shared_ptr<spe_gang_context> spe_gang_context_sptr;
 typedef boost::shared_ptr<spe_program_handle_t> spe_program_handle_sptr;
 typedef boost::scoped_array<gc_client_thread_info> gc_client_thread_info_sa;
@@ -139,6 +141,10 @@
   uint32_t              d_proc_def_ls_addr;    // the LS address of the table
   int                   d_nproc_defs;          // number of proc_defs in table
 
+  FILE                 *d_log0;
+  FILE                 *d_log1;
+  FILE                 *d_log2;
+
   gc_client_thread_info *alloc_cti();
   void free_cti(gc_client_thread_info *cti);
 

Modified: gnuradio/branches/developers/eb/gcell-wip2/src/lib/spu/gc_main.c
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip2/src/lib/spu/gc_main.c    
2008-03-13 18:04:03 UTC (rev 8014)
+++ gnuradio/branches/developers/eb/gcell-wip2/src/lib/spu/gc_main.c    
2008-03-13 22:54:38 UTC (rev 8015)
@@ -535,11 +535,12 @@
 
  wrap_up:;     // semicolon creates null statement for C99 compliance
 
+#if 0
   // Copy job descriptor back out to EA.
   // (The dma will be waited on in flush_completion_info)
   int tag = ci_tags + ci_idx;                  // use the current completion 
tag
   mfc_put(jd, jd_ea, sizeof(*jd), tag, 0, 0);
-
+#endif
   
   // Tell PPE we're done with the job.
   //





reply via email to

[Prev in Thread] Current Thread [Next in Thread]