Commit 89f2b66a authored by Marian Triebe's avatar Marian Triebe

Switch cppa log defines to caf log defines

parent 86e60176
......@@ -68,7 +68,7 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
size_t result_size) {
if (global_dims.empty()) {
auto str = "OpenCL kernel needs at least 1 global dimension.";
CPPA_LOGM_ERROR(detail::demangle(typeid(actor_facade)).c_str(), str);
CAF_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) {
......@@ -76,7 +76,7 @@ class actor_facade<Ret(Args...)> : public abstract_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>().c_str(), oss.str());
CAF_LOGM_ERROR(detail::demangle<actor_facade>().c_str(), oss.str());
throw std::runtime_error(oss.str());
}
};
......@@ -88,7 +88,7 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
if (err != CL_SUCCESS) {
std::ostringstream oss;
oss << "clCreateKernel: " << get_opencl_error(err);
CPPA_LOGM_ERROR(detail::demangle<actor_facade>().c_str(), oss.str());
CAF_LOGM_ERROR(detail::demangle<actor_facade>().c_str(), oss.str());
throw std::runtime_error(oss.str());
}
if (result_size == 0) {
......@@ -101,7 +101,7 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
}
void enqueue(msg_hdr_cref hdr, any_tuple msg, execution_unit*) override {
CPPA_LOG_TRACE("");
CAF_LOG_TRACE("");
typename detail::il_indices<detail::type_list<Args...>>::type indices;
enqueue_impl(hdr.sender, std::move(msg), hdr.id, indices);
}
......@@ -124,7 +124,7 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
, m_map_args(std::move(map_args))
, m_map_result(std::move(map_result))
, m_result_size(result_size) {
CPPA_LOG_TRACE("id: " << this->id());
CAF_LOG_TRACE("id: " << this->id());
}
template <long... Is>
......@@ -142,7 +142,7 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
*opt);
cmd->enqueue();
} else {
CPPA_LOGMF(CPPA_ERROR, "actor_facade::enqueue() tuple_cast failed.");
CAF_LOGMF(CAF_ERROR, "actor_facade::enqueue() tuple_cast failed.");
}
}
......@@ -164,8 +164,8 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
for (size_t i = 0; i < arguments.size(); ++i) {
err = clSetKernelArg(m_kernel.get(), i, sizeof(cl_mem),
static_cast<void*>(&arguments[i]));
CPPA_LOG_ERROR_IF(err != CL_SUCCESS,
"clSetKernelArg: " << get_opencl_error(err));
CAF_LOG_ERROR_IF(err != CL_SUCCESS,
"clSetKernelArg: " << get_opencl_error(err));
}
clFlush(m_queue.get());
}
......@@ -178,14 +178,14 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
auto buffer = clCreateBuffer(m_context.get(), CL_MEM_READ_ONLY, buffer_size,
nullptr, &err);
if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_ERROR, "clCreateBuffer: " << get_opencl_error(err));
CAF_LOGMF(CAF_ERROR, "clCreateBuffer: " << get_opencl_error(err));
return;
}
cl_event event;
err = clEnqueueWriteBuffer(m_queue.get(), buffer, CL_FALSE, 0, buffer_size,
arg0.data(), 0, nullptr, &event);
if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_ERROR, "clEnqueueWriteBuffer: " << get_opencl_error(err));
CAF_LOGMF(CAF_ERROR, "clEnqueueWriteBuffer: " << get_opencl_error(err));
return;
}
events.push_back(std::move(event));
......@@ -204,7 +204,7 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
clCreateBuffer(m_context.get(), CL_MEM_WRITE_ONLY,
sizeof(typename R::value_type) * ret_size, nullptr, &err);
if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_ERROR, "clCreateBuffer: " << get_opencl_error(err));
CAF_LOGMF(CAF_ERROR, "clCreateBuffer: " << get_opencl_error(err));
return;
}
mem_ptr tmp;
......
......@@ -56,13 +56,13 @@ class command : public ref_counted {
for (auto& e : m_events) {
err = clReleaseEvent(e);
if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_ERROR, "clReleaseEvent: " << get_opencl_error(err));
CAF_LOGMF(CAF_ERROR, "clReleaseEvent: " << get_opencl_error(err));
}
}
}
void enqueue() {
CPPA_LOG_TRACE("command::enqueue()");
CAF_LOG_TRACE("command::enqueue()");
this->ref(); // reference held by the OpenCL comand queue
cl_int err{0};
cl_event event_k;
......@@ -77,16 +77,21 @@ class command : public ref_counted {
data_or_nullptr(m_actor_facade->m_local_dimensions), m_events.size(),
(m_events.empty() ? nullptr : m_events.data()), &event_k);
if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_ERROR,
CAF_LOGMF(CAF_ERROR,
"clEnqueueNDRangeKernel: " << get_opencl_error(err));
this->deref(); // or can anything actually happen?
return;
} else {
cl_event event_r;
err =
clEnqueueReadBuffer(m_queue.get(), m_arguments.back().get(), CL_FALSE,
0, sizeof(typename R::value_type) * m_result_size,
m_result.data(), 1, &event_k, &event_r);
err = clEnqueueReadBuffer(m_queue.get(),
m_arguments.back().get(),
CL_FALSE,
0,
sizeof(typename R::value_type) * m_result_size,
m_result.data(),
1,
&event_k,
&event_r);
if (err != CL_SUCCESS) {
throw std::runtime_error("clEnqueueReadBuffer: " +
get_opencl_error(err));
......@@ -101,14 +106,14 @@ class command : public ref_counted {
},
this);
if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_ERROR, "clSetEventCallback: " << get_opencl_error(err));
CAF_LOGMF(CAF_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, "clFlush: " << get_opencl_error(err));
CAF_LOGMF(CAF_ERROR, "clFlush: " << get_opencl_error(err));
}
m_events.push_back(std::move(event_k));
m_events.push_back(std::move(event_r));
......
......@@ -41,7 +41,7 @@ class program {
public:
/**
* @brief Factory method, that creates a cppa::opencl::program
* @brief Factory method, that creates a caf::opencl::program
* from a given @p kernel_source.
* @returns A program object.
*/
......
......@@ -38,7 +38,7 @@ void opencl_metainfo::initialize() {
ostringstream oss;
oss << "clGetPlatformIDs (getting number of platforms): "
<< get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, oss.str());
CAF_LOGMF(CAF_ERROR, oss.str());
throw logic_error(oss.str());
}
......@@ -48,7 +48,7 @@ void opencl_metainfo::initialize() {
if (err != CL_SUCCESS) {
ostringstream oss;
oss << "clGetPlatformIDs (getting platform ids): " << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, oss.str());
CAF_LOGMF(CAF_ERROR, oss.str());
throw logic_error(oss.str());
}
......@@ -58,7 +58,7 @@ void opencl_metainfo::initialize() {
cl_device_type dev_type{CL_DEVICE_TYPE_GPU};
err = clGetDeviceIDs(ids[pid], dev_type, 0, nullptr, &num_devices);
if (err == CL_DEVICE_NOT_FOUND) {
CPPA_LOG_TRACE("No gpu devices found. Looking for cpu devices.");
CAF_LOG_TRACE("No gpu devices found. Looking for cpu devices.");
cout << "No gpu devices found. Looking for cpu devices." << endl;
dev_type = CL_DEVICE_TYPE_CPU;
err = clGetDeviceIDs(ids[pid], dev_type, 0, nullptr, &num_devices);
......@@ -66,7 +66,7 @@ void opencl_metainfo::initialize() {
if (err != CL_SUCCESS) {
ostringstream oss;
oss << "clGetDeviceIDs: " << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, oss.str());
CAF_LOGMF(CAF_ERROR, oss.str());
throw runtime_error(oss.str());
}
vector<cl_device_id> devices(num_devices);
......@@ -75,15 +75,15 @@ void opencl_metainfo::initialize() {
if (err != CL_SUCCESS) {
ostringstream oss;
oss << "clGetDeviceIDs: " << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, oss.str());
CAF_LOGMF(CAF_ERROR, oss.str());
throw runtime_error(oss.str());
}
auto pfn_notify = [](const char* errinfo, const void*, size_t, void*) {
CPPA_LOGC_ERROR("cppa::opencl::opencl_metainfo", "initialize",
"\n##### Error message via pfn_notify #####\n" +
string(errinfo) +
"\n########################################");
CAF_LOGC_ERROR("caf::opencl::opencl_metainfo", "initialize",
"\n##### Error message via pfn_notify #####\n" +
string(errinfo) +
"\n########################################");
};
// create a context
......@@ -92,12 +92,12 @@ void opencl_metainfo::initialize() {
if (err != CL_SUCCESS) {
ostringstream oss;
oss << "clCreateContext: " << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, oss.str());
CAF_LOGMF(CAF_ERROR, oss.str());
throw runtime_error(oss.str());
}
for (auto& d : devices) {
CPPA_LOG_TRACE("Creating command queue for device(s).");
CAF_LOG_TRACE("Creating command queue for device(s).");
device_ptr device;
device.adopt(d);
size_t return_size{0};
......@@ -106,7 +106,7 @@ void opencl_metainfo::initialize() {
err = clGetDeviceInfo(device.get(), CL_DEVICE_NAME, buf_size, buf,
&return_size);
if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_ERROR,
CAF_LOGMF(CAF_ERROR,
"clGetDeviceInfo (CL_DEVICE_NAME): " << get_opencl_error(err));
fill(buf, buf + buf_size, 0);
}
......@@ -114,7 +114,7 @@ void opencl_metainfo::initialize() {
cmd_queue.adopt(clCreateCommandQueue(m_context.get(), device.get(),
CL_QUEUE_PROFILING_ENABLE, &err));
if (err != CL_SUCCESS) {
CPPA_LOGMF(CPPA_DEBUG, "Could not create command queue for device "
CAF_LOGMF(CAF_DEBUG, "Could not create command queue for device "
<< buf << ": " << get_opencl_error(err));
} else {
size_t max_work_group_size{0};
......@@ -124,7 +124,7 @@ void opencl_metainfo::initialize() {
ostringstream oss;
oss << "clGetDeviceInfo ("
<< "CL_DEVICE_MAX_WORK_GROUP_SIZE): " << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, oss.str());
CAF_LOGMF(CAF_ERROR, oss.str());
throw runtime_error(oss.str());
}
cl_uint max_work_item_dimensions = 0;
......@@ -135,7 +135,7 @@ void opencl_metainfo::initialize() {
ostringstream oss;
oss << "clGetDeviceInfo ("
<< "CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS): " << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, oss.str());
CAF_LOGMF(CAF_ERROR, oss.str());
throw runtime_error(oss.str());
}
dim_vec max_work_items_per_dim(max_work_item_dimensions);
......@@ -146,7 +146,7 @@ void opencl_metainfo::initialize() {
ostringstream oss;
oss << "clGetDeviceInfo ("
<< "CL_DEVICE_MAX_WORK_ITEM_SIZES): " << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, oss.str());
CAF_LOGMF(CAF_ERROR, oss.str());
throw runtime_error(oss.str());
}
device_info dev_info{device, cmd_queue, max_work_group_size,
......@@ -159,7 +159,7 @@ void opencl_metainfo::initialize() {
ostringstream oss;
oss << "Could not create a command queue for "
<< "any present device.";
CPPA_LOGMF(CPPA_ERROR, oss.str());
CAF_LOGMF(CAF_ERROR, oss.str());
throw runtime_error(oss.str());
}
}
......
......@@ -48,7 +48,7 @@ program program::create(const char* kernel_source, const char* options,
oss << "Device id " << device_id
<< " is not a vaild device. Maximum id is: " << (devices.size() - 1)
<< ".";
CPPA_LOGM_ERROR(detail::demangle<program>().c_str(), oss.str());
CAF_LOGM_ERROR(detail::demangle<program>().c_str(), oss.str());
throw runtime_error(oss.str());
}
......@@ -89,7 +89,7 @@ program program::create(const char* kernel_source, const char* options,
sizeof(buffer[0]) * buildlog_buffer_size,
buffer.data(), nullptr);
CPPA_LOGC_ERROR("cppa::opencl::program", "create",
CAF_LOGC_ERROR("caf::opencl::program", "create",
"Build log:\n" + string(buffer.data()) +
"\n########################################");
}
......
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