Commit a31c0fc8 authored by Dominik Charousset's avatar Dominik Charousset

Apply clang-tidy to codebase

parent 219313d1
......@@ -127,14 +127,13 @@ public:
std::move(map_args),
std::move(map_result),
std::forward_as_tuple(xs...));
} else {
return make_actor<actor_facade, actor>(sys.next_actor_id(), sys.node(),
&sys, std::move(actor_cfg),
prog, itr->second, spawn_cfg,
std::move(map_args),
std::move(map_result),
std::forward_as_tuple(xs...));
}
return make_actor<actor_facade, actor>(sys.next_actor_id(), sys.node(),
&sys, std::move(actor_cfg),
prog, itr->second, spawn_cfg,
std::move(map_args),
std::move(map_result),
std::forward_as_tuple(xs...));
}
void enqueue(strong_actor_ptr sender, message_id mid, message content,
......@@ -176,18 +175,18 @@ public:
actor_facade(actor_config actor_cfg,
const program& prog, kernel_ptr kernel,
const spawn_config& spawn_cfg,
spawn_config spawn_cfg,
input_mapping map_args, output_mapping map_result,
std::tuple<Ts...> xs)
: monitorable_actor(actor_cfg),
kernel_(kernel),
kernel_(std::move(kernel)),
program_(prog.program_),
context_(prog.context_),
queue_(prog.queue_),
spawn_cfg_(spawn_cfg),
spawn_cfg_(std::move(spawn_cfg)),
map_args_(std::move(map_args)),
map_results_(std::move(map_result)),
argument_types_(xs) {
argument_types_(std::move(xs)) {
CAF_LOG_TRACE(CAF_ARG(this->id()));
default_output_size_ = std::accumulate(spawn_cfg_.dimensions().begin(),
spawn_cfg_.dimensions().end(),
......
......@@ -53,7 +53,7 @@ struct in_out {
template <class Arg>
struct out {
out() { }
out() = default;
template <class F>
out(F fun) {
fun_ = [fun](message& msg) -> optional<size_t> {
......
......@@ -49,17 +49,17 @@ public:
std::vector<cl_event> events, std::vector<mem_ptr> input_buffers,
std::vector<mem_ptr> output_buffers, std::vector<size_t> result_sizes,
message msg)
: result_sizes_(result_sizes),
handle_(handle),
actor_facade_(actor_facade),
: result_sizes_(std::move(result_sizes)),
handle_(std::move(handle)),
actor_facade_(std::move(actor_facade)),
mem_in_events_(std::move(events)),
input_buffers_(std::move(input_buffers)),
output_buffers_(std::move(output_buffers)),
msg_(msg) {
msg_(std::move(msg)) {
// nop
}
~command() {
~command() override {
for (auto& e : mem_in_events_) {
v1callcl(CAF_CLF(clReleaseEvent),e);
}
......@@ -95,7 +95,7 @@ public:
clReleaseEvent(event_k);
this->deref();
return;
} else {
}
enqueue_read_buffers(event_k, detail::get_indices(result_buffers_));
cl_event marker;
#if defined(__APPLE__)
......@@ -134,7 +134,7 @@ public:
}
mem_out_events_.push_back(std::move(event_k));
mem_out_events_.push_back(std::move(marker));
}
}
private:
......
......@@ -37,7 +37,8 @@ public:
friend class manager;
/// Intialize a new device in a context using a sepcific device_id
static device create(context_ptr context, device_ptr device_id, unsigned id);
static device create(const context_ptr& context, const device_ptr& device_id,
unsigned id);
/// Get the id assigned by caf
inline unsigned get_id() const;
/// Returns device info on CL_DEVICE_ADDRESS_BITS
......@@ -94,9 +95,16 @@ public:
private:
device(device_ptr device_id, command_queue_ptr queue, context_ptr context,
unsigned id);
template <class T>
static T info(device_ptr device_id, unsigned info_flag);
static std::string info_string(device_ptr device_id, unsigned info_flag);
static T info(const device_ptr& device_id, unsigned info_flag) {
T value;
clGetDeviceInfo(device_id.get(), info_flag, sizeof(T), &value, nullptr);
return value;
}
static std::string info_string(const device_ptr& device_id,
unsigned info_flag);
device_ptr device_id_;
command_queue_ptr command_queue_;
context_ptr context_;
......
......@@ -49,7 +49,7 @@ public:
manager(const manager&) = delete;
manager& operator=(const manager&) = delete;
/// Get the device with id, which is assigned sequientally.
const optional<const device&> get_device(size_t id = 0) const;
const optional<const device&> get_device(size_t dev_id = 0) const;
/// Get the first device that satisfies the predicate.
/// The predicate should accept a `const device&` and return a bool;
template <class UnaryPredicate>
......@@ -166,7 +166,7 @@ public:
protected:
manager(actor_system& sys);
~manager();
~manager() override;
private:
actor_system& system_;
......
......@@ -98,7 +98,7 @@ public:
iota(data_.begin(), data_.end(), 0);
}
typedef typename fvec::const_iterator const_iterator;
using const_iterator = typename fvec::const_iterator;
const_iterator begin() const { return data_.begin(); }
......
......@@ -18,6 +18,7 @@
******************************************************************************/
#include <iostream>
#include <utility>
#include "caf/logger.hpp"
#include "caf/string_algorithms.hpp"
......@@ -31,12 +32,13 @@ using namespace std;
namespace caf {
namespace opencl {
device device::create(context_ptr context, device_ptr device_id, unsigned id) {
device device::create(const context_ptr& context, const device_ptr& device_id,
unsigned id) {
CAF_LOG_DEBUG("creating device for opencl device with id:" << CAF_ARG(id));
// look up properties we need to create the command queue
auto supported = info<cl_ulong>(device_id, CL_DEVICE_QUEUE_PROPERTIES);
bool profiling = supported & CL_QUEUE_PROFILING_ENABLE;
bool out_of_order = supported & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
bool profiling = (supported & CL_QUEUE_PROFILING_ENABLE) != 0u;
bool out_of_order = (supported & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) != 0u;
unsigned properties = profiling ? CL_QUEUE_PROFILING_ENABLE : 0;
properties |= out_of_order ? CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE : 0;
// create the command queue
......@@ -94,14 +96,7 @@ device device::create(context_ptr context, device_ptr device_id, unsigned id) {
return dev;
}
template <class T>
T device::info(device_ptr device_id, unsigned info_flag) {
T value;
clGetDeviceInfo(device_id.get(), info_flag, sizeof(T), &value, nullptr);
return value;
}
string device::info_string(device_ptr device_id, unsigned info_flag) {
string device::info_string(const device_ptr& device_id, unsigned info_flag) {
size_t size;
clGetDeviceInfo(device_id.get(), info_flag, 0, nullptr, &size);
vector<char> buffer(size);
......@@ -112,9 +107,9 @@ string device::info_string(device_ptr device_id, unsigned info_flag) {
device::device(device_ptr device_id, command_queue_ptr queue,
context_ptr context, unsigned id)
: device_id_(device_id),
command_queue_(queue),
context_(context),
: device_id_(std::move(device_id)),
command_queue_(std::move(queue)),
context_(std::move(context)),
id_(id) { }
} // namespace opencl
......
......@@ -17,6 +17,7 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include <utility>
#include <vector>
#include <iostream>
......@@ -90,7 +91,7 @@ platform::platform(cl_platform_id platform_id, context_ptr context,
string name, string vendor, string version,
vector<device> devices)
: platform_id_(platform_id),
context_(context),
context_(std::move(context)),
name_(move(name)),
vendor_(move(vendor)),
version_(move(version)),
......
......@@ -140,7 +140,7 @@ public:
return data_[column + row * Size];
}
typedef typename ivec::const_iterator const_iterator;
using const_iterator = typename ivec::const_iterator;
const_iterator begin() const {
return data_.begin();
......
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