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
861be5e0
Commit
861be5e0
authored
Jun 06, 2013
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code optimizations
parent
111eb6ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
16 deletions
+13
-16
libcaf_opencl/cppa/opencl/actor_facade.hpp
libcaf_opencl/cppa/opencl/actor_facade.hpp
+10
-10
libcaf_opencl/cppa/opencl/command.hpp
libcaf_opencl/cppa/opencl/command.hpp
+3
-6
No files found.
libcaf_opencl/cppa/opencl/actor_facade.hpp
View file @
861be5e0
...
@@ -151,15 +151,15 @@ class actor_facade<Ret(Args...)> : public actor {
...
@@ -151,15 +151,15 @@ class actor_facade<Ret(Args...)> : public actor {
auto
opt
=
m_map_args
(
msg
);
auto
opt
=
m_map_args
(
msg
);
if
(
opt
)
{
if
(
opt
)
{
response_handle
handle
{
this
,
sender
,
id
.
response_id
()};
response_handle
handle
{
this
,
sender
,
id
.
response_id
()};
Ret
result_buf
(
std
::
accumulate
(
m_global_dimensions
.
begin
(),
size_t
ret_size
=
std
::
accumulate
(
m_global_dimensions
.
begin
(),
m_global_dimensions
.
end
(),
m_global_dimensions
.
end
(),
1
,
std
::
multiplies
<
size_t
>
{})
);
1
,
std
::
multiplies
<
size_t
>
{}
);
std
::
vector
<
mem_ptr
>
arguments
;
std
::
vector
<
mem_ptr
>
arguments
;
add_arguments_to_kernel
(
arguments
,
add_arguments_to_kernel
<
Ret
>
(
arguments
,
m_context
.
get
(),
m_context
.
get
(),
m_kernel
.
get
(),
m_kernel
.
get
(),
result_buf
,
ret_size
,
get_ref
<
Is
>
(
*
opt
)...);
get_ref
<
Is
>
(
*
opt
)...);
enqueue_to_dispatcher
(
m_dispatcher
,
enqueue_to_dispatcher
(
m_dispatcher
,
make_counted
<
command_impl
<
Ret
>>
(
handle
,
make_counted
<
command_impl
<
Ret
>>
(
handle
,
m_kernel
,
m_kernel
,
...
@@ -231,13 +231,13 @@ class actor_facade<Ret(Args...)> : public actor {
...
@@ -231,13 +231,13 @@ class actor_facade<Ret(Args...)> : public actor {
void
add_arguments_to_kernel
(
args_vec
&
arguments
,
void
add_arguments_to_kernel
(
args_vec
&
arguments
,
cl_context
context
,
cl_context
context
,
cl_kernel
kernel
,
cl_kernel
kernel
,
R
&
ret
,
size_t
ret_size
,
Ts
&&
...
args
)
{
Ts
&&
...
args
)
{
arguments
.
clear
();
arguments
.
clear
();
cl_int
err
{
0
};
cl_int
err
{
0
};
auto
buf
=
clCreateBuffer
(
context
,
auto
buf
=
clCreateBuffer
(
context
,
CL_MEM_WRITE_ONLY
,
CL_MEM_WRITE_ONLY
,
sizeof
(
typename
R
::
value_type
)
*
ret
.
size
()
,
sizeof
(
typename
R
::
value_type
)
*
ret
_size
,
nullptr
,
nullptr
,
&
err
);
&
err
);
if
(
err
!=
CL_SUCCESS
)
{
if
(
err
!=
CL_SUCCESS
)
{
...
...
libcaf_opencl/cppa/opencl/command.hpp
View file @
861be5e0
...
@@ -80,7 +80,7 @@ class command_impl : public command {
...
@@ -80,7 +80,7 @@ class command_impl : public command {
1
,
std
::
multiplies
<
size_t
>
{}))
1
,
std
::
multiplies
<
size_t
>
{}))
,
m_handle
(
handle
)
,
m_handle
(
handle
)
,
m_kernel
(
kernel
)
,
m_kernel
(
kernel
)
,
m_arguments
(
arguments
)
,
m_arguments
(
move
(
arguments
)
)
,
m_global_dims
(
global_dims
)
,
m_global_dims
(
global_dims
)
,
m_offsets
(
offsets
)
,
m_offsets
(
offsets
)
,
m_local_dims
(
local_dims
)
,
m_local_dims
(
local_dims
)
...
@@ -141,7 +141,6 @@ class command_impl : public command {
...
@@ -141,7 +141,6 @@ class command_impl : public command {
void
handle_results
()
{
void
handle_results
()
{
cl_int
err
{
0
};
cl_int
err
{
0
};
cl_event
read_event
;
T
result
(
m_number_of_values
);
T
result
(
m_number_of_values
);
err
=
clEnqueueReadBuffer
(
m_queue
.
get
(),
err
=
clEnqueueReadBuffer
(
m_queue
.
get
(),
m_arguments
[
0
].
get
(),
m_arguments
[
0
].
get
(),
...
@@ -151,14 +150,12 @@ class command_impl : public command {
...
@@ -151,14 +150,12 @@ class command_impl : public command {
result
.
data
(),
result
.
data
(),
0
,
0
,
nullptr
,
nullptr
,
&
read_event
);
nullptr
);
clReleaseEvent
(
read_event
);
if
(
err
!=
CL_SUCCESS
)
{
if
(
err
!=
CL_SUCCESS
)
{
throw
std
::
runtime_error
(
"clEnqueueReadBuffer: "
throw
std
::
runtime_error
(
"clEnqueueReadBuffer: "
+
get_opencl_error
(
err
));
+
get_opencl_error
(
err
));
}
}
auto
mapped_result
=
m_map_result
(
result
);
reply_tuple_to
(
m_handle
,
m_map_result
(
result
));
reply_tuple_to
(
m_handle
,
mapped_result
);
}
}
};
};
...
...
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