Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
las3_pub
/
predictable_parallel_patterns
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
3bdaba42
authored
Jun 05, 2019
by
FritzFlorian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt tests to new fork-join model.
parent
10ca31dc
Pipeline
#1245
failed with stages
in 27 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
12 deletions
+11
-12
lib/pls/include/pls/internal/scheduling/task.h
+3
-3
test/CMakeLists.txt
+2
-1
test/scheduling_tests.cpp
+6
-8
No files found.
lib/pls/include/pls/internal/scheduling/task.h
View file @
3bdaba42
...
...
@@ -34,7 +34,7 @@ class task {
virtual
void
execute_internal
()
=
0
;
template
<
typename
T
>
void
spawn_child
(
T
&
sub_task
);
void
spawn_child
(
T
&
&
sub_task
);
void
wait_for_all
();
private
:
...
...
@@ -42,9 +42,9 @@ class task {
};
template
<
typename
T
>
void
task
::
spawn_child
(
T
&
sub_task
)
{
void
task
::
spawn_child
(
T
&
&
sub_task
)
{
PROFILE_FORK_JOIN_STEALING
(
"spawn_child"
)
static_assert
(
std
::
is_base_of
<
task
,
T
>::
value
,
"Only pass task subclasses!"
);
static_assert
(
std
::
is_base_of
<
task
,
typename
std
::
remove_reference
<
T
>::
type
>::
value
,
"Only pass task subclasses!"
);
// Keep our refcount up to date
ref_count_
++
;
...
...
test/CMakeLists.txt
View file @
3bdaba42
add_executable
(
tests
main.cpp
data_structures_test.cpp
)
data_structures_test.cpp
scheduling_tests.cpp
)
target_link_libraries
(
tests catch2 pls
)
test/scheduling_tests.cpp
View file @
3bdaba42
...
...
@@ -4,7 +4,7 @@
using
namespace
pls
;
class
once_sub_task
:
public
fork_join_sub_
task
{
class
once_sub_task
:
public
task
{
std
::
atomic
<
int
>
*
counter_
;
int
children_
;
...
...
@@ -18,12 +18,12 @@ class once_sub_task : public fork_join_sub_task {
public
:
explicit
once_sub_task
(
std
::
atomic
<
int
>
*
counter
,
int
children
)
:
fork_join_sub_task
()
,
task
{}
,
counter_
{
counter
},
children_
{
children
}
{}
};
class
force_steal_sub_task
:
public
fork_join_sub_
task
{
class
force_steal_sub_task
:
public
task
{
std
::
atomic
<
int
>
*
parent_counter_
;
std
::
atomic
<
int
>
*
overall_counter_
;
...
...
@@ -41,7 +41,7 @@ class force_steal_sub_task : public fork_join_sub_task {
public
:
explicit
force_steal_sub_task
(
std
::
atomic
<
int
>
*
parent_counter
,
std
::
atomic
<
int
>
*
overall_counter
)
:
fork_join_sub_task
()
,
task
{}
,
parent_counter_
{
parent_counter
},
overall_counter_
{
overall_counter
}
{}
};
...
...
@@ -57,8 +57,7 @@ TEST_CASE("tbb task are scheduled correctly", "[internal/scheduling/fork_join_ta
my_scheduler
.
perform_work
([
&
]()
{
once_sub_task
sub_task
{
&
counter
,
start_counter
};
fork_join_task
task
{
&
sub_task
,
unique_id
::
create
(
42
)};
scheduler
::
execute_task
(
task
);
scheduler
::
spawn_child
(
sub_task
);
});
REQUIRE
(
counter
.
load
()
==
total_tasks
);
...
...
@@ -70,8 +69,7 @@ TEST_CASE("tbb task are scheduled correctly", "[internal/scheduling/fork_join_ta
my_scheduler
.
perform_work
([
&
]()
{
std
::
atomic
<
int
>
dummy_parent
{
1
},
overall_counter
{
8
};
force_steal_sub_task
sub_task
{
&
dummy_parent
,
&
overall_counter
};
fork_join_task
task
{
&
sub_task
,
unique_id
::
create
(
42
)};
scheduler
::
execute_task
(
task
);
scheduler
::
spawn_child
(
sub_task
);
});
my_scheduler
.
terminate
(
true
);
}
...
...
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