class ChordMessage {
public:
e_message_type_t type; // type of message
- std::string issuer_host_name; // used for logging
+ std::string issuer_host_name = simgrid::s4u::this_actor::get_host()->get_name(); // used for logging
int request_id = -1; // id (used by some types of messages)
int request_finger = 1; // finger parameter (used by some types of messages)
int answer_id = -1; // answer (used by some types of messages)
simgrid::s4u::Mailbox* answer_to = nullptr; // mailbox to send an answer to (if any)
- explicit ChordMessage(e_message_type_t type)
- : type(type), issuer_host_name(simgrid::s4u::this_actor::get_host()->get_name())
- {
- }
+ explicit ChordMessage(e_message_type_t type) : type(type) {}
static void destroy(void* message);
};
template<class T>
class Promise {
public:
- Promise() : state_(std::make_shared<FutureState<T>>()) {}
+ Promise() = default;
explicit Promise(std::shared_ptr<FutureState<T>> state) : state_(std::move(state)) {}
// Move type
Promise(Promise const&) = delete;
Promise& operator=(Promise const&) = delete;
- Promise(Promise&& that) :
- state_(std::move(that.state_)), future_get_(that.future_get_)
- {
- that.future_get_ = false;
- }
+ Promise(Promise&& that) : state_(std::move(that.state_)) { std::swap(future_get_, that.future_get_); }
Promise& operator=(Promise&& that)
{
}
private:
- std::shared_ptr<FutureState<T>> state_;
+ std::shared_ptr<FutureState<T>> state_{new FutureState<T>()};
bool future_get_ = false;
};
template<>
class Promise<void> {
public:
- Promise() : state_(std::make_shared<FutureState<void>>()) {}
+ Promise() = default;
explicit Promise(std::shared_ptr<FutureState<void>> state) : state_(std::move(state)) {}
~Promise()
{
// Move type
Promise(Promise const&) = delete;
Promise& operator=(Promise const&) = delete;
- Promise(Promise&& that) :
- state_(std::move(that.state_)), future_get_(that.future_get_)
- {
- that.future_get_ = false;
- }
+ Promise(Promise&& that) : state_(std::move(that.state_)) { std::swap(future_get_, that.future_get_); }
Promise& operator=(Promise&& that)
{
this->state_ = std::move(that.state_);
}
private:
- std::shared_ptr<FutureState<void>> state_;
+ std::shared_ptr<FutureState<void>> state_{new FutureState<void>()};
bool future_get_ = false;
};
class XBT_PUBLIC Barrier {
private:
- MutexPtr mutex_;
- ConditionVariablePtr cond_;
+ MutexPtr mutex_ = Mutex::create();
+ ConditionVariablePtr cond_ = ConditionVariable::create();
unsigned int expected_actors_;
unsigned int arrived_actors_ = 0;
public:
/** Creates a barrier for the given amount of actors */
- explicit Barrier(unsigned int count);
+ explicit Barrier(unsigned int expected_processes) : expected_actors_(expected_processes) {}
#ifndef DOXYGEN
~Barrier() = default;
Barrier(Barrier const&) = delete;
template<class T, class U>
class Extension {
- static const std::size_t INVALID_ID = std::numeric_limits<std::size_t>::max();
- std::size_t id_ = INVALID_ID;
+ static constexpr std::size_t INVALID_ID = std::numeric_limits<std::size_t>::max();
+ std::size_t id_ = INVALID_ID;
friend class Extendable<T>;
explicit constexpr Extension(std::size_t id) : id_(id) {}
public:
class Extendable {
private:
static std::vector<void(*)(void*)> deleters_;
- std::vector<void*> extensions_;
+ std::vector<void*> extensions_{(deleters_.size() > 0 ? deleters_.size() : 1), nullptr};
+
public:
static size_t extension_create(void (*deleter)(void*))
{
{
return Extension<T, U>(extension_create([](void* p) { delete static_cast<U*>(p); }));
}
- Extendable() : extensions_((deleters_.size() > 0 ? deleters_.size() : 1), nullptr) {}
+ Extendable() {}
Extendable(const Extendable&) = delete;
Extendable& operator=(const Extendable&) = delete;
~Extendable()
}
xbt_graph_t graph = xbt_graph_new_graph(0, nullptr);
- std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>;
- std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>;
+ std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>();
+ std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>();
netzone->get_impl()->get_graph(graph, nodes, edges);
for (auto elm : *edges) {
static void instr_on_platform_created()
{
currentContainer.clear();
- std::set<std::string>* filter = new std::set<std::string>;
+ std::set<std::string>* filter = new std::set<std::string>();
XBT_DEBUG("Starting graph extraction.");
recursiveGraphExtraction(simgrid::s4u::Engine::get_instance()->get_netzone_root(),
simgrid::instr::Container::get_root(), filter);
xbt_graph_t instr_routing_platform_graph()
{
xbt_graph_t ret = xbt_graph_new_graph(0, nullptr);
- std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>;
- std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>;
+ std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>();
+ std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>();
recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::get_instance()->get_netzone_root(),
simgrid::instr::Container::get_root());
delete nodes;
};
class Pt2PtTIData : public TIData {
- int tag;
+ int tag = 0;
+
public:
explicit Pt2PtTIData(const std::string& name, int endpoint, int size, int tag, const std::string& datatype)
: TIData(name, endpoint, size, datatype), tag(tag){};
explicit Pt2PtTIData(const std::string& name, int endpoint, int size, const std::string& datatype)
- : TIData(name, endpoint, size, datatype), tag(0){};
+ : TIData(name, endpoint, size, datatype){};
std::string print() override
{
std::stringstream stream;
namespace simgrid {
namespace jedule {
Subset::Subset(int start_idx, int end_idx, Container* parent)
-: start_idx(start_idx), parent(parent)
+ : start_idx(start_idx), nres(end_idx - start_idx + 1), parent(parent)
{
- nres=end_idx-start_idx+1;
}
Container::Container(const std::string& name) : name(name)
friend s4u::Mailbox* s4u::Mailbox::by_name(const std::string& name);
friend mc::CommunicationDeterminismChecker;
- explicit MailboxImpl(const std::string& name)
- : piface_(this), name_(name), comm_queue_(MAX_MAILBOX_SIZE), done_comm_queue_(MAX_MAILBOX_SIZE)
- {
- }
+ explicit MailboxImpl(const std::string& name) : piface_(this), name_(name) {}
public:
const xbt::string& get_name() const { return name_; }
const CommImplPtr& my_synchro, bool done, bool remove_matching);
actor::ActorImplPtr permanent_receiver_; // actor to which the mailbox is attached
- boost::circular_buffer_space_optimized<CommImplPtr> comm_queue_;
- boost::circular_buffer_space_optimized<CommImplPtr> done_comm_queue_; // messages already received in the permanent
- // receive mode
+ boost::circular_buffer_space_optimized<CommImplPtr> comm_queue_{MAX_MAILBOX_SIZE};
+ // messages already received in the permanent receive mode
+ boost::circular_buffer_space_optimized<CommImplPtr> done_comm_queue_{MAX_MAILBOX_SIZE};
};
} // namespace activity
} // namespace kernel
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/kernel/lmm/maxmin.hpp"
-#include "src/surf/surf_interface.hpp"
#include "xbt/backtrace.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_maxmin, surf, "Logging specific to SURF (maxmin)");
Constraint::Constraint(resource::Resource* id_value, double bound_value) : bound_(bound_value), id_(id_value)
{
rank_ = next_rank_++;
-
- remaining_ = 0.0;
- usage_ = 0.0;
- concurrency_limit_ = sg_concurrency_limit;
- concurrency_current_ = 0;
- concurrency_maximum_ = 0;
- sharing_policy_ = s4u::Link::SharingPolicy::SHARED;
-
- lambda_ = 0.0;
- new_lambda_ = 0.0;
- cnst_light_ = nullptr;
}
Constraint* System::constraint_new(resource::Resource* id, double bound_value)
#include "simgrid/kernel/resource/Action.hpp"
#include "simgrid/s4u/Link.hpp"
+#include "src/surf/surf_interface.hpp"
#include "xbt/asserts.h"
#include "xbt/mallocator.h"
boost::intrusive::list<Element, boost::intrusive::member_hook<Element, boost::intrusive::list_member_hook<>,
&Element::active_element_set_hook>>
active_element_set_;
- double remaining_;
- double usage_;
+ double remaining_ = 0.0;
+ double usage_ = 0.0;
double bound_;
// TODO MARTIN Check maximum value across resources at the end of simulation and give a warning is more than e.g. 500
- int concurrency_current_; /* The current concurrency */
- int concurrency_maximum_; /* The maximum number of (enabled and disabled) variables associated to the constraint at
- * any given time (essentially for tracing)*/
+ int concurrency_current_ = 0; /* The current concurrency */
+ int concurrency_maximum_ = 0; /* The maximum number of (enabled and disabled) variables associated to the constraint
+ * at any given time (essentially for tracing)*/
- s4u::Link::SharingPolicy sharing_policy_;
+ s4u::Link::SharingPolicy sharing_policy_ = s4u::Link::SharingPolicy::SHARED;
int rank_; // Only used in debug messages to identify the constraint
- double lambda_;
- double new_lambda_;
- ConstraintLight* cnst_light_;
+ double lambda_ = 0.0;
+ double new_lambda_ = 0.0;
+ ConstraintLight* cnst_light_ = nullptr;
private:
static int next_rank_; // To give a separate rank_ to each constraint
- int concurrency_limit_; /* The maximum number of variables that may be enabled at any time (stage variables if
- * necessary) */
+ int concurrency_limit_ = sg_concurrency_limit; /* The maximum number of variables that may be enabled at any time
+ * (stage variables if necessary) */
resource::Resource* id_;
};
* integers are not allowed.
*/
class ReadOptions {
- std::uint32_t value_;
+ std::uint32_t value_ = 0;
constexpr explicit ReadOptions(std::uint32_t value) : value_(value) {}
public:
- constexpr ReadOptions() : value_(0) {}
+ constexpr ReadOptions() {}
explicit constexpr operator bool() const { return value_ != 0; }
constexpr bool operator!() const { return value_ == 0; }
namespace simgrid {
namespace mc {
-ModelChecker::ModelChecker(std::unique_ptr<RemoteClient> process)
- : base_(nullptr)
- , socket_event_(nullptr)
- , signal_event_(nullptr)
- , page_store_(500)
- , process_(std::move(process))
-{
-}
+ModelChecker::ModelChecker(std::unique_ptr<RemoteClient> process) : process_(std::move(process)) {}
ModelChecker::~ModelChecker()
{
/** State of the model-checker (global variables for the model checker)
*/
class ModelChecker {
- struct event_base *base_;
- struct event* socket_event_;
- struct event* signal_event_;
+ struct event_base* base_ = nullptr;
+ struct event* socket_event_ = nullptr;
+ struct event* signal_event_ = nullptr;
/** String pool for host names */
// TODO, use std::set with heterogeneous comparison lookup (C++14)?
std::set<std::string> hostnames_;
// This is the parent snapshot of the current state:
- PageStore page_store_;
+ PageStore page_store_{500};
std::unique_ptr<RemoteClient> process_;
Checker* checker_ = nullptr;
public:
this->actors_count = mc_model_checker->process().actors().size();
this->system_state = std::make_shared<simgrid::mc::Snapshot>(state_number);
- this->original_num = -1;
}
void VisitedStates::prune()
std::size_t heap_bytes_used = 0;
int actors_count = 0;
int num = 0; // unique id of that state in the storage of all stored IDs
- int original_num = 0; // num field of the VisitedState to which I was declared equal to (used for dot_output)
+ int original_num = -1; // num field of the VisitedState to which I was declared equal to (used for dot_output)
explicit VisitedState(unsigned long state_number);
~VisitedState() = default;
* the process memory, etc. All those informations are gathered in
* the evaluation context.
*/
-class ExpressionContext {
-public:
- ExpressionContext()
- : cursor(nullptr)
- , frame_base(nullptr)
- , address_space(nullptr)
- , object_info(nullptr)
- {
- }
+struct ExpressionContext {
/** CPU state (registers) */
- unw_cursor_t* cursor;
- void* frame_base;
- /** Address space used to read memory */
- const simgrid::mc::AddressSpace* address_space;
- simgrid::mc::ObjectInformation* object_info;
+ unw_cursor_t* cursor = nullptr;
+ void* frame_base = nullptr;
+ const simgrid::mc::AddressSpace* address_space = nullptr; /** Address space used to read memory */
+ simgrid::mc::ObjectInformation* object_info = nullptr;
};
/** When an error happens in the execution of a DWARF expression */
private:
// Values of the stack (the top is stack_[size_ - 1]):
uintptr_t stack_[max_size]{0};
- size_t size_;
+ size_t size_ = 0;
public:
- ExpressionStack() : size_(0) {}
-
// Access:
std::size_t size() const { return size_; }
bool empty() const { return size_ == 0; }
/** Debug information about a given function or scope within a function */
class Frame {
public:
- Frame() = default;
-
/** Kind of scope (DW_TAG_subprogram, DW_TAG_inlined_subroutine, etc.) */
int tag = DW_TAG_invalid;
std::string name;
/** Range of instruction addresses for which this scope is valid */
- simgrid::xbt::Range<std::uint64_t> range = {0, 0};
+ simgrid::xbt::Range<std::uint64_t> range{0, 0};
simgrid::dwarf::LocationList frame_base_location;
*/
class Location {
private:
- void* memory_;
+ void* memory_ = nullptr;
int register_id_ = 0;
public:
explicit Location(void* x) : memory_(x) {}
- explicit Location(int register_id) : memory_(nullptr), register_id_(register_id) {}
+ explicit Location(int register_id) : register_id_(register_id) {}
// Type of location:
bool in_register() const { return memory_ == nullptr; }
bool in_memory() const { return memory_ != nullptr; }
State::State(unsigned long state_number) : num_(state_number)
{
this->internal_comm_.clear();
- this->internal_req_ = s_smx_simcall();
- this->executed_req_ = s_smx_simcall();
actor_states_.resize(MC_smx_get_maxpid());
/* Stateful model checking */
Channel(Channel&& that) : socket_(that.socket_) { that.socket_ = -1; }
Channel& operator=(Channel&& that)
{
- this->socket_ = that.socket_;
- that.socket_ = -1;
+ std::swap(this->socket_, that.socket_);
return *this;
}
* as a `uint64_t`.
*/
template <class T> class RemotePtr {
- std::uint64_t address_;
+ std::uint64_t address_ = 0;
public:
- RemotePtr() : address_(0) {}
- explicit RemotePtr(std::nullptr_t) : address_(0) {}
+ RemotePtr() = default;
+ explicit RemotePtr(std::nullptr_t) {}
explicit RemotePtr(std::uint64_t address) : address_(address) {}
explicit RemotePtr(T* address) : address_((std::uintptr_t)address) {}
explicit RemotePtr(Remote<T*> p) : address_((std::uintptr_t)*p.get_buffer()) {}
* @return Snapshot page numbers of this new snapshot
*/
ChunkedData::ChunkedData(PageStore& store, AddressSpace& as, RemotePtr<void> addr, std::size_t page_count)
+ : store_(&store)
{
- store_ = &store;
this->pagenos_.resize(page_count);
std::vector<char> buffer(xbt_pagesize);
for (std::size_t const& pageno : pagenos_)
store_->ref_page(pageno);
}
- ChunkedData(ChunkedData&& that) : store_(that.store_), pagenos_(std::move(that.pagenos_))
+ ChunkedData(ChunkedData&& that) : pagenos_(std::move(that.pagenos_))
{
- that.store_ = nullptr;
+ std::swap(store_, that.store_);
that.pagenos_.clear();
}
ChunkedData& operator=(ChunkedData const& that)
// ***** snapshot_page_manager
-PageStore::PageStore(std::size_t size) : memory_(nullptr), capacity_(size), top_index_(0)
+PageStore::PageStore(std::size_t size) : capacity_(size)
{
// Using mmap in order to be able to expand the region by relocating it somewhere else in the virtual memory space:
void* memory =
snapshot->process()->write_bytes(ignored_data.data.data(), ignored_data.data.size(), remote(ignored_data.start));
}
-Snapshot::Snapshot(int num_state, RemoteClient* process)
- : AddressSpace(process), num_state_(num_state), heap_bytes_used_(0), enabled_processes_(), hash_(0)
+Snapshot::Snapshot(int num_state, RemoteClient* process) : AddressSpace(process), num_state_(num_state)
{
XBT_DEBUG("Taking snapshot %i", num_state);
// To be private
int num_state_;
- std::size_t heap_bytes_used_;
+ std::size_t heap_bytes_used_ = 0;
std::vector<std::unique_ptr<Region>> snapshot_regions_;
std::set<pid_t> enabled_processes_;
std::vector<std::size_t> stack_sizes_;
class Governor {
simgrid::s4u::Host* const host_;
double sampling_rate_;
- int min_pstate; //< Never use a pstate less than this one
- int max_pstate; //< Never use a pstate larger than this one
+ int min_pstate = cfg_min_pstate; //< Never use a pstate less than this one
+ int max_pstate = cfg_max_pstate; //< Never use a pstate larger than this one
public:
explicit Governor(simgrid::s4u::Host* ptr)
: host_(ptr)
- , min_pstate(cfg_min_pstate)
- , max_pstate(cfg_max_pstate == max_pstate_not_limited ? host_->get_pstate_count() - 1 : cfg_max_pstate)
{
+ if (cfg_max_pstate == max_pstate_not_limited)
+ max_pstate = host_->get_pstate_count() - 1;
init();
}
virtual ~Governor() = default;
double watts_off_ = 0.0; /*< Consumption when the machine is turned off (shutdown) */
double total_energy_ = 0.0; /*< Total energy consumed by the host */
- double last_updated_; /*< Timestamp of the last energy update event*/
+ double last_updated_ = surf_get_clock(); /*< Timestamp of the last energy update event*/
};
simgrid::xbt::Extension<simgrid::s4u::Host, HostEnergy> HostEnergy::EXTENSION_ID;
this->pstate_ = host_->is_on() ? host_->get_pstate() : pstate_off_;
}
-HostEnergy::HostEnergy(simgrid::s4u::Host* ptr) : host_(ptr), last_updated_(surf_get_clock())
+HostEnergy::HostEnergy(simgrid::s4u::Host* ptr) : host_(ptr)
{
init_watts_range_list();
namespace simgrid {
namespace s4u {
-Barrier::Barrier(unsigned int expected_processes)
- : mutex_(Mutex::create()), cond_(ConditionVariable::create()), expected_actors_(expected_processes)
-{
-}
-
/** @brief Create a new barrier
*
* See @ref s4u_raii.
if (comp != computers.end()) {
computer = comp->second;
} else {
- computer = new std::vector<SD_task_t>;
+ computer = new std::vector<SD_task_t>();
computers.insert({char_performer, computer});
}
if (static_cast<unsigned int>(order) < computer->size()) {
int rank = simgrid::s4u::this_actor::get_pid();
int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
- std::vector<int>* trace_recvcounts = new std::vector<int>;
+ std::vector<int>* trace_recvcounts = new std::vector<int>();
if (comm->rank() == root) {
for (int i = 0; i < comm->size(); i++) // copy data to avoid bad free
trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
int rank = simgrid::s4u::this_actor::get_pid();
int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
- std::vector<int>* trace_recvcounts = new std::vector<int>;
+ std::vector<int>* trace_recvcounts = new std::vector<int>();
for (int i = 0; i < comm->size(); i++) { // copy data to avoid bad free
trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
}
int rank = simgrid::s4u::this_actor::get_pid();
int dt_size_send = sendtype->is_replayable() ? 1 : sendtype->size();
- std::vector<int>* trace_sendcounts = new std::vector<int>;
+ std::vector<int>* trace_sendcounts = new std::vector<int>();
if (comm->rank() == root) {
for (int i = 0; i < comm->size(); i++) { // copy data to avoid bad free
trace_sendcounts->push_back(sendcounts[i] * dt_size_send);
smpi_bench_end();
int rank = simgrid::s4u::this_actor::get_pid();
- std::vector<int>* trace_recvcounts = new std::vector<int>;
+ std::vector<int>* trace_recvcounts = new std::vector<int>();
int dt_send_size = datatype->is_replayable() ? 1 : datatype->size();
int totalcount = 0;
smpi_bench_end();
int send_size = 0;
int recv_size = 0;
- std::vector<int>* trace_sendcounts = new std::vector<int>;
- std::vector<int>* trace_recvcounts = new std::vector<int>;
+ std::vector<int>* trace_sendcounts = new std::vector<int>();
+ std::vector<int>* trace_recvcounts = new std::vector<int>();
int dt_size_recv = recvtype->size();
const int* real_sendcounts = sendcounts;
int send_size = 0;
int recv_size = 0;
- std::vector<int>* trace_sendcounts = new std::vector<int>;
- std::vector<int>* trace_recvcounts = new std::vector<int>;
+ std::vector<int>* trace_sendcounts = new std::vector<int>();
+ std::vector<int>* trace_recvcounts = new std::vector<int>();
const int* real_sendcounts = sendcounts;
const int* real_senddispls = senddispls;
int src_traced = getPid(comm, src);
// FIXME: Hack the way to trace this one
- std::vector<int>* dst_hack = new std::vector<int>;
- std::vector<int>* src_hack = new std::vector<int>;
+ std::vector<int>* dst_hack = new std::vector<int>();
+ std::vector<int>* src_hack = new std::vector<int>();
dst_hack->push_back(dst_traced);
src_hack->push_back(src_traced);
TRACE_smpi_comm_in(my_proc_id, __func__,
MPI_Group group_;
SMPI_Topo_type topoType_ = MPI_INVALID_TOPO;
MPI_Topology topo_; // to be replaced by an union
- int refcount_ = 1;
- MPI_Comm leaders_comm_; // inter-node communicator
- MPI_Comm intra_comm_; // intra-node communicator . For MPI_COMM_WORLD this can't be used, as var is global.
- // use an intracomm stored in the process data instead
- int* leaders_map_ = nullptr; // who is the leader of each process
+ int refcount_ = 1;
+ MPI_Comm leaders_comm_ = MPI_COMM_NULL; // inter-node communicator
+ MPI_Comm intra_comm_ = MPI_COMM_NULL; // intra-node communicator. For MPI_COMM_WORLD this can't be used, as var is
+ // global. Use an intracomm stored in the process data instead
+ int* leaders_map_ = nullptr; // who is the leader of each process
int is_uniform_ = 1;
int* non_uniform_map_ = nullptr; // set if smp nodes have a different number of processes allocated
int is_blocked_ = 0; // are ranks allocated on the same smp node contiguous ?
int is_smp_comm_; // set to 0 in case this is already an intra-comm or a leader-comm to avoid recursion
std::list<MPI_Win> rma_wins_; // attached windows for synchronization.
std::string name_;
- MPI_Info info_;
+ MPI_Info info_ = MPI_INFO_NULL;
int id_;
MPI_Errhandler errhandler_ = MPI_ERRORS_ARE_FATAL;
namespace smpi{
class Datatype : public F2C, public Keyval{
- char* name_;
+ char* name_ = nullptr;
/* The id here is the (unique) datatype id used for this datastructure.
* It's default value is set to -1 since some code expects this return value
* when no other id has been assigned
MPI_Aint lb_;
MPI_Aint ub_;
int flags_;
- int refcount_;
+ int refcount_ = 1;
public:
static std::unordered_map<int, smpi_key_elem> keyvals_;
// Beware of collisions if id in mpif.h is not unique
static std::unordered_map<std::string, F2C*>* f2c_lookup_;
static int f2c_id_;
- int my_f2c_id_;
+ int my_f2c_id_ = -1;
protected:
static std::unordered_map<std::string, F2C*>* f2c_lookup();
static char* get_key(char* key, int id);
static void delete_lookup();
static std::unordered_map<std::string, F2C*>* lookup();
- F2C() : my_f2c_id_(-1){}
virtual ~F2C() = default;
//Override these to handle specific values.
void* base_;
MPI_Aint size_;
int disp_unit_;
- int assert_;
+ int assert_ = 0;
MPI_Info info_;
MPI_Comm comm_;
std::vector<MPI_Request> *requests_;
Comm::Comm(MPI_Group group, MPI_Topology topo, int smp, int in_id) : group_(group), topo_(topo),is_smp_comm_(smp), id_(in_id)
{
- intra_comm_ = MPI_COMM_NULL;
- leaders_comm_ = MPI_COMM_NULL;
- info_ = MPI_INFO_NULL;
errhandler_->ref();
//First creation of comm is done before SIMIX_run, so only do comms for others
if(in_id==MPI_UNDEFINED && smp==0 && this->rank()!=MPI_UNDEFINED ){
{
id = std::to_string(ident);
}
-Datatype::Datatype(int size,MPI_Aint lb, MPI_Aint ub, int flags) : name_(nullptr), size_(size), lb_(lb), ub_(ub), flags_(flags), refcount_(1){
+
+Datatype::Datatype(int size, MPI_Aint lb, MPI_Aint ub, int flags) : size_(size), lb_(lb), ub_(ub), flags_(flags)
+{
#if SIMGRID_HAVE_MC
if(MC_is_active())
MC_ignore(&(refcount_), sizeof(refcount_));
#endif
}
-//for predefined types, so in_use = 0.
+// for predefined types, so refcount_ = 0.
Datatype::Datatype(char* name, int ident, int size, MPI_Aint lb, MPI_Aint ub, int flags)
: name_(name), id(std::to_string(ident)), size_(size), lb_(lb), ub_(ub), flags_(flags), refcount_(0)
{
#endif
}
-Datatype::Datatype(Datatype *datatype, int* ret) : name_(nullptr), size_(datatype->size_), lb_(datatype->lb_), ub_(datatype->ub_), flags_(datatype->flags_), refcount_(1)
+Datatype::Datatype(Datatype* datatype, int* ret)
+ : size_(datatype->size_), lb_(datatype->lb_), ub_(datatype->ub_), flags_(datatype->flags_)
{
flags_ &= ~DT_FLAG_PREDEFINED;
*ret = MPI_SUCCESS;
Type_Hindexed::Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths,
const MPI_Aint* block_indices, MPI_Datatype old_type)
- : Datatype(size, lb, ub, flags), block_count_(count), old_type_(old_type)
+ : Datatype(size, lb, ub, flags)
+ , block_count_(count)
+ , block_lengths_(new int[count])
+ , block_indices_(new MPI_Aint[count])
+ , old_type_(old_type)
{
old_type_->ref();
- block_lengths_ = new int[count];
- block_indices_ = new MPI_Aint[count];
for (int i = 0; i < count; i++) {
block_lengths_[i] = block_lengths[i];
block_indices_[i] = block_indices[i];
Type_Hindexed::Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths,
const int* block_indices, MPI_Datatype old_type, MPI_Aint factor)
- : Datatype(size, lb, ub, flags), block_count_(count), old_type_(old_type)
+ : Datatype(size, lb, ub, flags)
+ , block_count_(count)
+ , block_lengths_(new int[count])
+ , block_indices_(new MPI_Aint[count])
+ , old_type_(old_type)
{
old_type_->ref();
- block_lengths_ = new int[count];
- block_indices_ = new MPI_Aint[count];
for (int i = 0; i < count; i++) {
block_lengths_[i] = block_lengths[i];
block_indices_[i] = block_indices[i] * factor;
{
}
-Type_Struct::Type_Struct(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths, const MPI_Aint* block_indices, const MPI_Datatype* old_types): Datatype(size, lb, ub, flags), block_count_(count){
- block_lengths_= new int[count];
- block_indices_= new MPI_Aint[count];
- old_types_= new MPI_Datatype[count];
+Type_Struct::Type_Struct(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths,
+ const MPI_Aint* block_indices, const MPI_Datatype* old_types)
+ : Datatype(size, lb, ub, flags)
+ , block_count_(count)
+ , block_lengths_(new int[count])
+ , block_indices_(new MPI_Aint[count])
+ , old_types_(new MPI_Datatype[count])
+{
for (int i = 0; i < count; i++) {
block_lengths_[i]=block_lengths[i];
block_indices_[i]=block_indices[i];
int F2C::add_f()
{
if (f2c_lookup_ == nullptr)
- f2c_lookup_ = new std::unordered_map<std::string, F2C*>;
+ f2c_lookup_ = new std::unordered_map<std::string, F2C*>();
char key[KEY_SIZE];
my_f2c_id_=f2c_id_;
int F2C::c2f()
{
if (f2c_lookup_ == nullptr) {
- f2c_lookup_ = new std::unordered_map<std::string, F2C*>;
+ f2c_lookup_ = new std::unordered_map<std::string, F2C*>();
}
if(my_f2c_id_==-1)
F2C* F2C::f2c(int id)
{
if (f2c_lookup_ == nullptr)
- f2c_lookup_ = new std::unordered_map<std::string, F2C*>;
+ f2c_lookup_ = new std::unordered_map<std::string, F2C*>();
if(id >= 0){
char key[KEY_SIZE];
std::unordered_map<int, smpi_key_elem> Win::keyvals_;
int Win::keyval_id_=0;
-Win::Win(void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, int allocated, int dynamic): base_(base), size_(size), disp_unit_(disp_unit), assert_(0), info_(info), comm_(comm), allocated_(allocated), dynamic_(dynamic){
- int comm_size = comm->size();
- rank_ = comm->rank();
+Win::Win(void* base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, int allocated, int dynamic)
+ : base_(base)
+ , size_(size)
+ , disp_unit_(disp_unit)
+ , info_(info)
+ , comm_(comm)
+ , rank_(comm->rank())
+ , allocated_(allocated)
+ , dynamic_(dynamic)
+{
XBT_DEBUG("Creating window");
if(info!=MPI_INFO_NULL)
info->ref();
+ int comm_size = comm->size();
name_ = nullptr;
opened_ = 0;
group_ = MPI_GROUP_NULL;
/* no availability file, fixed trace */
if (not speed_profile) {
- type_ = Type::FIXED;
value_ = value;
XBT_DEBUG("No availability trace. Constant value = %f", value);
return;
/* only one point available, fixed trace */
if (speed_profile->event_list.size() == 1) {
- type_ = Type::FIXED;
value_ = speed_profile->event_list.front().value_;
return;
}
};
public:
- explicit CpuTiTmgr(double value) : type_(Type::FIXED), value_(value){};
+ explicit CpuTiTmgr(double value) : value_(value){};
CpuTiTmgr(profile::Profile* speed_profile, double value);
CpuTiTmgr(const CpuTiTmgr&) = delete;
CpuTiTmgr& operator=(const CpuTiTmgr&) = delete;
double get_power_scale(double a);
private:
- Type type_;
+ Type type_ = Type::FIXED;
double value_; /*< Percentage of cpu speed available. Value fixed between 0 and 1 */
/* Dynamic */
class XBT_PRIVATE IBNode;
-class XBT_PRIVATE ActiveComm {
-public:
+struct XBT_PRIVATE ActiveComm {
IBNode* destination = nullptr;
NetworkAction* action = nullptr;
double init_rate = -1;
- ActiveComm() = default;
- virtual ~ActiveComm() = default;
};
class IBNode {
simgrid::kernel::routing::HostCreationArgs host;
host.id = host_id;
if ((cluster->properties != nullptr) && (not cluster->properties->empty())) {
- host.properties = new std::unordered_map<std::string, std::string>;
+ host.properties = new std::unordered_map<std::string, std::string>();
for (auto const& elm : *cluster->properties)
host.properties->insert({elm.first, elm.second});
XBT_PUBLIC void simgrid_add_plugin_description(const char* name, const char* description, void_f_void_t init_fun)
{
if (not surf_plugin_description)
- surf_plugin_description = new std::vector<surf_model_description_t>;
+ surf_plugin_description = new std::vector<surf_model_description_t>();
surf_plugin_description->emplace_back(surf_model_description_t{name, description, init_fun});
}
impl_->st = boost::stacktrace::stacktrace();
#endif
}
-Backtrace::Backtrace(const Backtrace& bt)
+
+Backtrace::Backtrace(const Backtrace& bt) : impl_(bt.impl_)
{
- impl_ = bt.impl_;
if (impl_)
impl_->ref();
}
Backtrace::Backtrace(Backtrace&& bt)
{
- impl_ = bt.impl_;
- bt.impl_ = nullptr;
+ std::swap(impl_, bt.impl_);
}
Backtrace& Backtrace::operator=(const Backtrace& rhs)