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
626b3456
Commit
626b3456
authored
Jul 13, 2015
by
Marian Triebe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compile
parent
98ea3267
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
11 deletions
+23
-11
libcaf_opencl/examples/proper_matrix.cpp
libcaf_opencl/examples/proper_matrix.cpp
+3
-1
libcaf_opencl/examples/simple_matrix.cpp
libcaf_opencl/examples/simple_matrix.cpp
+3
-1
libcaf_opencl/test/opencl.cpp
libcaf_opencl/test/opencl.cpp
+17
-9
No files found.
libcaf_opencl/examples/proper_matrix.cpp
View file @
626b3456
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
using
namespace
std
;
using
namespace
std
;
using
namespace
caf
;
using
namespace
caf
;
using
detail
::
limited_vector
;
namespace
{
namespace
{
using
fvec
=
vector
<
float
>
;
using
fvec
=
vector
<
float
>
;
...
@@ -169,7 +171,7 @@ void multiplier(event_based_actor* self) {
...
@@ -169,7 +171,7 @@ void multiplier(event_based_actor* self) {
box_res
,
box_res
,
// 5th arg: global dimension arguments for opencl's enqueue,
// 5th arg: global dimension arguments for opencl's enqueue,
// creates matrix_size * matrix_size global work items
// creates matrix_size * matrix_size global work items
{
matrix_size
,
matrix_size
}
limited_vector
<
size_t
,
3
>
{
matrix_size
,
matrix_size
}
);
);
// send both matrices to the actor and
// send both matrices to the actor and
...
...
libcaf_opencl/examples/simple_matrix.cpp
View file @
626b3456
...
@@ -28,6 +28,8 @@
...
@@ -28,6 +28,8 @@
using
namespace
std
;
using
namespace
std
;
using
namespace
caf
;
using
namespace
caf
;
using
detail
::
limited_vector
;
namespace
{
namespace
{
constexpr
size_t
matrix_size
=
8
;
constexpr
size_t
matrix_size
=
8
;
...
@@ -91,7 +93,7 @@ void multiplier(event_based_actor* self) {
...
@@ -91,7 +93,7 @@ void multiplier(event_based_actor* self) {
// 6th arg: number of elements in the result buffer
// 6th arg: number of elements in the result buffer
auto
worker
=
spawn_cl
<
float
*
(
float
*
,
float
*
)
>
(
kernel_source
,
auto
worker
=
spawn_cl
<
float
*
(
float
*
,
float
*
)
>
(
kernel_source
,
kernel_name
,
kernel_name
,
{
matrix_size
,
matrix_size
},
limited_vector
<
size_t
,
3
>
{
matrix_size
,
matrix_size
},
{},
{},
{},
{},
matrix_size
*
matrix_size
);
matrix_size
*
matrix_size
);
...
...
libcaf_opencl/test/opencl.cpp
View file @
626b3456
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
using
namespace
caf
;
using
namespace
caf
;
using
namespace
caf
::
opencl
;
using
namespace
caf
::
opencl
;
using
detail
::
limited_vector
;
namespace
{
namespace
{
using
ivec
=
std
::
vector
<
int
>
;
using
ivec
=
std
::
vector
<
int
>
;
...
@@ -195,7 +197,8 @@ void test_opencl() {
...
@@ -195,7 +197,8 @@ void test_opencl() {
344
,
398
,
452
,
506
};
344
,
398
,
452
,
506
};
auto
w1
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
program
::
create
(
kernel_source
),
auto
w1
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
program
::
create
(
kernel_source
),
kernel_name
,
kernel_name
,
{
matrix_size
,
matrix_size
});
limited_vector
<
size_t
,
3
>
{
matrix_size
,
matrix_size
});
self
->
send
(
w1
,
make_iota_vector
<
int
>
(
matrix_size
*
matrix_size
));
self
->
send
(
w1
,
make_iota_vector
<
int
>
(
matrix_size
*
matrix_size
));
self
->
receive
(
self
->
receive
(
[
&
](
const
ivec
&
result
)
{
[
&
](
const
ivec
&
result
)
{
...
@@ -203,7 +206,8 @@ void test_opencl() {
...
@@ -203,7 +206,8 @@ void test_opencl() {
}
}
);
);
auto
w2
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
kernel_source
,
kernel_name
,
auto
w2
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
kernel_source
,
kernel_name
,
{
matrix_size
,
matrix_size
});
limited_vector
<
size_t
,
3
>
{
matrix_size
,
matrix_size
});
self
->
send
(
w2
,
make_iota_vector
<
int
>
(
matrix_size
*
matrix_size
));
self
->
send
(
w2
,
make_iota_vector
<
int
>
(
matrix_size
*
matrix_size
));
self
->
receive
(
self
->
receive
(
[
&
](
const
ivec
&
result
)
{
[
&
](
const
ivec
&
result
)
{
...
@@ -221,8 +225,10 @@ void test_opencl() {
...
@@ -221,8 +225,10 @@ void test_opencl() {
auto
map_res
=
[](
ivec
&
result
)
->
message
{
auto
map_res
=
[](
ivec
&
result
)
->
message
{
return
make_message
(
matrix_type
{
std
::
move
(
result
)});
return
make_message
(
matrix_type
{
std
::
move
(
result
)});
};
};
auto
w3
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
program
::
create
(
kernel_source
),
kernel_name
,
auto
w3
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
program
::
create
(
kernel_source
),
map_arg
,
map_res
,
{
matrix_size
,
matrix_size
});
kernel_name
,
map_arg
,
map_res
,
limited_vector
<
size_t
,
3
>
{
matrix_size
,
matrix_size
});
self
->
send
(
w3
,
make_iota_matrix
<
matrix_size
>
());
self
->
send
(
w3
,
make_iota_matrix
<
matrix_size
>
());
self
->
receive
(
self
->
receive
(
[
&
](
const
matrix_type
&
result
)
{
[
&
](
const
matrix_type
&
result
)
{
...
@@ -231,7 +237,8 @@ void test_opencl() {
...
@@ -231,7 +237,8 @@ void test_opencl() {
);
);
auto
w4
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
kernel_source
,
kernel_name
,
auto
w4
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
kernel_source
,
kernel_name
,
map_arg
,
map_res
,
map_arg
,
map_res
,
{
matrix_size
,
matrix_size
});
limited_vector
<
size_t
,
3
>
{
matrix_size
,
matrix_size
});
self
->
send
(
w4
,
make_iota_matrix
<
matrix_size
>
());
self
->
send
(
w4
,
make_iota_matrix
<
matrix_size
>
());
self
->
receive
(
self
->
receive
(
[
&
](
const
matrix_type
&
result
)
{
[
&
](
const
matrix_type
&
result
)
{
...
@@ -247,7 +254,8 @@ void test_opencl() {
...
@@ -247,7 +254,8 @@ void test_opencl() {
}
}
// test for opencl compiler flags
// test for opencl compiler flags
auto
prog5
=
program
::
create
(
kernel_source_compiler_flag
,
compiler_flag
);
auto
prog5
=
program
::
create
(
kernel_source_compiler_flag
,
compiler_flag
);
auto
w5
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
prog5
,
kernel_name_compiler_flag
,
{
array_size
});
auto
w5
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
prog5
,
kernel_name_compiler_flag
,
limited_vector
<
size_t
,
3
>
{
array_size
});
self
->
send
(
w5
,
make_iota_vector
<
int
>
(
array_size
));
self
->
send
(
w5
,
make_iota_vector
<
int
>
(
array_size
));
auto
expected3
=
make_iota_vector
<
int
>
(
array_size
);
auto
expected3
=
make_iota_vector
<
int
>
(
array_size
);
self
->
receive
(
self
->
receive
(
...
@@ -267,9 +275,9 @@ void test_opencl() {
...
@@ -267,9 +275,9 @@ void test_opencl() {
int
n
=
static_cast
<
int
>
(
arr6
.
capacity
());
int
n
=
static_cast
<
int
>
(
arr6
.
capacity
());
std
::
generate
(
arr6
.
begin
(),
arr6
.
end
(),
[
&
]{
return
--
n
;
});
std
::
generate
(
arr6
.
begin
(),
arr6
.
end
(),
[
&
]{
return
--
n
;
});
auto
w6
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
kernel_source_reduce
,
kernel_name_reduce
,
auto
w6
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
kernel_source_reduce
,
kernel_name_reduce
,
{
static_cast
<
size_t
>
(
reduce_global_size
)},
limited_vector
<
size_t
,
3
>
{
static_cast
<
size_t
>
(
reduce_global_size
)},
{},
{},
{
static_cast
<
size_t
>
(
reduce_local_size
)},
limited_vector
<
size_t
,
3
>
{
static_cast
<
size_t
>
(
reduce_local_size
)},
static_cast
<
size_t
>
(
reduce_result_size
));
static_cast
<
size_t
>
(
reduce_result_size
));
self
->
send
(
w6
,
move
(
arr6
));
self
->
send
(
w6
,
move
(
arr6
));
ivec
expected4
{
max_workgroup_size
*
7
,
max_workgroup_size
*
6
,
ivec
expected4
{
max_workgroup_size
*
7
,
max_workgroup_size
*
6
,
...
@@ -284,7 +292,7 @@ void test_opencl() {
...
@@ -284,7 +292,7 @@ void test_opencl() {
// constant memory arguments
// constant memory arguments
const
ivec
arr7
{
magic_number
};
const
ivec
arr7
{
magic_number
};
auto
w7
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
kernel_source_const
,
kernel_name_const
,
auto
w7
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
kernel_source_const
,
kernel_name_const
,
{
magic_number
});
limited_vector
<
size_t
,
3
>
{
magic_number
});
self
->
send
(
w7
,
move
(
arr7
));
self
->
send
(
w7
,
move
(
arr7
));
ivec
expected5
(
magic_number
);
ivec
expected5
(
magic_number
);
fill
(
begin
(
expected5
),
end
(
expected5
),
magic_number
);
fill
(
begin
(
expected5
),
end
(
expected5
),
magic_number
);
...
...
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