Commit 8ecfc7db authored by Dominik Charousset's avatar Dominik Charousset

priority-aware actors

this patch adds a new spawn option for priority-aware actors
and refactors libcppa's message passing; this version has a known
issue with network distributed group messaging
parent 6e9b6578
......@@ -82,7 +82,7 @@ class actor_facade<Ret(Args...)> : public actor {
result_mapping map_result) {
if (global_dims.empty()) {
auto str = "OpenCL kernel needs at least 1 global dimension.";
CPPA_LOGM_ERROR(detail::demangle(typeid(actor_facade)), str);
CPPA_LOGM_ERROR(detail::demangle(typeid(actor_facade)).c_str(), str);
throw std::runtime_error(str);
}
auto check_vec = [&](const dim_vec& vec, const char* name) {
......@@ -90,7 +90,7 @@ class actor_facade<Ret(Args...)> : public actor {
std::ostringstream oss;
oss << name << " vector is not empty, but "
<< "its size differs from global dimensions vector's size";
CPPA_LOGM_ERROR(detail::demangle<actor_facade>(), oss.str());
CPPA_LOGM_ERROR(detail::demangle<actor_facade>().c_str(), oss.str());
throw std::runtime_error(oss.str());
}
};
......@@ -104,7 +104,7 @@ class actor_facade<Ret(Args...)> : public actor {
if (err != CL_SUCCESS) {
std::ostringstream oss;
oss << "clCreateKernel: " << get_opencl_error(err);
CPPA_LOGM_ERROR(detail::demangle<actor_facade>(), oss.str());
CPPA_LOGM_ERROR(detail::demangle<actor_facade>().c_str(), oss.str());
throw std::runtime_error(oss.str());
}
return new actor_facade<Ret (Args...)>{dispatcher,
......@@ -169,7 +169,7 @@ class actor_facade<Ret(Args...)> : public actor {
m_local_dimensions,
m_map_result));
}
else { CPPA_LOG_ERROR("actor_facade::enqueue() tuple_cast failed."); }
else { CPPA_LOGMF(CPPA_ERROR, this, "actor_facade::enqueue() tuple_cast failed."); }
}
typedef std::vector<mem_ptr> args_vec;
......@@ -217,7 +217,7 @@ class actor_facade<Ret(Args...)> : public actor {
arg0.data(),
&err);
if (err != CL_SUCCESS) {
CPPA_LOG_ERROR("clCreateBuffer: " << get_opencl_error(err));
CPPA_LOGMF(CPPA_ERROR, this, "clCreateBuffer: " << get_opencl_error(err));
}
else {
mem_ptr tmp;
......@@ -241,7 +241,7 @@ class actor_facade<Ret(Args...)> : public actor {
nullptr,
&err);
if (err != CL_SUCCESS) {
CPPA_LOG_ERROR("clCreateBuffer: " << get_opencl_error(err));
CPPA_LOGMF(CPPA_ERROR, this, "clCreateBuffer: " << get_opencl_error(err));
}
else {
mem_ptr tmp;
......
......@@ -80,14 +80,14 @@ struct command_dispatcher::worker {
if (err != CL_SUCCESS) {
ostringstream oss;
oss << "clFlush: " << get_opencl_error(err);
CPPA_LOG_ERROR(oss.str());
CPPA_LOGMF(CPPA_ERROR, self, oss.str());
throw runtime_error(oss.str());
}
}
catch (exception& e) {
ostringstream oss;
oss << "worker loop, e.what(): " << e.what();
CPPA_LOG_ERROR(oss.str());
CPPA_LOGMF(CPPA_ERROR, self, oss.str());
throw runtime_error(oss.str());
}
}
......@@ -107,12 +107,12 @@ void command_dispatcher::worker_loop(command_dispatcher::worker* w) {
void command_dispatcher::supervisor_loop(command_dispatcher* scheduler,
job_queue* jq, command_ptr m_dummy) {
CPPA_LOGF_TRACE("");
unique_ptr<command_dispatcher::worker> worker;
worker.reset(new command_dispatcher::worker(scheduler, jq, m_dummy));
worker->start();
worker->m_thread.join();
worker.reset();
CPPA_LOG_TRACE("supervisor done");
}
void command_dispatcher::initialize() {
......@@ -128,13 +128,13 @@ void command_dispatcher::initialize() {
if (err != CL_SUCCESS) {
ostringstream oss;
oss << "clGetPlatformIDs: " << get_opencl_error(err);
CPPA_LOG_ERROR(oss.str());
CPPA_LOGMF(CPPA_ERROR, self, oss.str());
throw logic_error(oss.str());
}
else if (number_of_platforms < 1) {
ostringstream oss;
oss << "clGetPlatformIDs: 'no platforms found'.";
CPPA_LOG_ERROR(oss.str());
CPPA_LOGMF(CPPA_ERROR, self, oss.str());
throw logic_error(oss.str());
}
......@@ -152,7 +152,7 @@ void command_dispatcher::initialize() {
if (err != CL_SUCCESS) {
ostringstream oss;
oss << "clGetDeviceIDs: " << get_opencl_error(err);
CPPA_LOG_ERROR(oss.str());
CPPA_LOGMF(CPPA_ERROR, self, oss.str());
throw runtime_error(oss.str());
}
vector<cl_device_id> devices(num_devices);
......@@ -160,7 +160,7 @@ void command_dispatcher::initialize() {
if (err != CL_SUCCESS) {
ostringstream oss;
oss << "clGetDeviceIDs: " << get_opencl_error(err);
CPPA_LOG_ERROR(oss.str());
CPPA_LOGMF(CPPA_ERROR, self, oss.str());
throw runtime_error(oss.str());
}
......@@ -169,7 +169,7 @@ void command_dispatcher::initialize() {
if (err != CL_SUCCESS) {
ostringstream oss;
oss << "clCreateContext: " << get_opencl_error(err);
CPPA_LOG_ERROR(oss.str());
CPPA_LOGMF(CPPA_ERROR, self, oss.str());
throw runtime_error(oss.str());
}
......@@ -183,7 +183,7 @@ void command_dispatcher::initialize() {
char buf[buf_size];
err = clGetDeviceInfo(device.get(), CL_DEVICE_NAME, buf_size, buf, &return_size);
if (err != CL_SUCCESS) {
CPPA_LOG_ERROR("clGetDeviceInfo (CL_DEVICE_NAME): " << get_opencl_error(err));
CPPA_LOGMF(CPPA_ERROR, self, "clGetDeviceInfo (CL_DEVICE_NAME): " << get_opencl_error(err));
fill(buf, buf+buf_size, 0);
}
command_queue_ptr cmd_queue;
......@@ -192,7 +192,7 @@ void command_dispatcher::initialize() {
CL_QUEUE_PROFILING_ENABLE,
&err));
if (err != CL_SUCCESS) {
CPPA_LOG_DEBUG("Could not create command queue for device "
CPPA_LOGMF(CPPA_DEBUG, self, "Could not create command queue for device "
<< buf << ": " << get_opencl_error(err));
}
else {
......@@ -207,7 +207,7 @@ void command_dispatcher::initialize() {
oss << "clGetDeviceInfo (" << id
<< ":CL_DEVICE_MAX_WORK_GROUP_SIZE): "
<< get_opencl_error(err);
CPPA_LOG_ERROR(oss.str());
CPPA_LOGMF(CPPA_ERROR, self, oss.str());
throw runtime_error(oss.str());
}
cl_uint max_work_item_dimensions = 0;
......@@ -221,7 +221,7 @@ void command_dispatcher::initialize() {
oss << "clGetDeviceInfo (" << id
<< ":CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS): "
<< get_opencl_error(err);
CPPA_LOG_ERROR(oss.str());
CPPA_LOGMF(CPPA_ERROR, self, oss.str());
throw runtime_error(oss.str());
}
dim_vec max_work_items_per_dim(max_work_item_dimensions);
......@@ -235,7 +235,7 @@ void command_dispatcher::initialize() {
oss << "clGetDeviceInfo (" << id
<< ":CL_DEVICE_MAX_WORK_ITEM_SIZES): "
<< get_opencl_error(err);
CPPA_LOG_ERROR(oss.str());
CPPA_LOGMF(CPPA_ERROR, self, oss.str());
throw runtime_error(oss.str());
}
device_info dev_info{id,
......@@ -251,7 +251,7 @@ void command_dispatcher::initialize() {
ostringstream oss;
oss << "Could not create a command queue for "
<< "any of the present devices.";
CPPA_LOG_ERROR(oss.str());
CPPA_LOGMF(CPPA_ERROR, self, oss.str());
throw runtime_error(oss.str());
}
else {
......
......@@ -89,11 +89,11 @@ program program::create(const char* kernel_source) {
std::ostringstream oss;
oss << "clBuildProgram: " << get_opencl_error(err)
<< ", build log: " << build_log.data();
CPPA_LOGM_ERROR(detail::demangle<program>(), oss.str());
CPPA_LOGM_ERROR(detail::demangle<program>().c_str(), oss.str());
throw std::runtime_error(oss.str());
}
else {
# ifdef CPPA_DEBUG
# ifdef CPPA_ENABLE_DEBUG
device_ptr device_used(cppa::detail::singleton_manager::
get_command_dispatcher()->
m_devices.front().dev_id);
......@@ -119,8 +119,8 @@ program program::create(const char* kernel_source) {
build_log.data(),
nullptr);
build_log[ret_val_size] = '\0';
CPPA_LOG_DEBUG("clBuildProgram build log: "
<< build_log.data());
CPPA_LOGM_DEBUG("program", "clBuildProgram build log: "
<< build_log.data());
# endif
}
return {cptr, pptr};
......
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