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
1a2259d4
authored
Nov 18, 2014
by
Marcus Winter
Committed by
unknown
Dec 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mtapi_opencl_c: linux support, test cleanup
parent
b4d1dd0e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
7 deletions
+30
-7
mtapi_opencl_c/CMakeLists.txt
+6
-2
mtapi_opencl_c/src/embb_mtapi_opencl_runtimelinker.c
+13
-1
mtapi_opencl_c/test/embb_mtapi_opencl_test_task.cc
+11
-4
No files found.
mtapi_opencl_c/CMakeLists.txt
View file @
1a2259d4
...
@@ -13,7 +13,11 @@ FOREACH(src_tmp ${EMBB_MTAPI_OPENCL_C_SOURCES})
...
@@ -13,7 +13,11 @@ FOREACH(src_tmp ${EMBB_MTAPI_OPENCL_C_SOURCES})
SET_PROPERTY
(
SOURCE
${
src_tmp
}
PROPERTY LANGUAGE CXX
)
SET_PROPERTY
(
SOURCE
${
src_tmp
}
PROPERTY LANGUAGE CXX
)
ENDFOREACH
(
src_tmp
)
ENDFOREACH
(
src_tmp
)
ENDIF
()
ENDIF
()
IF
(
CMAKE_COMPILER_IS_GNUCC
)
set
(
EMBB_MAPI_OPENCL_LIBS dl
)
ENDIF
()
# Execute the GroupSources macro
# Execute the GroupSources macro
include
(
${
CMAKE_SOURCE_DIR
}
/CMakeCommon/GroupSourcesMSVC.cmake
)
include
(
${
CMAKE_SOURCE_DIR
}
/CMakeCommon/GroupSourcesMSVC.cmake
)
GroupSourcesMSVC
(
include
)
GroupSourcesMSVC
(
include
)
...
@@ -34,7 +38,7 @@ target_link_libraries(embb_mtapi_opencl_c embb_mtapi_c embb_base_c)
...
@@ -34,7 +38,7 @@ target_link_libraries(embb_mtapi_opencl_c embb_mtapi_c embb_base_c)
if
(
BUILD_TESTS STREQUAL ON
)
if
(
BUILD_TESTS STREQUAL ON
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
/../partest/include
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
/../partest/include
)
add_executable
(
embb_mtapi_opencl_c_test
${
EMBB_MTAPI_OPENCL_TEST_SOURCES
}
)
add_executable
(
embb_mtapi_opencl_c_test
${
EMBB_MTAPI_OPENCL_TEST_SOURCES
}
)
target_link_libraries
(
embb_mtapi_opencl_c_test embb_mtapi_opencl_c embb_mtapi_c partest embb_base_c
${
compiler_libs
}
)
target_link_libraries
(
embb_mtapi_opencl_c_test embb_mtapi_opencl_c embb_mtapi_c partest embb_base_c
${
compiler_libs
}
${
EMBB_MAPI_OPENCL_LIBS
}
)
CopyBin
(
BIN embb_mtapi_c_test DEST
${
local_install_dir
}
)
CopyBin
(
BIN embb_mtapi_c_test DEST
${
local_install_dir
}
)
endif
()
endif
()
...
...
mtapi_opencl_c/src/embb_mtapi_opencl_runtimelinker.c
View file @
1a2259d4
...
@@ -166,14 +166,26 @@ DECLARECLFUNC(cl_mem, clCreateFromGLBuffer, (cl_context context, cl_mem_flags fl
...
@@ -166,14 +166,26 @@ DECLARECLFUNC(cl_mem, clCreateFromGLBuffer, (cl_context context, cl_mem_flags fl
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// system specific functions
// system specific functions
//---- Windows Functions -------------------------------------------------
#ifdef _WIN32
#include <Windows.h>
#include <Windows.h>
#define CHECKEDIMPORT(name) name##_Dynamic = (name##Proc)GetProcAddress( opencl_dll_handle, #name ); if ( name##_Dynamic == 0 ) return 0;
#define CHECKEDIMPORT(name) name##_Dynamic = (name##Proc)GetProcAddress( opencl_dll_handle, #name ); if ( name##_Dynamic == 0 ) return 0;
#else
#include <dlfcn.h>
#define CHECKEDIMPORT(name) name##_Dynamic = (name##Proc)dlsym( opencl_dll_handle, #name ); if ( name##_Dynamic == 0 ) return 0;
#endif
int
embb_mtapi_opencl_link_at_runtime
()
{
int
embb_mtapi_opencl_link_at_runtime
()
{
#ifdef _WIN32
HMODULE
opencl_dll_handle
=
LoadLibraryA
(
"opencl.dll"
);
HMODULE
opencl_dll_handle
=
LoadLibraryA
(
"opencl.dll"
);
#else
void
*
opencl_dll_handle
=
dlopen
(
"libOpenCL.so"
,
RTLD_LAZY
);
#endif
if
(
opencl_dll_handle
==
0
)
if
(
opencl_dll_handle
==
0
)
return
0
;
return
0
;
...
...
mtapi_opencl_c/test/embb_mtapi_opencl_test_task.cc
View file @
1a2259d4
...
@@ -31,6 +31,10 @@
...
@@ -31,6 +31,10 @@
#define MTAPI_CHECK_STATUS(status) \
#define MTAPI_CHECK_STATUS(status) \
PT_ASSERT(MTAPI_SUCCESS == status)
PT_ASSERT(MTAPI_SUCCESS == status)
#define OPENCL_DOMAIN 1
#define OPENCL_NODE 2
#define OPENCL_JOB 2
// OpenCL Kernel Function for element by element vector addition
// OpenCL Kernel Function for element by element vector addition
const
char
*
kernel
=
const
char
*
kernel
=
"__kernel void test(
\n
"
"__kernel void test(
\n
"
...
@@ -74,8 +78,8 @@ void TaskTest::TestBasic() {
...
@@ -74,8 +78,8 @@ void TaskTest::TestBasic() {
MTAPI_CHECK_STATUS
(
status
);
MTAPI_CHECK_STATUS
(
status
);
mtapi_initialize
(
mtapi_initialize
(
1
,
OPENCL_DOMAIN
,
1
,
OPENCL_NODE
,
MTAPI_NULL
,
MTAPI_NULL
,
MTAPI_NULL
,
MTAPI_NULL
,
&
status
);
&
status
);
...
@@ -83,14 +87,14 @@ void TaskTest::TestBasic() {
...
@@ -83,14 +87,14 @@ void TaskTest::TestBasic() {
float
node_local
=
1.0
f
;
float
node_local
=
1.0
f
;
action
=
mtapi_opencl_action_create
(
action
=
mtapi_opencl_action_create
(
1
,
OPENCL_JOB
,
kernel
,
"test"
,
32
,
4
,
kernel
,
"test"
,
32
,
4
,
&
node_local
,
sizeof
(
float
),
&
node_local
,
sizeof
(
float
),
&
status
);
&
status
);
MTAPI_CHECK_STATUS
(
status
);
MTAPI_CHECK_STATUS
(
status
);
status
=
MTAPI_ERR_UNKNOWN
;
status
=
MTAPI_ERR_UNKNOWN
;
job
=
mtapi_job_get
(
1
,
1
,
&
status
);
job
=
mtapi_job_get
(
OPENCL_JOB
,
OPENCL_DOMAIN
,
&
status
);
MTAPI_CHECK_STATUS
(
status
);
MTAPI_CHECK_STATUS
(
status
);
task
=
mtapi_task_start
(
task
=
mtapi_task_start
(
...
@@ -111,4 +115,7 @@ void TaskTest::TestBasic() {
...
@@ -111,4 +115,7 @@ void TaskTest::TestBasic() {
mtapi_finalize
(
&
status
);
mtapi_finalize
(
&
status
);
MTAPI_CHECK_STATUS
(
status
);
MTAPI_CHECK_STATUS
(
status
);
mtapi_opencl_plugin_finalize
(
&
status
);
MTAPI_CHECK_STATUS
(
status
);
}
}
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