From: Arnaud Giersch Date: Fri, 23 Oct 2020 22:21:42 +0000 (+0200) Subject: More coding style updates for sg_host. X-Git-Tag: v3.26~247 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a2d16cd78c8d1a779948aa69d6e396028c788a5e More coding style updates for sg_host. --- diff --git a/docs/source/app_s4u.rst b/docs/source/app_s4u.rst index 08edf11835..ec9dc5ade7 100644 --- a/docs/source/app_s4u.rst +++ b/docs/source/app_s4u.rst @@ -1157,8 +1157,8 @@ Querying info .. autodoxymethod:: sg_host_core_count(const_sg_host_t host) .. autodoxymethod:: sg_host_dump(const_sg_host_t ws) .. autodoxymethod:: sg_host_get_name(const_sg_host_t host) - .. autodoxymethod:: sg_host_load(const_sg_host_t host) - .. autodoxymethod:: sg_host_speed(const_sg_host_t host) + .. autodoxymethod:: sg_host_get_load(const_sg_host_t host) + .. autodoxymethod:: sg_host_get_speed(const_sg_host_t host) User data and properties ------------------------ @@ -1268,9 +1268,9 @@ Platform and routing .. group-tab:: C - .. autodoxymethod:: sg_host_route(const_sg_host_t from, const_sg_host_t to, xbt_dynar_t links) - .. autodoxymethod:: sg_host_route_bandwidth(const_sg_host_t from, const_sg_host_t to) - .. autodoxymethod:: sg_host_route_latency(const_sg_host_t from, const_sg_host_t to) + .. autodoxymethod:: sg_host_get_route(const_sg_host_t from, const_sg_host_t to, xbt_dynar_t links) + .. autodoxymethod:: sg_host_get_route_bandwidth(const_sg_host_t from, const_sg_host_t to) + .. autodoxymethod:: sg_host_get_route_latency(const_sg_host_t from, const_sg_host_t to) .. autodoxymethod:: sg_host_sendto(sg_host_t from, sg_host_t to, double byte_amount) Signals diff --git a/examples/c/actor-migrate/actor-migrate.c b/examples/c/actor-migrate/actor-migrate.c index 7b03e0fd0f..ec4e098b19 100644 --- a/examples/c/actor-migrate/actor-migrate.c +++ b/examples/c/actor-migrate/actor-migrate.c @@ -19,7 +19,7 @@ static void worker(int argc, char* argv[]) sg_host_t first = sg_host_by_name(argv[1]); const_sg_host_t second = sg_host_by_name(argv[2]); - double flopAmount = sg_host_speed(first) * 5 + sg_host_speed(second) * 5; + double flopAmount = sg_host_get_speed(first) * 5 + sg_host_get_speed(second) * 5; XBT_INFO("Let's move to %s to execute %.2f Mflops (5sec on %s and 5sec on %s)", argv[1], flopAmount / 1e6, argv[1], argv[2]); diff --git a/examples/c/cloud-capping/cloud-capping.c b/examples/c/cloud-capping/cloud-capping.c index bc3de023fd..94c371b359 100644 --- a/examples/c/cloud-capping/cloud-capping.c +++ b/examples/c/cloud-capping/cloud-capping.c @@ -94,7 +94,7 @@ static void test_dynamic_change() const char* w0_argv[] = {"worker0", "Task0", "-1.0", NULL}; sg_actor_create("worker0", (sg_host_t)vm0, worker_busy_loop, 3, w0_argv); - char* speed = bprintf("%f", sg_host_speed(pm0)); + char* speed = bprintf("%f", sg_host_get_speed(pm0)); const char* w1_argv[] = {"worker1", "Task1", speed, NULL}; sg_actor_create("worker1", (sg_host_t)vm1, worker_busy_loop, 3, w1_argv); @@ -107,7 +107,7 @@ static void test_dynamic_change() static void test_one_task(sg_host_t hostA) { - const double cpu_speed = sg_host_speed(hostA); + const double cpu_speed = sg_host_get_speed(hostA); const double computation_amount = cpu_speed * 10; const char* hostA_name = sg_host_get_name(hostA); @@ -141,8 +141,8 @@ static void test_one_task(sg_host_t hostA) static void test_two_tasks(sg_host_t hostA, sg_host_t hostB) { - const double cpu_speed = sg_host_speed(hostA); - xbt_assert(cpu_speed == sg_host_speed(hostB)); + const double cpu_speed = sg_host_get_speed(hostA); + xbt_assert(cpu_speed == sg_host_get_speed(hostB)); const double computation_amount = cpu_speed * 10; const char* hostA_name = sg_host_get_name(hostA); const char* hostB_name = sg_host_get_name(hostB); @@ -226,7 +226,7 @@ static void master_main(int argc, char* argv[]) sg_vm_destroy(vm0); vm0 = sg_vm_create_core(pm0, "VM0"); - double cpu_speed = sg_host_speed(pm0); + double cpu_speed = sg_host_get_speed(pm0); sg_vm_set_bound(vm0, cpu_speed / 10); sg_vm_start(vm0); @@ -249,7 +249,7 @@ static void master_main(int argc, char* argv[]) sg_vm_set_ramsize(vm0, 1e9); // 1GB sg_vm_start(vm0); - cpu_speed = sg_host_speed(pm0); + cpu_speed = sg_host_get_speed(pm0); sg_vm_start(vm0); XBT_INFO("# 10. Test migration"); diff --git a/examples/c/energy-exec/energy-exec.c b/examples/c/energy-exec/energy-exec.c index 0bfec7cdec..2fc76615b8 100644 --- a/examples/c/energy-exec/energy-exec.c +++ b/examples/c/energy-exec/energy-exec.c @@ -19,14 +19,14 @@ static void dvfs(int argc, char* argv[]) sg_host_t host = sg_host_by_name("MyHost1"); XBT_INFO("Energetic profile: %s", sg_host_get_property_value(host, "wattage_per_state")); - XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", sg_host_speed(host), + XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", sg_host_get_speed(host), sg_host_get_consumed_energy(host)); double start = simgrid_get_clock(); XBT_INFO("Sleep for 10 seconds"); sg_actor_sleep_for(10); XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E; Energy dissipated=%.2f J", - simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_consumed_energy(host)); + simgrid_get_clock() - start, sg_host_get_speed(host), sg_host_get_consumed_energy(host)); // Run a task start = simgrid_get_clock(); @@ -34,27 +34,27 @@ static void dvfs(int argc, char* argv[]) sg_actor_execute(100E6); XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Current consumption: from %.0fW to %.0fW" " depending on load; Energy dissipated=%.0f J", - simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_wattmin_at(host, sg_host_get_pstate(host)), + simgrid_get_clock() - start, sg_host_get_speed(host), sg_host_get_wattmin_at(host, sg_host_get_pstate(host)), sg_host_get_wattmax_at(host, sg_host_get_pstate(host)), sg_host_get_consumed_energy(host)); // ========= Change power peak ========= int pstate = 2; sg_host_set_pstate(host, pstate); XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s)", pstate, - sg_host_get_pstate_speed(host, pstate), sg_host_speed(host)); + sg_host_get_pstate_speed(host, pstate), sg_host_get_speed(host)); // Run a second task start = simgrid_get_clock(); XBT_INFO("Run a task of %.0E flops", 100E6); sg_actor_execute(100E6); XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", - simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_consumed_energy(host)); + simgrid_get_clock() - start, sg_host_get_speed(host), sg_host_get_consumed_energy(host)); start = simgrid_get_clock(); XBT_INFO("Sleep for 4 seconds"); sg_actor_sleep_for(4); XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", - simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_consumed_energy(host)); + simgrid_get_clock() - start, sg_host_get_speed(host), sg_host_get_consumed_energy(host)); // =========== Turn the other host off ========== XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated %.0f J so far.", @@ -63,7 +63,7 @@ static void dvfs(int argc, char* argv[]) start = simgrid_get_clock(); sg_actor_sleep_for(10); XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", - simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_consumed_energy(host)); + simgrid_get_clock() - start, sg_host_get_speed(host), sg_host_get_consumed_energy(host)); } int main(int argc, char* argv[]) diff --git a/examples/c/exec-async/exec-async.c b/examples/c/exec-async/exec-async.c index c1d42ec0bd..d60e2d2dc5 100644 --- a/examples/c/exec-async/exec-async.c +++ b/examples/c/exec-async/exec-async.c @@ -17,7 +17,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(exec_async, "Messages specific for this example"); * That's exactly equivalent to synchronous execution. */ static void waiter(int argc, char* argv[]) { - double computation_amount = sg_host_speed(sg_host_self()); + double computation_amount = sg_host_get_speed(sg_host_self()); XBT_INFO("Execute %g flops, should take 1 second.", computation_amount); sg_exec_t activity = sg_actor_exec_init(computation_amount); sg_exec_start(activity); @@ -29,7 +29,7 @@ static void waiter(int argc, char* argv[]) /* This actor tests the ongoing execution until its completion, and don't wait before it's terminated. */ static void monitor(int argc, char* argv[]) { - double computation_amount = sg_host_speed(sg_host_self()); + double computation_amount = sg_host_get_speed(sg_host_self()); XBT_INFO("Execute %g flops, should take 1 second.", computation_amount); sg_exec_t activity = sg_actor_exec_init(computation_amount); sg_exec_start(activity); @@ -46,7 +46,7 @@ static void monitor(int argc, char* argv[]) /* This actor cancels the ongoing execution after a while. */ static void canceller(int argc, char* argv[]) { - double computation_amount = sg_host_speed(sg_host_self()); + double computation_amount = sg_host_get_speed(sg_host_self()); XBT_INFO("Execute %g flops, should take 1 second.", computation_amount); sg_exec_t activity = sg_actor_exec_init(computation_amount); diff --git a/examples/c/exec-dvfs/exec-dvfs.c b/examples/c/exec-dvfs/exec-dvfs.c index 5eb9f6b76a..fb5db642a2 100644 --- a/examples/c/exec-dvfs/exec-dvfs.c +++ b/examples/c/exec-dvfs/exec-dvfs.c @@ -20,7 +20,7 @@ static void dvfs(int argc, char* argv[]) int nb = sg_host_get_nb_pstates(host); XBT_INFO("Count of Processor states=%d", nb); - double current_peak = sg_host_speed(host); + double current_peak = sg_host_get_speed(host); XBT_INFO("Current power peak=%f", current_peak); sg_actor_execute(100E6); @@ -38,7 +38,7 @@ static void dvfs(int argc, char* argv[]) sg_host_set_pstate(host, new_pstate); - current_peak = sg_host_speed(host); + current_peak = sg_host_get_speed(host); XBT_INFO("Current power peak=%f", current_peak); sg_actor_execute(100E6); @@ -51,7 +51,7 @@ static void dvfs(int argc, char* argv[]) int nb2 = sg_host_get_nb_pstates(host); XBT_INFO("Count of Processor states=%d", nb2); - double current_peak2 = sg_host_speed(host); + double current_peak2 = sg_host_get_speed(host); XBT_INFO("Current power peak=%f", current_peak2); } diff --git a/examples/c/exec-remote/exec-remote.c b/examples/c/exec-remote/exec-remote.c index c5f45bd260..d844f6c901 100644 --- a/examples/c/exec-remote/exec-remote.c +++ b/examples/c/exec-remote/exec-remote.c @@ -25,8 +25,8 @@ static void wizard(int argc, char* argv[]) XBT_INFO("It started. Running 48.492Mf takes exactly one second on Ginette (but not on Fafard)."); sg_actor_sleep_for(0.1); - XBT_INFO("Loads in flops/s: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f", sg_host_load(boivin), sg_host_load(fafard), - sg_host_load(ginette)); + XBT_INFO("Loads in flops/s: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f", sg_host_get_load(boivin), + sg_host_get_load(fafard), sg_host_get_load(ginette)); sg_exec_wait(exec); @@ -37,14 +37,14 @@ static void wizard(int argc, char* argv[]) sg_exec_start(exec); sg_actor_sleep_for(0.5); - XBT_INFO("Loads before the move: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f", sg_host_load(boivin), sg_host_load(fafard), - sg_host_load(ginette)); + XBT_INFO("Loads before the move: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f", sg_host_get_load(boivin), + sg_host_get_load(fafard), sg_host_get_load(ginette)); sg_exec_set_host(exec, boivin); sg_actor_sleep_for(0.1); - XBT_INFO("Loads after the move: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f", sg_host_load(boivin), sg_host_load(fafard), - sg_host_load(ginette)); + XBT_INFO("Loads after the move: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f", sg_host_get_load(boivin), + sg_host_get_load(fafard), sg_host_get_load(ginette)); sg_exec_wait(exec); XBT_INFO("Done!"); diff --git a/examples/c/exec-waitany/exec-waitany.c b/examples/c/exec-waitany/exec-waitany.c index dc3f0adac5..a8a5780832 100644 --- a/examples/c/exec-waitany/exec-waitany.c +++ b/examples/c/exec-waitany/exec-waitany.c @@ -24,14 +24,14 @@ static void worker(int argc, char* argv[]) for (int i = 0; i < 3; i++) { char* name = bprintf("Exec-%d", i); - double amount = (6 * (i % 2) + i + 1) * sg_host_speed(sg_host_self()); + double amount = (6 * (i % 2) + i + 1) * sg_host_get_speed(sg_host_self()); sg_exec_t exec = sg_actor_exec_init(amount); sg_exec_set_name(exec, name); pending_execs[pending_execs_count++] = exec; sg_exec_start(exec); - XBT_INFO("Activity %s has started for %.0f seconds", name, amount / sg_host_speed(sg_host_self())); + XBT_INFO("Activity %s has started for %.0f seconds", name, amount / sg_host_get_speed(sg_host_self())); free(name); } diff --git a/examples/c/io-disk-raw/io-disk-raw.c b/examples/c/io-disk-raw/io-disk-raw.c index 6520d8354e..94fd1a52d2 100644 --- a/examples/c/io-disk-raw/io-disk-raw.c +++ b/examples/c/io-disk-raw/io-disk-raw.c @@ -27,7 +27,7 @@ static void host(int argc, char* argv[]) /* - Retrieve all disks from current host */ unsigned int disk_count; sg_disk_t* disk_list; - sg_host_disks(sg_host_self(), &disk_count, &disk_list); + sg_host_get_disks(sg_host_self(), &disk_count, &disk_list); for (unsigned int i = 0; i < disk_count; i++) XBT_INFO("Disk name: %s (read: %.0f B/s -- write: %.0f B/s ", sg_disk_get_name(disk_list[i]), diff --git a/examples/c/io-file-remote/io-file-remote.c b/examples/c/io-file-remote/io-file-remote.c index 7a3a38f719..26755c2fe3 100644 --- a/examples/c/io-file-remote/io-file-remote.c +++ b/examples/c/io-file-remote/io-file-remote.c @@ -56,7 +56,7 @@ int main(int argc, char** argv) for (long i = 0; i < host_count; i++) { unsigned int disk_count; sg_disk_t* disks; - sg_host_disks(hosts[i], &disk_count, &disks); + sg_host_get_disks(hosts[i], &disk_count, &disks); for (unsigned int j = 0; j < disk_count; j++) XBT_INFO("Init: %s: %llu/%llu MiB used/free on '%s@%s'", sg_host_get_name(hosts[i]), sg_disk_get_size_used(disks[j]) / INMEGA, sg_disk_get_size_free(disks[j]) / INMEGA, @@ -69,7 +69,7 @@ int main(int argc, char** argv) for (long i = 0; i < host_count; i++) { unsigned int disk_count; sg_disk_t* disks; - sg_host_disks(hosts[i], &disk_count, &disks); + sg_host_get_disks(hosts[i], &disk_count, &disks); for (unsigned int j = 0; j < disk_count; j++) XBT_INFO("End: %llu/%llu MiB used/free on '%s@%s'", sg_disk_get_size_used(disks[j]) / INMEGA, sg_disk_get_size_free(disks[j]) / INMEGA, sg_disk_get_name(disks[j]), sg_host_get_name(hosts[i])); diff --git a/examples/c/io-file-system/io-file-system.c b/examples/c/io-file-system/io-file-system.c index 988253b582..ff287cbbc3 100644 --- a/examples/c/io-file-system/io-file-system.c +++ b/examples/c/io-file-system/io-file-system.c @@ -33,7 +33,7 @@ static void host(int argc, char* argv[]) { unsigned int disk_count; sg_disk_t* disks; - sg_host_disks(sg_host_self(), &disk_count, &disks); + sg_host_get_disks(sg_host_self(), &disk_count, &disks); show_info(disk_count, disks); diff --git a/examples/c/platform-properties/platform-properties.c b/examples/c/platform-properties/platform-properties.c index ec71cb6200..7e6155705b 100644 --- a/examples/c/platform-properties/platform-properties.c +++ b/examples/c/platform-properties/platform-properties.c @@ -118,7 +118,7 @@ int main(int argc, char* argv[]) sg_host_t* hosts = sg_host_list(); for (size_t i = 0; i < host_count; i++) - XBT_INFO("Host '%s' runs at %.0f flops/s", sg_host_get_name(hosts[i]), sg_host_speed(hosts[i])); + XBT_INFO("Host '%s' runs at %.0f flops/s", sg_host_get_name(hosts[i]), sg_host_get_speed(hosts[i])); free(hosts); diff --git a/examples/c/plugin-host-load/plugin-host-load.c b/examples/c/plugin-host-load/plugin-host-load.c index f878f9f821..594d0dc6cb 100644 --- a/examples/c/plugin-host-load/plugin-host-load.c +++ b/examples/c/plugin-host-load/plugin-host-load.c @@ -20,36 +20,36 @@ static void execute_load_test(int argc, char* argv[]) XBT_INFO("Initial peak speed: %.0E flop/s; number of flops computed so far: %.0E (should be 0) and current average " "load: %.5f (should be 0)", - sg_host_speed(host), sg_host_get_computed_flops(host), sg_host_get_avg_load(host)); + sg_host_get_speed(host), sg_host_get_computed_flops(host), sg_host_get_avg_load(host)); double start = simgrid_get_clock(); XBT_INFO("Sleep for 10 seconds"); sg_actor_sleep_for(10); - double speed = sg_host_speed(host); + double speed = sg_host_get_speed(host); XBT_INFO("Done sleeping %.2fs; peak speed: %.0E flop/s; number of flops computed so far: %.0E (nothing should have " "changed)", - simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_computed_flops(host)); + simgrid_get_clock() - start, sg_host_get_speed(host), sg_host_get_computed_flops(host)); // Run a task start = simgrid_get_clock(); - XBT_INFO("Run a task of %.0E flops at current speed of %.0E flop/s", 200e6, sg_host_speed(host)); + XBT_INFO("Run a task of %.0E flops at current speed of %.0E flop/s", 200e6, sg_host_get_speed(host)); sg_actor_execute(200e6); XBT_INFO("Done working on my task; this took %.2fs; current peak speed: %.0E flop/s (when I started the computation, " "the speed was set to %.0E flop/s); number of flops computed so " "far: %.2E, average load as reported by the HostLoad plugin: %.5f (should be %.5f)", - simgrid_get_clock() - start, sg_host_speed(host), speed, sg_host_get_computed_flops(host), + simgrid_get_clock() - start, sg_host_get_speed(host), speed, sg_host_get_computed_flops(host), sg_host_get_avg_load(host), 200E6 / (10.5 * speed * sg_host_core_count(host) + - (simgrid_get_clock() - start - 0.5) * sg_host_speed(host) * sg_host_core_count(host))); + (simgrid_get_clock() - start - 0.5) * sg_host_get_speed(host) * sg_host_core_count(host))); // ========= Change power peak ========= int pstate = 1; sg_host_set_pstate(host, pstate); XBT_INFO( "========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s, average load is %.5f)", - pstate, sg_host_get_pstate_speed(host, pstate), sg_host_speed(host), sg_host_get_avg_load(host)); + pstate, sg_host_get_pstate_speed(host, pstate), sg_host_get_speed(host), sg_host_get_avg_load(host)); // Run a second task start = simgrid_get_clock(); @@ -57,7 +57,7 @@ static void execute_load_test(int argc, char* argv[]) sg_actor_execute(100e6); XBT_INFO("Done working on my task; this took %.2fs; current peak speed: %.0E flop/s; number of flops computed so " "far: %.2E", - simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_computed_flops(host)); + simgrid_get_clock() - start, sg_host_get_speed(host), sg_host_get_computed_flops(host)); start = simgrid_get_clock(); XBT_INFO("========= Requesting a reset of the computation and load counters"); @@ -67,7 +67,7 @@ static void execute_load_test(int argc, char* argv[]) XBT_INFO("Sleep for 4 seconds"); sg_actor_sleep_for(4); XBT_INFO("Done sleeping %.2f s; peak speed: %.0E flop/s; number of flops computed so far: %.0E", - simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_computed_flops(host)); + simgrid_get_clock() - start, sg_host_get_speed(host), sg_host_get_computed_flops(host)); // =========== Turn the other host off ========== XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 computed %.0f flops so far and has an " @@ -77,7 +77,7 @@ static void execute_load_test(int argc, char* argv[]) start = simgrid_get_clock(); sg_actor_sleep_for(10); XBT_INFO("Done sleeping %.2f s; peak speed: %.0E flop/s; number of flops computed so far: %.0E", - simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_computed_flops(host)); + simgrid_get_clock() - start, sg_host_get_speed(host), sg_host_get_computed_flops(host)); } static void change_speed(int argc, char* argv[]) diff --git a/examples/deprecated/simdag/scheduling/sd_scheduling.c b/examples/deprecated/simdag/scheduling/sd_scheduling.c index 0b2034950f..da272938f0 100644 --- a/examples/deprecated/simdag/scheduling/sd_scheduling.c +++ b/examples/deprecated/simdag/scheduling/sd_scheduling.c @@ -86,8 +86,8 @@ static double finish_on_at(const_SD_task_t task, const_sg_host_t host) if (SD_task_get_amount(parent) <= 1e-6){ redist_time= 0; } else { - redist_time = sg_host_route_latency(parent_host[0], host) + - SD_task_get_amount(parent) / sg_host_route_bandwidth(parent_host[0], host); + redist_time = sg_host_get_route_latency(parent_host[0], host) + + SD_task_get_amount(parent) / sg_host_get_route_bandwidth(parent_host[0], host); } data_available = SD_task_get_start_time(parent) + redist_time; } @@ -103,11 +103,12 @@ static double finish_on_at(const_SD_task_t task, const_sg_host_t host) xbt_dynar_free_container(&parents); - result = fmax(sg_host_get_available_at(host), last_data_available) + SD_task_get_amount(task) / sg_host_speed(host); + result = + fmax(sg_host_get_available_at(host), last_data_available) + SD_task_get_amount(task) / sg_host_get_speed(host); } else { xbt_dynar_free_container(&parents); - result = sg_host_get_available_at(host) + SD_task_get_amount(task)/sg_host_speed(host); + result = sg_host_get_available_at(host) + SD_task_get_amount(task) / sg_host_get_speed(host); } return result; } diff --git a/examples/deprecated/simdag/test/sd_test.cpp b/examples/deprecated/simdag/test/sd_test.cpp index 8fd8b55960..eea9731f71 100644 --- a/examples/deprecated/simdag/test/sd_test.cpp +++ b/examples/deprecated/simdag/test/sd_test.cpp @@ -43,11 +43,11 @@ int main(int argc, char **argv) XBT_INFO(" Link %s: latency = %f, bandwidth = %f", sg_link_get_name(link), sg_link_get_latency(link), sg_link_get_bandwidth(link)); - XBT_INFO("Route latency = %f, route bandwidth = %f", latency, sg_host_route_bandwidth(h1, h2)); + XBT_INFO("Route latency = %f, route bandwidth = %f", latency, sg_host_get_route_bandwidth(h1, h2)); XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount12, h1->get_cname(), h2->get_cname(), - sg_host_route_latency(h1, h2) + comm_amount12 / sg_host_route_bandwidth(h1, h2)); + sg_host_get_route_latency(h1, h2) + comm_amount12 / sg_host_get_route_bandwidth(h1, h2)); XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount21, h2->get_cname(), h1->get_cname(), - sg_host_route_latency(h2, h1) + comm_amount21 / sg_host_route_bandwidth(h2, h1)); + sg_host_get_route_latency(h2, h1) + comm_amount21 / sg_host_get_route_bandwidth(h2, h1)); /* creation of the tasks and their dependencies */ SD_task_t taskA = SD_task_create("Task A", nullptr, 10.0); diff --git a/examples/smpi/energy/energy.c b/examples/smpi/energy/energy.c index ba3eeaca76..27e67cd48d 100644 --- a/examples/smpi/energy/energy.c +++ b/examples/smpi/energy/energy.c @@ -55,8 +55,8 @@ int main(int argc, char *argv[]) for (i = 0; i < pstates; i++) { sg_host_set_pstate(sg_host_self(), i); - fprintf(stderr, "[%.6f] [rank %d] Current pstate: %d; Current power: %.0f\n", - MPI_Wtime(), rank, i, sg_host_speed(sg_host_self())); + fprintf(stderr, "[%.6f] [rank %d] Current pstate: %d; Current power: %.0f\n", MPI_Wtime(), rank, i, + sg_host_get_speed(sg_host_self())); SMPI_SAMPLE_FLOPS(1e9) { /* imagine here some code running for 1e9 flops... */ diff --git a/include/simgrid/host.h b/include/simgrid/host.h index 4e618c2d34..46dba84b12 100644 --- a/include/simgrid/host.h +++ b/include/simgrid/host.h @@ -71,11 +71,14 @@ XBT_PUBLIC xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host); * @return a dynar containing all storages (name) attached to the host */ XBT_PUBLIC xbt_dynar_t sg_host_get_attached_storage_list(const_sg_host_t host); -XBT_PUBLIC void sg_host_disks(const_sg_host_t host, unsigned int* disk_count, sg_disk_t** disks); +XBT_PUBLIC void sg_host_get_disks(const_sg_host_t host, unsigned int* disk_count, sg_disk_t** disks); +XBT_ATTRIB_DEPRECATED_v330("Please use sg_host_get_disks()") XBT_PUBLIC + void sg_host_disks(const_sg_host_t host, unsigned int* disk_count, sg_disk_t** disks); // =========== user-level functions =============== /** @brief Return the speed of the processor (in flop/s), regardless of the current load on the machine. */ -XBT_PUBLIC double sg_host_speed(const_sg_host_t host); +XBT_PUBLIC double sg_host_get_speed(const_sg_host_t host); +XBT_ATTRIB_DEPRECATED_v330("Please use sg_host_get_speed()") XBT_PUBLIC double sg_host_speed(const_sg_host_t host); XBT_PUBLIC double sg_host_get_pstate_speed(const_sg_host_t host, int pstate_index); XBT_PUBLIC double sg_host_get_available_speed(const_sg_host_t host); @@ -85,7 +88,8 @@ XBT_PUBLIC int sg_host_core_count(const_sg_host_t host); /** @brief Returns the current computation load (in flops per second). * @param host a host */ -XBT_PUBLIC double sg_host_load(const_sg_host_t host); +XBT_PUBLIC double sg_host_get_load(const_sg_host_t host); +XBT_ATTRIB_DEPRECATED_v330("Please use sg_host_get_load()") XBT_PUBLIC double sg_host_load(const_sg_host_t host); /** @brief Return the location on which the current process is running. */ XBT_PUBLIC sg_host_t sg_host_self(); @@ -135,9 +139,15 @@ XBT_PUBLIC const char* sg_host_get_property_value(const_sg_host_t host, const ch */ XBT_PUBLIC void sg_host_set_property_value(sg_host_t host, const char* name, const char* value); -XBT_PUBLIC void sg_host_route(const_sg_host_t from, const_sg_host_t to, xbt_dynar_t links); -XBT_PUBLIC double sg_host_route_latency(const_sg_host_t from, const_sg_host_t to); -XBT_PUBLIC double sg_host_route_bandwidth(const_sg_host_t from, const_sg_host_t to); +XBT_PUBLIC void sg_host_get_route(const_sg_host_t from, const_sg_host_t to, xbt_dynar_t links); +XBT_PUBLIC double sg_host_get_route_latency(const_sg_host_t from, const_sg_host_t to); +XBT_PUBLIC double sg_host_get_route_bandwidth(const_sg_host_t from, const_sg_host_t to); +XBT_ATTRIB_DEPRECATED_v330("Please use sg_host_get_route()") XBT_PUBLIC + void sg_host_route(const_sg_host_t from, const_sg_host_t to, xbt_dynar_t links); +XBT_ATTRIB_DEPRECATED_v330("Please use sg_host_get_route_latency()") XBT_PUBLIC + double sg_host_route_latency(const_sg_host_t from, const_sg_host_t to); +XBT_ATTRIB_DEPRECATED_v330("Please use sg_host_get_route_bandwidth()") XBT_PUBLIC + double sg_host_route_bandwidth(const_sg_host_t from, const_sg_host_t to); XBT_PUBLIC void sg_host_sendto(sg_host_t from, sg_host_t to, double byte_amount); #ifndef DOXYGEN diff --git a/include/simgrid/simdag.h b/include/simgrid/simdag.h index e808e0c80a..b25be60dfe 100644 --- a/include/simgrid/simdag.h +++ b/include/simgrid/simdag.h @@ -178,22 +178,22 @@ XBT_PUBLIC xbt_dynar_t SD_PTG_dotload(const char* filename); #define SD_workstation_get_name sg_host_get_name #define SD_workstation_get_by_name sg_host_by_name #define SD_workstation_dump sg_host_dump -#define SD_workstation_get_data sg_host_user -#define SD_workstation_set_data sg_host_user_set +#define SD_workstation_get_data sg_host_get_data +#define SD_workstation_set_data sg_host_set_data #define SD_workstation_get_properties sg_host_get_properties #define SD_workstation_get_property_value sg_host_get_property_value -#define SD_workstation_get_power sg_host_speed +#define SD_workstation_get_power sg_host_get_speed #define SD_workstation_get_available_power sg_host_get_available_speed -#define SD_route_get_latency sg_host_route_latency -#define SD_route_get_bandwidth sg_host_route_bandwidth +#define SD_route_get_latency sg_host_get_route_latency +#define SD_route_get_bandwidth sg_host_get_route_bandwidth #define SD_workstation_get_mounted_storage_list sg_host_get_mounted_storage_list // XBT_ATTRIB_DEPRECATED_v330 // Lost functions //SD_workstation_get_access_mode //SD_workstation_set_access_mode //SD_workstation_get_current_task -//SD_route_get_communication_time => SG_route_get_latency() + amount / SD_route_get_bandwidth() -//SD_workstation_get_computation_time => amount / sg_host_speed() +//SD_route_get_communication_time => SD_route_get_latency() + amount / SD_route_get_bandwidth() +//SD_workstation_get_computation_time => amount / sg_host_get_speed() //SD_route_get_size //SD_route_get_list //TRACE_sd_set_task_category diff --git a/src/bindings/java/jmsg_host.cpp b/src/bindings/java/jmsg_host.cpp index 655f1ed813..d6bc9fde49 100644 --- a/src/bindings/java/jmsg_host.cpp +++ b/src/bindings/java/jmsg_host.cpp @@ -159,7 +159,7 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getSpeed(JNIEnv * env, jobje return -1; } - return (jdouble)sg_host_speed(host); + return (jdouble)sg_host_get_speed(host); } JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCoreNumber(JNIEnv * env, jobject jhost) { @@ -364,7 +364,7 @@ JNIEXPORT jint JNICALL Java_org_simgrid_msg_Host_getPstatesCount(JNIEnv* env, jo JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCurrentPowerPeak(JNIEnv* env, jobject jhost) { const_sg_host_t host = jhost_get_native(env, jhost); - return sg_host_speed(host); + return sg_host_get_speed(host); } JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getPowerPeakAt(JNIEnv* env, jobject jhost, jint pstate) { @@ -375,7 +375,7 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getPowerPeakAt(JNIEnv* env, JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getLoad(JNIEnv* env, jobject jhost) { const_sg_host_t host = jhost_get_native(env, jhost); - return sg_host_load(host); + return sg_host_get_load(host); } JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCurrentLoad (JNIEnv *env, jobject jhost) diff --git a/src/msg/msg_legacy.cpp b/src/msg/msg_legacy.cpp index aa909f4db7..4d0d80acc4 100644 --- a/src/msg/msg_legacy.cpp +++ b/src/msg/msg_legacy.cpp @@ -347,7 +347,7 @@ xbt_dynar_t MSG_host_get_attached_storage_lists(const_sg_host_t host) } double MSG_host_get_speed(const_sg_host_t host) { - return sg_host_speed(host); + return sg_host_get_speed(host); } double MSG_host_get_power_peak_at(const_sg_host_t host, int pstate_index) { @@ -404,7 +404,7 @@ sg_host_t MSG_host_self() double MSG_host_get_load(const_sg_host_t host) { - return sg_host_load(host); + return sg_host_get_load(host); } /* ************************** Virtual Machines *************************** */ sg_vm_t MSG_vm_create_core(sg_host_t pm, const char* name) diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index 60a4edcb57..7a6c9c1492 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -399,7 +399,7 @@ void sg_host_user_destroy(sg_host_t host) // XBT_ATTRIB_DEPRECATED_v328 } // ========= storage related functions ============ -void sg_host_disks(const_sg_host_t host, unsigned int* disk_count, sg_disk_t** disks) +void sg_host_get_disks(const_sg_host_t host, unsigned int* disk_count, sg_disk_t** disks) { std::vector list = host->get_disks(); *disk_count = list.size(); @@ -408,6 +408,11 @@ void sg_host_disks(const_sg_host_t host, unsigned int* disk_count, sg_disk_t** d (*disks)[i] = list[i]; } +void sg_host_disks(const_sg_host_t host, unsigned int* disk_count, sg_disk_t** disks) // XBT_ATTRIB_DEPRECATED_v330 +{ + sg_host_get_disks(host, disk_count, disks); +} + xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host) // XBT_ATTRIB_DEPRECATED_v330 { xbt_assert((host != nullptr), "Invalid parameters"); @@ -433,11 +438,16 @@ xbt_dynar_t sg_host_get_attached_storage_list(const_sg_host_t host) // =========== user-level functions =============== // ================================================ /** @brief Returns the total speed of a host */ -double sg_host_speed(const_sg_host_t host) +double sg_host_get_speed(const_sg_host_t host) { return host->get_speed(); } +double sg_host_speed(const_sg_host_t host) // XBT_ATTRIB_DEPRECATED_v330 +{ + return sg_host_get_speed(host); +} + /** @brief Return the speed of the processor (in flop/s) at a given pstate. See also @ref plugin_energy. * * @param host host to test @@ -566,7 +576,7 @@ void sg_host_set_property_value(sg_host_t host, const char* name, const char* va * @param to where to * @param links [OUT] where to store the list of links (must exist, cannot be nullptr). */ -void sg_host_route(const_sg_host_t from, const_sg_host_t to, xbt_dynar_t links) +void sg_host_get_route(const_sg_host_t from, const_sg_host_t to, xbt_dynar_t links) { std::vector vlinks; from->route_to(to, vlinks, nullptr); @@ -579,7 +589,7 @@ void sg_host_route(const_sg_host_t from, const_sg_host_t to, xbt_dynar_t links) * @param from where from * @param to where to */ -double sg_host_route_latency(const_sg_host_t from, const_sg_host_t to) +double sg_host_get_route_latency(const_sg_host_t from, const_sg_host_t to) { std::vector vlinks; double res = 0; @@ -592,7 +602,7 @@ double sg_host_route_latency(const_sg_host_t from, const_sg_host_t to) * @param from where from * @param to where to */ -double sg_host_route_bandwidth(const_sg_host_t from, const_sg_host_t to) +double sg_host_get_route_bandwidth(const_sg_host_t from, const_sg_host_t to) { double min_bandwidth = -1.0; @@ -606,6 +616,21 @@ double sg_host_route_bandwidth(const_sg_host_t from, const_sg_host_t to) return min_bandwidth; } +void sg_host_route(const_sg_host_t from, const_sg_host_t to, xbt_dynar_t links) // XBT_ATTRIB_DEPRECATED_v330 +{ + sg_host_get_route(from, to, links); +} + +double sg_host_route_latency(const_sg_host_t from, const_sg_host_t to) // XBT_ATTRIB_DEPRECATED_v330 +{ + return sg_host_get_route_latency(from, to); +} + +double sg_host_route_bandwidth(const_sg_host_t from, const_sg_host_t to) // XBT_ATTRIB_DEPRECATED_v330 +{ + return sg_host_get_route_bandwidth(from, to); +} + void sg_host_sendto(sg_host_t from, sg_host_t to, double byte_amount) { from->sendto(to, byte_amount); @@ -656,7 +681,12 @@ const char* sg_host_self_get_name() return res; } -double sg_host_load(const_sg_host_t host) +double sg_host_get_load(const_sg_host_t host) { return host->get_load(); } + +double sg_host_load(const_sg_host_t host) // XBT_ATTRIB_DEPRECATED_v330 +{ + return sg_host_get_load(host); +} diff --git a/src/simdag/sd_task.cpp b/src/simdag/sd_task.cpp index d57878bd62..43b1489ead 100644 --- a/src/simdag/sd_task.cpp +++ b/src/simdag/sd_task.cpp @@ -691,8 +691,8 @@ double SD_task_get_execution_time(const_SD_task_t /*task*/, int host_count, cons if (bytes_amount != nullptr) for (int j = 0; j < host_count; j++) if (bytes_amount[i * host_count + j] != 0) - time += (sg_host_route_latency(host_list[i], host_list[j]) + - bytes_amount[i * host_count + j] / sg_host_route_bandwidth(host_list[i], host_list[j])); + time += (sg_host_get_route_latency(host_list[i], host_list[j]) + + bytes_amount[i * host_count + j] / sg_host_get_route_bandwidth(host_list[i], host_list[j])); if (time > max_time) max_time = time; diff --git a/src/smpi/internals/smpi_bench.cpp b/src/smpi/internals/smpi_bench.cpp index c5bd2a073f..9d8fb0b44e 100644 --- a/src/smpi/internals/smpi_bench.cpp +++ b/src/smpi/internals/smpi_bench.cpp @@ -66,7 +66,7 @@ void smpi_execute(double duration) void smpi_execute_benched(double duration) { smpi_bench_end(); - double speed = sg_host_speed(sg_host_self()); + double speed = sg_host_get_speed(sg_host_self()); smpi_execute_flops(duration*speed); smpi_bench_begin(); } diff --git a/teshsuite/simdag/basic-parsing-test/basic-parsing-test.c b/teshsuite/simdag/basic-parsing-test/basic-parsing-test.c index b1088ef97b..2cde1fcddf 100644 --- a/teshsuite/simdag/basic-parsing-test/basic-parsing-test.c +++ b/teshsuite/simdag/basic-parsing-test/basic-parsing-test.c @@ -25,15 +25,15 @@ int main(int argc, char **argv) fprintf(stderr, "Route between %s and %s\n", name1, name2); xbt_dynar_t route = xbt_dynar_new(sizeof(SD_link_t), NULL); - sg_host_route(h1, h2, route); + sg_host_get_route(h1, h2, route); fprintf(stderr, "Route size %lu\n", xbt_dynar_length(route)); unsigned int i; SD_link_t link; xbt_dynar_foreach(route, i, link) fprintf(stderr, " Link %s: latency = %f, bandwidth = %f\n", sg_link_get_name(link), sg_link_get_latency(link), sg_link_get_bandwidth(link)); - fprintf(stderr, "Route latency = %f, route bandwidth = %f\n", - sg_host_route_latency(h1, h2), sg_host_route_bandwidth(h1, h2)); + fprintf(stderr, "Route latency = %f, route bandwidth = %f\n", sg_host_get_route_latency(h1, h2), + sg_host_get_route_bandwidth(h1, h2)); xbt_dynar_free_container(&route); } if (!strcmp(argv[2], "FULL_LINK")) { @@ -46,15 +46,15 @@ int main(int argc, char **argv) const char *name2 = sg_host_get_name(h2); fprintf(stderr, "Route between %s and %s\n", name1, name2); xbt_dynar_t route = xbt_dynar_new(sizeof(SD_link_t), NULL); - sg_host_route(h1, h2, route); + sg_host_get_route(h1, h2, route); fprintf(stderr, " Route size %lu\n", xbt_dynar_length(route)); unsigned int k; SD_link_t link; xbt_dynar_foreach(route, k, link) fprintf(stderr, " Link %s: latency = %f, bandwidth = %f\n", sg_link_get_name(link), sg_link_get_latency(link), sg_link_get_bandwidth(link)); - fprintf(stderr, " Route latency = %f, route bandwidth = %f\n", - sg_host_route_latency(h1, h2), sg_host_route_bandwidth(h1, h2)); + fprintf(stderr, " Route latency = %f, route bandwidth = %f\n", sg_host_get_route_latency(h1, h2), + sg_host_get_route_bandwidth(h1, h2)); xbt_dynar_free_container(&route); } } diff --git a/teshsuite/simdag/flatifier/flatifier.cpp b/teshsuite/simdag/flatifier/flatifier.cpp index af95d1c4eb..40bb84aa09 100644 --- a/teshsuite/simdag/flatifier/flatifier.cpp +++ b/teshsuite/simdag/flatifier/flatifier.cpp @@ -49,7 +49,7 @@ static void dump_hosts() [](const_sg_host_t a, const_sg_host_t b) { return strcmp(sg_host_get_name(a), sg_host_get_name(b)) < 0; }); for (size_t i = 0; i < totalHosts; i++) { - std::printf(" get_cname(), sg_host_speed(hosts[i])); + std::printf(" get_cname(), sg_host_get_speed(hosts[i])); const std::unordered_map* props = hosts[i]->get_properties(); if (hosts[i]->get_core_count() > 1) { std::printf(" core=\"%d\"", hosts[i]->get_core_count());