case TRACING_COMPUTING:
fprintf(trace_file, "%s compute %f\n", process_id, extra->comp_size);
break;
+ case TRACING_SLEEPING:
+ fprintf(trace_file, "%s sleep %f\n", process_id, extra->sleep_duration);
+ break;
case TRACING_GATHERV: // rank gatherv send_size [recvcounts] root (sendtype) (recvtype)
fprintf(trace_file, "%s gatherv %d ", process_id, extra->send_size);
for (i = 0; i < extra->num_processes; i++)
#define OPT_TRACING_SMPI "tracing/smpi"
#define OPT_TRACING_SMPI_GROUP "tracing/smpi/group"
#define OPT_TRACING_SMPI_COMPUTING "tracing/smpi/computing"
+#define OPT_TRACING_SMPI_SLEEPING "tracing/smpi/sleeping"
#define OPT_TRACING_SMPI_INTERNALS "tracing/smpi/internals"
#define OPT_TRACING_DISPLAY_SIZES "tracing/smpi/display_sizes"
#define OPT_TRACING_FORMAT "tracing/smpi/format"
static int trace_smpi_enabled;
static int trace_smpi_grouped;
static int trace_smpi_computing;
+static int trace_smpi_sleeping;
static int trace_view_internals;
static int trace_categorized;
static int trace_uncategorized;
trace_smpi_enabled = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_SMPI);
trace_smpi_grouped = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_SMPI_GROUP);
trace_smpi_computing = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_SMPI_COMPUTING);
+ trace_smpi_sleeping = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_SMPI_SLEEPING);
trace_view_internals = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_SMPI_INTERNALS);
trace_categorized = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_CATEGORIZED);
trace_uncategorized = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_UNCATEGORIZED);
return trace_smpi_computing;
}
+int TRACE_smpi_is_sleeping(void)
+{
+ return trace_smpi_sleeping;
+}
+
int TRACE_smpi_view_internals(void)
{
return trace_view_internals;
xbt_cfgelm_boolean, 1, 1, NULL, NULL);
xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_SMPI_COMPUTING, "no");
+/* smpi sleeping */
+ xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_SMPI_SLEEPING,
+ "Generate states for timing out of SMPI parts of the application",
+ xbt_cfgelm_boolean, 1, 1, NULL, NULL);
+ xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_SMPI_SLEEPING, "no");
+
+
/* smpi internals */
xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_SMPI_INTERNALS,
"View internal messages sent by Collective communications in SMPI",
" This option aims at tracing computations in the application, outside SMPI\n"
" to allow further study of simulated or real computation time",
detailed);
+ print_line (OPT_TRACING_SMPI_SLEEPING, "Generates a \" Sleeping \" State",
+ " This option aims at tracing sleeps in the application, outside SMPI\n"
+ " to allow further study of simulated or real sleep time",
+ detailed);
print_line (OPT_TRACING_SMPI_INTERNALS, "Generates tracing events corresponding",
" to point-to-point messages sent by collective communications",
detailed);
XBT_PUBLIC(int) TRACE_smpi_is_enabled(void);
XBT_PUBLIC(int) TRACE_smpi_is_grouped(void);
XBT_PUBLIC(int) TRACE_smpi_is_computing(void);
+XBT_PUBLIC(int) TRACE_smpi_is_sleeping(void);
XBT_PUBLIC(int) TRACE_smpi_view_internals(void);
/* from resource_utilization.c */
TRACING_ALLGATHERV,
TRACING_REDUCE_SCATTER,
TRACING_COMPUTING,
+ TRACING_SLEEPING,
TRACING_SCAN,
TRACING_EXSCAN
} e_caller_type ;
int send_size;
int recv_size;
double comp_size;
+ double sleep_duration;
int src;
int dst;
int root;
"exscan", "1 0.54 0.25",
"scatterv", "0.52 0 0.52",
"scatter", "1 0.74 0.54",
+
"computing", "0 1 1",
+ "sleeping", "0 0.5 0.5",
+
"init", "0 1 0",
"finalize", "0 1 0",
NULL, NULL,
new_pajePopState (SIMIX_get_clock(), container, type);
}
+void TRACE_smpi_sleeping_init(int rank)
+{
+ //first use, initialize the color in the trace
+ //TODO : check with lucas and Pierre how to generalize this approach
+ //to avoid unnecessary access to the color array
+ if (!TRACE_smpi_is_enabled() || !TRACE_smpi_is_sleeping()) return;
+
+ char str[INSTR_DEFAULT_STR_SIZE];
+ smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
+ container_t container = PJ_container_get (str);
+ type_t type = PJ_type_get ("MPI_STATE", container->type);
+ const char *color = instr_find_color ("sleeping");
+ val_t value = PJ_value_get_or_new ("sleeping", color, type);
+ new_pajePushState (SIMIX_get_clock(), container, type, value);
+}
+
+void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra)
+{
+ //do not forget to set the color first, otherwise this will explode
+ if (!TRACE_smpi_is_enabled()|| !TRACE_smpi_is_sleeping()) {
+ cleanup_extra_data(extra);
+ return;
+ }
+
+ char str[INSTR_DEFAULT_STR_SIZE];
+ smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
+ container_t container = PJ_container_get (str);
+ type_t type = PJ_type_get ("MPI_STATE", container->type);
+ val_t value = PJ_value_get_or_new ("sleeping", NULL, type);
+ new_pajePushStateWithExtra (SIMIX_get_clock(), container, type, value, (void*)extra);
+}
+
+void TRACE_smpi_sleeping_out(int rank)
+{
+ if (!TRACE_smpi_is_enabled()|| !TRACE_smpi_is_sleeping()) return;
+ char str[INSTR_DEFAULT_STR_SIZE];
+ smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
+ container_t container = PJ_container_get (str);
+ type_t type = PJ_type_get ("MPI_STATE", container->type);
+ new_pajePopState (SIMIX_get_clock(), container, type);
+}
+
+
void TRACE_smpi_testing_in(int rank, instr_extra_data extra)
{
//do not forget to set the color first, otherwise this will explode
void TRACE_smpi_computing_init(int rank);
void TRACE_smpi_computing_out(int rank);
void TRACE_smpi_computing_in(int rank, instr_extra_data extra);
+void TRACE_smpi_sleeping_init(int rank);
+void TRACE_smpi_sleeping_out(int rank);
+void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra);
void TRACE_smpi_testing_out(int rank);
void TRACE_smpi_testing_in(int rank, instr_extra_data extra);
void TRACE_smpi_alloc(void);
smpi_execute(xbt_os_timer_elapsed(timer));
}
-unsigned int smpi_sleep(unsigned int secs)
+/* Private sleep function used by smpi_sleep() and smpi_usleep() */
+static unsigned int private_sleep(double secs)
{
- smx_action_t action;
-
smpi_bench_end();
- double flops = (double) secs*simcall_host_get_speed(SIMIX_host_self());
- XBT_DEBUG("Sleep for: %f flops", flops);
- action = simcall_host_execute("computation", SIMIX_host_self(), flops, 1, 0, 0);
+ XBT_DEBUG("Sleep for: %lf secs", secs);
#ifdef HAVE_TRACING
- simcall_set_category (action, TRACE_internal_smpi_get_category());
- #endif
- simcall_host_execution_wait(action);
+ int rank = smpi_comm_rank(MPI_COMM_WORLD);
+ instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
+ extra->type=TRACING_SLEEPING;
+ extra->sleep_duration=secs;
+ TRACE_smpi_sleeping_in(rank, extra);
+#endif
+ simcall_process_sleep(secs);
+#ifdef HAVE_TRACING
+ TRACE_smpi_sleeping_out(rank);
+#endif
smpi_bench_begin();
return 0;
}
-int smpi_usleep(useconds_t usecs)
+unsigned int smpi_sleep(unsigned int secs)
{
- smx_action_t action;
-
- smpi_bench_end();
-
- double flops = (double) (usecs/1000000.0)*simcall_host_get_speed(SIMIX_host_self());
- XBT_DEBUG("Sleep for: %f flops", flops);
- action = simcall_host_execute("computation", SIMIX_host_self(), flops, 1, 0, 0);
- #ifdef HAVE_TRACING
- simcall_set_category (action, TRACE_internal_smpi_get_category());
- #endif
- simcall_host_execution_wait(action);
+ return private_sleep((double)secs);
+}
- smpi_bench_begin();
- return 0;
+int smpi_usleep(useconds_t usecs)
+{
+ return (int)private_sleep((double)usecs / 1000000.0);
}