- int alias_count = 0;
- char** aliases = NULL;
- m_task_t *todo = NULL;
- int number_of_tasks = 0;
- double task_comp_size = 0;
- double task_comm_size = 0;
-
-
- int i;
-
- xbt_assert1(sscanf(argv[1],"%d", &number_of_tasks),"Invalid argument %s\n",argv[1]);
- xbt_assert1(sscanf(argv[2],"%lg", &task_comp_size),"Invalid argument %s\n",argv[2]);
- xbt_assert1(sscanf(argv[3],"%lg", &task_comm_size),"Invalid argument %s\n",argv[3]);
-
- {
- /* Task creation */
- char sprintf_buffer[64];
-
- todo = xbt_new0(m_task_t,number_of_tasks);
-
- for (i = 0; i < number_of_tasks; i++)
- {
- sprintf(sprintf_buffer, "Task_%d", i);
- todo[i] = MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL);
- }
- }
-
- {
- /* Process organisation */
- alias_count = argc - 4;
- aliases = xbt_new0(char*,alias_count);
-
- for(i = 4; i < argc; i++)
- {
- aliases[i-4] = strdup(argv[i]);
- }
- }
-
- INFO2("Got %d aliases and %d tasks to process", alias_count,number_of_tasks);
-
- for (i = 0; i < alias_count; i++)
- DEBUG1("%s", aliases[i]);
-
- for (i = 0; i < number_of_tasks; i++)
- {
- INFO2("Sending \"%s\" to \"%s\"",todo[i]->name,aliases[i % alias_count]);
-
- if(!strcmp(MSG_host_get_name(MSG_host_self()), aliases[i % alias_count]))
- {
- INFO0("Hey ! It's me ! :)");
- }
-
- MSG_task_send(todo[i], aliases[i % alias_count]);
- INFO0("Sent");
- }
-
- INFO0("All tasks have been dispatched. Let's tell everybody the computation is over.");
-
- for (i = 0; i < alias_count; i++)
- MSG_task_send(MSG_task_create("finalize", 0, 0, FINALIZE),aliases[i]);
-
- INFO0("Goodbye now!");
-
- for(i = 0; i < alias_count; i++)
- free(aliases[i]);
-
- free(aliases);
- free(todo);
- return 0;
-} /* end_of_master */
+ int alias_count = 0;
+ char **aliases = NULL;
+ m_task_t *todo = NULL;
+ int number_of_tasks = 0;
+ double task_comp_size = 0;
+ double task_comm_size = 0;
+ int i;
+ int read;
+
+ read = sscanf(argv[1], "%d", &number_of_tasks);
+ xbt_assert(read, "Invalid argument %s\n", argv[1]);
+ read = sscanf(argv[2], "%lg", &task_comp_size);
+ xbt_assert(read, "Invalid argument %s\n", argv[2]);
+ read = sscanf(argv[3], "%lg", &task_comm_size);
+ xbt_assert(read, "Invalid argument %s\n", argv[3]);
+
+ {
+ /* Task creation */
+ char sprintf_buffer[64];
+
+ todo = xbt_new0(m_task_t, number_of_tasks);
+
+ for (i = 0; i < number_of_tasks; i++) {
+ sprintf(sprintf_buffer, "Task_%d", i);
+ todo[i] =
+ MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size,
+ NULL);
+ }
+ }
+
+ {
+ /* Process organisation */
+ alias_count = argc - 4;
+ aliases = xbt_new0(char *, alias_count);
+
+ for (i = 4; i < argc; i++) {
+ aliases[i - 4] = strdup(argv[i]);
+ }
+ }
+
+ XBT_INFO("Got %d aliases and %d tasks to process", alias_count,
+ number_of_tasks);
+
+ for (i = 0; i < alias_count; i++)
+ XBT_DEBUG("%s", aliases[i]);
+
+ for (i = 0; i < number_of_tasks; i++) {
+ XBT_INFO("Sending \"%s\" to \"%s\"", todo[i]->name,
+ aliases[i % alias_count]);
+
+ if (!strcmp
+ (MSG_host_get_name(MSG_host_self()), aliases[i % alias_count])) {
+ XBT_INFO("Hey ! It's me ! :)");
+ }
+
+ MSG_task_send(todo[i], aliases[i % alias_count]);
+ XBT_INFO("Sent");
+ }
+
+ XBT_INFO
+ ("All tasks have been dispatched. Let's tell everybody the computation is over.");
+
+ for (i = 0; i < alias_count; i++)
+ MSG_task_send(MSG_task_create("finalize", 0, 0, FINALIZE), aliases[i]);
+
+ XBT_INFO("Goodbye now!");
+
+ for (i = 0; i < alias_count; i++)
+ free(aliases[i]);
+
+ free(aliases);
+ free(todo);
+ return 0;
+} /* end_of_master */