Commit 7d19ec4f authored by Matthieu Dorier's avatar Matthieu Dorier
Browse files

put some consistencies in tabs/spaces

parent b3564f76
...@@ -31,7 +31,6 @@ private: ...@@ -31,7 +31,6 @@ private:
margo_request m_request; margo_request m_request;
engine* m_engine; engine* m_engine;
hg_handle_t m_handle; hg_handle_t m_handle;
buffer m_buffer;
bool m_ignore_response; bool m_ignore_response;
/** /**
...@@ -64,7 +63,6 @@ public: ...@@ -64,7 +63,6 @@ public:
: m_request(other.m_request) : m_request(other.m_request)
, m_engine(other.m_engine) , m_engine(other.m_engine)
, m_handle(other.m_handle) , m_handle(other.m_handle)
, m_buffer(std::move(other.m_buffer))
, m_ignore_response(other.m_ignore_response) { , m_ignore_response(other.m_ignore_response) {
other.m_request = MARGO_REQUEST_NULL; other.m_request = MARGO_REQUEST_NULL;
other.m_engine = nullptr; other.m_engine = nullptr;
......
...@@ -40,10 +40,10 @@ class barrier_exception : public exception { ...@@ -40,10 +40,10 @@ class barrier_exception : public exception {
* @brief Wrapper for Argobots' ABT_barrier. * @brief Wrapper for Argobots' ABT_barrier.
*/ */
class barrier { class barrier {
ABT_barrier m_barrier;
public: ABT_barrier m_barrier;
public:
/** /**
* @brief Native handle type (ABT_barrier) * @brief Native handle type (ABT_barrier)
......
...@@ -31,7 +31,7 @@ class bulk { ...@@ -31,7 +31,7 @@ class bulk {
private: private:
engine* m_engine; engine* m_engine;
hg_bulk_t m_bulk; hg_bulk_t m_bulk;
bool m_is_local; bool m_is_local;
bool m_eager_mode; bool m_eager_mode;
...@@ -45,8 +45,8 @@ private: ...@@ -45,8 +45,8 @@ private:
* @param local Whether the bulk handle referes to memory that is * @param local Whether the bulk handle referes to memory that is
* local to this process. * local to this process.
*/ */
bulk(engine& e, hg_bulk_t b, bool local) bulk(engine& e, hg_bulk_t b, bool local)
: m_engine(&e), m_bulk(b), m_is_local(local), m_eager_mode(false) {} : m_engine(&e), m_bulk(b), m_is_local(local), m_eager_mode(false) {}
/** /**
* @brief The bulk_segment class represents a portion * @brief The bulk_segment class represents a portion
...@@ -141,7 +141,7 @@ public: ...@@ -141,7 +141,7 @@ public:
/** /**
* @brief Copy constructor. * @brief Copy constructor.
*/ */
bulk(const bulk& other) bulk(const bulk& other)
: m_engine(other.m_engine), m_bulk(other.m_bulk), : m_engine(other.m_engine), m_bulk(other.m_bulk),
m_is_local(other.m_is_local), m_eager_mode(other.m_eager_mode) { m_is_local(other.m_is_local), m_eager_mode(other.m_eager_mode) {
if(other.m_bulk != HG_BULK_NULL) { if(other.m_bulk != HG_BULK_NULL) {
...@@ -153,17 +153,17 @@ public: ...@@ -153,17 +153,17 @@ public:
/** /**
* @brief Move constructor. * @brief Move constructor.
*/ */
bulk(bulk&& other) bulk(bulk&& other)
: m_engine(other.m_engine), m_bulk(other.m_bulk), : m_engine(other.m_engine), m_bulk(other.m_bulk),
m_is_local(other.m_is_local), m_is_local(other.m_is_local),
m_eager_mode(other.m_eager_mode) { m_eager_mode(other.m_eager_mode) {
other.m_bulk = HG_BULK_NULL; other.m_bulk = HG_BULK_NULL;
} }
/** /**
* @brief Copy-assignment operator. * @brief Copy-assignment operator.
*/ */
bulk& operator=(const bulk& other) { bulk& operator=(const bulk& other) {
if(this == &other) return *this; if(this == &other) return *this;
if(m_bulk != HG_BULK_NULL) { if(m_bulk != HG_BULK_NULL) {
hg_return_t ret = margo_bulk_free(m_bulk); hg_return_t ret = margo_bulk_free(m_bulk);
...@@ -183,7 +183,7 @@ public: ...@@ -183,7 +183,7 @@ public:
/** /**
* @brief Move-assignment operator. * @brief Move-assignment operator.
*/ */
bulk& operator=(bulk&& other) { bulk& operator=(bulk&& other) {
if(this == &other) return *this; if(this == &other) return *this;
if(m_bulk != HG_BULK_NULL) { if(m_bulk != HG_BULK_NULL) {
hg_return_t ret = margo_bulk_free(m_bulk); hg_return_t ret = margo_bulk_free(m_bulk);
...@@ -196,11 +196,11 @@ public: ...@@ -196,11 +196,11 @@ public:
other.m_bulk = HG_BULK_NULL; other.m_bulk = HG_BULK_NULL;
return *this; return *this;
} }
/** /**
* @brief Destructor. * @brief Destructor.
*/ */
~bulk() { ~bulk() {
if(m_bulk != HG_BULK_NULL) { if(m_bulk != HG_BULK_NULL) {
hg_return_t ret = margo_bulk_free(m_bulk); hg_return_t ret = margo_bulk_free(m_bulk);
MARGO_ASSERT_TERMINATE(ret, margo_bulk_free, -1); MARGO_ASSERT_TERMINATE(ret, margo_bulk_free, -1);
......
...@@ -32,12 +32,12 @@ class endpoint; ...@@ -32,12 +32,12 @@ class endpoint;
*/ */
class callable_remote_procedure { class callable_remote_procedure {
friend class remote_procedure; friend class remote_procedure;
friend class async_response; friend class async_response;
private: private:
engine* m_engine; engine* m_engine;
hg_handle_t m_handle; hg_handle_t m_handle;
bool m_ignore_response; bool m_ignore_response;
uint16_t m_provider_id; uint16_t m_provider_id;
...@@ -50,7 +50,7 @@ private: ...@@ -50,7 +50,7 @@ private:
* @param ep endpoint on which to call the RPC. * @param ep endpoint on which to call the RPC.
* @param ignore_resp whether the response should be ignored. * @param ignore_resp whether the response should be ignored.
*/ */
callable_remote_procedure(engine& e, hg_id_t id, const endpoint& ep, callable_remote_procedure(engine& e, hg_id_t id, const endpoint& ep,
bool ignore_resp, uint16_t provider_id=0); bool ignore_resp, uint16_t provider_id=0);
/** /**
...@@ -73,7 +73,7 @@ private: ...@@ -73,7 +73,7 @@ private:
ret = margo_free_output(m_handle, &output); // won't do anything on a buffer type ret = margo_free_output(m_handle, &output); // won't do anything on a buffer type
MARGO_ASSERT(ret, margo_free_output); MARGO_ASSERT(ret, margo_free_output);
return packed_response(std::move(output), *m_engine); return packed_response(std::move(output), *m_engine);
} }
/** /**
* @brief Sends the RPC to the endpoint (calls margo_iforward), passing a buffer * @brief Sends the RPC to the endpoint (calls margo_iforward), passing a buffer
...@@ -97,63 +97,63 @@ public: ...@@ -97,63 +97,63 @@ public:
/** /**
* @brief Copy-constructor. * @brief Copy-constructor.
*/ */
callable_remote_procedure(const callable_remote_procedure& other) { callable_remote_procedure(const callable_remote_procedure& other) {
hg_return_t ret; hg_return_t ret;
m_handle = other.m_handle; m_handle = other.m_handle;
if(m_handle != HG_HANDLE_NULL) { if(m_handle != HG_HANDLE_NULL) {
ret = margo_ref_incr(m_handle); ret = margo_ref_incr(m_handle);
MARGO_ASSERT(ret, margo_ref_incr); MARGO_ASSERT(ret, margo_ref_incr);
} }
} }
/** /**
* @brief Move-constructor. * @brief Move-constructor.
*/ */
callable_remote_procedure(callable_remote_procedure&& other) { callable_remote_procedure(callable_remote_procedure&& other) {
m_handle = other.m_handle; m_handle = other.m_handle;
other.m_handle = HG_HANDLE_NULL; other.m_handle = HG_HANDLE_NULL;
} }
/** /**
* @brief Copy-assignment operator. * @brief Copy-assignment operator.
*/ */
callable_remote_procedure& operator=(const callable_remote_procedure& other) { callable_remote_procedure& operator=(const callable_remote_procedure& other) {
hg_return_t ret; hg_return_t ret;
if(&other == this) return *this; if(&other == this) return *this;
if(m_handle != HG_HANDLE_NULL) { if(m_handle != HG_HANDLE_NULL) {
ret = margo_destroy(m_handle); ret = margo_destroy(m_handle);
MARGO_ASSERT(ret, margo_destroy); MARGO_ASSERT(ret, margo_destroy);
} }
m_handle = other.m_handle; m_handle = other.m_handle;
ret = margo_ref_incr(m_handle); ret = margo_ref_incr(m_handle);
MARGO_ASSERT(ret, margo_ref_incr); MARGO_ASSERT(ret, margo_ref_incr);
return *this; return *this;
} }
/** /**
* @brief Move-assignment operator. * @brief Move-assignment operator.
*/ */
callable_remote_procedure& operator=(callable_remote_procedure&& other) { callable_remote_procedure& operator=(callable_remote_procedure&& other) {
if(&other == this) return *this; if(&other == this) return *this;
if(m_handle != HG_HANDLE_NULL) { if(m_handle != HG_HANDLE_NULL) {
hg_return_t ret = margo_destroy(m_handle); hg_return_t ret = margo_destroy(m_handle);
MARGO_ASSERT(ret, margo_destroy); MARGO_ASSERT(ret, margo_destroy);
} }
m_handle = other.m_handle; m_handle = other.m_handle;
other.m_handle = HG_HANDLE_NULL; other.m_handle = HG_HANDLE_NULL;
return *this; return *this;
} }
/** /**
* @brief Destructor. * @brief Destructor.
*/ */
~callable_remote_procedure() { ~callable_remote_procedure() {
if(m_handle != HG_HANDLE_NULL) { if(m_handle != HG_HANDLE_NULL) {
hg_return_t ret = margo_destroy(m_handle); hg_return_t ret = margo_destroy(m_handle);
MARGO_ASSERT_TERMINATE(ret, margo_destroy, -1); MARGO_ASSERT_TERMINATE(ret, margo_destroy, -1);
} }
} }
/** /**
* @brief Operator to call the RPC. Will serialize the arguments * @brief Operator to call the RPC. Will serialize the arguments
...@@ -164,13 +164,13 @@ public: ...@@ -164,13 +164,13 @@ public:
* *
* @return a packed_response object containing the returned value. * @return a packed_response object containing the returned value.
*/ */
template<typename ... T> template<typename ... T>
packed_response operator()(T&& ... t) const { packed_response operator()(T&& ... t) const {
buffer b; buffer b;
buffer_output_archive arch(b, *m_engine); buffer_output_archive arch(b, *m_engine);
serialize_many(arch, std::forward<T>(t)...); serialize_many(arch, std::forward<T>(t)...);
return forward(b); return forward(b);
} }
/** /**
* @brief Operator to call the RPC without any argument. * @brief Operator to call the RPC without any argument.
......
...@@ -41,10 +41,10 @@ class condition_variable_exception : public exception { ...@@ -41,10 +41,10 @@ class condition_variable_exception : public exception {
* @brief Wrapper for Argobots' ABT_cond. * @brief Wrapper for Argobots' ABT_cond.
*/ */
class condition_variable { class condition_variable {
ABT_cond m_cond;
public: ABT_cond m_cond;
public:
/** /**
* @brief Native handle type. * @brief Native handle type.
......
...@@ -30,15 +30,15 @@ class remote_bulk; ...@@ -30,15 +30,15 @@ class remote_bulk;
*/ */
class endpoint { class endpoint {
friend class engine; friend class engine;
friend class request; friend class request;
friend class callable_remote_procedure; friend class callable_remote_procedure;
friend class remote_bulk; friend class remote_bulk;
private: private:
engine* m_engine; engine* m_engine;
hg_addr_t m_addr; hg_addr_t m_addr;
public: public:
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
* @param e Engine that created the endpoint. * @param e Engine that created the endpoint.
* @param addr Mercury address. * @param addr Mercury address.
*/ */
endpoint(engine& e, hg_addr_t addr, bool take_ownership=true); endpoint(engine& e, hg_addr_t addr, bool take_ownership=true);
/** /**
* @brief Default constructor defined so that endpoints can * @brief Default constructor defined so that endpoints can
...@@ -61,37 +61,37 @@ public: ...@@ -61,37 +61,37 @@ public:
/** /**
* @brief Copy constructor. * @brief Copy constructor.
*/ */
endpoint(const endpoint& other); endpoint(const endpoint& other);
/** /**
* @brief Move constructor. * @brief Move constructor.
*/ */
endpoint(endpoint&& other) endpoint(endpoint&& other)
: m_engine(other.m_engine), m_addr(other.m_addr) { : m_engine(other.m_engine), m_addr(other.m_addr) {
other.m_addr = HG_ADDR_NULL; other.m_addr = HG_ADDR_NULL;
} }
/** /**
* @brief Copy-assignment operator. * @brief Copy-assignment operator.
*/ */
endpoint& operator=(const endpoint& other); endpoint& operator=(const endpoint& other);
/** /**
* @brief Move-assignment operator. * @brief Move-assignment operator.
*/ */
endpoint& operator=(endpoint&& other); endpoint& operator=(endpoint&& other);
/** /**
* @brief Destructor. * @brief Destructor.
*/ */
~endpoint(); ~endpoint();
/** /**
* @brief Creates a string representation of the endpoint's address. * @brief Creates a string representation of the endpoint's address.
* *
* @return A string representation of the endpoint's address. * @return A string representation of the endpoint's address.
*/ */
operator std::string() const; operator std::string() const;
/** /**
* @brief Indicates whether the endpoint is null or not. * @brief Indicates whether the endpoint is null or not.
......
...@@ -42,10 +42,10 @@ class engine { ...@@ -42,10 +42,10 @@ class engine {
friend class request; friend class request;
friend class bulk; friend class bulk;
friend class endpoint; friend class endpoint;
friend class remote_bulk; friend class remote_bulk;
friend class remote_procedure; friend class remote_procedure;
friend class callable_remote_procedure; friend class callable_remote_procedure;
template<typename T> template<typename T>
friend class provider; friend class provider;
...@@ -53,7 +53,7 @@ private: ...@@ -53,7 +53,7 @@ private:
using rpc_t = std::function<void(const request&, const buffer&)>; using rpc_t = std::function<void(const request&, const buffer&)>;
margo_instance_id m_mid; margo_instance_id m_mid;
std::unordered_map<hg_id_t, rpc_t> m_rpcs; std::unordered_map<hg_id_t, rpc_t> m_rpcs;
bool m_is_server; bool m_is_server;
bool m_owns_mid; bool m_owns_mid;
...@@ -88,27 +88,27 @@ private: ...@@ -88,27 +88,27 @@ private:
* @tparam disable_response whether the caller expects a response. * @tparam disable_response whether the caller expects a response.
* @param handle handle of the RPC. * @param handle handle of the RPC.
*/ */
template<typename F, bool disable_response> template<typename F, bool disable_response>
static void rpc_handler_ult(hg_handle_t handle) { static void rpc_handler_ult(hg_handle_t handle) {
using G = typename std::remove_reference<F>::type; using G = typename std::remove_reference<F>::type;
const struct hg_info* info = margo_get_info(handle); const struct hg_info* info = margo_get_info(handle);
THALLIUM_ASSERT_CONDITION(info != nullptr, "margo_get_info returned null"); THALLIUM_ASSERT_CONDITION(info != nullptr, "margo_get_info returned null");
margo_instance_id mid = margo_hg_handle_get_instance(handle); margo_instance_id mid = margo_hg_handle_get_instance(handle);
THALLIUM_ASSERT_CONDITION(mid != 0, "margo_hg_handle_get_instance returned null"); THALLIUM_ASSERT_CONDITION(mid != 0, "margo_hg_handle_get_instance returned null");
void* data = margo_registered_data(mid, info->id); void* data = margo_registered_data(mid, info->id);
THALLIUM_ASSERT_CONDITION(data != nullptr, "margo_registered_data returned null"); THALLIUM_ASSERT_CONDITION(data != nullptr, "margo_registered_data returned null");
auto cb_data = static_cast<rpc_callback_data*>(data); auto cb_data = static_cast<rpc_callback_data*>(data);
auto f = function_cast<G>(cb_data->m_function); auto f = function_cast<G>(cb_data->m_function);
request req(*(cb_data->m_engine), handle, disable_response); request req(*(cb_data->m_engine), handle, disable_response);
buffer input; buffer input;
hg_return_t ret; hg_return_t ret;
ret = margo_get_input(handle, &input); ret = margo_get_input(handle, &input);
MARGO_ASSERT(ret, margo_get_input); MARGO_ASSERT(ret, margo_get_input);
(*f)(req, input); (*f)(req, input);
ret = margo_free_input(handle, &input); ret = margo_free_input(handle, &input);
MARGO_ASSERT(ret, margo_free_input); MARGO_ASSERT(ret, margo_free_input);
margo_destroy(handle); // because of margo_ref_incr in rpc_callback margo_destroy(handle); // because of margo_ref_incr in rpc_callback
} }
/** /**
* @brief Callback called when an RPC is received. * @brief Callback called when an RPC is received.
...@@ -160,20 +160,20 @@ public: ...@@ -160,20 +160,20 @@ public:
* @param rpc_thread_count number of threads to use for servicing RPCs. * @param rpc_thread_count number of threads to use for servicing RPCs.
* Use -1 to indicate that RPCs should be serviced in the progress ES. * Use -1 to indicate that RPCs should be serviced in the progress ES.
*/ */
engine(const std::string& addr, int mode, engine(const std::string& addr, int mode,
bool use_progress_thread = false, bool use_progress_thread = false,
std::int32_t rpc_thread_count = 0) { std::int32_t rpc_thread_count = 0) {
m_is_server = (mode == THALLIUM_SERVER_MODE); m_is_server = (mode == THALLIUM_SERVER_MODE);
m_finalize_called = false; m_finalize_called = false;
m_mid = margo_init(addr.c_str(), mode, m_mid = margo_init(addr.c_str(), mode,
use_progress_thread ? 1 : 0, use_progress_thread ? 1 : 0,
rpc_thread_count); rpc_thread_count);
// XXX throw an exception if m_mid not initialized // XXX throw an exception if m_mid not initialized
m_owns_mid = true; m_owns_mid = true;
margo_push_finalize_callback(m_mid, margo_push_finalize_callback(m_mid,
&engine::on_finalize_cb, static_cast<void*>(this)); &engine::on_finalize_cb, static_cast<void*>(this));
} }
engine(const std::string& addr, int mode, engine(const std::string& addr, int mode,
const pool& progress_pool, const pool& progress_pool,
...@@ -222,28 +222,28 @@ public: ...@@ -222,28 +222,28 @@ public:
/** /**
* @brief Copy-constructor is deleted. * @brief Copy-constructor is deleted.
*/ */
engine(const engine& other) = delete; engine(const engine& other) = delete;
/** /**
* @brief Move-constructor is deleted. * @brief Move-constructor is deleted.
*/ */
engine(engine&& other) = delete; engine(engine&& other) = delete;