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
add a missing file and add MSG_vm_set_bound
[simgrid.git]
/
examples
/
msg
/
cloud
/
masterslave_virtual_machines.c
diff --git
a/examples/msg/cloud/masterslave_virtual_machines.c
b/examples/msg/cloud/masterslave_virtual_machines.c
index
4a6c657
..
830739a
100644
(file)
--- a/
examples/msg/cloud/masterslave_virtual_machines.c
+++ b/
examples/msg/cloud/masterslave_virtual_machines.c
@@
-53,14
+53,14
@@
int master_fun(int argc, char *argv[])
msg_host_t *pms = xbt_new(msg_host_t, workers_count);
xbt_dynar_t vms = xbt_dynar_new(sizeof(msg_vm_t), NULL);
msg_host_t *pms = xbt_new(msg_host_t, workers_count);
xbt_dynar_t vms = xbt_dynar_new(sizeof(msg_vm_t), NULL);
- /* Retrive the PMs that will launch worker processes. */
+ /* Retri
e
ve the PMs that will launch worker processes. */
for (i = 1; i < argc; i++)
pms[i - 1] = MSG_get_host_by_name(argv[i]);
/* Launch VMs and worker processes. One VM per PM, and one worker process per VM. */
for (i = 1; i < argc; i++)
pms[i - 1] = MSG_get_host_by_name(argv[i]);
/* Launch VMs and worker processes. One VM per PM, and one worker process per VM. */
- XBT_INFO("Launch %
l
d VMs", workers_count);
+ XBT_INFO("Launch %d VMs", workers_count);
for (i=0; i< workers_count; i++) {
char *vm_name = bprintf("VM%02d", i);
char *pr_name = bprintf("WRK%02d", i);
for (i=0; i< workers_count; i++) {
char *vm_name = bprintf("VM%02d", i);
char *pr_name = bprintf("WRK%02d", i);
@@
-73,6
+73,12
@@
int master_fun(int argc, char *argv[])
XBT_INFO("create %s", vm_name);
msg_vm_t vm = MSG_vm_create_core(pms[i], vm_name);
XBT_INFO("create %s", vm_name);
msg_vm_t vm = MSG_vm_create_core(pms[i], vm_name);
+
+ s_ws_params_t params;
+ memset(¶ms, 0, sizeof(params));
+ params.ramsize = 1L * 1024 * 1024 * 1024; // 1Gbytes
+ MSG_host_set_params(vm, ¶ms);
+
MSG_vm_start(vm);
xbt_dynar_push(vms, &vm);
MSG_vm_start(vm);
xbt_dynar_push(vms, &vm);
@@
-222,7
+228,7
@@
int main(int argc, char *argv[])
return 1;
}
return 1;
}
- msg_host_t master_pm;
+ msg_host_t master_pm
= NULL
;
char **master_argv = xbt_new(char *, 12);
master_argv[0] = xbt_strdup("master");
master_argv[11] = NULL;
char **master_argv = xbt_new(char *, 12);
master_argv[0] = xbt_strdup("master");
master_argv[11] = NULL;
@@
-241,12
+247,13
@@
int main(int argc, char *argv[])
break;
}
break;
}
+ msg_error_t res = 1;
+ if (master_pm!=NULL){
+ MSG_process_create_with_arguments("master", master_fun, NULL, master_pm, nb_hosts + 1, master_argv);
- MSG_process_create_with_arguments("master", master_fun, NULL, master_pm, nb_hosts + 1, master_argv);
-
- msg_error_t res = MSG_main();
- XBT_INFO("Simulation time %g", MSG_get_clock());
-
+ res = MSG_main();
+ XBT_INFO("Bye (simulation time %g)", MSG_get_clock());
+ }
xbt_dynar_free(&hosts_dynar);
return !(res == MSG_OK);
xbt_dynar_free(&hosts_dynar);
return !(res == MSG_OK);