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
d76bbd6c
Commit
d76bbd6c
authored
Apr 11, 2013
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed signature of conversion funs for spawn_cl
From const any_tuple& to any_tunple
parent
3806e14f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
7 deletions
+37
-7
cppa/opencl.hpp
cppa/opencl.hpp
+31
-1
cppa/opencl/actor_facade.hpp
cppa/opencl/actor_facade.hpp
+2
-2
cppa/opencl/command.hpp
cppa/opencl/command.hpp
+3
-3
cppa/opencl/command_dispatcher.hpp
cppa/opencl/command_dispatcher.hpp
+1
-1
No files found.
cppa/opencl.hpp
View file @
d76bbd6c
...
...
@@ -56,7 +56,7 @@ template<typename MapArgs, typename MapResult>
struct
get_cl_spawn_helper
;
template
<
typename
R
,
typename
...
Ts
>
struct
get_cl_spawn_helper
<
std
::
function
<
option
<
cow_tuple
<
Ts
...
>>
(
const
any_tuple
&
)
>
,
struct
get_cl_spawn_helper
<
std
::
function
<
option
<
cow_tuple
<
Ts
...
>>
(
any_tuple
)
>
,
std
::
function
<
any_tuple
(
R
&
)
>>
{
typedef
cl_spawn_helper
<
R
(
const
Ts
&
...)
>
type
;
};
...
...
@@ -91,6 +91,36 @@ actor_ptr spawn_cl(const char* source,
f0
{
map_args
},
f1
{
map_result
});
}
template
<
typename
Signature
,
typename
...
Ts
>
actor_ptr
spawn_cl
(
const
opencl
::
program
&
prog
,
const
char
*
fun_name
,
std
::
vector
<
size_t
>
dimensions
,
std
::
vector
<
size_t
>
offset
=
{},
std
::
vector
<
size_t
>
local_dims
=
{})
{
using
std
::
move
;
cl_spawn_helper
<
Signature
>
f
;
return
f
(
prog
,
fun_name
,
move
(
dimensions
),
move
(
offset
),
move
(
local_dims
));
}
template
<
typename
MapArgs
,
typename
MapResult
>
actor_ptr
spawn_cl
(
const
opencl
::
program
&
prog
,
const
char
*
fun_name
,
MapArgs
map_args
,
MapResult
map_result
,
std
::
vector
<
size_t
>
dimensions
,
std
::
vector
<
size_t
>
offset
=
{},
std
::
vector
<
size_t
>
local_dims
=
{})
{
using
std
::
move
;
typedef
typename
util
::
get_callable_trait
<
MapArgs
>::
type
t0
;
typedef
typename
util
::
get_callable_trait
<
MapResult
>::
type
t1
;
typedef
typename
t0
::
fun_type
f0
;
typedef
typename
t1
::
fun_type
f1
;
typename
get_cl_spawn_helper
<
f0
,
f1
>::
type
f
;
return
f
(
prog
,
fun_name
,
move
(
dimensions
),
move
(
offset
),
move
(
local_dims
),
f0
{
map_args
},
f1
{
map_result
});
}
}
// namespace cppa
#endif // CPPA_OPENCL_HPP
cppa/opencl/actor_facade.hpp
View file @
d76bbd6c
...
...
@@ -69,7 +69,7 @@ class actor_facade<Ret(Args...)> : public actor {
public:
typedef
cow_tuple
<
typename
util
::
rm_ref
<
Args
>::
type
...
>
args_tuple
;
typedef
std
::
function
<
option
<
args_tuple
>
(
const
any_tuple
&
)
>
arg_mapping
;
typedef
std
::
function
<
option
<
args_tuple
>
(
any_tuple
)
>
arg_mapping
;
typedef
std
::
function
<
any_tuple
(
Ret
&
)
>
result_mapping
;
static
actor_facade
*
create
(
command_dispatcher
*
dispatcher
,
...
...
@@ -152,7 +152,7 @@ class actor_facade<Ret(Args...)> : public actor {
void
enqueue_impl
(
const
actor_ptr
&
sender
,
any_tuple
msg
,
message_id
id
,
util
::
int_list
<
Is
...
>
)
{
auto
opt
=
m_map_args
(
msg
);
if
(
opt
)
{
response_handle
handle
{
this
,
sender
,
id
};
response_handle
handle
{
this
,
sender
,
id
.
response_id
()
};
size_t
number_of_values
{
1
};
std
::
for_each
(
m_global_dimensions
.
begin
(),
m_global_dimensions
.
end
(),
...
...
cppa/opencl/command.hpp
View file @
d76bbd6c
...
...
@@ -148,13 +148,13 @@ class command_impl : public command {
/* get results from gpu */
cl_int
err
{
0
};
cl_event
read_event
;
T
result
s
(
m_number_of_values
);
T
result
(
m_number_of_values
);
err
=
clEnqueueReadBuffer
(
m_queue
.
get
(),
m_arguments
[
0
].
get
(),
CL_TRUE
,
0
,
sizeof
(
typename
T
::
value_type
)
*
m_number_of_values
,
result
s
.
data
(),
result
.
data
(),
0
,
NULL
,
&
read_event
);
...
...
@@ -164,7 +164,7 @@ class command_impl : public command {
+
get_opencl_error
(
err
)
+
"'."
);
}
auto
mapped_result
=
m_map_result
(
result
s
);
auto
mapped_result
=
m_map_result
(
result
);
reply_tuple_to
(
m_handle
,
mapped_result
);
//reply_to(m_handle, results);
}
...
...
cppa/opencl/command_dispatcher.hpp
View file @
d76bbd6c
...
...
@@ -87,7 +87,7 @@ class command_dispatcher {
std
::
vector
<
size_t
>
global_dims
,
std
::
vector
<
size_t
>
global_offs
,
std
::
vector
<
size_t
>
local_dims
,
std
::
function
<
option
<
cow_tuple
<
typename
util
::
rm_ref
<
Args
>::
type
...
>>
(
const
any_tuple
&
)
>
map_args
,
std
::
function
<
option
<
cow_tuple
<
typename
util
::
rm_ref
<
Args
>::
type
...
>>
(
any_tuple
)
>
map_args
,
std
::
function
<
any_tuple
(
Ret
&
)
>
map_result
)
{
return
actor_facade
<
Ret
(
Args
...)
>::
create
(
this
,
...
...
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