Commit 2319ac39 authored by Joseph Noir's avatar Joseph Noir

Merge branch 'unstable' into topic/opencl

Conflicts:
	configure
	cppa/opencl/actor_facade.hpp
	cppa/opencl/command.hpp
parents 258fd659 b95fe60d
This diff is collapsed.
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include "cppa/actor.hpp"
#include "cppa/logging.hpp" #include "cppa/logging.hpp"
#include "cppa/opencl/global.hpp" #include "cppa/opencl/global.hpp"
#include "cppa/response_handle.hpp" #include "cppa/abstract_actor.hpp"
#include "cppa/response_promise.hpp"
#include "cppa/opencl/smart_ptr.hpp" #include "cppa/opencl/smart_ptr.hpp"
#include "cppa/util/scope_guard.hpp" #include "cppa/util/scope_guard.hpp"
...@@ -51,7 +51,7 @@ class command : public ref_counted { ...@@ -51,7 +51,7 @@ class command : public ref_counted {
public: public:
command(response_handle handle, command(response_promise handle,
intrusive_ptr<T> actor_facade, intrusive_ptr<T> actor_facade,
std::vector<cl_event> events, std::vector<cl_event> events,
std::vector<mem_ptr> arguments, std::vector<mem_ptr> arguments,
...@@ -71,8 +71,8 @@ class command : public ref_counted { ...@@ -71,8 +71,8 @@ class command : public ref_counted {
for(auto& e : m_events) { for(auto& e : m_events) {
err = clReleaseEvent(e); err = clReleaseEvent(e);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_ERROR, self, "clReleaseEvent: " CPPA_LOGMF(CPPA_ERROR, "clReleaseEvent: "
<< get_opencl_error(err)); << get_opencl_error(err));
} }
} }
} }
...@@ -95,8 +95,8 @@ class command : public ref_counted { ...@@ -95,8 +95,8 @@ class command : public ref_counted {
(m_events.empty() ? nullptr : m_events.data()), (m_events.empty() ? nullptr : m_events.data()),
&event_k); &event_k);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_ERROR, self, "clEnqueueNDRangeKernel: " CPPA_LOGMF(CPPA_ERROR, "clEnqueueNDRangeKernel: "
<< get_opencl_error(err)); << get_opencl_error(err));
this->deref(); // or can anything actually happen? this->deref(); // or can anything actually happen?
return; return;
} }
...@@ -126,15 +126,15 @@ class command : public ref_counted { ...@@ -126,15 +126,15 @@ class command : public ref_counted {
}, },
this); this);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_ERROR, self, "clSetEventCallback: " CPPA_LOGMF(CPPA_ERROR, "clSetEventCallback: "
<< get_opencl_error(err)); << get_opencl_error(err));
this->deref(); // callback is not set this->deref(); // callback is not set
return; return;
} }
err = clFlush(m_queue.get()); err = clFlush(m_queue.get());
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_ERROR, self, "clFlush: " << get_opencl_error(err)); CPPA_LOGMF(CPPA_ERROR, "clFlush: " << get_opencl_error(err));
} }
m_events.push_back(std::move(event_k)); m_events.push_back(std::move(event_k));
m_events.push_back(std::move(event_r)); m_events.push_back(std::move(event_r));
...@@ -144,7 +144,7 @@ class command : public ref_counted { ...@@ -144,7 +144,7 @@ class command : public ref_counted {
private: private:
int m_result_size; int m_result_size;
response_handle m_handle; response_promise m_handle;
intrusive_ptr<T> m_actor_facade; intrusive_ptr<T> m_actor_facade;
command_queue_ptr m_queue; command_queue_ptr m_queue;
std::vector<cl_event> m_events; std::vector<cl_event> m_events;
...@@ -153,7 +153,7 @@ class command : public ref_counted { ...@@ -153,7 +153,7 @@ class command : public ref_counted {
any_tuple m_msg; // required to keep the argument buffers alive (for async copy) any_tuple m_msg; // required to keep the argument buffers alive (for async copy)
void handle_results () { void handle_results () {
reply_tuple_to(m_handle, m_actor_facade->m_map_result(m_result)); m_handle.deliver(m_actor_facade->m_map_result(m_result));
} }
}; };
......
...@@ -50,7 +50,7 @@ void opencl_metainfo::initialize() ...@@ -50,7 +50,7 @@ void opencl_metainfo::initialize()
ostringstream oss; ostringstream oss;
oss << "clGetPlatformIDs (getting number of platforms): " oss << "clGetPlatformIDs (getting number of platforms): "
<< get_opencl_error(err); << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, self, oss.str()); CPPA_LOGMF(CPPA_ERROR, oss.str());
throw logic_error(oss.str()); throw logic_error(oss.str());
} }
...@@ -62,7 +62,7 @@ void opencl_metainfo::initialize() ...@@ -62,7 +62,7 @@ void opencl_metainfo::initialize()
ostringstream oss; ostringstream oss;
oss << "clGetPlatformIDs (getting platform ids): " oss << "clGetPlatformIDs (getting platform ids): "
<< get_opencl_error(err); << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, self, oss.str()); CPPA_LOGMF(CPPA_ERROR, oss.str());
throw logic_error(oss.str()); throw logic_error(oss.str());
} }
...@@ -81,7 +81,7 @@ void opencl_metainfo::initialize() ...@@ -81,7 +81,7 @@ void opencl_metainfo::initialize()
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
ostringstream oss; ostringstream oss;
oss << "clGetDeviceIDs: " << get_opencl_error(err); oss << "clGetDeviceIDs: " << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, self, oss.str()); CPPA_LOGMF(CPPA_ERROR, oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
vector<cl_device_id> devices(num_devices); vector<cl_device_id> devices(num_devices);
...@@ -89,7 +89,7 @@ void opencl_metainfo::initialize() ...@@ -89,7 +89,7 @@ void opencl_metainfo::initialize()
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
ostringstream oss; ostringstream oss;
oss << "clGetDeviceIDs: " << get_opencl_error(err); oss << "clGetDeviceIDs: " << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, self, oss.str()); CPPA_LOGMF(CPPA_ERROR, oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
...@@ -112,7 +112,7 @@ void opencl_metainfo::initialize() ...@@ -112,7 +112,7 @@ void opencl_metainfo::initialize()
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
ostringstream oss; ostringstream oss;
oss << "clCreateContext: " << get_opencl_error(err); oss << "clCreateContext: " << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, self, oss.str()); CPPA_LOGMF(CPPA_ERROR, oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
...@@ -126,8 +126,8 @@ void opencl_metainfo::initialize() ...@@ -126,8 +126,8 @@ void opencl_metainfo::initialize()
char buf[buf_size]; char buf[buf_size];
err = clGetDeviceInfo(device.get(), CL_DEVICE_NAME, buf_size, buf, &return_size); err = clGetDeviceInfo(device.get(), CL_DEVICE_NAME, buf_size, buf, &return_size);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_ERROR, self, "clGetDeviceInfo (CL_DEVICE_NAME): " CPPA_LOGMF(CPPA_ERROR, "clGetDeviceInfo (CL_DEVICE_NAME): "
<< get_opencl_error(err)); << get_opencl_error(err));
fill(buf, buf+buf_size, 0); fill(buf, buf+buf_size, 0);
} }
command_queue_ptr cmd_queue; command_queue_ptr cmd_queue;
...@@ -136,8 +136,8 @@ void opencl_metainfo::initialize() ...@@ -136,8 +136,8 @@ void opencl_metainfo::initialize()
CL_QUEUE_PROFILING_ENABLE, CL_QUEUE_PROFILING_ENABLE,
&err)); &err));
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_DEBUG, self, "Could not create command queue for device " CPPA_LOGMF(CPPA_DEBUG, "Could not create command queue for device "
<< buf << ": " << get_opencl_error(err)); << buf << ": " << get_opencl_error(err));
} }
else { else {
size_t max_work_group_size{0}; size_t max_work_group_size{0};
...@@ -151,7 +151,7 @@ void opencl_metainfo::initialize() ...@@ -151,7 +151,7 @@ void opencl_metainfo::initialize()
oss << "clGetDeviceInfo (" oss << "clGetDeviceInfo ("
<< "CL_DEVICE_MAX_WORK_GROUP_SIZE): " << "CL_DEVICE_MAX_WORK_GROUP_SIZE): "
<< get_opencl_error(err); << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, self, oss.str()); CPPA_LOGMF(CPPA_ERROR, oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
cl_uint max_work_item_dimensions = 0; cl_uint max_work_item_dimensions = 0;
...@@ -165,7 +165,7 @@ void opencl_metainfo::initialize() ...@@ -165,7 +165,7 @@ void opencl_metainfo::initialize()
oss << "clGetDeviceInfo (" oss << "clGetDeviceInfo ("
<< "CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS): " << "CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS): "
<< get_opencl_error(err); << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, self, oss.str()); CPPA_LOGMF(CPPA_ERROR, oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
dim_vec max_work_items_per_dim(max_work_item_dimensions); dim_vec max_work_items_per_dim(max_work_item_dimensions);
...@@ -179,7 +179,7 @@ void opencl_metainfo::initialize() ...@@ -179,7 +179,7 @@ void opencl_metainfo::initialize()
oss << "clGetDeviceInfo (" oss << "clGetDeviceInfo ("
<< "CL_DEVICE_MAX_WORK_ITEM_SIZES): " << "CL_DEVICE_MAX_WORK_ITEM_SIZES): "
<< get_opencl_error(err); << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, self, oss.str()); CPPA_LOGMF(CPPA_ERROR, oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
device_info dev_info{device, device_info dev_info{device,
...@@ -195,7 +195,7 @@ void opencl_metainfo::initialize() ...@@ -195,7 +195,7 @@ void opencl_metainfo::initialize()
ostringstream oss; ostringstream oss;
oss << "Could not create a command queue for " oss << "Could not create a command queue for "
<< "any present device."; << "any present device.";
CPPA_LOGMF(CPPA_ERROR, self, oss.str()); CPPA_LOGMF(CPPA_ERROR, oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
} }
......
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