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