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
42045189
Commit
42045189
authored
Jul 28, 2014
by
Marian Triebe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style
clang-format with BreakConstructorInitializersBeforeComma false
parent
3d59325f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
50 deletions
+44
-50
libcaf_opencl/caf/opencl/actor_facade.hpp
libcaf_opencl/caf/opencl/actor_facade.hpp
+13
-13
libcaf_opencl/caf/opencl/command.hpp
libcaf_opencl/caf/opencl/command.hpp
+13
-19
libcaf_opencl/caf/opencl/device_info.hpp
libcaf_opencl/caf/opencl/device_info.hpp
+5
-5
libcaf_opencl/caf/opencl/smart_ptr.hpp
libcaf_opencl/caf/opencl/smart_ptr.hpp
+4
-4
libcaf_opencl/src/opencl_metainfo.cpp
libcaf_opencl/src/opencl_metainfo.cpp
+4
-4
libcaf_opencl/src/program.cpp
libcaf_opencl/src/program.cpp
+5
-5
No files found.
libcaf_opencl/caf/opencl/actor_facade.hpp
View file @
42045189
...
...
@@ -55,8 +55,8 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
friend
class
command
<
actor_facade
,
Ret
>
;
public:
using
args_tuple
=
cow_tuple
<
typename
detail
::
rm_const_and_ref
<
Args
>::
type
...
>
;
using
args_tuple
=
cow_tuple
<
typename
detail
::
rm_const_and_ref
<
Args
>::
type
...
>
;
using
arg_mapping
=
std
::
function
<
optional
<
args_tuple
>
(
any_tuple
)
>
;
using
result_mapping
=
std
::
function
<
any_tuple
(
Ret
&
)
>
;
...
...
@@ -114,16 +114,16 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
const
dim_vec
&
global_dimensions
,
const
dim_vec
&
global_offsets
,
const
dim_vec
&
local_dimensions
,
arg_mapping
map_args
,
result_mapping
map_result
,
size_t
result_size
)
:
m_kernel
(
kernel
)
,
m_program
(
prog
.
m_program
)
,
m_context
(
prog
.
m_context
)
,
m_queue
(
prog
.
m_queue
)
,
m_global_dimensions
(
global_dimensions
)
,
m_global_offsets
(
global_offsets
)
,
m_local_dimensions
(
local_dimensions
)
,
m_map_args
(
std
::
move
(
map_args
))
,
m_map_result
(
std
::
move
(
map_result
))
,
m_result_size
(
result_size
)
{
:
m_kernel
(
kernel
)
,
m_program
(
prog
.
m_program
),
m_context
(
prog
.
m_context
),
m_queue
(
prog
.
m_queue
),
m_global_dimensions
(
global_dimensions
),
m_global_offsets
(
global_offsets
),
m_local_dimensions
(
local_dimensions
),
m_map_args
(
std
::
move
(
map_args
)),
m_map_result
(
std
::
move
(
map_result
)),
m_result_size
(
result_size
)
{
CAF_LOG_TRACE
(
"id: "
<<
this
->
id
());
}
...
...
@@ -165,7 +165,7 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
err
=
clSetKernelArg
(
m_kernel
.
get
(),
i
,
sizeof
(
cl_mem
),
static_cast
<
void
*>
(
&
arguments
[
i
]));
CAF_LOG_ERROR_IF
(
err
!=
CL_SUCCESS
,
"clSetKernelArg: "
<<
get_opencl_error
(
err
));
"clSetKernelArg: "
<<
get_opencl_error
(
err
));
}
clFlush
(
m_queue
.
get
());
}
...
...
libcaf_opencl/caf/opencl/command.hpp
View file @
42045189
...
...
@@ -42,14 +42,14 @@ class command : public ref_counted {
command
(
response_promise
handle
,
intrusive_ptr
<
T
>
actor_facade
,
std
::
vector
<
cl_event
>
events
,
std
::
vector
<
mem_ptr
>
arguments
,
size_t
result_size
,
any_tuple
msg
)
:
m_result_size
(
result_size
)
,
m_handle
(
handle
)
,
m_actor_facade
(
actor_facade
)
,
m_queue
(
actor_facade
->
m_queue
)
,
m_events
(
std
::
move
(
events
))
,
m_arguments
(
std
::
move
(
arguments
))
,
m_result
(
m_result_size
)
,
m_msg
(
msg
)
{}
:
m_result_size
(
result_size
)
,
m_handle
(
handle
),
m_actor_facade
(
actor_facade
),
m_queue
(
actor_facade
->
m_queue
),
m_events
(
std
::
move
(
events
)),
m_arguments
(
std
::
move
(
arguments
)),
m_result
(
m_result_size
),
m_msg
(
msg
)
{}
~
command
()
{
cl_int
err
{
0
};
...
...
@@ -77,21 +77,15 @@ class command : public ref_counted {
data_or_nullptr
(
m_actor_facade
->
m_local_dimensions
),
m_events
.
size
(),
(
m_events
.
empty
()
?
nullptr
:
m_events
.
data
()),
&
event_k
);
if
(
err
!=
CL_SUCCESS
)
{
CAF_LOGMF
(
CAF_ERROR
,
"clEnqueueNDRangeKernel: "
<<
get_opencl_error
(
err
));
CAF_LOGMF
(
CAF_ERROR
,
"clEnqueueNDRangeKernel: "
<<
get_opencl_error
(
err
));
this
->
deref
();
// or can anything actually happen?
return
;
}
else
{
cl_event
event_r
;
err
=
clEnqueueReadBuffer
(
m_queue
.
get
(),
m_arguments
.
back
().
get
(),
CL_FALSE
,
0
,
sizeof
(
typename
R
::
value_type
)
*
m_result_size
,
m_result
.
data
(),
1
,
&
event_k
,
&
event_r
);
err
=
clEnqueueReadBuffer
(
m_queue
.
get
(),
m_arguments
.
back
().
get
(),
CL_FALSE
,
0
,
sizeof
(
typename
R
::
value_type
)
*
m_result_size
,
m_result
.
data
(),
1
,
&
event_k
,
&
event_r
);
if
(
err
!=
CL_SUCCESS
)
{
throw
std
::
runtime_error
(
"clEnqueueReadBuffer: "
+
get_opencl_error
(
err
));
...
...
libcaf_opencl/caf/opencl/device_info.hpp
View file @
42045189
...
...
@@ -35,11 +35,11 @@ class device_info {
device_info
(
device_ptr
device
,
command_queue_ptr
queue
,
size_t
work_group_size
,
cl_uint
dimensons
,
const
dim_vec
&
items_per_dimension
)
:
m_max_work_group_size
(
work_group_size
)
,
m_max_dimensions
(
dimensons
)
,
m_max_work_items_per_dim
(
items_per_dimension
)
,
m_device
(
device
)
,
m_cmd_queue
(
queue
)
{}
:
m_max_work_group_size
(
work_group_size
)
,
m_max_dimensions
(
dimensons
),
m_max_work_items_per_dim
(
items_per_dimension
),
m_device
(
device
),
m_cmd_queue
(
queue
)
{}
inline
size_t
get_max_work_group_size
();
inline
cl_uint
get_max_dimensions
();
...
...
libcaf_opencl/caf/opencl/smart_ptr.hpp
View file @
42045189
...
...
@@ -101,10 +101,10 @@ using event_ptr = smart_ptr<cl_event, clRetainEvent, clReleaseEvent>;
using
kernel_ptr
=
smart_ptr
<
cl_kernel
,
clRetainKernel
,
clReleaseKernel
>
;
using
context_ptr
=
smart_ptr
<
cl_context
,
clRetainContext
,
clReleaseContext
>
;
using
program_ptr
=
smart_ptr
<
cl_program
,
clRetainProgram
,
clReleaseProgram
>
;
using
device_ptr
=
smart_ptr
<
cl_device_id
,
clRetainDeviceDummy
,
clReleaseDeviceDummy
>
;
using
command_queue_ptr
=
smart_ptr
<
cl_command_queue
,
clRetainCommandQueue
,
clReleaseCommandQueue
>
;
using
device_ptr
=
smart_ptr
<
cl_device_id
,
clRetainDeviceDummy
,
clReleaseDeviceDummy
>
;
using
command_queue_ptr
=
smart_ptr
<
cl_command_queue
,
clRetainCommandQueue
,
clReleaseCommandQueue
>
;
}
// namespace opencl
}
// namespace caf
...
...
libcaf_opencl/src/opencl_metainfo.cpp
View file @
42045189
...
...
@@ -82,8 +82,8 @@ void opencl_metainfo::initialize() {
auto
pfn_notify
=
[](
const
char
*
errinfo
,
const
void
*
,
size_t
,
void
*
)
{
CAF_LOGC_ERROR
(
"caf::opencl::opencl_metainfo"
,
"initialize"
,
"
\n
##### Error message via pfn_notify #####
\n
"
+
string
(
errinfo
)
+
"
\n
########################################"
);
string
(
errinfo
)
+
"
\n
########################################"
);
};
// create a context
...
...
@@ -107,7 +107,7 @@ void opencl_metainfo::initialize() {
&
return_size
);
if
(
err
!=
CL_SUCCESS
)
{
CAF_LOGMF
(
CAF_ERROR
,
"clGetDeviceInfo (CL_DEVICE_NAME): "
<<
get_opencl_error
(
err
));
"clGetDeviceInfo (CL_DEVICE_NAME): "
<<
get_opencl_error
(
err
));
fill
(
buf
,
buf
+
buf_size
,
0
);
}
command_queue_ptr
cmd_queue
;
...
...
@@ -115,7 +115,7 @@ void opencl_metainfo::initialize() {
CL_QUEUE_PROFILING_ENABLE
,
&
err
));
if
(
err
!=
CL_SUCCESS
)
{
CAF_LOGMF
(
CAF_DEBUG
,
"Could not create command queue for device "
<<
buf
<<
": "
<<
get_opencl_error
(
err
));
<<
buf
<<
": "
<<
get_opencl_error
(
err
));
}
else
{
size_t
max_work_group_size
{
0
};
err
=
clGetDeviceInfo
(
device
.
get
(),
CL_DEVICE_MAX_WORK_GROUP_SIZE
,
...
...
libcaf_opencl/src/program.cpp
View file @
42045189
...
...
@@ -33,9 +33,9 @@ namespace opencl {
program
::
program
(
context_ptr
context
,
command_queue_ptr
queue
,
program_ptr
program
)
:
m_context
(
move
(
context
))
,
m_program
(
move
(
program
))
,
m_queue
(
move
(
queue
))
{}
:
m_context
(
move
(
context
))
,
m_program
(
move
(
program
)),
m_queue
(
move
(
queue
))
{}
program
program
::
create
(
const
char
*
kernel_source
,
const
char
*
options
,
uint32_t
device_id
)
{
...
...
@@ -90,8 +90,8 @@ program program::create(const char* kernel_source, const char* options,
buffer
.
data
(),
nullptr
);
CAF_LOGC_ERROR
(
"caf::opencl::program"
,
"create"
,
"Build log:
\n
"
+
string
(
buffer
.
data
())
+
"
\n
########################################"
);
"Build log:
\n
"
+
string
(
buffer
.
data
())
+
"
\n
########################################"
);
}
#endif
throw
runtime_error
(
oss
.
str
());
...
...
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