-/* Copyright (c) 2007-2012. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2014. The SimGrid Team.
+ * All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* Launch VMs and worker processes. One VM per PM, and one worker process per VM. */
- XBT_INFO("Launch %ld 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);
XBT_INFO("put %s on %s", pr_name, vm_name);
MSG_process_create_with_arguments(pr_name, worker_fun, NULL, vm, 2, wrk_argv);
+ xbt_free(vm_name);
}
XBT_INFO("put %s on %s", pr_name, vm_name);
MSG_process_create_with_arguments(pr_name, worker_fun, NULL, vm, 2, wrk_argv);
+ xbt_free(vm_name);
}
XBT_INFO("Send a task to %d worker process", workers_count * 2);
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;
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("Bye (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);