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
624a2741
Commit
624a2741
authored
Apr 02, 2013
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code optimizations
parent
813597df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
29 deletions
+25
-29
libcaf_opencl/cppa/opencl/actor_facade.hpp
libcaf_opencl/cppa/opencl/actor_facade.hpp
+12
-20
libcaf_opencl/cppa/opencl/command.hpp
libcaf_opencl/cppa/opencl/command.hpp
+9
-8
libcaf_opencl/src/opencl/command_dispatcher.cpp
libcaf_opencl/src/opencl/command_dispatcher.cpp
+4
-1
No files found.
libcaf_opencl/cppa/opencl/actor_facade.hpp
View file @
624a2741
...
...
@@ -33,6 +33,7 @@
#define CPPA_OPENCL_ACTOR_FACADE_HPP
#include <ostream>
#include <algorithm>
#include <stdexcept>
#include "cppa/cppa.hpp"
...
...
@@ -131,28 +132,19 @@ class actor_facade<Ret(Args...)> : public actor {
template
<
long
...
Is
>
void
enqueue_impl
(
const
actor_ptr
&
sender
,
any_tuple
msg
,
message_id
id
,
util
::
int_list
<
Is
...
>
)
{
//auto opt = tuple_cast<Args...>(msg);
if
(
m_global_dimensions
.
empty
())
{
std
::
ostringstream
oss
;
oss
<<
"actor_facade::enqueue() global dimensions can't be empty!"
;
CPPA_LOG_ERROR
(
oss
.
str
());
throw
std
::
runtime_error
(
oss
.
str
());
}
auto
opt
=
m_map_args
(
msg
);
if
(
opt
)
{
response_handle
handle
{
this
,
sender
,
id
};
size_t
number_of_values
=
1
;
if
(
!
m_global_dimensions
.
empty
())
{
for
(
auto
s
:
m_global_dimensions
)
{
number_of_values
*=
s
;
}
}
else
{
number_of_values
=
get
<
0
>
(
*
opt
).
size
();
m_global_dimensions
.
push_back
(
number_of_values
);
m_global_dimensions
.
push_back
(
1
);
m_global_dimensions
.
push_back
(
1
);
}
if
(
m_global_dimensions
.
empty
()
||
number_of_values
<=
0
)
{
std
::
ostringstream
oss
;
oss
<<
"actor_facade::enqueue() can't handle dimension sizes!"
;
CPPA_LOG_ERROR
(
oss
.
str
());
throw
std
::
runtime_error
(
oss
.
str
());
}
size_t
number_of_values
{
1
};
std
::
for_each
(
m_global_dimensions
.
begin
(),
m_global_dimensions
.
end
(),
[
&
](
const
size_t
&
s
)
{
number_of_values
*=
s
;
});
Ret
result_buf
(
number_of_values
);
std
::
vector
<
mem_ptr
>
arguments
;
add_arguments_to_kernel
(
arguments
,
...
...
@@ -164,7 +156,7 @@ class actor_facade<Ret(Args...)> : public actor {
enqueue_to_dispatcher
(
m_dispatcher
,
make_counted
<
command_impl
<
Ret
>>
(
handle
,
m_kernel
,
arguments
,
std
::
move
(
arguments
)
,
m_global_dimensions
,
m_global_offsets
,
m_local_dimensions
,
...
...
libcaf_opencl/cppa/opencl/command.hpp
View file @
624a2741
...
...
@@ -33,6 +33,7 @@
#define CPPA_OPENCL_COMMAND_HPP
#include <vector>
#include <algorithm>
#include <functional>
#include "cppa/actor.hpp"
...
...
@@ -69,10 +70,10 @@ class command_impl : public command {
command_impl
(
response_handle
handle
,
kernel_ptr
kernel
,
std
::
vector
<
mem_ptr
>
arguments
,
std
::
vector
<
size_t
>
global_dimensions
,
std
::
vector
<
size_t
>
global_offsets
,
std
::
vector
<
size_t
>
local_dimensions
,
std
::
function
<
any_tuple
(
T
&
)
>
map_result
)
const
std
::
vector
<
size_t
>&
global_dimensions
,
const
std
::
vector
<
size_t
>&
global_offsets
,
const
std
::
vector
<
size_t
>&
local_dimensions
,
const
std
::
function
<
any_tuple
(
T
&
)
>&
map_result
)
:
m_number_of_values
(
1
)
,
m_handle
(
handle
)
,
m_kernel
(
kernel
)
...
...
@@ -83,9 +84,9 @@ class command_impl : public command {
,
m_map_result
(
map_result
)
{
m_kernel_event
.
adopt
(
cl_event
());
for
(
size_t
s
:
m_global_dimensions
)
{
m_number_of_values
*=
s
;
}
std
::
for_each
(
m_global_dimensions
.
begin
(),
m_global_dimensions
.
end
(),
[
&
](
const
size_t
&
s
)
{
m_number_of_values
*=
s
;
});
}
void
enqueue
(
command_queue_ptr
queue
)
{
...
...
@@ -131,7 +132,7 @@ class command_impl : public command {
private:
int
m_number_of_values
;
int
m_number_of_values
;
response_handle
m_handle
;
kernel_ptr
m_kernel
;
event_ptr
m_kernel_event
;
...
...
libcaf_opencl/src/opencl/command_dispatcher.cpp
View file @
624a2741
...
...
@@ -87,7 +87,10 @@ struct command_dispatcher::worker {
}
}
catch
(
exception
&
e
)
{
CPPA_LOG_ERROR
(
"worker loop, what(): "
<<
e
.
what
());
ostringstream
oss
;
oss
<<
"worker loop, e.what(): '"
<<
e
.
what
()
<<
"'."
;
CPPA_LOG_ERROR
(
oss
.
str
());
throw
runtime_error
(
oss
.
str
());
}
}
else
{
...
...
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