Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
cc7e8d5a
Unverified
Commit
cc7e8d5a
authored
Apr 23, 2020
by
Dominik Charousset
Committed by
GitHub
Apr 23, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1093
Fix build with C++17 enabled
parents
e83e5f84
1fb71654
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
26 deletions
+63
-26
Jenkinsfile
Jenkinsfile
+5
-0
libcaf_core/caf/detail/type_traits.hpp
libcaf_core/caf/detail/type_traits.hpp
+17
-0
libcaf_opencl/examples/proper_matrix.cpp
libcaf_opencl/examples/proper_matrix.cpp
+11
-7
libcaf_opencl/examples/scan.cpp
libcaf_opencl/examples/scan.cpp
+18
-11
libcaf_opencl/test/opencl.cpp
libcaf_opencl/test/opencl.cpp
+12
-8
No files found.
Jenkinsfile
View file @
cc7e8d5a
...
...
@@ -38,6 +38,11 @@ config = [
tools:
[
'gcc8'
],
extraSteps:
[
'coverageReport'
],
]],
[
'Linux'
,
[
builds:
[
'debug'
],
tools:
[
'gcc8'
],
extraFlags:
[
'EXTRA_FLAGS=-std=c++17'
]
]],
[
'Linux'
,
[
builds:
[
'release'
],
tools:
[
'gcc8'
],
...
...
libcaf_core/caf/detail/type_traits.hpp
View file @
cc7e8d5a
...
...
@@ -471,6 +471,23 @@ struct callable_trait<R (C::*)(Ts...)> : callable_trait<R (Ts...)> {};
template
<
class
R
,
class
...
Ts
>
struct
callable_trait
<
R
(
*
)(
Ts
...)
>
:
callable_trait
<
R
(
Ts
...)
>
{};
#if __cplusplus >= 201703L
// member const function pointer
template
<
class
C
,
typename
R
,
class
...
Ts
>
struct
callable_trait
<
R
(
C
::*
)(
Ts
...)
const
noexcept
>
:
callable_trait
<
R
(
Ts
...)
>
{};
// member function pointer
template
<
class
C
,
typename
R
,
class
...
Ts
>
struct
callable_trait
<
R
(
C
::*
)(
Ts
...)
noexcept
>
:
callable_trait
<
R
(
Ts
...)
>
{};
// good ol' function pointer
template
<
class
R
,
class
...
Ts
>
struct
callable_trait
<
R
(
*
)(
Ts
...)
noexcept
>
:
callable_trait
<
R
(
Ts
...)
>
{};
#endif
template
<
class
T
>
struct
has_apply_operator
{
template
<
class
U
>
...
...
libcaf_opencl/examples/proper_matrix.cpp
View file @
cc7e8d5a
...
...
@@ -27,10 +27,14 @@
#include "caf/opencl/all.hpp"
using
namespace
std
;
using
namespace
caf
;
using
namespace
caf
::
opencl
;
using
std
::
cout
;
using
std
::
endl
;
using
std
::
string
;
using
std
::
vector
;
using
caf
::
detail
::
limited_vector
;
namespace
{
...
...
@@ -111,11 +115,12 @@ private:
template
<
size_t
Size
>
string
to_string
(
const
square_matrix
<
Size
>&
m
)
{
ostringstream
oss
;
std
::
ostringstream
oss
;
oss
.
fill
(
' '
);
for
(
size_t
row
=
0
;
row
<
Size
;
++
row
)
{
for
(
size_t
column
=
0
;
column
<
Size
;
++
column
)
oss
<<
fixed
<<
setprecision
(
2
)
<<
setw
(
9
)
<<
m
(
column
,
row
);
oss
<<
std
::
fixed
<<
std
::
setprecision
(
2
)
<<
std
::
setw
(
9
)
<<
m
(
column
,
row
);
oss
<<
'\n'
;
}
return
oss
.
str
();
...
...
@@ -181,11 +186,10 @@ void multiplier(event_based_actor* self) {
// send both matrices to the actor and
// wait for results in form of a matrix_type
self
->
request
(
worker
,
chrono
::
seconds
(
5
),
move
(
m1
),
move
(
m2
)).
then
(
[](
const
matrix_type
&
result
)
{
self
->
request
(
worker
,
std
::
chrono
::
seconds
(
5
),
std
::
move
(
m1
),
std
::
move
(
m2
))
.
then
(
[](
const
matrix_type
&
result
)
{
cout
<<
"result:"
<<
endl
<<
to_string
(
result
);
}
);
});
}
int
main
()
{
...
...
libcaf_opencl/examples/scan.cpp
View file @
cc7e8d5a
...
...
@@ -26,10 +26,15 @@
#include "caf/all.hpp"
#include "caf/opencl/all.hpp"
using
namespace
std
;
using
namespace
caf
;
using
namespace
caf
::
opencl
;
using
std
::
cerr
;
using
std
::
cout
;
using
std
::
endl
;
using
std
::
string
;
using
std
::
vector
;
using
caf
::
detail
::
limited_vector
;
namespace
{
...
...
@@ -166,7 +171,7 @@ kernel void phase_3(global uint* restrict data,
}
// namespace
template
<
class
T
,
class
E
=
caf
::
detail
::
enable_if_t
<
is_integral
<
T
>
::
value
>>
template
<
class
T
,
class
=
caf
::
detail
::
enable_if_t
<
std
::
is_integral
<
T
>
::
value
>>
T
round_up
(
T
numToRound
,
T
multiple
)
{
return
((
numToRound
+
multiple
-
1
)
/
multiple
)
*
multiple
;
}
...
...
@@ -180,9 +185,9 @@ int main() {
<<
"' values."
<<
endl
;
// ---- create data ----
uvec
values
(
problem_size
);
random_device
rd
;
mt19937
gen
(
rd
());
uniform_int_distribution
<
uval
>
val_gen
(
0
,
1023
);
std
::
random_device
rd
;
std
::
mt19937
gen
(
rd
());
std
::
uniform_int_distribution
<
uval
>
val_gen
(
0
,
1023
);
std
::
generate
(
begin
(
values
),
end
(
values
),
[
&
]()
{
return
val_gen
(
gen
);
});
// ---- find device ----
auto
&
mngr
=
system
.
opencl_manager
();
...
...
@@ -205,7 +210,7 @@ int main() {
}
{
// ---- general ----
auto
dev
=
move
(
*
opt
);
auto
dev
=
std
::
move
(
*
opt
);
auto
prog
=
mngr
.
create_program
(
kernel_source
,
""
,
dev
);
scoped_actor
self
{
system
};
// ---- config parameters ----
...
...
@@ -243,7 +248,8 @@ int main() {
return
msg
.
apply
([
&
](
uref
&
data
,
uref
&
incs
)
{
auto
size
=
incs
.
size
();
range
=
nd_conf
(
size
);
return
make_message
(
move
(
data
),
move
(
incs
),
static_cast
<
uval
>
(
size
));
return
make_message
(
std
::
move
(
data
),
std
::
move
(
incs
),
static_cast
<
uval
>
(
size
));
});
},
in_out
<
uval
,
mref
,
mref
>
{},
...
...
@@ -256,7 +262,8 @@ int main() {
return
msg
.
apply
([
&
](
uref
&
data
,
uref
&
incs
)
{
auto
size
=
incs
.
size
();
range
=
nd_conf
(
size
);
return
make_message
(
move
(
data
),
move
(
incs
),
static_cast
<
uval
>
(
size
));
return
make_message
(
std
::
move
(
data
),
std
::
move
(
incs
),
static_cast
<
uval
>
(
size
));
});
},
in_out
<
uval
,
mref
,
val
>
{},
...
...
@@ -273,8 +280,8 @@ int main() {
cout
<<
" index | values | scan "
<<
endl
<<
"-------+--------+--------"
<<
endl
;
for
(
size_t
i
=
0
;
i
<
problem_size
;
++
i
)
cout
<<
s
etw
(
6
)
<<
i
<<
" | "
<<
setw
(
6
)
<<
values
[
i
]
<<
" | "
<<
setw
(
6
)
<<
results
[
i
]
<<
endl
;
cout
<<
s
td
::
setw
(
6
)
<<
i
<<
" | "
<<
std
::
setw
(
6
)
<<
values
[
i
]
<<
" | "
<<
std
::
setw
(
6
)
<<
results
[
i
]
<<
std
::
endl
;
}
);
}
...
...
libcaf_opencl/test/opencl.cpp
View file @
cc7e8d5a
...
...
@@ -12,10 +12,14 @@
#include "caf/opencl/all.hpp"
using
namespace
std
;
using
namespace
caf
;
using
namespace
caf
::
opencl
;
using
std
::
cout
;
using
std
::
endl
;
using
std
::
string
;
using
std
::
vector
;
using
caf
::
detail
::
tl_at
;
using
caf
::
detail
::
tl_head
;
using
caf
::
detail
::
type_list
;
...
...
@@ -292,7 +296,7 @@ void check_vector_results(const string& description,
cout
<<
"Size: "
<<
expected
.
size
()
<<
" vs. "
<<
result
.
size
()
<<
endl
;
cout
<<
"Differ at: "
<<
endl
;
bool
same
=
true
;
for
(
size_t
i
=
0
;
i
<
min
(
expected
.
size
(),
result
.
size
());
++
i
)
{
for
(
size_t
i
=
0
;
i
<
std
::
min
(
expected
.
size
(),
result
.
size
());
++
i
)
{
if
(
expected
[
i
]
!=
result
[
i
])
{
cout
<<
"["
<<
i
<<
"] "
<<
expected
[
i
]
<<
" != "
<<
result
[
i
]
<<
endl
;
same
=
false
;
...
...
@@ -405,7 +409,7 @@ void test_opencl(actor_system& sys) {
"semicolon is missing)."
);
try
{
/* auto expected_error = */
mngr
.
create_program
(
kernel_source_error
);
}
catch
(
const
exception
&
exc
)
{
}
catch
(
const
std
::
exception
&
exc
)
{
CAF_MESSAGE
(
"got: "
<<
exc
.
what
());
}
#endif // CAF_NO_EXCEPTIONS
...
...
@@ -423,7 +427,7 @@ void test_opencl(actor_system& sys) {
);
// test for manuel return size selection (max workgroup size 1d)
auto
max_wg_size
=
min
(
dev
->
max_work_item_sizes
()[
0
],
size_t
{
512
});
auto
max_wg_size
=
std
::
min
(
dev
->
max_work_item_sizes
()[
0
],
size_t
{
512
});
auto
reduce_buffer_size
=
static_cast
<
size_t
>
(
max_wg_size
)
*
8
;
auto
reduce_local_size
=
static_cast
<
size_t
>
(
max_wg_size
);
auto
reduce_work_groups
=
reduce_buffer_size
/
reduce_local_size
;
...
...
@@ -731,7 +735,7 @@ void test_in_val_out_val(actor_system& sys) {
},
others
>>
wrong_msg
);
// test for manuel return size selection (max workgroup size 1d)
auto
max_wg_size
=
min
(
dev
->
max_work_item_sizes
()[
0
],
size_t
{
512
});
auto
max_wg_size
=
std
::
min
(
dev
->
max_work_item_sizes
()[
0
],
size_t
{
512
});
auto
reduce_buffer_size
=
static_cast
<
size_t
>
(
max_wg_size
)
*
8
;
auto
reduce_local_size
=
static_cast
<
size_t
>
(
max_wg_size
);
auto
reduce_work_groups
=
reduce_buffer_size
/
reduce_local_size
;
...
...
@@ -801,7 +805,7 @@ void test_in_val_out_mref(actor_system& sys) {
" (kernel passed directly)"
,
res1
,
result
);
},
others
>>
wrong_msg
);
// test for manuel return size selection (max workgroup size 1d)
auto
max_wg_size
=
min
(
dev
->
max_work_item_sizes
()[
0
],
size_t
{
512
});
auto
max_wg_size
=
std
::
min
(
dev
->
max_work_item_sizes
()[
0
],
size_t
{
512
});
auto
reduce_buffer_size
=
static_cast
<
size_t
>
(
max_wg_size
)
*
8
;
auto
reduce_local_size
=
static_cast
<
size_t
>
(
max_wg_size
);
auto
reduce_work_groups
=
reduce_buffer_size
/
reduce_local_size
;
...
...
@@ -858,7 +862,7 @@ void test_in_mref_out_val(actor_system& sys) {
" (kernel passed directly)"
,
res1
,
result
);
},
others
>>
wrong_msg
);
// test for manuel return size selection (max workgroup size 1d)
auto
max_wg_size
=
min
(
dev
->
max_work_item_sizes
()[
0
],
size_t
{
512
});
auto
max_wg_size
=
std
::
min
(
dev
->
max_work_item_sizes
()[
0
],
size_t
{
512
});
auto
reduce_buffer_size
=
static_cast
<
size_t
>
(
max_wg_size
)
*
8
;
auto
reduce_local_size
=
static_cast
<
size_t
>
(
max_wg_size
);
auto
reduce_work_groups
=
reduce_buffer_size
/
reduce_local_size
;
...
...
@@ -917,7 +921,7 @@ void test_in_mref_out_mref(actor_system& sys) {
" (kernel passed directly)"
,
res1
,
result
);
},
others
>>
wrong_msg
);
// test for manuel return size selection (max workgroup size 1d)
auto
max_wg_size
=
min
(
dev
->
max_work_item_sizes
()[
0
],
size_t
{
512
});
auto
max_wg_size
=
std
::
min
(
dev
->
max_work_item_sizes
()[
0
],
size_t
{
512
});
auto
reduce_buffer_size
=
static_cast
<
size_t
>
(
max_wg_size
)
*
8
;
auto
reduce_local_size
=
static_cast
<
size_t
>
(
max_wg_size
);
auto
reduce_work_groups
=
reduce_buffer_size
/
reduce_local_size
;
...
...
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