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