Commit 53017b58 authored by Vladislav Perepelkin's avatar Vladislav Perepelkin
Browse files

Merge branch 'refactor_mzykin' into 'master'

Refactor mzykin

See merge request luna/lo3!13
parents f70ebd2d fe7bc65e
......@@ -24,7 +24,7 @@ CXX_WARN ?= \
-Wall -Werror -Wpedantic -Wno-vla -Wno-sign-compare \
-Wno-unused-but-set-variable -Wno-unused-variable \
-Wno-unused-function
PYTHON ?= python
PYTHON ?= python2
MPICXX ?= mpicxx
MPICH_CXX?=${CXX}
CXX_FLAGS += \
......
......@@ -16,7 +16,7 @@
#include "serializable.h"
class CF;
typedef std::shared_ptr<CF> CFPtr;
using CFPtr = std::shared_ptr<CF>;
class CF : public Serializable
{
......
......@@ -5,7 +5,7 @@
class Comm
{
public:
typedef std::function<void (int, int, void *, size_t)> MsgHandler;
using MsgHandler = std::function<void (int, int, void *, size_t)> ;
virtual ~Comm() {}
......@@ -16,7 +16,7 @@ public:
void send_copy(int dest, int tag, const void *buf, size_t size);
template <class T>
template <typename T>
void send(int dest, int tag, const T &val)
{
send_copy(dest, tag, &val, sizeof(T));
......@@ -32,7 +32,7 @@ public:
virtual int next_rank() const;
virtual bool is_root() const;
virtual bool is_root() const noexcept;
virtual void barrier()=0;
......
......@@ -3,7 +3,7 @@
#include <string>
#include <vector>
const unsigned int
constexpr unsigned int
DEFAULT_WORKER_THREADS_COUNT=4,
DEFAULT_COMM_REQUEST_THREADS_COUNT=1,
DEFAULT_COMM_RECEIVE_THREADS_COUNT=1;
......@@ -22,8 +22,7 @@ public:
Config(int argc, char **argv);
RunMode get_run_mode() const;
RunMode get_run_mode() const noexcept ;
const std::string &argv(unsigned int) const;
const std::string &get_fp_path() const;
......@@ -31,9 +30,9 @@ public:
std::string get_help() const;
std::string get_version() const;
unsigned int get_worker_threads_count() const;
unsigned int get_comm_request_threads_count() const;
unsigned int get_comm_recv_threads_count() const;
unsigned int get_worker_threads_count() const noexcept;
unsigned int get_comm_request_threads_count() const noexcept;
unsigned int get_comm_recv_threads_count() const noexcept;
private:
std::string program_name_;
RunMode mode_;
......
......@@ -10,5 +10,5 @@ public:
CyclicLocator(int pos);
virtual int get_next_rank(Comm &) const;
virtual int get_next_rank(Comm &) const noexcept;
};
......@@ -54,8 +54,8 @@ public:
DF operator>=(const DF &) const;
DF operator>(const DF &) const;
bool is_set() const;
bool is_unset() const;
bool is_set() const noexcept;
bool is_unset() const noexcept;
ValueType get_type() const { return type_; }
......
......@@ -11,7 +11,7 @@ class CF;
class FP
{
public:
~FP() noexcept(false);
~FP() noexcept (false);
FP(const std::string &path);
Block operator[](unsigned int block_idx) const;
......
......@@ -19,7 +19,7 @@ public:
std::string to_string() const;
virtual size_t get_serialization_size() const;
virtual size_t get_serialization_size() const noexcept;
virtual size_t serialize(void *buf, size_t buf_size) const;
virtual size_t deserialize(const void *buf, size_t buf_size);
......
......@@ -34,4 +34,4 @@ int Comm::next_rank() const
return (rank()+1)%size();
}
bool Comm::is_root() const { return rank()==0; }
bool Comm::is_root() const noexcept { return rank()==0; }
......@@ -3,8 +3,10 @@
#include <sys/time.h>
#include <time.h>
static struct timespec t_;
static struct timespec tt_;
namespace {
struct timespec t_;
struct timespec tt_;
}
int mpi_rank;
std::string logfilename;
......
......@@ -43,7 +43,7 @@ Config::Config(int argc, char **argv)
}
}
Config::RunMode Config::get_run_mode() const { return mode_; }
Config::RunMode Config::get_run_mode() const noexcept { return mode_; }
const std::string &Config::argv(unsigned int idx) const
{
......@@ -87,17 +87,17 @@ std::string Config::get_version() const
return os.str();
}
unsigned int Config::get_worker_threads_count() const
unsigned int Config::get_worker_threads_count() const noexcept
{
return DEFAULT_WORKER_THREADS_COUNT;
}
unsigned int Config::get_comm_request_threads_count() const
unsigned int Config::get_comm_request_threads_count() const noexcept
{
return DEFAULT_COMM_REQUEST_THREADS_COUNT;
}
unsigned int Config::get_comm_recv_threads_count() const
unsigned int Config::get_comm_recv_threads_count() const noexcept
{
return DEFAULT_COMM_RECEIVE_THREADS_COUNT;
}
......@@ -7,7 +7,7 @@ CyclicLocator::CyclicLocator(int pos)
{
}
int CyclicLocator::get_next_rank(Comm &comm) const
int CyclicLocator::get_next_rank(Comm &comm) const noexcept
{
if (pos_>=0) {
return pos_%comm.size();
......
......@@ -4,7 +4,7 @@
#include <iomanip>
#include <sstream>
std::vector<std::string> _STR_VT={
const std::vector<std::string> _STR_VT={
"(unset)", "int", "real", "string", "value", "name"
};
......@@ -155,8 +155,8 @@ DEFINE_DF_OPERATOR(>=)
#undef DEFINE_DF_OPERATOR
bool DF::is_set() const { return type_!=TYPE_UNDEFINED; }
bool DF::is_unset() const { return !is_set(); }
bool DF::is_set() const noexcept { return type_!=TYPE_UNDEFINED; }
bool DF::is_unset() const noexcept { return !is_set(); }
int DF::get_int() const
{
......
......@@ -43,27 +43,23 @@ std::string Id::to_string() const
std::ostringstream os;
os << "ID<";
for (auto i=0u; i<idx_.size(); i++) {
if (i>0) {
os << ", ";
}
os << idx_[i];
os << idx_[0];
for (auto i = 1u; i<idx_.size(); i++) {
os << ", " << idx_[i];
}
os << ">";
return os.str();
}
size_t Id::get_serialization_size() const
size_t Id::get_serialization_size() const noexcept
{
return sizeof(size_t)+idx_.size()*sizeof(int);
}
size_t Id::serialize(void *buf, size_t buf_size) const
{
size_t orig_buf_size=buf_size;
auto orig_buf_size=buf_size;
assert(buf_size>=get_serialization_size());
put<size_t>(buf, buf_size, idx_.size());
......
......@@ -24,7 +24,6 @@ void init_mpi(int &argc, char **&argv)
void ctrl_c_handler(int sig_num)
{
printf("%s\n", rts->get_status().c_str());
ABORT("Ctrl-C detected");
}
......
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