[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8548 - gnuradio/branches/developers/eb/mp-sched/gnura
From: |
eb |
Subject: |
[Commit-gnuradio] r8548 - gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime |
Date: |
Mon, 2 Jun 2008 21:33:46 -0600 (MDT) |
Author: eb
Date: 2008-06-02 21:33:43 -0600 (Mon, 02 Jun 2008)
New Revision: 8548
Added:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_block_task.cc
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_block_task.h
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_top_task.cc
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_top_task.h
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_tbb.cc
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_tbb.h
Modified:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/Makefile.am
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_sts.h
Log:
mp-scheduler work-in-progress
Modified:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/Makefile.am
===================================================================
---
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/Makefile.am
2008-06-02 23:28:15 UTC (rev 8547)
+++
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/Makefile.am
2008-06-03 03:33:43 UTC (rev 8548)
@@ -29,6 +29,19 @@
$(SHM_OPEN_LIBS)
+# FIXME conditionalize these
+
+tbb_sources = \
+ gr_tbb_top_task.cc \
+ gr_top_block_impl_tbb.cc \
+ gr_tbb_block_task.cc
+
+tbb_headers = \
+ gr_tbb_block_task.h \
+ gr_tbb_top_task.h \
+ gr_top_block_impl_tbb.h
+
+
libruntime_la_SOURCES = \
gr_basic_block.cc \
gr_flowgraph.cc \
@@ -62,7 +75,8 @@
gr_vmcircbuf_mmap_tmpfile.cc \
gr_vmcircbuf_createfilemapping.cc \
gr_vmcircbuf_sysv_shm.cc \
- gr_select_handler.cc
+ gr_select_handler.cc \
+ $(tbb_sources)
libruntime_qa_la_SOURCES = \
qa_gr_block.cc \
@@ -107,7 +121,8 @@
gr_timer.h \
gr_tmp_path.h \
gr_types.h \
- gr_vmcircbuf.h
+ gr_vmcircbuf.h \
+ $(tbb_headers)
noinst_HEADERS = \
gr_vmcircbuf_mmap_shm_open.h \
Added:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_block_task.cc
===================================================================
---
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_block_task.cc
(rev 0)
+++
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_block_task.cc
2008-06-03 03:33:43 UTC (rev 8548)
@@ -0,0 +1,41 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_tbb_block_task.h>
+#include <gr_top_block_impl_tbb.h>
+
+
+gr_tbb_block_task::~gr_tbb_block_task()
+{
+}
+
+tbb::task *
+gr_tbb_block_task::execute()
+{
+ if (d_tb_impl->d_shutting_down)
+ return NULL;
+
+ return NULL; // FIXME do some real work
+}
Property changes on:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_block_task.cc
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_block_task.h
===================================================================
---
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_block_task.h
(rev 0)
+++
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_block_task.h
2008-06-03 03:33:43 UTC (rev 8548)
@@ -0,0 +1,43 @@
+/* -*- 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_GR_TBB_BLOCK_TASK_H
+#define INCLUDED_GR_TBB_BLOCK_TASK_H
+
+#include <tbb/task.h>
+
+class gr_top_block_impl_tbb;
+class gr_block;
+
+class gr_tbb_block_task : public tbb::task
+{
+ gr_top_block_impl_tbb *d_tb_impl;
+ gr_block *d_block;
+
+public:
+ gr_tbb_block_task(gr_top_block_impl_tbb *tb_impl, gr_block *block)
+ : d_tb_impl(tb_impl), d_block(block) { }
+ ~gr_tbb_block_task();
+
+ tbb::task *execute();
+};
+
+
+#endif /* INCLUDED_GR_TBB_BLOCK_TASK_H */
Property changes on:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_block_task.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_top_task.cc
===================================================================
---
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_top_task.cc
(rev 0)
+++
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_top_task.cc
2008-06-03 03:33:43 UTC (rev 8548)
@@ -0,0 +1,58 @@
+/* -*- 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.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_tbb_top_task.h>
+#include <gr_tbb_block_task.h>
+#include <gr_top_block_impl_tbb.h>
+
+gr_tbb_top_task::~gr_tbb_top_task()
+{
+}
+
+/*
+ * If we're not done, we recycle ourselves as our continuation and
+ * spawn a gr_tbb_block_task for each source.
+ */
+tbb::task *
+gr_tbb_top_task::execute()
+{
+ if (d_tb_impl->d_shutting_down || d_tb_impl->d_nalive == 0)
+ return NULL;
+
+ recycle_as_safe_continuation();
+
+ // create a child for each source
+ tbb::task_list tl;
+
+ for (size_t i = 0; i < d_tb_impl->d_source.size(); i++){
+ gr_tbb_block_task &t =
+ *new(allocate_child()) gr_tbb_block_task(d_tb_impl,
d_tb_impl->d_source[i].get());
+ tl.push_back(t);
+ }
+
+ set_ref_count(d_tb_impl->d_source.size() + 1); // + 1 for
"safe_continuation"
+
+ spawn(tl);
+ return NULL;
+}
Property changes on:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_top_task.cc
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_top_task.h
===================================================================
---
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_top_task.h
(rev 0)
+++
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_top_task.h
2008-06-03 03:33:43 UTC (rev 8548)
@@ -0,0 +1,41 @@
+/* -*- 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_GR_TBB_TOP_TASK_H
+#define INCLUDED_GR_TBB_TOP_TASK_H
+
+#include <tbb/task.h>
+
+class gr_top_block_impl_tbb;
+
+class gr_tbb_top_task : public tbb::task
+{
+ gr_top_block_impl_tbb *d_tb_impl;
+
+public:
+ gr_tbb_top_task(gr_top_block_impl_tbb *tb_impl) : d_tb_impl(tb_impl) { }
+ ~gr_tbb_top_task();
+
+ tbb::task *execute();
+};
+
+
+
+#endif /* INCLUDED_GR_TBB_TOP_TASK_H */
Property changes on:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_tbb_top_task.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_sts.h
===================================================================
---
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_sts.h
2008-06-02 23:28:15 UTC (rev 8547)
+++
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_sts.h
2008-06-03 03:33:43 UTC (rev 8548)
@@ -28,11 +28,9 @@
/*!
*\brief Implementation details of gr_top_block
- *
* \ingroup internal
- * The actual implementation of gr_top_block. Separate class allows
- * decoupling of changes from dependent classes.
*
+ * Concrete implementation of gr_top_block using gr_single_threaded_scheduler.
*/
class gr_top_block_impl_sts : public gr_top_block_impl
{
Added:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_tbb.cc
===================================================================
---
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_tbb.cc
(rev 0)
+++
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_tbb.cc
2008-06-03 03:33:43 UTC (rev 8548)
@@ -0,0 +1,115 @@
+/* -*- 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_top_block.h>
+#include <gr_top_block_impl_tbb.h>
+#include <gr_flat_flowgraph.h>
+#include <gr_scheduler_thread.h>
+#include <gr_local_sighandler.h>
+
+#include <stdexcept>
+#include <iostream>
+#include <string.h>
+#include <unistd.h>
+
+#define GR_TOP_BLOCK_IMPL_TBB_DEBUG 0
+
+
+// ----------------------------------------------------------------
+
+gr_top_block_impl_tbb::gr_top_block_impl_tbb(gr_top_block *owner)
+ : gr_top_block_impl(owner)
+{
+}
+
+gr_top_block_impl_tbb::~gr_top_block_impl_tbb()
+{
+}
+
+void
+gr_top_block_impl_tbb::start_threads()
+{
+ if (GR_TOP_BLOCK_IMPL_TBB_DEBUG)
+ std::cout << "start_threads: entered" << std::endl;
+
+#if 0
+ d_graphs = d_ffg->partition();
+ for (std::vector<gr_basic_block_vector_t>::iterator p = d_graphs.begin();
+ p != d_graphs.end(); p++) {
+ gr_scheduler_thread *thread = new
gr_scheduler_thread(make_gr_block_vector(*p));
+ d_threads.push_back(thread);
+ if (GR_TOP_BLOCK_IMPL_TBB_DEBUG)
+ std::cout << "start_threads: starting " << thread << std::endl;
+ thread->start();
+ }
+#endif
+
+ d_running = true;
+}
+
+/*
+ * N.B. as currently implemented, it is possible that this may be
+ * invoked by the SIGINT handler which is fragile as hell...
+ */
+void
+gr_top_block_impl_tbb::stop()
+{
+ if (GR_TOP_BLOCK_IMPL_TBB_DEBUG){
+ char *msg = "stop: entered\n";
+ ::write(1, msg, strlen(msg));
+ }
+
+#if 0
+ for (gr_scheduler_thread_viter_t p = d_threads.begin(); p !=
d_threads.end(); p++) {
+ if (*p)
+ (*p)->stop();
+ }
+#endif
+}
+
+void
+gr_top_block_impl_tbb::wait()
+{
+ if (GR_TOP_BLOCK_IMPL_TBB_DEBUG)
+ std::cout << "wait: entered" << std::endl;
+
+#if 0
+ void *dummy_status; // don't ever dereference this
+ gr_local_sighandler sigint(SIGINT, runtime_sigint_handler);
+
+ for (gr_scheduler_thread_viter_t p = d_threads.begin(); p !=
d_threads.end(); p++) {
+ if (GR_TOP_BLOCK_IMPL_TBB_DEBUG)
+ std::cout << "wait: joining thread " << (*p) << std::endl;
+ (*p)->join(&dummy_status); // omnithreads will self-delete, so pointer is
now dead
+ (*p) = 0; // FIXME: switch to stl::list and actually remove from container
+ if (GR_TOP_BLOCK_IMPL_TBB_DEBUG)
+ std::cout << "wait: join returned" << std::endl;
+ }
+
+ d_threads.clear();
+#endif
+ d_running = false;
+}
Property changes on:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_tbb.cc
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_tbb.h
===================================================================
---
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_tbb.h
(rev 0)
+++
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_tbb.h
2008-06-03 03:33:43 UTC (rev 8548)
@@ -0,0 +1,57 @@
+/* -*- 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_TOP_BLOCK_IMPL_TBB_H
+#define INCLUDED_GR_TOP_BLOCK_IMPL_TBB_H
+
+#include <gr_top_block_impl.h>
+#include <tbb/atomic.h>
+
+/*!
+ *\brief Implementation details of gr_top_block
+ * \ingroup internal
+ *
+ * Concrete implementation of gr_top_block using threading building blocks.
+ */
+class gr_top_block_impl_tbb : public gr_top_block_impl
+{
+public:
+ gr_top_block_impl_tbb(gr_top_block *owner);
+ ~gr_top_block_impl_tbb();
+
+ // Signal scheduler threads to stop
+ void stop();
+
+ // Wait for scheduler threads to exit
+ void wait();
+
+public:
+
+ std::vector<gr_block_sptr> d_source;
+ bool d_shutting_down;
+ tbb::atomic<int> d_nalive;
+
+
+ void start_threads();
+};
+
+#endif /* INCLUDED_GR_TOP_BLOCK_IMPL_TBB_H */
Property changes on:
gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime/gr_top_block_impl_tbb.h
___________________________________________________________________
Name: svn:eol-style
+ native
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8548 - gnuradio/branches/developers/eb/mp-sched/gnuradio-core/src/lib/runtime,
eb <=