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
88ccfff7
Commit
88ccfff7
authored
Jan 12, 2015
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed warnings
parent
881a492d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
11 deletions
+15
-11
libcaf_opencl/caf/opencl/actor_facade.hpp
libcaf_opencl/caf/opencl/actor_facade.hpp
+1
-1
libcaf_opencl/caf/opencl/command.hpp
libcaf_opencl/caf/opencl/command.hpp
+5
-3
libcaf_opencl/src/opencl_metainfo.cpp
libcaf_opencl/src/opencl_metainfo.cpp
+7
-5
libcaf_opencl/unit_testing/test_opencl.cpp
libcaf_opencl/unit_testing/test_opencl.cpp
+2
-2
No files found.
libcaf_opencl/caf/opencl/actor_facade.hpp
View file @
88ccfff7
...
@@ -162,7 +162,7 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
...
@@ -162,7 +162,7 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
cl_int
err
{
0
};
cl_int
err
{
0
};
// rotate left (output buffer to the end)
// rotate left (output buffer to the end)
rotate
(
begin
(
arguments
),
begin
(
arguments
)
+
1
,
end
(
arguments
));
rotate
(
begin
(
arguments
),
begin
(
arguments
)
+
1
,
end
(
arguments
));
for
(
size_
t
i
=
0
;
i
<
arguments
.
size
();
++
i
)
{
for
(
cl_uin
t
i
=
0
;
i
<
arguments
.
size
();
++
i
)
{
err
=
clSetKernelArg
(
m_kernel
.
get
(),
i
,
sizeof
(
cl_mem
),
err
=
clSetKernelArg
(
m_kernel
.
get
(),
i
,
sizeof
(
cl_mem
),
static_cast
<
void
*>
(
&
arguments
[
i
]));
static_cast
<
void
*>
(
&
arguments
[
i
]));
CAF_LOG_ERROR_IF
(
err
!=
CL_SUCCESS
,
CAF_LOG_ERROR_IF
(
err
!=
CL_SUCCESS
,
...
...
libcaf_opencl/caf/opencl/command.hpp
View file @
88ccfff7
...
@@ -69,12 +69,14 @@ class command : public ref_counted {
...
@@ -69,12 +69,14 @@ class command : public ref_counted {
auto
data_or_nullptr
=
[](
const
dim_vec
&
vec
)
{
auto
data_or_nullptr
=
[](
const
dim_vec
&
vec
)
{
return
vec
.
empty
()
?
nullptr
:
vec
.
data
();
return
vec
.
empty
()
?
nullptr
:
vec
.
data
();
};
};
// OpenCL expects cl_uint (unsigned int), hence the cast
err
=
clEnqueueNDRangeKernel
(
err
=
clEnqueueNDRangeKernel
(
m_queue
.
get
(),
m_actor_facade
->
m_kernel
.
get
(),
m_queue
.
get
(),
m_actor_facade
->
m_kernel
.
get
(),
m_actor_facade
->
m_global_dimensions
.
size
(
),
static_cast
<
cl_uint
>
(
m_actor_facade
->
m_global_dimensions
.
size
()
),
data_or_nullptr
(
m_actor_facade
->
m_global_offsets
),
data_or_nullptr
(
m_actor_facade
->
m_global_offsets
),
data_or_nullptr
(
m_actor_facade
->
m_global_dimensions
),
data_or_nullptr
(
m_actor_facade
->
m_global_dimensions
),
data_or_nullptr
(
m_actor_facade
->
m_local_dimensions
),
m_events
.
size
(),
data_or_nullptr
(
m_actor_facade
->
m_local_dimensions
),
static_cast
<
cl_uint
>
(
m_events
.
size
()),
(
m_events
.
empty
()
?
nullptr
:
m_events
.
data
()),
&
event_k
);
(
m_events
.
empty
()
?
nullptr
:
m_events
.
data
()),
&
event_k
);
if
(
err
!=
CL_SUCCESS
)
{
if
(
err
!=
CL_SUCCESS
)
{
CAF_LOGMF
(
CAF_ERROR
,
"clEnqueueNDRangeKernel: "
<<
get_opencl_error
(
err
));
CAF_LOGMF
(
CAF_ERROR
,
"clEnqueueNDRangeKernel: "
<<
get_opencl_error
(
err
));
...
@@ -115,7 +117,7 @@ class command : public ref_counted {
...
@@ -115,7 +117,7 @@ class command : public ref_counted {
}
}
private:
private:
in
t
m_result_size
;
size_
t
m_result_size
;
response_promise
m_handle
;
response_promise
m_handle
;
intrusive_ptr
<
T
>
m_actor_facade
;
intrusive_ptr
<
T
>
m_actor_facade
;
command_queue_ptr
m_queue
;
command_queue_ptr
m_queue
;
...
...
libcaf_opencl/src/opencl_metainfo.cpp
View file @
88ccfff7
...
@@ -125,20 +125,22 @@ void opencl_metainfo::initialize() {
...
@@ -125,20 +125,22 @@ void opencl_metainfo::initialize() {
CAF_LOG_DEBUG
(
"creating command queue for device(s)"
);
CAF_LOG_DEBUG
(
"creating command queue for device(s)"
);
command_queue_ptr
cmd_queue
;
command_queue_ptr
cmd_queue
;
try
{
try
{
cmd_queue
.
adopt
(
v2get
(
CAF_CLF
(
clCreateCommandQueue
),
m_context
.
get
(),
cmd_queue
.
adopt
(
v2get
(
CAF_CLF
(
clCreateCommandQueue
),
device
.
get
(),
CL_QUEUE_PROFILING_ENABLE
));
m_context
.
get
(),
device
.
get
(),
static_cast
<
unsigned
>
(
CL_QUEUE_PROFILING_ENABLE
)));
}
}
catch
(
std
::
runtime_error
&
)
{
catch
(
std
::
runtime_error
&
)
{
CAF_LOG_DEBUG
(
"unable to create command queue for device"
);
CAF_LOG_DEBUG
(
"unable to create command queue for device"
);
}
}
if
(
cmd_queue
)
{
if
(
cmd_queue
)
{
auto
max_wgs
=
v3get
<
size_t
>
(
CAF_CLF
(
clGetDeviceInfo
),
device
.
get
(),
auto
max_wgs
=
v3get
<
size_t
>
(
CAF_CLF
(
clGetDeviceInfo
),
device
.
get
(),
CL_DEVICE_MAX_WORK_GROUP_SIZE
);
static_cast
<
unsigned
>
(
CL_DEVICE_MAX_WORK_GROUP_SIZE
)
);
auto
max_wid
=
v3get
<
cl_uint
>
(
CAF_CLF
(
clGetDeviceInfo
),
device
.
get
(),
auto
max_wid
=
v3get
<
cl_uint
>
(
CAF_CLF
(
clGetDeviceInfo
),
device
.
get
(),
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS
);
static_cast
<
unsigned
>
(
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS
)
);
dim_vec
max_wi_per_dim
(
max_wid
);
dim_vec
max_wi_per_dim
(
max_wid
);
callcl
(
CAF_CLF
(
clGetDeviceInfo
),
device
.
get
(),
callcl
(
CAF_CLF
(
clGetDeviceInfo
),
device
.
get
(),
CL_DEVICE_MAX_WORK_ITEM_SIZES
,
sizeof
(
size_t
)
*
max_wid
,
static_cast
<
unsigned
>
(
CL_DEVICE_MAX_WORK_ITEM_SIZES
),
sizeof
(
size_t
)
*
max_wid
,
max_wi_per_dim
.
data
());
max_wi_per_dim
.
data
());
m_devices
.
push_back
(
device_info
{
std
::
move
(
device
),
std
::
move
(
cmd_queue
),
m_devices
.
push_back
(
device_info
{
std
::
move
(
device
),
std
::
move
(
cmd_queue
),
max_wgs
,
max_wid
,
max_wi_per_dim
});
max_wgs
,
max_wid
,
max_wi_per_dim
});
...
...
libcaf_opencl/unit_testing/test_opencl.cpp
View file @
88ccfff7
...
@@ -266,8 +266,8 @@ void test_opencl() {
...
@@ -266,8 +266,8 @@ void test_opencl() {
// test for manuel return size selection
// test for manuel return size selection
const
int
max_workgroup_size
=
static_cast
<
int
>
(
get_max_workgroup_size
(
0
,
1
));
// max workgroup size (1d)
const
int
max_workgroup_size
=
static_cast
<
int
>
(
get_max_workgroup_size
(
0
,
1
));
// max workgroup size (1d)
const
size_t
reduce_buffer_size
=
max_workgroup_size
*
8
;
const
size_t
reduce_buffer_size
=
static_cast
<
size_t
>
(
max_workgroup_size
*
8
)
;
const
size_t
reduce_local_size
=
max_workgroup_size
;
const
size_t
reduce_local_size
=
static_cast
<
size_t
>
(
max_workgroup_size
)
;
const
size_t
reduce_work_groups
=
reduce_buffer_size
/
reduce_local_size
;
const
size_t
reduce_work_groups
=
reduce_buffer_size
/
reduce_local_size
;
const
size_t
reduce_global_size
=
reduce_buffer_size
;
const
size_t
reduce_global_size
=
reduce_buffer_size
;
const
size_t
reduce_result_size
=
reduce_work_groups
;
const
size_t
reduce_result_size
=
reduce_work_groups
;
...
...
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