Commit 5a8a755b authored by Dominik Charousset's avatar Dominik Charousset

CPPA_OPENCL doesn't need to be set for user apps

instead of requiring users to define CPPA_OPENCL, the library will
throw an exception if compiled without OpenCL support
parent f9b9aade
...@@ -86,10 +86,11 @@ actor_ptr spawn_cl(const char* source, ...@@ -86,10 +86,11 @@ actor_ptr spawn_cl(const char* source,
typedef typename t0::fun_type f0; typedef typename t0::fun_type f0;
typedef typename t1::fun_type f1; typedef typename t1::fun_type f1;
typename get_cl_spawn_helper<f0,f1>::type f; typename get_cl_spawn_helper<f0,f1>::type f;
f(source, fun_name, move(dimensions), move(offset), move(local_dims), f0{map_args}, f1{map_result}); return f(source, fun_name,
move(dimensions), move(offset), move(local_dims),
f0{map_args}, f1{map_result});
} }
} // namespace cppa } // namespace cppa
#endif // CPPA_OPENCL_HPP #endif // CPPA_OPENCL_HPP
...@@ -64,7 +64,6 @@ option<cow_tuple<Ts...>> default_map_args(any_tuple msg) { ...@@ -64,7 +64,6 @@ option<cow_tuple<Ts...>> default_map_args(any_tuple msg) {
return tuple_cast<Ts...>(msg); return tuple_cast<Ts...>(msg);
} }
#ifdef CPPA_OPENCL
class command_dispatcher { class command_dispatcher {
struct worker; struct worker;
...@@ -174,10 +173,6 @@ class command_dispatcher { ...@@ -174,10 +173,6 @@ class command_dispatcher {
command_ptr); command_ptr);
}; };
#else // CPPA_OPENCL
class command_dispatcher : public detail::singleton_mixin<command_dispatcher> { };
#endif // CPPA_OPENCL
command_dispatcher* get_command_dispatcher(); command_dispatcher* get_command_dispatcher();
} } // namespace cppa::opencl } } // namespace cppa::opencl
......
...@@ -48,7 +48,15 @@ ...@@ -48,7 +48,15 @@
#include "cppa/detail/thread_pool_scheduler.hpp" #include "cppa/detail/thread_pool_scheduler.hpp"
#include "cppa/detail/uniform_type_info_map.hpp" #include "cppa/detail/uniform_type_info_map.hpp"
#include "cppa/opencl/command_dispatcher.hpp" #ifdef CPPA_OPENCL
# include "cppa/opencl/command_dispatcher.hpp"
#else
namespace cppa { namespace opencl {
class command_dispatcher : public detail::singleton_mixin<command_dispatcher> { };
} } // namespace cppa::opencl
#endif
namespace cppa { void shutdown() { detail::singleton_manager::shutdown(); } } namespace cppa { void shutdown() { detail::singleton_manager::shutdown(); } }
...@@ -99,7 +107,12 @@ void singleton_manager::shutdown() { ...@@ -99,7 +107,12 @@ void singleton_manager::shutdown() {
} }
opencl::command_dispatcher* singleton_manager::get_command_dispatcher() { opencl::command_dispatcher* singleton_manager::get_command_dispatcher() {
# ifdef CPPA_OPENCL
return lazy_get(s_command_dispatcher); return lazy_get(s_command_dispatcher);
# else
CPPA_LOGF_ERROR("libcppa was compiled without OpenCL support");
throw std::logic_error("libcppa was compiled without OpenCL support");
# endif
} }
actor_registry* singleton_manager::get_actor_registry() { actor_registry* singleton_manager::get_actor_registry() {
......
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