[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8183 - in gnuradio/branches/developers/eb/gcell-wip:
From: |
eb |
Subject: |
[Commit-gnuradio] r8183 - in gnuradio/branches/developers/eb/gcell-wip: . gcell/src/apps gcell/src/lib/general/spu gcell/src/lib/runtime gcell/src/lib/runtime/spu gcell/src/lib/spu gcell/src/lib/wrapper |
Date: |
Thu, 10 Apr 2008 20:33:12 -0600 (MDT) |
Author: eb
Date: 2008-04-10 20:33:12 -0600 (Thu, 10 Apr 2008)
New Revision: 8183
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gcell-embedspu-libtool
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/spu/gcell_runtime_qa.c
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcell_wrapper.cc
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcell_wrapper.h
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcp_fft_1d_r2.cc
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcp_fft_1d_r2.h
Removed:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/spu/gcell_qa.c
Modified:
gnuradio/branches/developers/eb/gcell-wip/Makefile.common
gnuradio/branches/developers/eb/gcell-wip/gcell/src/apps/test_all.cc
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.c
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/libfft.h
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/Makefile.am
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/qa_gcell_runtime.cc
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/qa_job_manager.cc
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/spu/Makefile.am
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/Makefile.am
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/gcp_fft_1d_r2.cc
Log:
work-in-progress on gcell
Modified: gnuradio/branches/developers/eb/gcell-wip/Makefile.common
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/Makefile.common 2008-04-10
22:25:38 UTC (rev 8182)
+++ gnuradio/branches/developers/eb/gcell-wip/Makefile.common 2008-04-11
02:33:12 UTC (rev 8183)
@@ -96,6 +96,9 @@
GCELL_SPU_INCLUDES = @gcell_spu_INCLUDES@
GCELL_SPU_LA = @gcell_spu_LA@
+# libtool aware wrapper for ppu-embedspu
+GCELL_EMBEDSPU_LIBTOOL =
@abs_top_srcdir@/gcell/src/lib/runtime/gcell-embedspu-libtool
+
# This used to be set in configure.ac but is now defined here for all
# Makefiles when this fragment is included.
STD_DEFINES_AND_INCLUDES=$(DEFINES) $(OMNITHREAD_INCLUDES)
$(GNURADIO_INCLUDES) $(BOOST_CFLAGS)
Modified: gnuradio/branches/developers/eb/gcell-wip/gcell/src/apps/test_all.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/gcell/src/apps/test_all.cc
2008-04-10 22:25:38 UTC (rev 8182)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/src/apps/test_all.cc
2008-04-11 02:33:12 UTC (rev 8183)
@@ -22,8 +22,8 @@
#include <cppunit/TextTestRunner.h>
#include <qa_gcell_runtime.h>
+#include <qa_gcell_wrapper.h>
-
int
main(int argc, char **argv)
{
@@ -31,6 +31,7 @@
CppUnit::TextTestRunner runner;
runner.addTest(qa_gcell_runtime::suite());
+ runner.addTest(qa_gcell_wrapper::suite());
bool was_successful = runner.run("", false);
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.c
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.c
2008-04-10 22:25:38 UTC (rev 8182)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.c
2008-04-11 02:33:12 UTC (rev 8183)
@@ -21,6 +21,7 @@
#include <libfft.h>
#include <fft_1d_r2.h>
+#include <assert.h>
/*
* invoke the inline version
@@ -28,5 +29,7 @@
void
fft_1d_r2(vector float *out, vector float *in, vector float *W, int log2_size)
{
+ assert((1 << log2_size) <= MAX_FFT_1D_SIZE);
+
_fft_1d_r2(out, in, W, log2_size);
}
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/libfft.h
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/libfft.h
2008-04-10 22:25:38 UTC (rev 8182)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/libfft.h
2008-04-11 02:33:12 UTC (rev 8183)
@@ -43,6 +43,9 @@
#ifndef INCLUDED_LIBFFT_H
#define INCLUDED_LIBFFT_H
+// must be defined before inclusion of fft_1d_r2.h
+#define MAX_FFT_1D_SIZE 4096
+
/* fft_1d_r2
* ---------
* Performs a single precision, complex Fast Fourier Transform using
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/Makefile.am
2008-04-10 22:25:38 UTC (rev 8182)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/Makefile.am
2008-04-11 02:33:12 UTC (rev 8183)
@@ -27,6 +27,8 @@
$(GCELL_INCLUDES) $(IBM_PPU_SYNC_INCLUDES) $(WITH_INCLUDES)
+dist_bin_SCRIPTS = gcell-embedspu-libtool
+
noinst_LTLIBRARIES = libruntime.la libruntime-qa.la
libruntime_la_SOURCES = \
@@ -55,20 +57,10 @@
qa_job_manager.h \
qa_gcell_runtime.h
+# generate a libtool.lo that contains an embeded SPU executable
+gcell_runtime_qa.lo: ../spu/gcell_runtime_qa
+ $(GCELL_EMBEDSPU_LIBTOOL) $@ $<
-# This kruft is required to link the QA SPU executable into the PPE shared lib
w/o warnings
-gcell_qa.lo: ../spu/gcell_qa
- ppu-embedspu -m32 -fpic gcell_qa ../spu/gcell_qa .libs/gcell_qa.o
- @rm -f gcell_qa.lo
- @echo "# gcell_qa.lo - a libtool object file" >> gcell_qa.lo
- @echo "# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365
2005/12/18 22:14:06)" >> gcell_qa.lo
- @echo "#" >> gcell_qa.lo
- @echo "# Please DO NOT delete this file!" >> gcell_qa.lo
- @echo "# It is necessary for linking the library." >> gcell_qa.lo
- @echo "" >> gcell_qa.lo
- @echo "pic_object='.libs/gcell_qa.o'" >> gcell_qa.lo
- @echo "non_pic_object=none" >> gcell_qa.lo
-
libruntime_qa_la_LIBADD = \
- gcell_qa.lo \
+ gcell_runtime_qa.lo \
libruntime.la
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gcell-embedspu-libtool
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gcell-embedspu-libtool
(rev 0)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gcell-embedspu-libtool
2008-04-11 02:33:12 UTC (rev 8183)
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+if [ $# -ne 2 ]; then
+ echo "usage: gcell-embedspu-libtool file.lo spu_executable_file" 1>&2
+ exit 1
+fi
+
+lo_file=$1
+spu_executable=$2
+symbol_name=${lo_file%%.lo}
+
+# generate the .o file that wraps the SPU executable
+ppu-embedspu -m32 -fpic ${symbol_name} ${spu_executable} .libs/${symbol_name}.o
+
+# generate the .lo libtool file that points at all the right places
+rm -f $lo_file
+cat >$lo_file.new <<EOF
+# $lo_file - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 2005/12/18
22:14:06)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+pic_object='.libs/${symbol_name}.o'
+non_pic_object=none
+EOF
+
+mv $lo_file.new $lo_file
+
Property changes on:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gcell-embedspu-libtool
___________________________________________________________________
Name: svn:executable
+ *
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/qa_gcell_runtime.cc
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/qa_gcell_runtime.cc
2008-04-10 22:25:38 UTC (rev 8182)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/qa_gcell_runtime.cc
2008-04-11 02:33:12 UTC (rev 8183)
@@ -33,7 +33,7 @@
CppUnit::TestSuite *
qa_gcell_runtime::suite()
{
- CppUnit::TestSuite *s = new CppUnit::TestSuite("lib");
+ CppUnit::TestSuite *s = new CppUnit::TestSuite("runtime");
s->addTest(qa_jd_stack::suite());
s->addTest(qa_jd_queue::suite());
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/qa_job_manager.cc
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/qa_job_manager.cc
2008-04-10 22:25:38 UTC (rev 8182)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/qa_job_manager.cc
2008-04-11 02:33:12 UTC (rev 8183)
@@ -29,7 +29,8 @@
#include <malloc.h>
-extern spe_program_handle_t gcell_qa; // handle to embedded SPU executable w/
QA routines
+// handle to embedded SPU executable w/ QA routines
+extern spe_program_handle_t gcell_runtime_qa;
#if 0
static void
@@ -175,7 +176,7 @@
{
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
mgr = gc_make_job_manager(&opts);
}
@@ -184,7 +185,7 @@
{
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 100;
opts.gang_schedule = false;
mgr = gc_make_job_manager(&opts);
@@ -200,7 +201,7 @@
#if 0
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 100;
opts.gang_schedule = true;
CPPUNIT_ASSERT_THROW(mgr = gc_make_job_manager(&opts), std::out_of_range);
@@ -221,7 +222,7 @@
{
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
//mgr->set_debug(-1);
@@ -260,7 +261,7 @@
{
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 0; // use them all
mgr = gc_make_job_manager(&opts);
//mgr->set_debug(-1);
@@ -295,7 +296,7 @@
{
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
gc_proc_id_t gcp_qa_nop = mgr->lookup_proc("qa_nop");
@@ -373,7 +374,7 @@
{
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
@@ -402,7 +403,7 @@
{
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
gc_job_desc *jd = mgr->alloc_job_desc();
@@ -435,7 +436,7 @@
static const int M = 201;
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
gc_job_desc *jd = mgr->alloc_job_desc();
@@ -546,7 +547,7 @@
{
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
@@ -574,7 +575,7 @@
{
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
gc_job_desc *jd = mgr->alloc_job_desc();
@@ -609,7 +610,7 @@
static const int M = 201;
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
gc_job_desc *jd = mgr->alloc_job_desc();
@@ -657,7 +658,7 @@
{
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
@@ -727,7 +728,7 @@
gc_job_manager_sptr mgr;
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
@@ -776,7 +777,7 @@
qa_job_manager::t15_body()
{
gc_jm_options opts;
- opts.program_handle = gc_program_handle_from_address(&gcell_qa);
+ opts.program_handle = gc_program_handle_from_address(&gcell_runtime_qa);
opts.nspes = 1;
gc_job_manager_sptr mgr = gc_make_job_manager(&opts);
Deleted:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/spu/gcell_qa.c
Copied:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/spu/gcell_runtime_qa.c
(from rev 8175,
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/spu/gcell_qa.c)
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/spu/gcell_runtime_qa.c
(rev 0)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/spu/gcell_runtime_qa.c
2008-04-11 02:33:12 UTC (rev 8183)
@@ -0,0 +1,109 @@
+/* -*- 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))
+
+// FIXME move these out of here; only for QA usage
+
+static void
+qa_nop(const gc_job_direct_args_t *input _UNUSED,
+ gc_job_direct_args_t *output _UNUSED,
+ const gc_job_ea_args_t *eaa _UNUSED)
+{
+}
+
+GC_DECLARE_PROC(qa_nop, "qa_nop");
+
+static int
+sum_shorts(short *p, int nshorts)
+{
+ int total = 0;
+ for (int i = 0; i < nshorts; i++)
+ total += p[i];
+
+ return total;
+}
+
+static void
+qa_sum_shorts(const gc_job_direct_args_t *input _UNUSED,
+ gc_job_direct_args_t *output,
+ const gc_job_ea_args_t *eaa)
+{
+ for (unsigned int i = 0; i < eaa->nargs; i++){
+ short *p = eaa->arg[i].ls_addr;
+ int n = eaa->arg[i].get_size / sizeof(short);
+ output->arg[i].s32 = sum_shorts(p, n);
+ //printf("qa_sum_shorts(%p, %d) = %d\n", p, n, output->arg[i].s32);
+ }
+}
+
+GC_DECLARE_PROC(qa_sum_shorts, "qa_sum_shorts");
+
+static void
+write_seq(unsigned char *p, int nbytes, int counter)
+{
+ for (int i = 0; i < nbytes; i++)
+ p[i] = counter++;
+}
+
+static void
+qa_put_seq(const gc_job_direct_args_t *input,
+ gc_job_direct_args_t *output _UNUSED,
+ const gc_job_ea_args_t *eaa)
+{
+ int counter = input->arg[0].s32;
+
+ for (unsigned int i = 0; i < eaa->nargs; i++){
+ unsigned char *p = eaa->arg[i].ls_addr;
+ int n = eaa->arg[i].put_size;
+ write_seq(p, n, counter);
+ counter += n;
+ }
+}
+
+GC_DECLARE_PROC(qa_put_seq, "qa_put_seq");
+
+static void
+qa_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(qa_copy, "qa_copy");
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/spu/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/spu/Makefile.am
2008-04-10 22:25:38 UTC (rev 8182)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/spu/Makefile.am
2008-04-11 02:33:12 UTC (rev 8183)
@@ -99,10 +99,16 @@
$(wrapper_spu_noinst_headers)
# ----------------------------------------------------------------
-# SPU executable containing QA code
+# SPU executables
noinst_PROGRAMS = \
- gcell_qa
+ gcell_all \
+ gcell_runtime_qa
-gcell_qa_SOURCES = $(runtime_srcdir)/gcell_qa.c
-gcell_qa_LDADD = libgcell_spu.a
+# all known gcell procs (at least until they get too big)
+gcell_all_SOURCES = $(wrapper_spu_sources)
+gcell_all_LDADD = libgcell_spu.a
+
+# just the QA code required for testing the runtime
+gcell_runtime_qa_SOURCES = $(runtime_srcdir)/gcell_runtime_qa.c
+gcell_runtime_qa_LDADD = libgcell_spu.a
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/Makefile.am
2008-04-10 22:25:38 UTC (rev 8182)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/Makefile.am
2008-04-11 02:33:12 UTC (rev 8183)
@@ -20,17 +20,30 @@
include $(top_srcdir)/Makefile.common
-AM_CPPFLAGS = $(DEFINES) $(GCELL_INCLUDES) $(WITH_INCLUDES)
+AM_CPPFLAGS = $(DEFINES) $(GCELL_INCLUDES) $(FFTW3F_CFLAGS) $(WITH_INCLUDES)
-
noinst_LTLIBRARIES = libwrapper.la libwrapper-qa.la
+# generate a libtool.lo that contains an embeded SPU executable
+gcell_all.lo: ../spu/gcell_all
+ $(GCELL_EMBEDSPU_LIBTOOL) $@ $<
+
libwrapper_la_SOURCES = \
gcp_fft_1d_r2.cc
-libwrapper_qa_la_SOURCES =
+libwrapper_la_LIBADD = \
+ gcell_all.lo
+libwrapper_qa_la_SOURCES = \
+ qa_gcell_wrapper.cc \
+ qa_gcp_fft_1d_r2.cc
+
+libwrapper_qa_la_LIBADD = \
+ -lfftw3f
+
gcellinclude_HEADERS = \
gcp_fft_1d_r2.h
-noinst_HEADERS =
+noinst_HEADERS = \
+ qa_gcell_wrapper.h
+
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/gcp_fft_1d_r2.cc
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/gcp_fft_1d_r2.cc
2008-04-10 22:25:38 UTC (rev 8182)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/gcp_fft_1d_r2.cc
2008-04-11 02:33:12 UTC (rev 8183)
@@ -64,8 +64,8 @@
const std::complex<float> *W)
{
unsigned int fft_length = 1 << log2_fft_length;
- if (fft_length > 8192)
- throw std::invalid_argument("fft_length > 8192");
+ if (fft_length > 4096)
+ throw std::invalid_argument("fft_length > 4096");
if ((intptr_t)out & 0xf)
throw gc_bad_align("out");
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcell_wrapper.cc
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcell_wrapper.cc
(rev 0)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcell_wrapper.cc
2008-04-11 02:33:12 UTC (rev 8183)
@@ -0,0 +1,39 @@
+/* -*- 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.
+ */
+
+/*
+ * This class gathers together all the test cases for the lib
+ * directory into a single test suite. As you create new test cases,
+ * add them here.
+ */
+
+#include <qa_gcell_wrapper.h>
+#include <qa_gcp_fft_1d_r2.h>
+
+CppUnit::TestSuite *
+qa_gcell_wrapper::suite()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite("wrapper");
+
+ s->addTest(qa_gcp_fft_1d_r2::suite());
+
+ return s;
+}
Property changes on:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcell_wrapper.cc
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcell_wrapper.h
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcell_wrapper.h
(rev 0)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcell_wrapper.h
2008-04-11 02:33:12 UTC (rev 8183)
@@ -0,0 +1,35 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_QA_GCELL_WRAPPER_H
+#define INCLUDED_QA_GCELL_WRAPPER_H
+
+#include <cppunit/TestSuite.h>
+
+//! collect all the tests for the wrapper directory
+
+class qa_gcell_wrapper {
+public:
+ //! return suite of tests
+ static CppUnit::TestSuite *suite();
+};
+
+
+#endif /* INCLUDED_QA_GCELL_WRAPPER_H */
Property changes on:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcell_wrapper.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcp_fft_1d_r2.cc
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcp_fft_1d_r2.cc
(rev 0)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcp_fft_1d_r2.cc
2008-04-11 02:33:12 UTC (rev 8183)
@@ -0,0 +1,191 @@
+/* -*- 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 "qa_gcp_fft_1d_r2.h"
+#include <cppunit/TestAssert.h>
+#include <gcp_fft_1d_r2.h>
+#include <fftw3.h>
+#include <stdio.h>
+#include <stdlib.h> // random, posix_memalign
+#include <algorithm>
+
+typedef boost::shared_ptr<void> void_sptr;
+
+// handle to embedded SPU executable
+extern spe_program_handle_t gcell_all;
+
+/*
+ * Return pointer to cache-aligned chunk of storage of size size bytes.
+ * Throw if can't allocate memory. The storage should be freed
+ * with "free" when done. The memory is initialized to zero.
+ */
+static void *
+aligned_alloc(size_t size, size_t alignment = 128)
+{
+ void *p = 0;
+ if (posix_memalign(&p, alignment, size) != 0){
+ perror("posix_memalign");
+ throw std::runtime_error("memory");
+ }
+ memset(p, 0, size); // zero the memory
+ return p;
+}
+
+class free_deleter {
+public:
+ void operator()(void *p) {
+ free(p);
+ }
+};
+
+static boost::shared_ptr<void>
+aligned_alloc_sptr(size_t size, size_t alignment = 128)
+{
+ return boost::shared_ptr<void>(aligned_alloc(size, alignment),
free_deleter());
+}
+
+// test forward FFT
+void
+qa_gcp_fft_1d_r2::t1()
+{
+ gc_jm_options opts;
+ opts.program_handle = gc_program_handle_from_address(&gcell_all);
+ opts.nspes = 1;
+ gc_job_manager_sptr mgr = gc_make_job_manager(&opts);
+
+#if 0
+ for (int log2_fft_size = 5; log2_fft_size <= 11; log2_fft_size++){
+ test(mgr, log2_fft_size, true);
+ }
+#else
+ test(mgr, 5, true);
+#endif
+}
+
+// test reverse FFT
+void
+qa_gcp_fft_1d_r2::t2()
+{
+ gc_jm_options opts;
+ opts.program_handle = gc_program_handle_from_address(&gcell_all);
+ opts.nspes = 1;
+ gc_job_manager_sptr mgr = gc_make_job_manager(&opts);
+
+#if 0
+ for (int log2_fft_size = 5; log2_fft_size <= 11; log2_fft_size++){
+ test(mgr, log2_fft_size, false);
+ }
+#else
+ test(mgr, 5, false);
+#endif
+}
+
+void
+qa_gcp_fft_1d_r2::t3()
+{
+}
+
+void
+qa_gcp_fft_1d_r2::t4()
+{
+}
+
+static inline float
+abs_diff(std::complex<float> x, std::complex<float> y)
+{
+ return std::max(std::abs(x.real()-y.real()),
+ std::abs(x.imag()-y.imag()));
+}
+
+void
+qa_gcp_fft_1d_r2::test(gc_job_manager_sptr mgr, int log2_fft_size, bool
forward)
+{
+ int fft_size = 1 << log2_fft_size;
+
+ // allocate aligned buffers with boost shared_ptr's
+ void_sptr fftw_in_void = aligned_alloc_sptr(fft_size *
sizeof(std::complex<float>), 128);
+ void_sptr fftw_out_void = aligned_alloc_sptr(fft_size *
sizeof(std::complex<float>), 128);
+ void_sptr cell_in_void = aligned_alloc_sptr(fft_size *
sizeof(std::complex<float>), 128);
+ void_sptr cell_out_void = aligned_alloc_sptr(fft_size *
sizeof(std::complex<float>), 128);
+ void_sptr cell_twiddle_void = aligned_alloc_sptr(fft_size/4 *
sizeof(std::complex<float>), 128);
+
+ // cast them to the type we really want
+ std::complex<float> *fftw_in = (std::complex<float> *) fftw_in_void.get();
+ std::complex<float> *fftw_out = (std::complex<float> *) fftw_out_void.get();
+ std::complex<float> *cell_in = (std::complex<float> *) cell_in_void.get();
+ std::complex<float> *cell_out = (std::complex<float> *) cell_out_void.get();
+ std::complex<float> *cell_twiddle = (std::complex<float> *)
cell_twiddle_void.get();
+
+ if (forward)
+ gcp_fft_1d_r2_forward_twiddle(log2_fft_size, cell_twiddle);
+ else
+ gcp_fft_1d_r2_reverse_twiddle(log2_fft_size, cell_twiddle);
+
+ srandom(1); // we want reproducibility
+
+ // initialize the input buffers
+ for (int i = 0; i < fft_size; i++){
+ std::complex<float> t((float) (random() & 0xfffff), (float) (random() &
0xfffff));
+ fftw_in[i] = t;
+ cell_in[i] = t;
+ }
+
+ // ------------------------------------------------------------------------
+ // compute the reference answer
+ fftwf_plan plan = fftwf_plan_dft_1d (fft_size,
+ reinterpret_cast<fftwf_complex
*>(fftw_in),
+ reinterpret_cast<fftwf_complex
*>(fftw_out),
+ forward ? FFTW_FORWARD : FFTW_BACKWARD,
+ FFTW_ESTIMATE);
+ if (plan == 0){
+ fprintf(stderr, "qa_gcp_fft_1d_r2: error creating FFTW plan\n");
+ throw std::runtime_error ("fftwf_plan_dft_r2c_1d failed");
+ }
+
+ fftwf_execute(plan);
+ fftwf_destroy_plan(plan);
+
+ // ------------------------------------------------------------------------
+ // compute the answer on the cell
+ gc_job_desc *jd = gcp_fft_1d_r2_submit(mgr, log2_fft_size,
+ cell_out, cell_in, cell_twiddle);
+ if (!mgr->wait_job(jd)){
+ fprintf(stderr, "wait_job failed: %s\n",
gc_job_status_string(jd->status).c_str());
+ mgr->free_job_desc(jd);
+ CPPUNIT_ASSERT(0);
+ }
+ mgr->free_job_desc(jd);
+
+ // ------------------------------------------------------------------------
+ // compute the maximum of the abs diff of the real and imag components
+ float max_diff = 0.0;
+ for (int i = 0; i < fft_size; i++){
+ max_diff = std::max(max_diff, abs_diff(fftw_out[i], cell_out[i]));
+ if (1)
+ printf("(%16.3f, %16.3fj) (%16.3f, %16.3fj) (%16.3f, %16.3fj)\n",
+ fftw_out[i].real(), fftw_out[i].imag(),
+ cell_out[i].real(), cell_out[i].imag(),
+ fftw_out[i].real() - cell_out[i].real(),
+ fftw_out[i].imag() - cell_out[i].imag());
+ }
+
+ fprintf(stdout, "%s fft_size = %4d max_diff = %f\n", forward ? "fwd" :
"rev", fft_size, max_diff);
+}
Property changes on:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcp_fft_1d_r2.cc
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcp_fft_1d_r2.h
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcp_fft_1d_r2.h
(rev 0)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcp_fft_1d_r2.h
2008-04-11 02:33:12 UTC (rev 8183)
@@ -0,0 +1,48 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_QA_GCP_FFT_1D_R2_H
+#define INCLUDED_QA_GCP_FFT_1D_R2_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <gc_job_manager.h>
+
+class qa_gcp_fft_1d_r2 : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE(qa_gcp_fft_1d_r2);
+ CPPUNIT_TEST(t1);
+ CPPUNIT_TEST(t2);
+ CPPUNIT_TEST(t3);
+ CPPUNIT_TEST(t4);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void t1();
+ void t2();
+ void t3();
+ void t4();
+
+ void test(gc_job_manager_sptr mgr, int log2_fft_size, bool forward);
+};
+
+
+
+#endif /* INCLUDED_QA_GCP_FFT_1D_R2_H */
Property changes on:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/wrapper/qa_gcp_fft_1d_r2.h
___________________________________________________________________
Name: svn:eol-style
+ native
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8183 - in gnuradio/branches/developers/eb/gcell-wip: . gcell/src/apps gcell/src/lib/general/spu gcell/src/lib/runtime gcell/src/lib/runtime/spu gcell/src/lib/spu gcell/src/lib/wrapper,
eb <=