static simgrid::mc::RemoteSimulation* process;
-static uintptr_t eval_binary_operation(simgrid::dwarf::ExpressionContext const& state, int op, uintptr_t a, uintptr_t b)
+static uintptr_t eval_binary_operation(simgrid::dwarf::ExpressionContext const& state, uint8_t op, uintptr_t a,
+ uintptr_t b)
{
Dwarf_Op ops[15];
ops[0].atom = DW_OP_const8u;
XBT_INFO("### Put a VM on a PM, put one task to the PM and three tasks to the VM");
vm0 = new simgrid::s4u::VirtualMachine("VM0", pm2, 2);
run_test_process("( [ooo]2 X )2", pm2, flop_amount * 2 / 3);
- run_test_process("( [Xoo]2 o )2", vm0, flop_amount * (2. / 3 * 2) / 3); // VM_share/3
- run_test_process("( [oXo]2 o )2", vm0, flop_amount * (2. / 3 * 2) / 3); // VM_share/3
- run_test_process("( [ooX]2 o )2", vm0, flop_amount * (2. / 3 * 2) / 3); // VM_share/3
+ run_test_process("( [Xoo]2 o )2", vm0, (flop_amount * 4 / 3) / 3); // VM_share/3
+ run_test_process("( [oXo]2 o )2", vm0, (flop_amount * 4 / 3) / 3); // VM_share/3
+ run_test_process("( [ooX]2 o )2", vm0, (flop_amount * 4 / 3) / 3); // VM_share/3
simgrid::s4u::this_actor::sleep_for(2);
test_energy_consumption(chooser,2);
vm0->destroy();
} else if (chooser == "( [ooo]2 ooo )4") {
XBT_INFO("### Put a VM on a PM, and put three tasks to the PM and three tasks to the VM");
vm0 = new simgrid::s4u::VirtualMachine("VM0", pm4, 2);
- run_test_process("( [Xoo]2 ooo )4", vm0, flop_amount * (8. / 5) * 1 / 3); // The VM has 8/5 of the PM
- run_test_process("( [oXo]2 ooo )4", vm0, flop_amount * (8. / 5) * 1 / 3);
- run_test_process("( [ooX]2 ooo )4", vm0, flop_amount * (8. / 5) * 1 / 3);
+ run_test_process("( [Xoo]2 ooo )4", vm0, (flop_amount * 8 / 5) / 3); // The VM has 8/5 of the PM
+ run_test_process("( [oXo]2 ooo )4", vm0, (flop_amount * 8 / 5) / 3);
+ run_test_process("( [ooX]2 ooo )4", vm0, (flop_amount * 8 / 5) / 3);
run_test_process("( [ooo]2 Xoo )4", pm4, flop_amount * 4 / 5);
run_test_process("( [ooo]2 oXo )4", pm4, flop_amount * 4 / 5);
static void host()
{
simgrid::s4u::Disk* disk = simgrid::s4u::this_actor::get_host()->get_disks().front(); // Disk1
- int id = simgrid::s4u::this_actor::get_pid();
+ int id = static_cast<int>(simgrid::s4u::this_actor::get_pid());
XBT_INFO("process %d is writing!", id);
disk->write(4000000);
XBT_INFO("process %d goes to sleep for %d seconds", id, id);
e.load_platform(argv[1]);
std::vector<simgrid::s4u::Host*> hosts = e.get_all_hosts();
- int host_count = e.get_host_count();
+ int host_count = static_cast<int>(e.get_host_count());
/* Random number initialization */
simgrid::xbt::random::set_mersenne_seed(static_cast<int>(xbt_os_time()));
static void sendpid()
{
- simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name("mailbox");
- int pid = simgrid::s4u::this_actor::get_pid();
- double comm_size = 100000;
+ simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name("mailbox");
+ int pid = static_cast<int>(simgrid::s4u::this_actor::get_pid());
+ long comm_size = 100000;
simgrid::s4u::this_actor::on_exit([pid](bool /*failed*/) { XBT_INFO("Process \"%d\" killed.", pid); });
XBT_INFO("Sending pid of \"%d\".", pid);
static void dump_hosts()
{
- unsigned int totalHosts = sg_host_count();
+ unsigned int totalHosts = static_cast<unsigned int>(sg_host_count());
sg_host_t* hosts = sg_host_list();
std::sort(hosts, hosts + totalHosts,
[](const_sg_host_t a, const_sg_host_t b) { return strcmp(sg_host_get_name(a), sg_host_get_name(b)) < 0; });
static void dump_routes()
{
- unsigned int totalHosts = sg_host_count();
+ unsigned int totalHosts = static_cast<unsigned int>(sg_host_count());
sg_host_t* hosts = sg_host_list();
std::sort(hosts, hosts + totalHosts,
[](const_sg_host_t a, const_sg_host_t b) { return strcmp(sg_host_get_name(a), sg_host_get_name(b)) < 0; });
/* Link constraints and variables */
for (int i = 0; i < 15; i++)
for (int j = 0; j < 16; j++)
- if (A[i][j])
+ if (A[i][j] != 0.0)
Sys->expand(tmp_cnst[i], tmp_var[j], 1.0);
Sys->solve();
double date;
static void test(int nb_cnst, int nb_var, int nb_elem, unsigned int pw_base_limit, unsigned int pw_max_limit,
- float rate_no_limit, int max_share, int mode)
+ double rate_no_limit, int max_share, int mode)
{
simgrid::kernel::lmm::Constraint** cnst = new simgrid::kernel::lmm::Constraint*[nb_cnst];
simgrid::kernel::lmm::Variable** var = new simgrid::kernel::lmm::Variable*[nb_var];
for (int i = 0; i < nb_var; i++) {
var[i] = Sys->variable_new(NULL, 1.0, -1.0, nb_elem);
//Have a few variables with a concurrency share of two (e.g. cross-traffic in some cases)
- int concurrency_share = 1 + simgrid::xbt::random::uniform_int(0, max_share - 1);
+ short concurrency_share = static_cast<short>(1 + simgrid::xbt::random::uniform_int(0, max_share - 1));
var[i]->set_concurrency_share(concurrency_share);
for (int j = 0; j < nb_cnst; j++)
{
simgrid::s4u::Engine e(&argc, argv);
- float rate_no_limit=0.2;
- float acc_date=0;
- float acc_date2=0;
+ double rate_no_limit = 0.2;
+ double acc_date = 0.0;
+ double acc_date2 = 0.0;
int testclass;
if(argc<3) {
acc_date2+=date*date;
}
- float mean_date= acc_date/(float)testcount;
- float stdev_date= sqrt(acc_date2/(float)testcount-mean_date*mean_date);
+ double mean_date = acc_date / static_cast<double>(testcount);
+ double stdev_date = sqrt(acc_date2 / static_cast<double>(testcount) - mean_date * mean_date);
fprintf(stderr, "%ix One shot execution time for a total of %u constraints, "
"%u variables with %u active constraint each, concurrency in [%i,%i] and max concurrency share %u\n",
}
timeout = atof(argv[2]);
if (argc == 4)
- modes = strtol(argv[2], NULL, 0);
+ modes = static_cast<unsigned>(strtoul(argv[2], NULL, 0));
XBT_INFO("Parmap benchmark with %d workers (modes = %#x)...", nthreads, modes);
XBT_INFO("%s", "");
parmap.apply(fun_get_id, data);
std::sort(begin(a), end(a));
- unsigned count = std::distance(begin(a), std::unique(begin(a), end(a)));
+ unsigned count = static_cast<unsigned>(std::distance(begin(a), std::unique(begin(a), end(a))));
if (count != num_workers) {
XBT_CRITICAL("only %u/%u threads did some work", count, num_workers);
ret = 1;