Commit 5b5fdc8c by Marcus Winter

dataflow_cpp: refactored to use tasks_cpp

parent a7bc2f9b
......@@ -17,16 +17,16 @@ include_directories(${EMBB_DATAFLOW_CPP_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../base_cpp/include
${CMAKE_CURRENT_BINARY_DIR}/../base_cpp/include
${CMAKE_CURRENT_SOURCE_DIR}/../mtapi_c/include
${CMAKE_CURRENT_SOURCE_DIR}/../mtapi_cpp/include
${CMAKE_CURRENT_BINARY_DIR}/../mtapi_cpp/include)
${CMAKE_CURRENT_SOURCE_DIR}/../tasks_cpp/include
${CMAKE_CURRENT_BINARY_DIR}/../tasks_cpp/include)
add_library (embb_dataflow_cpp ${EMBB_DATAFLOW_CPP_SOURCES} ${EMBB_DATAFLOW_CPP_HEADERS})
target_link_libraries(embb_dataflow_cpp embb_mtapi_cpp embb_base_cpp embb_mtapi_c embb_base_c)
target_link_libraries(embb_dataflow_cpp embb_tasks_cpp embb_base_cpp embb_mtapi_c embb_base_c)
if (BUILD_TESTS STREQUAL ON)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../partest/include)
add_executable (embb_dataflow_cpp_test ${EMBB_DATAFLOW_CPP_TEST_SOURCES})
target_link_libraries(embb_dataflow_cpp_test embb_dataflow_cpp embb_mtapi_cpp embb_mtapi_c partest
target_link_libraries(embb_dataflow_cpp_test embb_dataflow_cpp embb_tasks_cpp embb_mtapi_c partest
embb_base_cpp embb_base_c ${compiler_libs})
CopyBin(BIN embb_dataflow_cpp_test DEST ${local_install_dir})
endif()
......
......@@ -29,7 +29,7 @@
#include <cstddef>
#include <embb/mtapi/taskcontext.h>
#include <embb/tasks/task_context.h>
#include <embb/dataflow/internal/node.h>
......@@ -48,7 +48,7 @@ class Action {
pending_ = 0;
}
void RunMTAPI(embb::mtapi::TaskContext & /*context*/) {
void RunMTAPI(embb::tasks::TaskContext & /*context*/) {
pending_ = 1;
node_->Run(clock_);
pending_ = 0;
......
......@@ -29,7 +29,7 @@
#include <embb/dataflow/internal/action.h>
#include <embb/dataflow/internal/scheduler.h>
#include <embb/mtapi/node.h>
#include <embb/tasks/node.h>
#include <embb/base/function.h>
namespace embb {
......@@ -40,24 +40,24 @@ template <int Slices>
class SchedulerMTAPI : public Scheduler {
public:
SchedulerMTAPI() {
embb::mtapi::Node & node = embb::mtapi::Node::GetInstance();
embb::tasks::Node & node = embb::tasks::Node::GetInstance();
for (int ii = 0; ii < Slices; ii++) {
embb::mtapi::Group & group = node.CreateGroup();
embb::tasks::Group & group = node.CreateGroup();
group_[ii] = &group;
}
queue_count_ = static_cast<int>(node.GetWorkerThreadCount());
queue_ = reinterpret_cast<embb::mtapi::Queue**>(
queue_ = reinterpret_cast<embb::tasks::Queue**>(
embb::base::Allocation::Allocate(
sizeof(embb::mtapi::Queue*)*queue_count_));
sizeof(embb::tasks::Queue*)*queue_count_));
for (int ii = 0; ii < queue_count_; ii++) {
embb::mtapi::Queue & queue = node.CreateQueue(0, true);
embb::tasks::Queue & queue = node.CreateQueue(0, true);
queue_[ii] = &queue;
}
}
virtual ~SchedulerMTAPI() {
embb::mtapi::Node & node = embb::mtapi::Node::GetInstance();
embb::tasks::Node & node = embb::tasks::Node::GetInstance();
for (int ii = 0; ii < Slices; ii++) {
group_[ii]->WaitAll(MTAPI_INFINITE);
node.DestroyGroup(*group_[ii]);
......@@ -82,8 +82,8 @@ class SchedulerMTAPI : public Scheduler {
}
private:
embb::mtapi::Group * group_[Slices];
embb::mtapi::Queue ** queue_;
embb::tasks::Group * group_[Slices];
embb::tasks::Queue ** queue_;
int queue_count_;
};
......
......@@ -29,7 +29,7 @@
#include <iostream>
#include <sstream>
#include <embb/mtapi/mtapi.h>
#include <embb/tasks/tasks.h>
#include <embb/base/function.h>
#include <embb/base/c/memory_allocation.h>
......@@ -143,7 +143,7 @@ SimpleTest::SimpleTest() {
}
void SimpleTest::TestBasic() {
embb::mtapi::Node::Initialize(1, 1);
embb::tasks::Node::Initialize(1, 1);
for (int ii = 0; ii < 10000; ii++) {
ArraySink<TEST_COUNT> asink;
......@@ -203,7 +203,7 @@ void SimpleTest::TestBasic() {
PT_EXPECT(asink.Check());
}
embb::mtapi::Node::Finalize();
embb::tasks::Node::Finalize();
PT_EXPECT(embb_get_bytes_allocated() == 0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment