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
02d4c3f4
Commit
02d4c3f4
authored
Aug 04, 2014
by
Marian Triebe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compile as libcaf submodule
parent
42045189
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
36 deletions
+41
-36
libcaf_opencl/caf/opencl/actor_facade.hpp
libcaf_opencl/caf/opencl/actor_facade.hpp
+9
-8
libcaf_opencl/caf/opencl/command.hpp
libcaf_opencl/caf/opencl/command.hpp
+3
-3
libcaf_opencl/caf/opencl/opencl_metainfo.hpp
libcaf_opencl/caf/opencl/opencl_metainfo.hpp
+14
-12
libcaf_opencl/caf/opencl/spawn_cl.hpp
libcaf_opencl/caf/opencl/spawn_cl.hpp
+4
-4
libcaf_opencl/src/opencl_metainfo.cpp
libcaf_opencl/src/opencl_metainfo.cpp
+7
-5
libcaf_opencl/src/program.cpp
libcaf_opencl/src/program.cpp
+4
-4
No files found.
libcaf_opencl/caf/opencl/actor_facade.hpp
View file @
02d4c3f4
...
...
@@ -29,7 +29,7 @@
#include "caf/channel.hpp"
#include "caf/to_string.hpp"
#include "c
af
/tuple_cast.hpp"
#include "c
ppa
/tuple_cast.hpp"
#include "caf/intrusive_ptr.hpp"
#include "caf/detail/int_list.hpp"
...
...
@@ -58,8 +58,8 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
using
args_tuple
=
cow_tuple
<
typename
detail
::
rm_const_and_ref
<
Args
>::
type
...
>
;
using
arg_mapping
=
std
::
function
<
optional
<
args_tuple
>
(
any_tupl
e
)
>
;
using
result_mapping
=
std
::
function
<
any_tupl
e
(
Ret
&
)
>
;
using
arg_mapping
=
std
::
function
<
optional
<
args_tuple
>
(
messag
e
)
>
;
using
result_mapping
=
std
::
function
<
messag
e
(
Ret
&
)
>
;
static
intrusive_ptr
<
actor_facade
>
create
(
const
program
&
prog
,
const
char
*
kernel_name
,
arg_mapping
map_args
,
...
...
@@ -100,10 +100,11 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
local_dims
,
std
::
move
(
map_args
),
std
::
move
(
map_result
),
result_size
};
}
void
enqueue
(
msg_hdr_cref
hdr
,
any_tuple
msg
,
execution_unit
*
)
override
{
void
enqueue
(
const
actor_addr
&
sender
,
message_id
mid
,
message
content
,
execution_unit
*
host
)
override
{
CAF_LOG_TRACE
(
""
);
typename
detail
::
il_indices
<
detail
::
type_list
<
Args
...
>>::
type
indices
;
enqueue_impl
(
hdr
.
sender
,
std
::
move
(
msg
),
hdr
.
id
,
indices
);
enqueue_impl
(
sender
,
mid
,
std
::
move
(
content
)
,
indices
);
}
private:
...
...
@@ -128,16 +129,16 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
}
template
<
long
...
Is
>
void
enqueue_impl
(
const
actor_addr
&
sender
,
any_tuple
msg
,
message_id
id
,
void
enqueue_impl
(
const
actor_addr
&
sender
,
message_id
mid
,
message
msg
,
detail
::
int_list
<
Is
...
>
)
{
auto
opt
=
m_map_args
(
std
::
move
(
msg
));
if
(
opt
)
{
response_promise
handle
{
this
->
address
(),
sender
,
id
.
response_id
()};
response_promise
handle
{
this
->
address
(),
sender
,
m
id
.
response_id
()};
evnt_vec
events
;
args_vec
arguments
;
add_arguments_to_kernel
<
Ret
>
(
events
,
arguments
,
m_result_size
,
get_ref
<
Is
>
(
*
opt
)...);
auto
cmd
=
make_counted
<
command
<
actor_facade
,
Ret
>>
(
auto
cmd
=
detail
::
make_counted
<
command
<
actor_facade
,
Ret
>>
(
handle
,
this
,
std
::
move
(
events
),
std
::
move
(
arguments
),
m_result_size
,
*
opt
);
cmd
->
enqueue
();
...
...
libcaf_opencl/caf/opencl/command.hpp
View file @
02d4c3f4
...
...
@@ -25,7 +25,7 @@
#include <algorithm>
#include <functional>
#include "caf/logging.hpp"
#include "caf/
detail/
logging.hpp"
#include "caf/opencl/global.hpp"
#include "caf/abstract_actor.hpp"
#include "caf/response_promise.hpp"
...
...
@@ -41,7 +41,7 @@ class command : public ref_counted {
public:
command
(
response_promise
handle
,
intrusive_ptr
<
T
>
actor_facade
,
std
::
vector
<
cl_event
>
events
,
std
::
vector
<
mem_ptr
>
arguments
,
size_t
result_size
,
any_tupl
e
msg
)
size_t
result_size
,
messag
e
msg
)
:
m_result_size
(
result_size
),
m_handle
(
handle
),
m_actor_facade
(
actor_facade
),
...
...
@@ -122,7 +122,7 @@ class command : public ref_counted {
std
::
vector
<
cl_event
>
m_events
;
std
::
vector
<
mem_ptr
>
m_arguments
;
R
m_result
;
any_tupl
e
m_msg
;
// required to keep the argument buffers alive (async copy)
messag
e
m_msg
;
// required to keep the argument buffers alive (async copy)
void
handle_results
()
{
m_handle
.
deliver
(
m_actor_facade
->
m_map_result
(
m_result
));
...
...
libcaf_opencl/caf/opencl/opencl_metainfo.hpp
View file @
02d4c3f4
...
...
@@ -33,36 +33,38 @@
#include "caf/opencl/device_info.hpp"
#include "caf/opencl/actor_facade.hpp"
#include "caf/detail/singleton_mixin.hpp"
#include "caf/detail/singleton_manager.hpp"
//#include "caf/detail/singleton_mixin.hpp"
//#include "caf/detail/singleton_manager.hpp"
#include "caf/detail/singletons.hpp"
namespace
caf
{
namespace
opencl
{
class
opencl_metainfo
{
class
opencl_metainfo
:
public
detail
::
abstract_singleton
{
friend
class
program
;
friend
class
detail
::
singleton
_manager
;
friend
class
detail
::
singleton
s
;
friend
command_queue_ptr
get_command_queue
(
uint32_t
id
);
public:
const
std
::
vector
<
device_info
>
get_devices
()
const
;
/**
* Get opencl_metainfo instance.
*/
static
opencl_metainfo
*
instance
();
private:
static
inline
opencl_metainfo
*
create_singleton
()
{
return
new
opencl_metainfo
;
}
opencl_metainfo
();
void
initialize
();
void
dispose
()
;
void
d
estroy
()
;
void
stop
();
void
initialize
()
override
;
void
d
ispose
()
override
;
context_ptr
m_context
;
std
::
vector
<
device_info
>
m_devices
;
};
opencl_metainfo
*
get_opencl_metainfo
();
}
// namespace opencl
}
// namespace caf
...
...
libcaf_opencl/caf/opencl/spawn_cl.hpp
View file @
02d4c3f4
...
...
@@ -74,20 +74,20 @@ struct cl_spawn_helper<R(Ts...), void> {
Us
&&
...
args
)
const
{
using
std
::
move
;
using
std
::
forward
;
map_arg_fun
f0
=
[](
any_tupl
e
msg
)
{
map_arg_fun
f0
=
[](
messag
e
msg
)
{
return
tuple_cast
<
typename
util
::
rm_const_and_ref
<
typename
carr_to_vec
<
Ts
>::
type
>::
type
...
>
(
msg
);
};
map_res_fun
f1
=
[](
result_type
&
result
)
{
return
make_
any_tupl
e
(
move
(
result
));
return
make_
messag
e
(
move
(
result
));
};
return
impl
::
create
(
p
,
fname
,
move
(
f0
),
move
(
f1
),
forward
<
Us
>
(
args
)...);
}
};
template
<
typename
R
,
typename
...
Ts
>
struct
cl_spawn_helper
<
std
::
function
<
optional
<
cow_tuple
<
Ts
...
>>
(
any_tupl
e
)
>
,
std
::
function
<
any_tupl
e
(
R
&
)
>>
struct
cl_spawn_helper
<
std
::
function
<
optional
<
cow_tuple
<
Ts
...
>>
(
messag
e
)
>
,
std
::
function
<
messag
e
(
R
&
)
>>
:
cl_spawn_helper
<
R
(
Ts
...)
>
{};
}
// namespace detail
...
...
libcaf_opencl/src/opencl_metainfo.cpp
View file @
02d4c3f4
...
...
@@ -24,6 +24,13 @@ using namespace std;
namespace
caf
{
namespace
opencl
{
opencl_metainfo
*
opencl_metainfo
::
instance
()
{
auto
sid
=
detail
::
singletons
::
opencl_plugin_id
;
auto
fac
=
[]
{
return
new
opencl_metainfo
;
};
auto
res
=
detail
::
singletons
::
get_plugin_singleton
(
sid
,
fac
);
return
static_cast
<
opencl_metainfo
*>
(
res
);
}
const
std
::
vector
<
device_info
>
opencl_metainfo
::
get_devices
()
const
{
return
m_devices
;
}
...
...
@@ -164,13 +171,8 @@ void opencl_metainfo::initialize() {
}
}
void
opencl_metainfo
::
destroy
()
{
delete
this
;
}
void
opencl_metainfo
::
dispose
()
{
delete
this
;
}
opencl_metainfo
*
get_opencl_metainfo
()
{
return
detail
::
singleton_manager
::
get_opencl_metainfo
();
}
}
// namespace opencl
}
// namespace caf
libcaf_opencl/src/program.cpp
View file @
02d4c3f4
...
...
@@ -22,7 +22,7 @@
#include <cstring>
#include <iostream>
#include "caf/singletons.hpp"
#include "caf/
detail/
singletons.hpp"
#include "caf/opencl/program.hpp"
#include "caf/opencl/opencl_metainfo.hpp"
...
...
@@ -39,9 +39,9 @@ program::program(context_ptr context, command_queue_ptr queue,
program
program
::
create
(
const
char
*
kernel_source
,
const
char
*
options
,
uint32_t
device_id
)
{
auto
metainfo
=
get_opencl_metainfo
();
auto
devices
=
metainfo
->
get_devices
();
auto
context
=
metainfo
->
m_context
;
auto
metainfo
=
opencl_metainfo
::
instance
();
auto
devices
=
metainfo
->
get_devices
();
auto
context
=
metainfo
->
m_context
;
if
(
devices
.
size
()
<=
device_id
)
{
ostringstream
oss
;
...
...
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