Unverified Commit b653cc93 authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #646

Fix build of OpenCL module under windows
parents 463ebbfe cb8588c3
...@@ -572,6 +572,7 @@ if(NOT CAF_NO_OPENCL) ...@@ -572,6 +572,7 @@ if(NOT CAF_NO_OPENCL)
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.0) if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.0)
find_package(OpenCL) find_package(OpenCL)
if(OpenCL_FOUND) if(OpenCL_FOUND)
include_directories(BEFORE ${OpenCL_INCLUDE_DIRS})
add_optional_caf_lib(opencl) add_optional_caf_lib(opencl)
add_optional_caf_binaries(libcaf_opencl/examples) add_optional_caf_binaries(libcaf_opencl/examples)
else() else()
......
...@@ -33,7 +33,9 @@ if(NOT CAF_BUILD_STATIC_ONLY) ...@@ -33,7 +33,9 @@ if(NOT CAF_BUILD_STATIC_ONLY)
endif() endif()
# build static library only if --build-static or --build-static-only was set # build static library only if --build-static or --build-static-only was set
if(CAF_BUILD_STATIC_ONLY OR CAF_BUILD_STATIC) if(CAF_BUILD_STATIC_ONLY OR CAF_BUILD_STATIC)
add_library(libcaf_opencl_static STATIC ${LIBCAF_OPENCL_HDRS} ${LIBCAF_OPENCL_SRCS}) add_library(libcaf_opencl_static STATIC ${LIBCAF_OPENCL_SRCS}
${LIBCAF_OPENCL_HDRS}
${OpenCL_INCLUDE_DIRS})
target_link_libraries(libcaf_opencl_static ${LD_FLAGS} target_link_libraries(libcaf_opencl_static ${LD_FLAGS}
${CAF_LIBRARY_CORE_STATIC} ${CAF_LIBRARY_CORE_STATIC}
${OpenCL_LIBRARIES}) ${OpenCL_LIBRARIES})
......
...@@ -32,7 +32,7 @@ namespace caf { ...@@ -32,7 +32,7 @@ namespace caf {
namespace opencl { namespace opencl {
void throwcl(const char* fname, cl_int err); void throwcl(const char* fname, cl_int err);
void pfn_notify(const char* errinfo, const void*, size_t, void*); void CL_CALLBACK pfn_notify(const char* errinfo, const void*, size_t, void*);
// call convention for simply calling a function // call convention for simply calling a function
template <class F, class... Ts> template <class F, class... Ts>
......
...@@ -32,7 +32,7 @@ void throwcl(const char* fname, cl_int err) { ...@@ -32,7 +32,7 @@ void throwcl(const char* fname, cl_int err) {
} }
} }
void pfn_notify(const char* errinfo, const void*, size_t, void*) { void CL_CALLBACK pfn_notify(const char* errinfo, const void*, size_t, void*) {
CAF_LOG_ERROR("\n##### Error message via pfn_notify #####\n" CAF_LOG_ERROR("\n##### Error message via pfn_notify #####\n"
<< errinfo << << errinfo <<
"\n########################################"); "\n########################################");
......
...@@ -122,7 +122,7 @@ constexpr const char* kernel_source = R"__( ...@@ -122,7 +122,7 @@ constexpr const char* kernel_source = R"__(
} }
} }
kernel void use_local(global int* restrict values, kernel void use_local(global int* restrict values,
local int* restrict buf) { local int* restrict buf) {
size_t lid = get_local_id(0); size_t lid = get_local_id(0);
size_t gid = get_group_id(0); size_t gid = get_group_id(0);
...@@ -134,7 +134,7 @@ constexpr const char* kernel_source = R"__( ...@@ -134,7 +134,7 @@ constexpr const char* kernel_source = R"__(
values[gid * gs + lid] = buf[lid]; values[gid * gs + lid] = buf[lid];
} }
kernel void test_order(local int* buf, kernel void test_order(local int* buf,
global int* restrict values) { global int* restrict values) {
size_t lid = get_local_id(0); size_t lid = get_local_id(0);
size_t gid = get_group_id(0); size_t gid = get_group_id(0);
...@@ -146,7 +146,7 @@ constexpr const char* kernel_source = R"__( ...@@ -146,7 +146,7 @@ constexpr const char* kernel_source = R"__(
values[gid * gs + lid] = buf[lid]; values[gid * gs + lid] = buf[lid];
} }
kernel void use_private(global int* restrict buf, kernel void use_private(global int* restrict buf,
private int val) { private int val) {
buf[get_global_id(0)] += val; buf[get_global_id(0)] += val;
} }
...@@ -458,7 +458,7 @@ void test_opencl(actor_system& sys) { ...@@ -458,7 +458,7 @@ void test_opencl(actor_system& sys) {
return problem_size; return problem_size;
}; };
// constant memory arguments // constant memory arguments
const ivec arr7{problem_size}; const ivec arr7{static_cast<int>(problem_size)};
auto w7 = mngr.spawn(kernel_source, kn_const, auto w7 = mngr.spawn(kernel_source, kn_const,
opencl::nd_range{dims{problem_size}}, opencl::nd_range{dims{problem_size}},
opencl::in<int>{}, opencl::in<int>{},
...@@ -759,7 +759,7 @@ void test_in_val_out_val(actor_system& sys) { ...@@ -759,7 +759,7 @@ void test_in_val_out_val(actor_system& sys) {
// calculator function for getting the size of the output // calculator function for getting the size of the output
auto res_size2 = [](const ivec&) { return problem_size; }; auto res_size2 = [](const ivec&) { return problem_size; };
// constant memory arguments // constant memory arguments
const ivec input2{problem_size}; const ivec input2{static_cast<int>(problem_size)};
auto w6 = mngr.spawn(kernel_source, kn_const, auto w6 = mngr.spawn(kernel_source, kn_const,
nd_range{dims{problem_size}}, nd_range{dims{problem_size}},
in<int>{}, out<int>{res_size2}); in<int>{}, out<int>{res_size2});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment