summaryrefslogtreecommitdiff
path: root/gcell/src/apps
diff options
context:
space:
mode:
Diffstat (limited to 'gcell/src/apps')
-rw-r--r--gcell/src/apps/Makefile.am47
-rw-r--r--gcell/src/apps/benchmark_dma.cc265
-rw-r--r--gcell/src/apps/benchmark_nop.cc162
-rwxr-xr-xgcell/src/apps/gen_script.py118
-rwxr-xr-xgcell/src/apps/plot_speedup.py121
-rw-r--r--gcell/src/apps/results-071223126
-rwxr-xr-xgcell/src/apps/split_and_avg_results.py101
-rw-r--r--gcell/src/apps/spu/Makefile.am32
-rw-r--r--gcell/src/apps/spu/benchmark_procs.c75
-rw-r--r--gcell/src/apps/test_all.cc38
10 files changed, 1085 insertions, 0 deletions
diff --git a/gcell/src/apps/Makefile.am b/gcell/src/apps/Makefile.am
new file mode 100644
index 0000000000..e8cbf3cfc7
--- /dev/null
+++ b/gcell/src/apps/Makefile.am
@@ -0,0 +1,47 @@
+#
+# 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.
+#
+
+include $(top_srcdir)/Makefile.common
+
+SUBDIRS = spu .
+
+AM_CPPFLAGS = $(DEFINES) $(OMNITHREAD_INCLUDES) $(MBLOCK_INCLUDES) \
+ $(GCELL_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
+
+
+GCELL_QA_LA = $(top_builddir)/gcell/src/lib/libgcell-qa.la
+
+TESTS = test_all
+
+
+bin_PROGRAMS = \
+ test_all \
+ benchmark_dma \
+ benchmark_nop
+
+
+test_all_SOURCES = test_all.cc
+test_all_LDADD = $(GCELL_QA_LA) $(GCELL_LA)
+
+benchmark_dma_SOURCES = benchmark_dma.cc
+benchmark_dma_LDADD = spu/benchmark_procs $(GCELL_LA) $(MBLOCK_LA)
+
+benchmark_nop_SOURCES = benchmark_nop.cc
+benchmark_nop_LDADD = spu/benchmark_procs $(GCELL_LA) $(MBLOCK_LA)
diff --git a/gcell/src/apps/benchmark_dma.cc b/gcell/src/apps/benchmark_dma.cc
new file mode 100644
index 0000000000..c3df3a91f0
--- /dev/null
+++ b/gcell/src/apps/benchmark_dma.cc
@@ -0,0 +1,265 @@
+/* -*- 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.
+ */
+
+#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[NJDS];
+ 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) * NJDS;
+ 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;
+ 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 (int i = 0; i < NJDS; i++){
+ if (gbi + dma_size > BUFSIZE)
+ gbi = 0;
+
+ all_jds[i] = mgr->alloc_job_desc();
+ 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();
+
+ 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[i])){
+ jds[ci][njds[ci]++] = all_jds[i];
+ nsubmitted++;
+ }
+ 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++;
+ // printf("ncompleted = %7d\n", ncompleted);
+ if (nsubmitted < njobs){ // submit another one
+ if (mgr->submit_job(jds[ci][i])){
+ jds[ci^1][njds[ci^1]++] = jds[ci][i]; // remember for next iter
+ nsubmitted++;
+ }
+ else {
+ printf("submit_job(jds[%d]) failed, status = %d\n",
+ i, jds[ci][i]->status);
+ }
+ }
+ }
+ }
+ ci ^= 1; // toggle current
+ }
+
+ // 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;
+}
diff --git a/gcell/src/apps/benchmark_nop.cc b/gcell/src/apps/benchmark_nop.cc
new file mode 100644
index 0000000000..7ef3f636ef
--- /dev/null
+++ b/gcell/src/apps/benchmark_nop.cc
@@ -0,0 +1,162 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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.
+ */
+
+#include "gc_job_manager.h"
+#include "mb_time.h"
+#include <getopt.h>
+#include <stdlib.h>
+#include <stdio.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;
+
+static void
+init_jd(gc_job_desc *jd, unsigned int usecs)
+{
+ jd->proc_id = gcp_benchmark_udelay;
+ jd->input.nargs = 1;
+ jd->input.arg[0].u32 = usecs;
+ jd->output.nargs = 0;
+ jd->eaa.nargs = 0;
+}
+
+static void
+run_test(unsigned int nspes, unsigned int usecs, int njobs)
+{
+ static const int NJDS = 64;
+ int nsubmitted = 0;
+ int ncompleted = 0;
+ gc_job_desc *all_jds[NJDS];
+ gc_job_desc *jds[2][NJDS];
+ unsigned int njds[2];
+ unsigned int ci; // current index
+ bool done[NJDS];
+
+ gc_jm_options opts;
+ opts.program_handle = &benchmark_procs;
+ opts.nspes = nspes;
+ opts.gang_schedule = true;
+ 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 (int i = 0; i < NJDS; i++){
+ all_jds[i] = mgr->alloc_job_desc();
+ init_jd(all_jds[i], usecs);
+ }
+
+ mb_time t_start = mb_time::time();
+
+ 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[i])){
+ jds[ci][njds[ci]++] = all_jds[i];
+ nsubmitted++;
+ }
+ 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++;
+ // printf("ncompleted = %7d\n", ncompleted);
+ if (nsubmitted < njobs){ // submit another one
+ if (mgr->submit_job(jds[ci][i])){
+ jds[ci^1][njds[ci^1]++] = jds[ci][i]; // remember for next iter
+ nsubmitted++;
+ }
+ else {
+ printf("submit_job(jds[%d]) failed, status = %d\n",
+ i, jds[ci][i]->status);
+ }
+ }
+ }
+ }
+ ci ^= 1; // toggle current
+ }
+
+ // 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 njobs: %g speedup: %6.3f\n",
+ mgr->nspes(), usecs, delta, (double) njobs,
+ njobs * usecs * 1e-6 / delta);
+
+ delete mgr;
+}
+
+int
+main(int argc, char **argv)
+{
+ unsigned int nspes = 0;
+ unsigned int usecs = 0;
+ int njobs = 500000;
+ int ch;
+
+ while ((ch = getopt(argc, argv, "n:u:N:")) != EOF){
+ switch(ch){
+ case 'n':
+ nspes = strtol(optarg, 0, 0);
+ break;
+
+ case 'u':
+ usecs = strtol(optarg, 0, 0);
+ break;
+
+ case 'N':
+ njobs = strtol(optarg, 0, 0);
+ break;
+
+ case '?':
+ default:
+ fprintf(stderr, "usage: benchmark_nop [-n <nspes>] [-u <udelay>] [-N <njobs>]\n");
+ return 1;
+ }
+ }
+
+ run_test(nspes, usecs, njobs);
+ return 0;
+}
diff --git a/gcell/src/apps/gen_script.py b/gcell/src/apps/gen_script.py
new file mode 100755
index 0000000000..e4bbc74807
--- /dev/null
+++ b/gcell/src/apps/gen_script.py
@@ -0,0 +1,118 @@
+#!/usr/bin/env python
+
+import sys
+import time
+import os
+
+from optparse import OptionParser
+
+
+def get_svn_rev():
+ try:
+ f = os.popen("svn info", "r")
+ lines = f.readlines()
+ f.close()
+ except:
+ return "unk"
+
+ svn_rev = "unk"
+ for l in lines:
+ if l.startswith('Revision:'):
+ t = l.rstrip()
+ svn_rev = t.split()[-1]
+ return svn_rev
+
+def is_ps3():
+ try:
+ f = open("/proc/cpuinfo")
+ s = f.read()
+ except:
+ return False
+
+ return s.find('PS3') != -1
+
+
+def main():
+
+ def make_fname(suffix):
+ return basename + '.' + suffix
+
+ max_spes_default = 16
+ if is_ps3():
+ max_spes_default = 6
+
+ parser = OptionParser()
+ parser.add_option("-m", "--max-spes", type="int", default=max_spes_default,
+ metavar="NSPES",
+ help="maximum number of SPEs to use [default=%default]")
+ parser.add_option("", "--min-spes", type="int", default=1,
+ metavar="NSPES",
+ help="minimum number of SPEs to use [default=%default]")
+ parser.add_option("-p", "--oprofile", action="store_true", default=False,
+ help="emit oprofile commands")
+ parser.add_option("-t", "--tag", default=None,
+ help="additional goodie in generated filenames")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ sys.exit(1)
+
+ svn_rev = get_svn_rev()
+
+ os.environ['TZ'] = 'PST8PDT' # always pacific
+ time.tzset()
+
+ tag = ''
+ if options.tag:
+ tag = '-' + options.tag
+
+ basename = 'R-%s%s-%s' % (svn_rev, tag, time.strftime('%Y%m%d-%H%M'))
+
+ base_njobs = int(500e3)
+ njobs = {
+ 1 : base_njobs,
+ 10 : base_njobs,
+ 50 : base_njobs,
+ 100 : base_njobs,
+ 200 : int(base_njobs/2),
+ 250 : int(base_njobs/2.5),
+ 300 : int(base_njobs/3),
+ 400 : int(base_njobs/4),
+ 500 : int(base_njobs/5)
+ }
+
+
+ f_results = make_fname('results')
+ f_opreport = make_fname('opreport')
+ f_avg = make_fname('avg')
+ f_png = make_fname('png')
+
+ f = sys.stdout
+ f.write("#!/bin/bash\n")
+
+ if options.oprofile:
+ f.write("opcontrol --stop\n")
+ f.write("opcontrol --reset\n")
+ f.write("opcontrol --start\n")
+
+ f.write("(\n")
+
+ for udelay in (10, 50, 100, 200, 300):
+ for nspes in range(options.min_spes, options.max_spes+1):
+ cmd = "./benchmark_nop -n %d -u %d -N %d\n" % (nspes, udelay, njobs[udelay])
+ f.write(cmd)
+ f.write(cmd)
+
+ f.write(") | tee %s\n" % (f_results,))
+
+ if options.oprofile:
+ f.write("opcontrol --dump\n")
+ f.write("opcontrol --stop\n")
+ f.write("opreport -l | head -100 > %s\n" % (f_opreport,))
+
+ f.write("./split_and_avg_results.py %s > %s\n" % (f_results, f_avg))
+ f.write("./plot_speedup.py %s -o %s\n" % (f_avg, f_png))
+
+
+if __name__ == '__main__':
+ main()
diff --git a/gcell/src/apps/plot_speedup.py b/gcell/src/apps/plot_speedup.py
new file mode 100755
index 0000000000..96277f85ca
--- /dev/null
+++ b/gcell/src/apps/plot_speedup.py
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+
+from optparse import OptionParser
+from pylab import *
+from pprint import pprint
+import os.path
+
+
+def add_entry(d, nspes, speedup, work_incr):
+ if d.has_key(work_incr):
+ d[work_incr].append((nspes, speedup))
+ else:
+ d[work_incr] = [(nspes, speedup)]
+
+def parse_file(f):
+ d = {}
+ for line in f:
+ items = [float(x) for x in line.split()]
+ # print "items =", items
+ nspes = items[0]
+ work_incr = int(1e6 * items[1])
+ speedup = items[4]
+ add_entry(d, nspes, speedup, work_incr)
+ return d
+
+
+class plot_data(object):
+ def __init__(self, filenames, output_filename):
+ self.fig = figure(1, figsize=(8, 6), facecolor='w')
+ self.sp = self.fig.add_subplot(1,1,1)
+ self.sp.set_xlabel("nspes", fontweight="bold")
+ self.sp.set_ylabel("speedup", fontweight="bold")
+ self.sp.grid(True)
+ # print 'rcParams["legend.fontsize"] =', rcParams["legend.fontsize"]
+ rcParams["legend.fontsize"] = 10
+
+
+ self.markers = {
+ 10 : 'o',
+ 50 : 's',
+ 100 : '^',
+ 200 : 'D',
+ 300 : 'v',
+ 400 : '>',
+ 500 : 'h'
+ }
+
+ if len(filenames) == 1:
+ f = filenames[0]
+ d = parse_file(open(f))
+ self.make_single_plot(d, f)
+
+ else:
+ for f in filenames:
+ d = parse_file(open(f))
+ self.make_plot(d, f, f == filenames[0])
+
+ if output_filename:
+ savefig(output_filename)
+ else:
+ show()
+
+
+ def make_single_plot(self, d, filename):
+ def style(k):
+ return self.markers[k]
+
+ tag, ext = os.path.splitext(os.path.basename(filename))
+ title(tag)
+ keys = d.keys()
+ keys.sort()
+ keys.reverse()
+ for k in keys:
+ vlist = d[k] # list of 2-tuples
+ xs = [v[0] for v in vlist]
+ ys = [v[1] for v in vlist]
+ plot(xs, ys, style(k), label="%d us" % (k,))
+
+ x = legend(loc=2)
+
+ def make_plot(self, d, filename, first):
+ def style(k):
+ if first:
+ return self.markers[k]
+ else:
+ return 'k' + self.markers[k]
+
+ tag, ext = os.path.splitext(os.path.basename(filename))
+ keys = d.keys()
+ keys.sort()
+ keys.reverse()
+ for k in keys:
+ vlist = d[k] # list of 2-tuples
+ xs = [v[0] for v in vlist]
+ ys = [v[1] for v in vlist]
+ plot(xs, ys, style(k), label="%s %d us" % (tag, k))
+
+ x = legend(loc=2)
+
+def main():
+ usage="%prog: [options] input_filename..."
+ description = "Plot R*.avg files from benchmark_nop.py"
+ parser = OptionParser(usage=usage, description=description)
+ parser.add_option('-o', '--output', default=None, metavar="FILE",
+ help="generate .png file")
+ (options, args) = parser.parse_args()
+ if len(args) < 1:
+ parser.print_help()
+ raise SystemExit, 1
+
+ filenames = args
+ dc = plot_data(filenames, options.output)
+
+
+
+if __name__ == '__main__':
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gcell/src/apps/results-071223 b/gcell/src/apps/results-071223
new file mode 100644
index 0000000000..2716171215
--- /dev/null
+++ b/gcell/src/apps/results-071223
@@ -0,0 +1,126 @@
+nspes: 1 udelay: 1 elapsed_time: 26.117 njobs: 1e+06 us/job: 26.117
+nspes: 1 udelay: 1 elapsed_time: 26.058 njobs: 1e+06 us/job: 26.058
+nspes: 1 udelay: 1 elapsed_time: 26.737 njobs: 1e+06 us/job: 26.737
+nspes: 2 udelay: 1 elapsed_time: 23.585 njobs: 1e+06 us/job: 23.585
+nspes: 2 udelay: 1 elapsed_time: 21.958 njobs: 1e+06 us/job: 21.958
+nspes: 2 udelay: 1 elapsed_time: 21.034 njobs: 1e+06 us/job: 21.034
+nspes: 3 udelay: 1 elapsed_time: 25.819 njobs: 1e+06 us/job: 25.819
+nspes: 3 udelay: 1 elapsed_time: 23.719 njobs: 1e+06 us/job: 23.719
+nspes: 3 udelay: 1 elapsed_time: 21.711 njobs: 1e+06 us/job: 21.711
+nspes: 4 udelay: 1 elapsed_time: 20.210 njobs: 1e+06 us/job: 20.210
+nspes: 4 udelay: 1 elapsed_time: 20.558 njobs: 1e+06 us/job: 20.558
+nspes: 4 udelay: 1 elapsed_time: 20.957 njobs: 1e+06 us/job: 20.957
+nspes: 5 udelay: 1 elapsed_time: 24.571 njobs: 1e+06 us/job: 24.571
+nspes: 5 udelay: 1 elapsed_time: 20.207 njobs: 1e+06 us/job: 20.207
+nspes: 5 udelay: 1 elapsed_time: 21.976 njobs: 1e+06 us/job: 21.976
+nspes: 6 udelay: 1 elapsed_time: 22.601 njobs: 1e+06 us/job: 22.601
+nspes: 6 udelay: 1 elapsed_time: 18.794 njobs: 1e+06 us/job: 18.794
+nspes: 6 udelay: 1 elapsed_time: 19.755 njobs: 1e+06 us/job: 19.755
+nspes: 1 udelay: 5 elapsed_time: 28.047 njobs: 1e+06 us/job: 28.047
+nspes: 1 udelay: 5 elapsed_time: 27.265 njobs: 1e+06 us/job: 27.265
+nspes: 1 udelay: 5 elapsed_time: 27.555 njobs: 1e+06 us/job: 27.555
+nspes: 2 udelay: 5 elapsed_time: 21.130 njobs: 1e+06 us/job: 21.130
+nspes: 2 udelay: 5 elapsed_time: 21.067 njobs: 1e+06 us/job: 21.067
+nspes: 2 udelay: 5 elapsed_time: 21.607 njobs: 1e+06 us/job: 21.607
+nspes: 3 udelay: 5 elapsed_time: 23.712 njobs: 1e+06 us/job: 23.712
+nspes: 3 udelay: 5 elapsed_time: 23.658 njobs: 1e+06 us/job: 23.658
+nspes: 3 udelay: 5 elapsed_time: 25.277 njobs: 1e+06 us/job: 25.277
+nspes: 4 udelay: 5 elapsed_time: 22.264 njobs: 1e+06 us/job: 22.264
+nspes: 4 udelay: 5 elapsed_time: 20.970 njobs: 1e+06 us/job: 20.970
+nspes: 4 udelay: 5 elapsed_time: 21.533 njobs: 1e+06 us/job: 21.533
+nspes: 5 udelay: 5 elapsed_time: 21.504 njobs: 1e+06 us/job: 21.504
+nspes: 5 udelay: 5 elapsed_time: 21.956 njobs: 1e+06 us/job: 21.956
+nspes: 5 udelay: 5 elapsed_time: 21.333 njobs: 1e+06 us/job: 21.333
+nspes: 6 udelay: 5 elapsed_time: 20.639 njobs: 1e+06 us/job: 20.639
+nspes: 6 udelay: 5 elapsed_time: 23.022 njobs: 1e+06 us/job: 23.022
+nspes: 6 udelay: 5 elapsed_time: 22.453 njobs: 1e+06 us/job: 22.453
+nspes: 1 udelay: 10 elapsed_time: 27.780 njobs: 1e+06 us/job: 27.780
+nspes: 1 udelay: 10 elapsed_time: 27.683 njobs: 1e+06 us/job: 27.683
+nspes: 1 udelay: 10 elapsed_time: 26.803 njobs: 1e+06 us/job: 26.803
+nspes: 2 udelay: 10 elapsed_time: 20.878 njobs: 1e+06 us/job: 20.878
+nspes: 2 udelay: 10 elapsed_time: 22.430 njobs: 1e+06 us/job: 22.430
+nspes: 2 udelay: 10 elapsed_time: 20.952 njobs: 1e+06 us/job: 20.952
+nspes: 3 udelay: 10 elapsed_time: 22.752 njobs: 1e+06 us/job: 22.752
+nspes: 3 udelay: 10 elapsed_time: 24.294 njobs: 1e+06 us/job: 24.294
+nspes: 3 udelay: 10 elapsed_time: 23.935 njobs: 1e+06 us/job: 23.935
+nspes: 4 udelay: 10 elapsed_time: 20.437 njobs: 1e+06 us/job: 20.437
+nspes: 4 udelay: 10 elapsed_time: 21.498 njobs: 1e+06 us/job: 21.498
+nspes: 4 udelay: 10 elapsed_time: 20.521 njobs: 1e+06 us/job: 20.521
+nspes: 5 udelay: 10 elapsed_time: 22.704 njobs: 1e+06 us/job: 22.704
+nspes: 5 udelay: 10 elapsed_time: 21.106 njobs: 1e+06 us/job: 21.106
+nspes: 5 udelay: 10 elapsed_time: 22.800 njobs: 1e+06 us/job: 22.800
+nspes: 6 udelay: 10 elapsed_time: 21.098 njobs: 1e+06 us/job: 21.098
+nspes: 6 udelay: 10 elapsed_time: 22.749 njobs: 1e+06 us/job: 22.749
+nspes: 6 udelay: 10 elapsed_time: 19.651 njobs: 1e+06 us/job: 19.651
+nspes: 1 udelay: 50 elapsed_time: 54.621 njobs: 1e+06 us/job: 54.621
+nspes: 1 udelay: 50 elapsed_time: 54.548 njobs: 1e+06 us/job: 54.548
+nspes: 1 udelay: 50 elapsed_time: 54.641 njobs: 1e+06 us/job: 54.641
+nspes: 2 udelay: 50 elapsed_time: 30.837 njobs: 1e+06 us/job: 30.837
+nspes: 2 udelay: 50 elapsed_time: 30.933 njobs: 1e+06 us/job: 30.933
+nspes: 2 udelay: 50 elapsed_time: 30.044 njobs: 1e+06 us/job: 30.044
+nspes: 3 udelay: 50 elapsed_time: 24.170 njobs: 1e+06 us/job: 24.170
+nspes: 3 udelay: 50 elapsed_time: 23.798 njobs: 1e+06 us/job: 23.798
+nspes: 3 udelay: 50 elapsed_time: 23.515 njobs: 1e+06 us/job: 23.515
+nspes: 4 udelay: 50 elapsed_time: 23.011 njobs: 1e+06 us/job: 23.011
+nspes: 4 udelay: 50 elapsed_time: 21.382 njobs: 1e+06 us/job: 21.382
+nspes: 4 udelay: 50 elapsed_time: 20.531 njobs: 1e+06 us/job: 20.531
+nspes: 5 udelay: 50 elapsed_time: 24.157 njobs: 1e+06 us/job: 24.157
+nspes: 5 udelay: 50 elapsed_time: 21.119 njobs: 1e+06 us/job: 21.119
+nspes: 5 udelay: 50 elapsed_time: 22.055 njobs: 1e+06 us/job: 22.055
+nspes: 6 udelay: 50 elapsed_time: 19.136 njobs: 1e+06 us/job: 19.136
+nspes: 6 udelay: 50 elapsed_time: 20.607 njobs: 1e+06 us/job: 20.607
+nspes: 6 udelay: 50 elapsed_time: 20.527 njobs: 1e+06 us/job: 20.527
+nspes: 1 udelay: 100 elapsed_time: 107.531 njobs: 1e+06 us/job: 107.531
+nspes: 1 udelay: 100 elapsed_time: 107.607 njobs: 1e+06 us/job: 107.607
+nspes: 1 udelay: 100 elapsed_time: 107.532 njobs: 1e+06 us/job: 107.532
+nspes: 2 udelay: 100 elapsed_time: 53.950 njobs: 1e+06 us/job: 53.950
+nspes: 2 udelay: 100 elapsed_time: 53.920 njobs: 1e+06 us/job: 53.920
+nspes: 2 udelay: 100 elapsed_time: 54.232 njobs: 1e+06 us/job: 54.232
+nspes: 3 udelay: 100 elapsed_time: 37.987 njobs: 1e+06 us/job: 37.987
+nspes: 3 udelay: 100 elapsed_time: 38.778 njobs: 1e+06 us/job: 38.778
+nspes: 3 udelay: 100 elapsed_time: 39.042 njobs: 1e+06 us/job: 39.042
+nspes: 4 udelay: 100 elapsed_time: 31.192 njobs: 1e+06 us/job: 31.192
+nspes: 4 udelay: 100 elapsed_time: 31.090 njobs: 1e+06 us/job: 31.090
+nspes: 4 udelay: 100 elapsed_time: 31.472 njobs: 1e+06 us/job: 31.472
+nspes: 5 udelay: 100 elapsed_time: 28.490 njobs: 1e+06 us/job: 28.490
+nspes: 5 udelay: 100 elapsed_time: 27.574 njobs: 1e+06 us/job: 27.574
+nspes: 5 udelay: 100 elapsed_time: 27.013 njobs: 1e+06 us/job: 27.013
+nspes: 6 udelay: 100 elapsed_time: 26.635 njobs: 1e+06 us/job: 26.635
+nspes: 6 udelay: 100 elapsed_time: 24.036 njobs: 1e+06 us/job: 24.036
+nspes: 6 udelay: 100 elapsed_time: 26.174 njobs: 1e+06 us/job: 26.174
+nspes: 1 udelay: 300 elapsed_time: 320.618 njobs: 1e+06 us/job: 320.618
+nspes: 1 udelay: 300 elapsed_time: 320.635 njobs: 1e+06 us/job: 320.635
+nspes: 1 udelay: 300 elapsed_time: 320.699 njobs: 1e+06 us/job: 320.699
+nspes: 2 udelay: 300 elapsed_time: 160.314 njobs: 1e+06 us/job: 160.314
+nspes: 2 udelay: 300 elapsed_time: 160.340 njobs: 1e+06 us/job: 160.340
+nspes: 2 udelay: 300 elapsed_time: 160.312 njobs: 1e+06 us/job: 160.312
+nspes: 3 udelay: 300 elapsed_time: 106.878 njobs: 1e+06 us/job: 106.878
+nspes: 3 udelay: 300 elapsed_time: 106.875 njobs: 1e+06 us/job: 106.875
+nspes: 3 udelay: 300 elapsed_time: 106.871 njobs: 1e+06 us/job: 106.871
+nspes: 4 udelay: 300 elapsed_time: 80.158 njobs: 1e+06 us/job: 80.158
+nspes: 4 udelay: 300 elapsed_time: 80.163 njobs: 1e+06 us/job: 80.163
+nspes: 4 udelay: 300 elapsed_time: 80.154 njobs: 1e+06 us/job: 80.154
+nspes: 5 udelay: 300 elapsed_time: 64.156 njobs: 1e+06 us/job: 64.156
+nspes: 5 udelay: 300 elapsed_time: 64.250 njobs: 1e+06 us/job: 64.250
+nspes: 5 udelay: 300 elapsed_time: 64.158 njobs: 1e+06 us/job: 64.158
+nspes: 6 udelay: 300 elapsed_time: 53.633 njobs: 1e+06 us/job: 53.633
+nspes: 6 udelay: 300 elapsed_time: 53.541 njobs: 1e+06 us/job: 53.541
+nspes: 6 udelay: 300 elapsed_time: 53.617 njobs: 1e+06 us/job: 53.617
+nspes: 1 udelay: 500 elapsed_time: 533.638 njobs: 1e+06 us/job: 533.638
+nspes: 1 udelay: 500 elapsed_time: 533.649 njobs: 1e+06 us/job: 533.649
+nspes: 1 udelay: 500 elapsed_time: 533.618 njobs: 1e+06 us/job: 533.618
+nspes: 2 udelay: 500 elapsed_time: 266.810 njobs: 1e+06 us/job: 266.810
+nspes: 2 udelay: 500 elapsed_time: 266.814 njobs: 1e+06 us/job: 266.814
+nspes: 2 udelay: 500 elapsed_time: 266.893 njobs: 1e+06 us/job: 266.893
+nspes: 3 udelay: 500 elapsed_time: 177.875 njobs: 1e+06 us/job: 177.875
+nspes: 3 udelay: 500 elapsed_time: 177.878 njobs: 1e+06 us/job: 177.878
+nspes: 3 udelay: 500 elapsed_time: 177.875 njobs: 1e+06 us/job: 177.875
+nspes: 4 udelay: 500 elapsed_time: 133.417 njobs: 1e+06 us/job: 133.417
+nspes: 4 udelay: 500 elapsed_time: 133.483 njobs: 1e+06 us/job: 133.483
+nspes: 4 udelay: 500 elapsed_time: 133.407 njobs: 1e+06 us/job: 133.407
+nspes: 5 udelay: 500 elapsed_time: 106.723 njobs: 1e+06 us/job: 106.723
+nspes: 5 udelay: 500 elapsed_time: 106.728 njobs: 1e+06 us/job: 106.728
+nspes: 5 udelay: 500 elapsed_time: 106.722 njobs: 1e+06 us/job: 106.722
+nspes: 6 udelay: 500 elapsed_time: 88.943 njobs: 1e+06 us/job: 88.943
+nspes: 6 udelay: 500 elapsed_time: 88.941 njobs: 1e+06 us/job: 88.941
+nspes: 6 udelay: 500 elapsed_time: 88.944 njobs: 1e+06 us/job: 88.944
diff --git a/gcell/src/apps/split_and_avg_results.py b/gcell/src/apps/split_and_avg_results.py
new file mode 100755
index 0000000000..8a750fac9d
--- /dev/null
+++ b/gcell/src/apps/split_and_avg_results.py
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+"""
+input file looks like this:
+
+nspes: 1 udelay: 10 elapsed_time: 6.842 njobs: 500000 speedup: 0.731
+nspes: 2 udelay: 10 elapsed_time: 4.093 njobs: 500000 speedup: 1.221
+"""
+
+import sys
+from optparse import OptionParser
+from pprint import pprint
+
+class data(object):
+ def __init__(self, nspes, work_per_job, elapsed_time, njobs):
+ self.nspes = nspes
+ self.work_per_job = work_per_job # seconds
+ self.elapsed_time = elapsed_time # seconds
+ self.njobs = njobs
+ self.speedup = work_per_job * njobs / elapsed_time
+
+ def __repr__(self):
+ return "<data nspes=%d work_per_job=%s elapsed_time=%s njobs=%s speedup=%s>" % (
+ self.nspes, (self.work_per_job),
+ (self.elapsed_time),
+ (self.njobs),
+ (self.speedup))
+
+def cmp_data(x, y):
+ t = x.nspes - y.nspes
+ if t == 0:
+ t = x.work_per_job - y.work_per_job
+ if t < 0:
+ return -1
+ elif t > 0:
+ return +1
+ else:
+ return 0
+ return t
+
+def main():
+ usage = "usage: %prog [options] input_filename"
+ parser = OptionParser(usage=usage)
+ (options, args) = parser.parse_args()
+ if len(args) != 1:
+ parser.print_help()
+ raise SystemExit, 1
+ input_filename = args[0]
+
+
+ m = {}
+ for line in open(input_filename, "r"):
+ s = line.split()
+ nspes = int(s[1])
+ work_per_job = int(s[3]) * 1e-6
+ elapsed_time = float(s[5])
+ njobs = float(s[7])
+ d = data(nspes, work_per_job, elapsed_time, njobs)
+
+ # collect lists that have the same values for nspes and work_per_job
+ # so we can generate an average elapsed_time from all observations
+ key = (nspes, work_per_job)
+ v = m.get(key, [])
+ v.append(d)
+ m[key] = v
+
+ r = []
+ for k, v in m.iteritems():
+ total_elapsed_time = sum([x.elapsed_time for x in v])
+ r.append(data(v[0].nspes,
+ v[0].work_per_job,
+ total_elapsed_time/len(v),
+ v[0].njobs))
+
+ r.sort(cmp_data)
+
+ #pprint(r)
+ for t in r:
+ print t.nspes, t.work_per_job, t.elapsed_time, t.njobs, t.speedup
+
+if __name__ == '__main__':
+ main()
diff --git a/gcell/src/apps/spu/Makefile.am b/gcell/src/apps/spu/Makefile.am
new file mode 100644
index 0000000000..c94fe18ebd
--- /dev/null
+++ b/gcell/src/apps/spu/Makefile.am
@@ -0,0 +1,32 @@
+#
+# Copyright 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.
+#
+
+
+include $(top_srcdir)/Makefile.common.spu
+
+AM_CPPFLAGS = $(GCELL_SPU_INCLUDES)
+
+# SPU executables
+
+noinst_PROGRAMS = \
+ benchmark_procs
+
+benchmark_procs_SOURCES = benchmark_procs.c
+benchmark_procs_LDADD = $(GCELL_SPU_LA)
diff --git a/gcell/src/apps/spu/benchmark_procs.c b/gcell/src/apps/spu/benchmark_procs.c
new file mode 100644
index 0000000000..8d5b406536
--- /dev/null
+++ b/gcell/src/apps/spu/benchmark_procs.c
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#include <gc_delay.h>
+#include <gc_declare_proc.h>
+#include <string.h>
+
+#define _UNUSED __attribute__((unused))
+
+
+static void
+benchmark_udelay(const gc_job_direct_args_t *input,
+ gc_job_direct_args_t *output _UNUSED,
+ const gc_job_ea_args_t *eaa _UNUSED)
+{
+ gc_udelay(input->arg[0].u32);
+}
+
+GC_DECLARE_PROC(benchmark_udelay, "benchmark_udelay");
+
+
+
+static void
+benchmark_put_zeros(const gc_job_direct_args_t *input _UNUSED,
+ gc_job_direct_args_t *output _UNUSED,
+ const gc_job_ea_args_t *eaa)
+{
+ for (unsigned int i = 0; i < eaa->nargs; i++){
+ if (eaa->arg[i].direction == GCJD_DMA_PUT)
+ memset(eaa->arg[i].ls_addr, 0, eaa->arg[i].put_size);
+ }
+}
+
+GC_DECLARE_PROC(benchmark_put_zeros, "benchmark_put_zeros");
+
+
+static void
+benchmark_copy(const gc_job_direct_args_t *input _UNUSED,
+ gc_job_direct_args_t *output,
+ const gc_job_ea_args_t *eaa)
+{
+ if (eaa->nargs != 2
+ || eaa->arg[0].direction != GCJD_DMA_PUT
+ || eaa->arg[1].direction != GCJD_DMA_GET){
+ output->arg[0].s32 = -1;
+ return;
+ }
+
+ output->arg[0].s32 = 0;
+ unsigned n = eaa->arg[0].put_size;
+ if (eaa->arg[1].get_size < n)
+ n = eaa->arg[1].get_size;
+
+ memcpy(eaa->arg[0].ls_addr, eaa->arg[1].ls_addr, n);
+}
+
+GC_DECLARE_PROC(benchmark_copy, "benchmark_copy");
diff --git a/gcell/src/apps/test_all.cc b/gcell/src/apps/test_all.cc
new file mode 100644
index 0000000000..e652de21db
--- /dev/null
+++ b/gcell/src/apps/test_all.cc
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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.
+ */
+
+#include <cppunit/TextTestRunner.h>
+
+#include <qa_lib.h>
+
+
+int
+main(int argc, char **argv)
+{
+
+ CppUnit::TextTestRunner runner;
+
+ runner.addTest(qa_lib::suite());
+
+ bool was_successful = runner.run("", false);
+
+ return was_successful ? 0 : 1;
+}