A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Merge branch 'clean_events' of github.com:Takishipp/simgrid into clean_events
[simgrid.git]
/
examples
/
msg
/
cloud-simple
/
cloud-simple.c
diff --git
a/examples/msg/cloud-simple/cloud-simple.c
b/examples/msg/cloud-simple/cloud-simple.c
index
4140f38
..
74d1314
100644
(file)
--- a/
examples/msg/cloud-simple/cloud-simple.c
+++ b/
examples/msg/cloud-simple/cloud-simple.c
@@
-86,7
+86,7
@@
static void launch_communication_worker(msg_host_t tx_host, msg_host_t rx_host)
{
char *mbox = bprintf("MBOX:%s-%s", MSG_host_get_name(tx_host), MSG_host_get_name(rx_host));
char **argv = NULL;
-
+
const char *pr_name_tx = "comm_tx";
argv = xbt_new(char *, 3);
argv[0] = xbt_strdup(pr_name_tx);
@@
-95,7
+95,7
@@
static void launch_communication_worker(msg_host_t tx_host, msg_host_t rx_host)
MSG_process_create_with_arguments(pr_name_tx, communication_tx_fun, NULL, tx_host, 2, argv);
- const char *pr_name_rx = "comm_rx";
+ const char *pr_name_rx = "comm_rx";
argv = xbt_new(char *, 3);
argv[0] = xbt_strdup(pr_name_rx);
argv[1] = xbt_strdup(mbox);
@@
-109,12
+109,9
@@
static void launch_communication_worker(msg_host_t tx_host, msg_host_t rx_host)
static int master_main(int argc, char *argv[])
{
- xbt_dynar_t hosts_dynar = MSG_hosts_as_dynar();
- msg_host_t pm0 = xbt_dynar_get_as(hosts_dynar, 0, msg_host_t);
- msg_host_t pm1 = xbt_dynar_get_as(hosts_dynar, 1, msg_host_t);
- msg_host_t pm2 = xbt_dynar_get_as(hosts_dynar, 2, msg_host_t);
- msg_vm_t vm0, vm1;
-
+ msg_host_t pm0 = MSG_host_by_name("Fafard");
+ msg_host_t pm1 = MSG_host_by_name("Tremblay");
+ msg_host_t pm2 = MSG_host_by_name("Bourassa");
XBT_INFO("## Test 1 (started): check computation on normal PMs");
@@
-137,7
+134,7
@@
static int master_main(int argc, char *argv[])
XBT_INFO("## Test 2 (started): check impact of running a task inside a VM (there is no degradation for the moment)");
XBT_INFO("### Put a VM on a PM, and put a task to the VM");
- vm0 = MSG_vm_create_core(pm0, "VM0");
+
msg_vm_t
vm0 = MSG_vm_create_core(pm0, "VM0");
MSG_vm_start(vm0);
launch_computation_worker(vm0);
MSG_process_sleep(2);
@@
-161,7
+158,7
@@
static int master_main(int argc, char *argv[])
XBT_INFO("### Put two VMs on a PM, and put a task to each VM");
vm0 = MSG_vm_create_core(pm0, "VM0");
- vm1 = MSG_vm_create_core(pm0, "VM1");
+
msg_vm_t
vm1 = MSG_vm_create_core(pm0, "VM1");
MSG_vm_start(vm0);
MSG_vm_start(vm1);
launch_computation_worker(vm0);
@@
-239,12
+236,11
@@
static int master_main(int argc, char *argv[])
" network one");
XBT_INFO("### Relocate VM0 between PM0 and PM1");
vm0 = MSG_vm_create_core(pm0, "VM0");
- {
- s_vm_params_t params;
- memset(¶ms, 0, sizeof(params));
- params.ramsize = 1L * 1024 * 1024 * 1024; // 1Gbytes
- MSG_host_set_params(vm0, ¶ms);
- }
+ s_vm_params_t params;
+ memset(¶ms, 0, sizeof(params));
+ params.ramsize = 1L * 1024 * 1024 * 1024; // 1Gbytes
+ MSG_vm_set_params(vm0, ¶ms);
+
MSG_vm_start(vm0);
launch_communication_worker(vm0, pm2);
MSG_process_sleep(0.01);
@@
-255,7
+251,6
@@
static int master_main(int argc, char *argv[])
MSG_vm_destroy(vm0);
XBT_INFO("## Test 6 (ended)");
- xbt_dynar_free(&hosts_dynar);
return 0;
}
@@
-275,16
+270,16
@@
int main(int argc, char *argv[])
MSG_init(&argc, argv);
/* load the platform file */
- xbt_assert(argc == 2);
- MSG_create_environment(argv[1]);
+ const char* platform = "../../platforms/small_platform.xml";
+ if (argc == 2)
+ platform = argv[1];
+ MSG_create_environment(platform);
- xbt_dynar_t hosts_dynar = MSG_hosts_as_dynar();
- msg_host_t pm0 = xbt_dynar_get_as(hosts_dynar, 0, msg_host_t);
+ msg_host_t pm0 = MSG_host_by_name("Fafard");
launch_master(pm0);
int res = MSG_main();
XBT_INFO("Bye (simulation time %g)", MSG_get_clock());
- xbt_dynar_free(&hosts_dynar);
return !(res == MSG_OK);
}