Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
98a7722e
authored
Mar 26, 2015
by
Marcus Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mtapi_opencl_c: fixed vs2012 build
parent
ae53f414
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
mtapi_opencl_c/src/embb_mtapi_opencl.c
+9
-9
mtapi_opencl_c/src/embb_mtapi_opencl_runtimelinker.c
+11
-0
No files found.
mtapi_opencl_c/src/embb_mtapi_opencl.c
View file @
98a7722e
...
@@ -76,8 +76,8 @@ struct embb_mtapi_opencl_task_struct {
...
@@ -76,8 +76,8 @@ struct embb_mtapi_opencl_task_struct {
typedef
struct
embb_mtapi_opencl_task_struct
embb_mtapi_opencl_task_t
;
typedef
struct
embb_mtapi_opencl_task_struct
embb_mtapi_opencl_task_t
;
static
int
round_up
(
int
group_size
,
in
t
global_size
)
{
static
size_t
round_up
(
size_t
group_size
,
size_
t
global_size
)
{
in
t
r
=
global_size
%
group_size
;
size_
t
r
=
global_size
%
group_size
;
if
(
r
==
0
)
{
if
(
r
==
0
)
{
return
global_size
;
return
global_size
;
}
else
{
}
else
{
...
@@ -153,18 +153,18 @@ static void opencl_task_start(
...
@@ -153,18 +153,18 @@ static void opencl_task_start(
if
(
0
==
elements
)
if
(
0
==
elements
)
elements
=
1
;
elements
=
1
;
global_work_size
=
global_work_size
=
round_up
(
(
int
)
opencl_action
->
local_work_size
,
(
int
)
elements
);
round_up
(
opencl_action
->
local_work_size
,
elements
);
opencl_task
->
task
=
task
;
opencl_task
->
task
=
task
;
opencl_task
->
arguments_size
=
local_task
->
arguments_size
;
opencl_task
->
arguments_size
=
(
int
)
local_task
->
arguments_size
;
if
(
0
<
local_task
->
arguments_size
)
{
if
(
0
<
local_task
->
arguments_size
)
{
opencl_task
->
arguments
=
clCreateBuffer
(
plugin
->
context
,
opencl_task
->
arguments
=
clCreateBuffer
(
plugin
->
context
,
CL_MEM_READ_ONLY
,
local_task
->
arguments_size
,
NULL
,
&
err
);
CL_MEM_READ_ONLY
,
local_task
->
arguments_size
,
NULL
,
&
err
);
}
else
{
}
else
{
opencl_task
->
arguments
=
NULL
;
opencl_task
->
arguments
=
NULL
;
}
}
opencl_task
->
result_buffer_size
=
local_task
->
result_size
;
opencl_task
->
result_buffer_size
=
(
int
)
local_task
->
result_size
;
if
(
0
<
local_task
->
result_size
)
{
if
(
0
<
local_task
->
result_size
)
{
opencl_task
->
result_buffer
=
clCreateBuffer
(
plugin
->
context
,
opencl_task
->
result_buffer
=
clCreateBuffer
(
plugin
->
context
,
CL_MEM_WRITE_ONLY
,
local_task
->
result_size
,
NULL
,
&
err
);
CL_MEM_WRITE_ONLY
,
local_task
->
result_size
,
NULL
,
&
err
);
...
@@ -184,13 +184,13 @@ static void opencl_task_start(
...
@@ -184,13 +184,13 @@ static void opencl_task_start(
err
=
clEnqueueWriteBuffer
(
plugin
->
command_queue
,
err
=
clEnqueueWriteBuffer
(
plugin
->
command_queue
,
opencl_task
->
arguments
,
CL_FALSE
,
0
,
opencl_task
->
arguments
,
CL_FALSE
,
0
,
opencl_task
->
arguments_size
,
local_task
->
arguments
,
0
,
NULL
,
NULL
);
(
size_t
)
opencl_task
->
arguments_size
,
local_task
->
arguments
,
0
,
NULL
,
NULL
);
err
=
clEnqueueNDRangeKernel
(
plugin
->
command_queue
,
err
=
clEnqueueNDRangeKernel
(
plugin
->
command_queue
,
opencl_action
->
kernel
,
1
,
NULL
,
opencl_action
->
kernel
,
1
,
NULL
,
&
global_work_size
,
&
opencl_action
->
local_work_size
,
0
,
NULL
,
NULL
);
&
global_work_size
,
&
opencl_action
->
local_work_size
,
0
,
NULL
,
NULL
);
err
=
clEnqueueReadBuffer
(
plugin
->
command_queue
,
err
=
clEnqueueReadBuffer
(
plugin
->
command_queue
,
opencl_task
->
result_buffer
,
CL_FALSE
,
0
,
opencl_task
->
result_buffer
,
CL_FALSE
,
0
,
opencl_task
->
result_buffer_size
,
local_task
->
result_buffer
,
(
size_t
)
opencl_task
->
result_buffer_size
,
local_task
->
result_buffer
,
0
,
NULL
,
&
opencl_task
->
kernel_finish_event
);
0
,
NULL
,
&
opencl_task
->
kernel_finish_event
);
err
=
clSetEventCallback
(
opencl_task
->
kernel_finish_event
,
err
=
clSetEventCallback
(
opencl_task
->
kernel_finish_event
,
CL_COMPLETE
,
opencl_task_complete
,
opencl_task
);
CL_COMPLETE
,
opencl_task_complete
,
opencl_task
);
...
@@ -357,11 +357,11 @@ mtapi_action_hndl_t mtapi_opencl_action_create(
...
@@ -357,11 +357,11 @@ mtapi_action_hndl_t mtapi_opencl_action_create(
if
(
CL_SUCCESS
==
err
)
{
if
(
CL_SUCCESS
==
err
)
{
free_node_local_data_on_error
=
MTAPI_TRUE
;
free_node_local_data_on_error
=
MTAPI_TRUE
;
}
}
action
->
node_local_data_size
=
node_local_data_size
;
action
->
node_local_data_size
=
(
int
)
node_local_data_size
;
if
(
CL_SUCCESS
==
err
)
{
if
(
CL_SUCCESS
==
err
)
{
err
=
clEnqueueWriteBuffer
(
plugin
->
command_queue
,
err
=
clEnqueueWriteBuffer
(
plugin
->
command_queue
,
action
->
node_local_data
,
CL_TRUE
,
0
,
action
->
node_local_data
,
CL_TRUE
,
0
,
action
->
node_local_data_size
,
node_local_data
,
0
,
NULL
,
NULL
);
(
size_t
)
action
->
node_local_data_size
,
node_local_data
,
0
,
NULL
,
NULL
);
}
}
}
else
{
}
else
{
action
->
node_local_data
=
NULL
;
action
->
node_local_data
=
NULL
;
...
...
mtapi_opencl_c/src/embb_mtapi_opencl_runtimelinker.c
View file @
98a7722e
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
*/
*/
#include <CL/opencl.h>
#include <CL/opencl.h>
#include <embb/base/c/internal/config.h>
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// function pointer wrappers to hide runtime linking
// function pointer wrappers to hide runtime linking
...
@@ -252,6 +253,9 @@ DECLARECLFUNC(cl_mem, clCreateFromGLBuffer, (cl_context context,
...
@@ -252,6 +253,9 @@ DECLARECLFUNC(cl_mem, clCreateFromGLBuffer, (cl_context context,
#endif
#endif
#ifdef __cplusplus
extern
"C"
#endif
int
embb_mtapi_opencl_link_at_runtime
()
{
int
embb_mtapi_opencl_link_at_runtime
()
{
#ifdef _WIN32
#ifdef _WIN32
HMODULE
opencl_dll_handle
=
LoadLibraryA
(
"opencl.dll"
);
HMODULE
opencl_dll_handle
=
LoadLibraryA
(
"opencl.dll"
);
...
@@ -261,6 +265,10 @@ int embb_mtapi_opencl_link_at_runtime() {
...
@@ -261,6 +265,10 @@ int embb_mtapi_opencl_link_at_runtime() {
if
(
opencl_dll_handle
==
0
)
if
(
opencl_dll_handle
==
0
)
return
0
;
return
0
;
#ifdef EMBB_PLATFORM_COMPILER_MSVC
#pragma warning(push)
#pragma warning(disable: 4191)
#endif
CHECKEDIMPORT
(
clGetPlatformIDs
);
CHECKEDIMPORT
(
clGetPlatformIDs
);
CHECKEDIMPORT
(
clGetPlatformInfo
);
CHECKEDIMPORT
(
clGetPlatformInfo
);
CHECKEDIMPORT
(
clGetDeviceIDs
);
CHECKEDIMPORT
(
clGetDeviceIDs
);
...
@@ -293,6 +301,9 @@ int embb_mtapi_opencl_link_at_runtime() {
...
@@ -293,6 +301,9 @@ int embb_mtapi_opencl_link_at_runtime() {
CHECKEDIMPORT
(
clEnqueueAcquireGLObjects
);
CHECKEDIMPORT
(
clEnqueueAcquireGLObjects
);
CHECKEDIMPORT
(
clEnqueueReleaseGLObjects
);
CHECKEDIMPORT
(
clEnqueueReleaseGLObjects
);
CHECKEDIMPORT
(
clCreateFromGLBuffer
);
CHECKEDIMPORT
(
clCreateFromGLBuffer
);
#ifdef EMBB_PLATFORM_COMPILER_MSVC
#pragma warning(pop)
#endif
return
1
;
return
1
;
}
}
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