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
d8fc59f1
Commit
d8fc59f1
authored
Jan 31, 2014
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added unit test for constant memory argument
parent
2be0b352
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
unit_testing/test_opencl.cpp
unit_testing/test_opencl.cpp
+28
-1
No files found.
unit_testing/test_opencl.cpp
View file @
d8fc59f1
...
...
@@ -21,6 +21,8 @@ using fvec = vector<float>;
constexpr
size_t
matrix_size
=
4
;
constexpr
size_t
array_size
=
32
;
constexpr
int
magic_number
=
23
;
// since we do currently not support local memory arguments
// this size is fixed in the reduce kernel code
constexpr
size_t
reduce_buffer_size
=
512
*
8
;
...
...
@@ -33,6 +35,7 @@ constexpr const char* kernel_name = "matrix_square";
constexpr
const
char
*
kernel_name_result_size
=
"result_size"
;
constexpr
const
char
*
kernel_name_compiler_flag
=
"compiler_flag"
;
constexpr
const
char
*
kernel_name_reduce
=
"reduce"
;
constexpr
const
char
*
kernel_name_const
=
"const_mod"
;
constexpr
const
char
*
compiler_flag
=
"-D OPENCL_CPPA_TEST_FLAG"
;
...
...
@@ -68,7 +71,8 @@ constexpr const char* kernel_source_compiler_flag = R"__(
}
)__"
;
// http://developer.amd.com/resources/documentation-articles/articles-whitepapers/opencl-optimization-case-study-simple-reductions/
// http://developer.amd.com/resources/documentation-articles/articles-whitepapers/
// opencl-optimization-case-study-simple-reductions
constexpr
const
char
*
kernel_source_reduce
=
R"__(
__kernel void reduce(__global int* buffer,
__global int* result) {
...
...
@@ -101,6 +105,14 @@ constexpr const char* kernel_source_reduce = R"__(
}
)__"
;
constexpr
const
char
*
kernel_source_const
=
R"__(
__kernel void const_mod(__constant int* input,
__global int* output) {
size_t idx = get_global_id(0);
output[idx] = input[0];
}
)__"
;
}
template
<
size_t
Size
>
...
...
@@ -279,6 +291,21 @@ int main() {
}
);
// constant memory arguments
ivec
arr7
{
magic_number
};
auto
worker7
=
spawn_cl
<
ivec
(
ivec
&
)
>
(
kernel_source_const
,
kernel_name_const
,
{
magic_number
});
send
(
worker7
,
move
(
arr7
));
ivec
expected5
(
magic_number
);
fill
(
begin
(
expected5
),
end
(
expected5
),
magic_number
);
receive
(
on_arg_match
>>
[
&
]
(
const
ivec
&
result
)
{
CPPA_CHECK
(
equal
(
begin
(
expected5
),
end
(
expected5
),
begin
(
result
)));
}
);
cppa
::
await_all_others_done
();
cppa
::
shutdown
();
...
...
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