Commit ebb1c29b authored by Marian Triebe's avatar Marian Triebe

Add missing functions for opencl module

parent 8d6df336
......@@ -209,6 +209,13 @@ public:
/// @throws `std::logic_error` if module is not loaded.
io::middleman& middleman();
/// Returns the opencl manager instance from opencl module.
/// @throws `std::logic_error` if module is not loaded.
opencl::manager& opencl_manager() const;
/// Returns `true` if the opencl module is available, `false` otherwise.
bool has_opencl_manager() const;
/// Returns `true` if the RIAC probe module is available, `false` otherwise.
bool has_probe() const;
......@@ -426,6 +433,7 @@ private:
io::middleman* middleman_;
scoped_execution_unit dummy_execution_unit_;
atom_value backend_name_;
opencl::manager* opencl_manager_;
riac::probe* probe_;
bool await_actors_before_shutdown_;
};
......
......@@ -102,6 +102,12 @@ struct header;
} // namespace io
namespace opencl {
class manager;
} // namespace opencl
namespace riac {
class probe;
......
......@@ -67,6 +67,9 @@ actor_system::actor_system(actor_system_config&& cfg)
auto& mmptr = modules_[module::middleman];
if (mmptr)
middleman_ = reinterpret_cast<io::middleman*>(mmptr->subtype_ptr());
auto& clptr = modules_[module::opencl_manager];
if (clptr)
opencl_manager_ = reinterpret_cast<opencl::manager*>(clptr->subtype_ptr());
auto& pptr = modules_[module::riac_probe];
if (pptr)
probe_ = reinterpret_cast<riac::probe*>(pptr->subtype_ptr());
......@@ -196,6 +199,16 @@ io::middleman& actor_system::middleman() {
return *middleman_;
}
bool actor_system::has_opencl_manager() const {
return opencl_manager_ != nullptr;
}
opencl::manager& actor_system::opencl_manager() const {
if (! opencl_manager_)
throw std::logic_error("cannot access opencl manager: module not loaded");
return *opencl_manager_;
}
bool actor_system::has_probe() const {
return probe_ != nullptr;
}
......
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