XBT_PRIVATE unsigned char* smpi_get_tmp_sendbuffer(size_t size);
XBT_PRIVATE unsigned char* smpi_get_tmp_recvbuffer(size_t size);
-XBT_PRIVATE void log_timed_action(simgrid::xbt::ReplayAction& action, double clock);
+XBT_PRIVATE void log_timed_action(const simgrid::xbt::ReplayAction& action, double clock);
namespace simgrid {
namespace smpi {
*/
XBT_PUBLIC void smpi_trace_set_call_location(const char* file, int line);
/** Fortran binding **/
-XBT_PUBLIC void smpi_trace_set_call_location_(const char* file, int* line);
+XBT_PUBLIC void smpi_trace_set_call_location_(const char* file, const int* line);
/** Fortran binding + -fsecond-underscore **/
-XBT_PUBLIC void smpi_trace_set_call_location__(const char* file, int* line);
+XBT_PUBLIC void smpi_trace_set_call_location__(const char* file, const int* line);
#define SMPI_ITER_NAME1(line) _XBT_CONCAT(iter_count, line)
#define SMPI_ITER_NAME(line) SMPI_ITER_NAME1(line)
/* Helper functions */
XBT_PRIVATE container_t smpi_container(int rank);
-XBT_PRIVATE void TRACE_smpi_setup_container(int rank, sg_host_t host);
+XBT_PRIVATE void TRACE_smpi_setup_container(int rank, const_sg_host_t host);
XBT_PRIVATE void TRACE_smpi_computing_init(int rank);
XBT_PRIVATE void TRACE_smpi_computing_out(int rank);
void add_rma_win(MPI_Win win);
void remove_rma_win(MPI_Win win);
void finish_rma_calls();
- MPI_Comm split_type(int type, int key, MPI_Info info);
+ MPI_Comm split_type(int type, int key, const Info* info);
};
} // namespace smpi
void commit();
bool is_valid();
bool is_basic();
- static const char* encode(MPI_Datatype dt) { return dt->id.c_str(); }
+ static const char* encode(const Datatype* dt) { return dt->id.c_str(); }
static MPI_Datatype decode(const std::string& datatype_id);
bool is_replayable();
void addflag(int flag);
static int keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
void* extra_state);
static int keyval_free(int* keyval);
- int pack(const void* inbuf, int incount, void* outbuf, int outcount, int* position, MPI_Comm comm);
- int unpack(const void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Comm comm);
+ int pack(const void* inbuf, int incount, void* outbuf, int outcount, int* position, const Comm* comm);
+ int unpack(const void* inbuf, int insize, int* position, void* outbuf, int outcount, const Comm* comm);
static int create_contiguous(int count, MPI_Datatype old_type, MPI_Aint lb, MPI_Datatype* new_type);
static int create_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type);
int sync();
int seek(MPI_Offset offset, int whence);
int seek_shared(MPI_Offset offset, int whence);
- int set_view(MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, const char *datarep, MPI_Info info);
+ int set_view(MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, const char* datarep, const Info* info);
int get_view(MPI_Offset *disp, MPI_Datatype *etype, MPI_Datatype *filetype, char *datarep);
MPI_Info info();
void set_info( MPI_Info info);
static int write_ordered(MPI_File fh, const void *buf, int count,MPI_Datatype datatype, MPI_Status *status);
template <int (*T)(MPI_File, void *, int, MPI_Datatype, MPI_Status *)> int op_all(void *buf, int count,MPI_Datatype datatype, MPI_Status *status);
static int close(MPI_File *fh);
- static int del(const char *filename, MPI_Info info);
+ static int del(const char* filename, const Info* info);
MPI_Errhandler errhandler();
void set_errhandler( MPI_Errhandler errhandler);
};
public:
Info() = default;
- explicit Info(Info* orig) : map_(orig->map_) {}
+ explicit Info(const Info* orig) : map_(orig->map_) {}
~Info() = default;
void ref();
static void unref(MPI_Info info);
template <typename T> int attr_delete(int keyval);
template <typename T> int attr_get(int keyval, void* attr_value, int* flag);
template <typename T> int attr_put(int keyval, void* attr_value);
- template <typename T> static int call_deleter(T* obj, smpi_key_elem elem, int keyval, void * value, int* flag);
+ template <typename T>
+ static int call_deleter(T* obj, const s_smpi_key_elem_t* elem, int keyval, void* value, int* flag);
template <typename T> void cleanup_attr();
};
static int grequest_start( MPI_Grequest_query_function *query_fn, MPI_Grequest_free_function *free_fn, MPI_Grequest_cancel_function *cancel_fn, void *extra_state, MPI_Request *request);
static int grequest_complete( MPI_Request request);
- static int get_status(MPI_Request req, int* flag, MPI_Status * status);
+ static int get_status(const Request* req, int* flag, MPI_Status* status);
static void free_f(int id);
static Request* f2c(int);
static void empty(MPI_Status * status);
static int cancelled (const MPI_Status * status);
static void set_cancelled (MPI_Status * status, int flag);
-static void set_elements (MPI_Status * status, MPI_Datatype , int count);
+static void set_elements(MPI_Status* status, const Datatype*, int count);
static int get_count(const MPI_Status * status, MPI_Datatype datatype);
};
int get_accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr,
int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, int target_count,
MPI_Datatype target_datatype, MPI_Op op, MPI_Request* request=nullptr);
- int compare_and_swap(const void *origin_addr, void *compare_addr,
- void *result_addr, MPI_Datatype datatype, int target_rank,
- MPI_Aint target_disp);
+ int compare_and_swap(const void* origin_addr, const void* compare_addr, void* result_addr, MPI_Datatype datatype,
+ int target_rank, MPI_Aint target_disp);
static Win* f2c(int id);
int lock(int lock_type, int rank, int assert);
return key;
}
-void TRACE_smpi_setup_container(int rank, sg_host_t host)
+void TRACE_smpi_setup_container(int rank, const_sg_host_t host)
{
container_t father = simgrid::instr::Container::get_root();
if (TRACE_smpi_is_grouped()) {
}
/** Required for Fortran bindings */
-void smpi_trace_set_call_location_(const char* file, int* line)
+void smpi_trace_set_call_location_(const char* file, const int* line)
{
smpi_trace_set_call_location(file, *line);
}
/** Required for Fortran if -fsecond-underscore is activated */
-void smpi_trace_set_call_location__(const char* file, int* line)
+void smpi_trace_set_call_location__(const char* file, const int* line)
{
smpi_trace_set_call_location(file, *line);
}
};
}
-static void memcpy_private(void* dest, const void* src, std::vector<std::pair<size_t, size_t>>& private_blocks)
+static void memcpy_private(void* dest, const void* src, const std::vector<std::pair<size_t, size_t>>& private_blocks)
{
for (auto const& block : private_blocks)
memcpy((uint8_t*)dest+block.first, (uint8_t*)src+block.first, block.second-block.first);
}
-static void check_blocks(std::vector<std::pair<size_t, size_t>> &private_blocks, size_t buff_size) {
+static void check_blocks(const std::vector<std::pair<size_t, size_t>>& private_blocks, size_t buff_size)
+{
for (auto const& block : private_blocks)
xbt_assert(block.first <= block.second && block.second <= buff_size, "Oops, bug in shared malloc.");
}
/* This is a ... heavy way to count the MPI ranks */
int rank_counts = 0;
- simgrid::s4u::Actor::on_creation.connect([&rank_counts](simgrid::s4u::Actor& actor) {
+ simgrid::s4u::Actor::on_creation.connect([&rank_counts](const simgrid::s4u::Actor& actor) {
if (not actor.is_daemon())
rank_counts++;
});
typedef std::tuple</*sender*/ int, /* receiver */ int, /* tag */ int> req_key_t;
typedef std::unordered_map<req_key_t, MPI_Request, hash_tuple::hash<std::tuple<int,int,int>>> req_storage_t;
-void log_timed_action(simgrid::xbt::ReplayAction& action, double clock)
+void log_timed_action(const simgrid::xbt::ReplayAction& action, double clock)
{
if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
std::string s = boost::algorithm::join(action, " ");
TRACE_smpi_comm_in(my_proc_id, "smpi_replay_run_init", new simgrid::instr::NoOpTIData("init"));
TRACE_smpi_comm_out(my_proc_id);
xbt_replay_action_register("init", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::InitAction().execute(action); });
- xbt_replay_action_register("finalize", [](simgrid::xbt::ReplayAction&) { /* nothing to do */ });
+ xbt_replay_action_register("finalize", [](simgrid::xbt::ReplayAction const&) { /* nothing to do */ });
xbt_replay_action_register("comm_size", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::CommunicatorAction().execute(action); });
xbt_replay_action_register("comm_split",[](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::CommunicatorAction().execute(action); });
xbt_replay_action_register("comm_dup", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::CommunicatorAction().execute(action); });
errhandler_->ref();
}
-MPI_Comm Comm::split_type(int type, int /*key*/, MPI_Info)
+MPI_Comm Comm::split_type(int type, int /*key*/, const Info*)
{
//MPI_UNDEFINED can be given to some nodes... but we need them to still perform the smp part which is collective
if(type != MPI_COMM_TYPE_SHARED && type != MPI_UNDEFINED){
name_ = xbt_strdup(name);
}
-int Datatype::pack(const void* inbuf, int incount, void* outbuf, int outcount, int* position, MPI_Comm)
+int Datatype::pack(const void* inbuf, int incount, void* outbuf, int outcount, int* position, const Comm*)
{
if (outcount - *position < incount*static_cast<int>(size_))
return MPI_ERR_OTHER;
return MPI_SUCCESS;
}
-int Datatype::unpack(const void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Comm)
+int Datatype::unpack(const void* inbuf, int insize, int* position, void* outbuf, int outcount, const Comm*)
{
if (outcount*static_cast<int>(size_)> insize)
return MPI_ERR_OTHER;
return MPI_SUCCESS;
}
- int File::del(const char* filename, MPI_Info)
+ int File::del(const char* filename, const Info*)
{
//get the file with MPI_MODE_DELETE_ON_CLOSE and then close it
File* f = new File(MPI_COMM_SELF,filename,MPI_MODE_DELETE_ON_CLOSE|MPI_MODE_RDWR, nullptr);
return ret;
}
- int File::set_view(MPI_Offset /*disp*/, MPI_Datatype etype, MPI_Datatype filetype, const char* datarep, MPI_Info)
+ int File::set_view(MPI_Offset /*disp*/, MPI_Datatype etype, MPI_Datatype filetype, const char* datarep, const Info*)
{
etype_=etype;
filetype_=filetype;
return &attributes_;
}
-template <> int Keyval::call_deleter<Comm>(Comm* obj, smpi_key_elem elem, int keyval, void* value, int* /*flag*/)
+template <>
+int Keyval::call_deleter<Comm>(Comm* obj, const s_smpi_key_elem_t* elem, int keyval, void* value, int* /*flag*/)
{
int ret = MPI_SUCCESS;
if(elem->delete_fn.comm_delete_fn!=MPI_NULL_DELETE_FN)
return ret;
}
-template <> int Keyval::call_deleter<Win>(Win* obj, smpi_key_elem elem, int keyval, void* value, int* /*flag*/)
+template <>
+int Keyval::call_deleter<Win>(Win* obj, const s_smpi_key_elem_t* elem, int keyval, void* value, int* /*flag*/)
{
int ret = MPI_SUCCESS;
if(elem->delete_fn.win_delete_fn!=MPI_NULL_DELETE_FN)
}
template <>
-int Keyval::call_deleter<Datatype>(Datatype* obj, smpi_key_elem elem, int keyval, void* value, int* /*flag*/)
+int Keyval::call_deleter<Datatype>(Datatype* obj, const s_smpi_key_elem_t* elem, int keyval, void* value, int* /*flag*/)
{
int ret = MPI_SUCCESS;
if(elem->delete_fn.type_delete_fn!=MPI_NULL_DELETE_FN)
}
}
-int Request::get_status(MPI_Request req, int* flag, MPI_Status* status)
+int Request::get_status(const Request* req, int* flag, MPI_Status* status)
{
*flag=0;
status->cancelled=flag;
}
-void Status::set_elements (MPI_Status * status, MPI_Datatype , int count){
+void Status::set_elements(MPI_Status* status, const Datatype*, int count)
+{
status->count=count;
}
#include <vector>
/* static functions */
-static int assignnodes(int ndim, int nfactor, int *pfacts,int **pdims);
+static int assignnodes(int ndim, int nfactor, const int* pfacts, int** pdims);
static int getfactors(int num, int *nfators, int **factors);
* - ptr to array of dimensions (returned value)
* Returns: - 0 or ERROR
*/
-static int assignnodes(int ndim, int nfactor, int *pfacts, int **pdims)
+static int assignnodes(int ndim, int nfactor, const int* pfacts, int** pdims)
{
int *pmin;
return MPI_SUCCESS;
}
-int Win::compare_and_swap(const void *origin_addr, void *compare_addr,
- void *result_addr, MPI_Datatype datatype, int target_rank,
- MPI_Aint target_disp){
+int Win::compare_and_swap(const void* origin_addr, const void* compare_addr, void* result_addr, MPI_Datatype datatype,
+ int target_rank, MPI_Aint target_disp)
+{
//get sender pointer
const Win* send_win = connected_wins_[target_rank];
{
simgrid::s4u::Engine* engine = simgrid::s4u::Engine::get_instance();
std::vector<simgrid::s4u::Host*> available_hosts =
- engine->get_filtered_hosts([](simgrid::s4u::Host* host) { return host->is_on(); });
+ engine->get_filtered_hosts([](const simgrid::s4u::Host* host) { return host->is_on(); });
xbt_assert(available_hosts.size() > 0, "No hosts available; are they all switched off?");
// TODO: Account for daemon background load (-> use especially the availability file)
void for_each_actor(simgrid::s4u::Host* host, const std::function<void(simgrid::s4u::ActorPtr)>& callback)
{
auto range = host_to_actors.equal_range(host);
- std::for_each(
- range.first,
- range.second,
- [&callback](host_to_actors_map_t::value_type& x) { callback(x.second); }
- );
+ std::for_each(range.first, range.second,
+ [&callback](host_to_actors_map_t::value_type const& x) { callback(x.second); });
}
};