Commit 81bff1a2 authored by Dominik Charousset's avatar Dominik Charousset

Merge branch 'unstable' of github.com:Neverlord/libcppa into unstable

parents 21dd89ba b2c7d448
...@@ -103,9 +103,7 @@ class actor_facade<Ret(Args...)> : public actor { ...@@ -103,9 +103,7 @@ class actor_facade<Ret(Args...)> : public actor {
&err)); &err));
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
std::ostringstream oss; std::ostringstream oss;
oss << "clCreateKernel: '" oss << "clCreateKernel: " << get_opencl_error(err);
<< get_opencl_error(err)
<< "'.";
CPPA_LOGM_ERROR(detail::demangle<actor_facade>(), oss.str()); CPPA_LOGM_ERROR(detail::demangle<actor_facade>(), oss.str());
throw std::runtime_error(oss.str()); throw std::runtime_error(oss.str());
} }
......
...@@ -79,16 +79,14 @@ struct command_dispatcher::worker { ...@@ -79,16 +79,14 @@ struct command_dispatcher::worker {
cl_int err{clFlush(cmd_q)}; cl_int err{clFlush(cmd_q)};
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
ostringstream oss; ostringstream oss;
oss << "clFlush: '" oss << "clFlush: " << get_opencl_error(err);
<< get_opencl_error(err)
<< "'.";
CPPA_LOG_ERROR(oss.str()); CPPA_LOG_ERROR(oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
} }
catch (exception& e) { catch (exception& e) {
ostringstream oss; ostringstream oss;
oss << "worker loop, e.what(): '" << e.what() << "'."; oss << "worker loop, e.what(): " << e.what();
CPPA_LOG_ERROR(oss.str()); CPPA_LOG_ERROR(oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
...@@ -129,9 +127,7 @@ void command_dispatcher::initialize() { ...@@ -129,9 +127,7 @@ void command_dispatcher::initialize() {
err = clGetPlatformIDs(ids.size(), ids.data(), &number_of_platforms); err = clGetPlatformIDs(ids.size(), ids.data(), &number_of_platforms);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
ostringstream oss; ostringstream oss;
oss << "clGetPlatformIDs: '" oss << "clGetPlatformIDs: " << get_opencl_error(err);
<< get_opencl_error(err)
<< "'.";
CPPA_LOG_ERROR(oss.str()); CPPA_LOG_ERROR(oss.str());
throw logic_error(oss.str()); throw logic_error(oss.str());
} }
...@@ -155,9 +151,7 @@ void command_dispatcher::initialize() { ...@@ -155,9 +151,7 @@ void command_dispatcher::initialize() {
} }
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
ostringstream oss; ostringstream oss;
oss << "clGetDeviceIDs: '" oss << "clGetDeviceIDs: " << get_opencl_error(err);
<< get_opencl_error(err)
<< "'.";
CPPA_LOG_ERROR(oss.str()); CPPA_LOG_ERROR(oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
...@@ -165,9 +159,7 @@ void command_dispatcher::initialize() { ...@@ -165,9 +159,7 @@ void command_dispatcher::initialize() {
err = clGetDeviceIDs(ids[pid], dev_type, num_devices, devices.data(), nullptr); err = clGetDeviceIDs(ids[pid], dev_type, num_devices, devices.data(), nullptr);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
ostringstream oss; ostringstream oss;
oss << "clGetDeviceIDs: '" oss << "clGetDeviceIDs: " << get_opencl_error(err);
<< get_opencl_error(err)
<< "'.";
CPPA_LOG_ERROR(oss.str()); CPPA_LOG_ERROR(oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
...@@ -176,9 +168,7 @@ void command_dispatcher::initialize() { ...@@ -176,9 +168,7 @@ void command_dispatcher::initialize() {
m_context.adopt(clCreateContext(0, 1, devices.data(), nullptr, nullptr, &err)); m_context.adopt(clCreateContext(0, 1, devices.data(), nullptr, nullptr, &err));
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
ostringstream oss; ostringstream oss;
oss << "clCreateContext: '" oss << "clCreateContext: " << get_opencl_error(err);
<< get_opencl_error(err)
<< "'.";
CPPA_LOG_ERROR(oss.str()); CPPA_LOG_ERROR(oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
...@@ -193,11 +183,7 @@ void command_dispatcher::initialize() { ...@@ -193,11 +183,7 @@ void command_dispatcher::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) {
ostringstream oss; CPPA_LOG_ERROR("clGetDeviceInfo (CL_DEVICE_NAME): " << get_opencl_error(err));
oss << "clGetDeviceInfo (CL_DEVICE_NAME): '"
<< get_opencl_error(err)
<< "'.";
CPPA_LOG_ERROR(oss.str());
fill(buf, buf+buf_size, 0); fill(buf, buf+buf_size, 0);
} }
command_queue_ptr cmd_queue; command_queue_ptr cmd_queue;
...@@ -207,8 +193,7 @@ void command_dispatcher::initialize() { ...@@ -207,8 +193,7 @@ void command_dispatcher::initialize() {
&err)); &err));
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
CPPA_LOG_DEBUG("Could not create command queue for device " CPPA_LOG_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};
...@@ -219,10 +204,9 @@ void command_dispatcher::initialize() { ...@@ -219,10 +204,9 @@ void command_dispatcher::initialize() {
&return_size); &return_size);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
ostringstream oss; ostringstream oss;
oss << "[!!!] clGetDeviceInfo (" oss << "clGetDeviceInfo (" << id
<< id << ":CL_DEVICE_MAX_WORK_GROUP_SIZE): "
<< ":CL_DEVICE_MAX_WORK_GROUP_SIZE): '" << get_opencl_error(err);
<< get_opencl_error(err) << "'.";
CPPA_LOG_ERROR(oss.str()); CPPA_LOG_ERROR(oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
...@@ -234,10 +218,9 @@ void command_dispatcher::initialize() { ...@@ -234,10 +218,9 @@ void command_dispatcher::initialize() {
&return_size); &return_size);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
ostringstream oss; ostringstream oss;
oss << "[!!!] clGetDeviceInfo (" oss << "clGetDeviceInfo (" << id
<< id << ":CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS): "
<< ":CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS): '" << get_opencl_error(err);
<< get_opencl_error(err) << "'.";
CPPA_LOG_ERROR(oss.str()); CPPA_LOG_ERROR(oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
...@@ -249,10 +232,9 @@ void command_dispatcher::initialize() { ...@@ -249,10 +232,9 @@ void command_dispatcher::initialize() {
&return_size); &return_size);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
ostringstream oss; ostringstream oss;
oss << "[!!!] clGetDeviceInfo (" oss << "clGetDeviceInfo (" << id
<< id << ":CL_DEVICE_MAX_WORK_ITEM_SIZES): "
<< ":CL_DEVICE_MAX_WORK_ITEM_SIZES): '" << get_opencl_error(err);
<< get_opencl_error(err) << "'.";
CPPA_LOG_ERROR(oss.str()); CPPA_LOG_ERROR(oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
} }
...@@ -267,7 +249,7 @@ void command_dispatcher::initialize() { ...@@ -267,7 +249,7 @@ void command_dispatcher::initialize() {
} }
if (m_devices.empty()) { if (m_devices.empty()) {
ostringstream oss; ostringstream oss;
oss << "[!!!] Could not create a command queue for " oss << "Could not create a command queue for "
<< "any of the present devices."; << "any of the present devices.";
CPPA_LOG_ERROR(oss.str()); CPPA_LOG_ERROR(oss.str());
throw runtime_error(oss.str()); throw runtime_error(oss.str());
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace cppa { namespace opencl { namespace cppa { namespace opencl {
//program::program() : m_context(nullptr), pptr(nullptr) { }
program::program(context_ptr context, program_ptr program) program::program(context_ptr context, program_ptr program)
: m_context(std::move(context)), m_program(std::move(program)) { } : m_context(std::move(context)), m_program(std::move(program)) { }
...@@ -56,9 +54,8 @@ program program::create(const char* kernel_source) { ...@@ -56,9 +54,8 @@ program program::create(const char* kernel_source) {
&err)); &err));
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
throw std::runtime_error("clCreateProgramWithSource: '" throw std::runtime_error("clCreateProgramWithSource: "
+ get_opencl_error(err) + get_opencl_error(err));
+ "'.");
} }
// build programm from program object // build programm from program object
...@@ -90,10 +87,8 @@ program program::create(const char* kernel_source) { ...@@ -90,10 +87,8 @@ program program::create(const char* kernel_source) {
nullptr); nullptr);
build_log[ret_val_size] = '\0'; build_log[ret_val_size] = '\0';
std::ostringstream oss; std::ostringstream oss;
oss << "clBuildProgram: '" oss << "clBuildProgram: " << get_opencl_error(err)
<< get_opencl_error(err) << ", build log: " << build_log.data();
<< "'. Build log: "
<< build_log.data();
CPPA_LOGM_ERROR(detail::demangle<program>(), oss.str()); CPPA_LOGM_ERROR(detail::demangle<program>(), oss.str());
throw std::runtime_error(oss.str()); throw std::runtime_error(oss.str());
} }
...@@ -124,7 +119,8 @@ program program::create(const char* kernel_source) { ...@@ -124,7 +119,8 @@ program program::create(const char* kernel_source) {
build_log.data(), build_log.data(),
nullptr); nullptr);
build_log[ret_val_size] = '\0'; build_log[ret_val_size] = '\0';
CPPA_LOG_DEBUG("clBuildProgram log: '" << build_log.data()); CPPA_LOG_DEBUG("clBuildProgram build log: "
<< build_log.data());
# endif # endif
} }
return {cptr, pptr}; 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