Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5b5fdc8c
authored
Mar 24, 2015
by
Marcus Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dataflow_cpp: refactored to use tasks_cpp
parent
a7bc2f9b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
18 deletions
+18
-18
dataflow_cpp/CMakeLists.txt
+4
-4
dataflow_cpp/include/embb/dataflow/internal/action.h
+2
-2
dataflow_cpp/include/embb/dataflow/internal/scheduler_mtapi.h
+9
-9
dataflow_cpp/test/dataflow_cpp_test_simple.cc
+3
-3
No files found.
dataflow_cpp/CMakeLists.txt
View file @
5b5fdc8c
...
...
@@ -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
()
...
...
dataflow_cpp/include/embb/dataflow/internal/action.h
View file @
5b5fdc8c
...
...
@@ -29,7 +29,7 @@
#include <cstddef>
#include <embb/
mtapi/task
context.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
;
...
...
dataflow_cpp/include/embb/dataflow/internal/scheduler_mtapi.h
View file @
5b5fdc8c
...
...
@@ -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_
;
};
...
...
dataflow_cpp/test/dataflow_cpp_test_simple.cc
View file @
5b5fdc8c
...
...
@@ -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
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment