I moved the computation of the orecv configs to the SmpiHost class.
It's currently a crude implementation and does not (yet) allow for a
per-host configuration, but this is planned and outlined in the code.
For that, all we need is an option to parse and set orecv values on
a per-node basis. (See the orecv_ property.)
#include "smpi/smpi_utils.hpp"
#include "src/smpi/SmpiHost.hpp"
#include "smpi/smpi_utils.hpp"
#include "src/smpi/SmpiHost.hpp"
-#include "src/surf/virtual_machine.hpp"
-
+#include <simgrid/s4u/VirtualMachine.hpp>
#include <string>
#include <vector>
#include <string>
#include <vector>
double SmpiHost::orecv(size_t size)
{
if (orecv_parsed_values.empty()) {
double SmpiHost::orecv(size_t size)
{
if (orecv_parsed_values.empty()) {
- if (orecv_.empty()) {
- std::string test = xbt_cfg_get_string("smpi/or");
+ if (orecv_.empty()) { /* This is currently always true since orecv_ is not really used yet. */
+ /* Get global value */
orecv_parsed_values = parse_factor(xbt_cfg_get_string("smpi/or"));
}
orecv_parsed_values = parse_factor(xbt_cfg_get_string("smpi/or"));
}
+ else /* Can currently not be reached, see above */
orecv_parsed_values = parse_factor(orecv_.c_str());
}
orecv_parsed_values = parse_factor(orecv_.c_str());
}
static void onHostDestruction(simgrid::s4u::Host& host) {
// Ignore virtual machines
static void onHostDestruction(simgrid::s4u::Host& host) {
// Ignore virtual machines
- simgrid::surf::HostImpl* surf_host = host.extension<simgrid::surf::HostImpl>();
- if (dynamic_cast<simgrid::surf::VirtualMachine*>(surf_host))
+ if (dynamic_cast<simgrid::s4u::VirtualMachine*>(&host))
#include <simgrid/s4u/host.hpp>
#include <string>
#include <vector>
#include <simgrid/s4u/host.hpp>
#include <string>
#include <vector>
+#include <xbt/config.hpp>
#include <xbt/Extendable.hpp>
#include <xbt/Extendable.hpp>
#include "private.h"
#include "simgrid/msg.h" /* barrier */
#include "private.h"
#include "simgrid/msg.h" /* barrier */
+#include "src/smpi/SmpiHost.hpp"
#include "xbt/dict.h"
#include "xbt/log.h"
#include "xbt/sysdep.h"
#include "xbt/dict.h"
#include "xbt/log.h"
#include "xbt/sysdep.h"
s_smpi_mpi_instance_t* instance = (s_smpi_mpi_instance_t*)xbt_malloc(sizeof(s_smpi_mpi_instance_t));
s_smpi_mpi_instance_t* instance = (s_smpi_mpi_instance_t*)xbt_malloc(sizeof(s_smpi_mpi_instance_t));
+ static int already_called = 0;
+ if (!already_called) {
+ already_called = 1;
+ xbt_dynar_t hosts = MSG_hosts_as_dynar();
+ unsigned int cursor;
+ void* h;
+ xbt_dynar_foreach(hosts, cursor, h) {
+ simgrid::s4u::Host* host = static_cast<simgrid::s4u::Host*>(h);
+ host->extension_set(new simgrid::smpi::SmpiHost(host));
+ }
+ xbt_dynar_free(&hosts);
+ }
+
instance->name = name;
instance->size = num_processes;
instance->present_processes = 0;
instance->name = name;
instance->size = num_processes;
instance->present_processes = 0;
smpi_instances = xbt_dict_new_homogeneous(xbt_free_f);
}
smpi_instances = xbt_dict_new_homogeneous(xbt_free_f);
}
xbt_dict_set(smpi_instances, name, (void*)instance, nullptr);
}
xbt_dict_set(smpi_instances, name, (void*)instance, nullptr);
}
#include "src/mc/mc_replay.h"
#include "src/msg/msg_private.h"
#include "src/simix/smx_private.h"
#include "src/mc/mc_replay.h"
#include "src/msg/msg_private.h"
#include "src/simix/smx_private.h"
+#include "src/smpi/SmpiHost.hpp"
#include "surf/surf.h"
#include "xbt/replay.hpp"
#include <xbt/config.hpp>
#include "surf/surf.h"
#include "xbt/replay.hpp"
#include <xbt/config.hpp>
+ simgrid::s4u::Host::onCreation.connect([](simgrid::s4u::Host& host) {
+ host.extension_set(new simgrid::smpi::SmpiHost(&host));
+ });
+
// parse the platform file: get the host list
SIMIX_create_environment(argv[1]);
SIMIX_comm_set_copy_data_callback(smpi_comm_copy_buffer_callback);
// parse the platform file: get the host list
SIMIX_create_environment(argv[1]);
SIMIX_comm_set_copy_data_callback(smpi_comm_copy_buffer_callback);
#include "src/simix/smx_private.h"
#include "simgrid/sg_config.h"
#include "smpi/smpi_utils.hpp"
#include "src/simix/smx_private.h"
#include "simgrid/sg_config.h"
#include "smpi/smpi_utils.hpp"
+#include "src/smpi/SmpiHost.hpp"
#include <simgrid/s4u/host.hpp>
#include "src/kernel/activity/SynchroComm.hpp"
#include <simgrid/s4u/host.hpp>
#include "src/kernel/activity/SynchroComm.hpp"
}
if(req->detached_sender_ != nullptr){
//integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0
}
if(req->detached_sender_ != nullptr){
//integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0
- double sleeptime = smpi_or(req->real_size_);
+ double sleeptime = simgrid::s4u::Actor::self()->host()->extension<simgrid::smpi::SmpiHost>()->orecv(req->real_size());
if(sleeptime > 0.0){
simcall_process_sleep(sleeptime);
XBT_DEBUG("receiving size of %zu : sleep %f ", req->real_size_, sleeptime);
if(sleeptime > 0.0){
simcall_process_sleep(sleeptime);
XBT_DEBUG("receiving size of %zu : sleep %f ", req->real_size_, sleeptime);