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
64b15b2a
authored
Apr 06, 2016
by
Marcus Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dataflow_cpp: preparations for deferred slice initialization
parent
f61ec036
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
1 deletions
+31
-1
dataflow_cpp/include/embb/dataflow/internal/node.h
+1
-0
dataflow_cpp/include/embb/dataflow/internal/process.h
+4
-0
dataflow_cpp/include/embb/dataflow/internal/scheduler.h
+1
-0
dataflow_cpp/include/embb/dataflow/internal/scheduler_mtapi.h
+8
-1
dataflow_cpp/include/embb/dataflow/internal/scheduler_sequential.h
+1
-0
dataflow_cpp/include/embb/dataflow/network.h
+3
-0
tasks_cpp/include/embb/tasks/node.h
+10
-0
tasks_cpp/src/node.cc
+3
-0
No files found.
dataflow_cpp/include/embb/dataflow/internal/node.h
View file @
64b15b2a
...
@@ -44,6 +44,7 @@ class Node {
...
@@ -44,6 +44,7 @@ class Node {
virtual
bool
HasOutputs
()
const
{
return
false
;
}
virtual
bool
HasOutputs
()
const
{
return
false
;
}
virtual
void
Run
(
int
clock
)
=
0
;
virtual
void
Run
(
int
clock
)
=
0
;
virtual
bool
IsFullyConnected
()
=
0
;
virtual
bool
IsFullyConnected
()
=
0
;
virtual
bool
IsSequential
()
{
return
true
;
}
virtual
bool
Start
(
int
/*clock*/
)
{
virtual
bool
Start
(
int
/*clock*/
)
{
EMBB_THROW
(
embb
::
base
::
ErrorException
,
EMBB_THROW
(
embb
::
base
::
ErrorException
,
"Nodes are started implicitly."
);
"Nodes are started implicitly."
);
...
...
dataflow_cpp/include/embb/dataflow/internal/process.h
View file @
64b15b2a
...
@@ -98,6 +98,10 @@ class Process< Serial, Inputs<I1, I2, I3, I4, I5>,
...
@@ -98,6 +98,10 @@ class Process< Serial, Inputs<I1, I2, I3, I4, I5>,
return
inputs_
.
IsFullyConnected
()
&&
outputs_
.
IsFullyConnected
();
return
inputs_
.
IsFullyConnected
()
&&
outputs_
.
IsFullyConnected
();
}
}
virtual
bool
IsSequential
()
{
return
Serial
;
}
InputsType
&
GetInputs
()
{
InputsType
&
GetInputs
()
{
return
inputs_
;
return
inputs_
;
}
}
...
...
dataflow_cpp/include/embb/dataflow/internal/scheduler.h
View file @
64b15b2a
...
@@ -40,6 +40,7 @@ class Scheduler {
...
@@ -40,6 +40,7 @@ class Scheduler {
virtual
void
Spawn
(
Action
&
action
)
=
0
;
virtual
void
Spawn
(
Action
&
action
)
=
0
;
virtual
void
Enqueue
(
int
process_id
,
Action
&
action
)
=
0
;
virtual
void
Enqueue
(
int
process_id
,
Action
&
action
)
=
0
;
virtual
void
WaitForSlice
(
int
slice
)
=
0
;
virtual
void
WaitForSlice
(
int
slice
)
=
0
;
virtual
int
GetSlices
()
=
0
;
};
};
}
// namespace internal
}
// namespace internal
...
...
dataflow_cpp/include/embb/dataflow/internal/scheduler_mtapi.h
View file @
64b15b2a
...
@@ -44,6 +44,13 @@ class SchedulerMTAPI : public Scheduler {
...
@@ -44,6 +44,13 @@ class SchedulerMTAPI : public Scheduler {
:
slices_
(
slices
)
{
:
slices_
(
slices
)
{
embb
::
tasks
::
Node
&
node
=
embb
::
tasks
::
Node
::
GetInstance
();
embb
::
tasks
::
Node
&
node
=
embb
::
tasks
::
Node
::
GetInstance
();
int
tl
=
std
::
min
(
static_cast
<
int
>
(
node
.
GetTaskLimit
()),
static_cast
<
int
>
(
node
.
GetGroupCount
()));
if
(
tl
<
slices_
)
{
slices_
=
tl
;
}
group_
=
reinterpret_cast
<
embb
::
tasks
::
Group
**>
(
group_
=
reinterpret_cast
<
embb
::
tasks
::
Group
**>
(
embb
::
base
::
Allocation
::
Allocate
(
embb
::
base
::
Allocation
::
Allocate
(
sizeof
(
embb
::
tasks
::
Group
*
)
*
slices_
));
sizeof
(
embb
::
tasks
::
Group
*
)
*
slices_
));
...
@@ -93,7 +100,7 @@ class SchedulerMTAPI : public Scheduler {
...
@@ -93,7 +100,7 @@ class SchedulerMTAPI : public Scheduler {
virtual
void
WaitForSlice
(
int
slice
)
{
virtual
void
WaitForSlice
(
int
slice
)
{
group_
[
slice
]
->
WaitAll
(
MTAPI_INFINITE
);
group_
[
slice
]
->
WaitAll
(
MTAPI_INFINITE
);
}
}
virtual
int
GetSlices
()
{
return
slices_
;
}
private
:
private
:
embb
::
tasks
::
Group
**
group_
;
embb
::
tasks
::
Group
**
group_
;
embb
::
tasks
::
Queue
**
queue_
;
embb
::
tasks
::
Queue
**
queue_
;
...
...
dataflow_cpp/include/embb/dataflow/internal/scheduler_sequential.h
View file @
64b15b2a
...
@@ -45,6 +45,7 @@ class SchedulerSequential : public Scheduler {
...
@@ -45,6 +45,7 @@ class SchedulerSequential : public Scheduler {
action
.
RunSequential
();
action
.
RunSequential
();
}
}
virtual
void
WaitForSlice
(
int
/*slice*/
)
{}
virtual
void
WaitForSlice
(
int
/*slice*/
)
{}
virtual
int
GetSlices
()
{
return
1
;
}
};
};
}
// namespace internal
}
// namespace internal
...
...
dataflow_cpp/include/embb/dataflow/network.h
View file @
64b15b2a
...
@@ -687,6 +687,9 @@ class Network : public internal::ClockListener {
...
@@ -687,6 +687,9 @@ class Network : public internal::ClockListener {
slices_
=
int
(
embb_core_count_available
())
*
4
;
slices_
=
int
(
embb_core_count_available
())
*
4
;
}
}
sched_
=
embb
::
base
::
Allocation
::
New
<
internal
::
SchedulerMTAPI
>
(
slices_
);
sched_
=
embb
::
base
::
Allocation
::
New
<
internal
::
SchedulerMTAPI
>
(
slices_
);
if
(
sched_
->
GetSlices
()
!=
slices_
)
{
slices_
=
sched_
->
GetSlices
();
}
sink_counter_
=
reinterpret_cast
<
embb
::
base
::
Atomic
<
int
>*>
(
sink_counter_
=
reinterpret_cast
<
embb
::
base
::
Atomic
<
int
>*>
(
embb
::
base
::
Allocation
::
Allocate
(
embb
::
base
::
Allocation
::
Allocate
(
sizeof
(
embb
::
base
::
Atomic
<
int
>
)
*
slices_
));
sizeof
(
embb
::
base
::
Atomic
<
int
>
)
*
slices_
));
...
...
tasks_cpp/include/embb/tasks/node.h
View file @
64b15b2a
...
@@ -130,6 +130,15 @@ class Node {
...
@@ -130,6 +130,15 @@ class Node {
}
}
/**
/**
* Returns the number of available groups.
* \return The number of available groups
* \waitfree
*/
mtapi_uint_t
GetGroupCount
()
const
{
return
group_count_
;
}
/**
* Returns the number of available tasks.
* Returns the number of available tasks.
* \return The number of available tasks
* \return The number of available tasks
* \waitfree
* \waitfree
...
@@ -238,6 +247,7 @@ class Node {
...
@@ -238,6 +247,7 @@ class Node {
mtapi_task_context_t
*
context
);
mtapi_task_context_t
*
context
);
mtapi_uint_t
queue_count_
;
mtapi_uint_t
queue_count_
;
mtapi_uint_t
group_count_
;
mtapi_uint_t
task_limit_
;
mtapi_uint_t
task_limit_
;
mtapi_uint_t
core_count_
;
mtapi_uint_t
core_count_
;
mtapi_uint_t
worker_thread_count_
;
mtapi_uint_t
worker_thread_count_
;
...
...
tasks_cpp/src/node.cc
View file @
64b15b2a
...
@@ -78,6 +78,9 @@ Node::Node(
...
@@ -78,6 +78,9 @@ Node::Node(
mtapi_node_get_attribute
(
node_id
,
MTAPI_NODE_MAX_QUEUES
,
&
queue_count_
,
mtapi_node_get_attribute
(
node_id
,
MTAPI_NODE_MAX_QUEUES
,
&
queue_count_
,
sizeof
(
queue_count_
),
&
status
);
sizeof
(
queue_count_
),
&
status
);
assert
(
MTAPI_SUCCESS
==
status
);
assert
(
MTAPI_SUCCESS
==
status
);
mtapi_node_get_attribute
(
node_id
,
MTAPI_NODE_MAX_GROUPS
,
&
group_count_
,
sizeof
(
group_count_
),
&
status
);
assert
(
MTAPI_SUCCESS
==
status
);
mtapi_node_get_attribute
(
node_id
,
MTAPI_NODE_MAX_TASKS
,
&
task_limit_
,
mtapi_node_get_attribute
(
node_id
,
MTAPI_NODE_MAX_TASKS
,
&
task_limit_
,
sizeof
(
queue_count_
),
&
status
);
sizeof
(
queue_count_
),
&
status
);
assert
(
MTAPI_SUCCESS
==
status
);
assert
(
MTAPI_SUCCESS
==
status
);
...
...
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