src/replay/replay
src/testall
teshsuite/bug-17132/bug-17132
-teshsuite/smpi/allgather_coll
-teshsuite/smpi/allgatherv_coll
-teshsuite/smpi/allreduce_coll
-teshsuite/smpi/alltoall_coll
-teshsuite/smpi/alltoallv_coll
-teshsuite/smpi/barrier_coll
+teshsuite/smpi/allgather/allgather_coll
+teshsuite/smpi/allgatherv/allgatherv_coll
+teshsuite/smpi/allreduce/allreduce_coll
+teshsuite/smpi/alltoall/alltoall_coll
+teshsuite/smpi/alltoallv/alltoallv_coll
+teshsuite/smpi/barrier/barrier_coll
teshsuite/smpi/bcast_coll
-teshsuite/smpi/gather_coll
+teshsuite/smpi/gather/gather_coll
teshsuite/smpi/reduce_coll
teshsuite/smpi/reduce_scatter_coll
teshsuite/smpi/allreduce
-teshsuite/smpi/alltoall2
-teshsuite/smpi/alltoall_basic
+teshsuite/smpi/alltoall/alltoall2
+teshsuite/smpi/alltoall/alltoall_basic
teshsuite/smpi/alltoallv
teshsuite/smpi/bcast
teshsuite/smpi/compute
teshsuite/smpi/compute2
teshsuite/smpi/compute3
teshsuite/smpi/dsend
-teshsuite/smpi/hvector_test
-teshsuite/smpi/indexed_test
+teshsuite/smpi/hvector/hvector_test
+teshsuite/smpi/indexed/indexed_test
teshsuite/smpi/pingpong
teshsuite/smpi/reduce
teshsuite/smpi/scatter
teshsuite/smpi/shared
teshsuite/smpi/smpi_sendrecv
teshsuite/smpi/split
-teshsuite/smpi/struct_test
+teshsuite/smpi/struct/struct_test
teshsuite/smpi/ttest01
-teshsuite/smpi/vector_test
+teshsuite/smpi/vector/vector_test
teshsuite/smpi/mpich-test/*/*.out
teshsuite/smpi/mpich-test/*/*.stdo
teshsuite/smpi/mpich-test/coll/allgatherf
teshsuite/smpi/mpich3-test/pt2pt/sendself
teshsuite/smpi/mpich3-test/pt2pt/waitany-null
teshsuite/smpi/mpich3-test/pt2pt/waittestnull
+teshsuite/smpi/mpich3-test/topo/cartcreates
+teshsuite/smpi/mpich3-test/topo/cartshift1
+teshsuite/smpi/mpich3-test/topo/cartsuball
+teshsuite/smpi/mpich3-test/topo/cartzero
teshsuite/msg/host_on_off
teshsuite/msg/process
+teshsuite/msg/process_join/process_join
teshsuite/msg/storage/storage_basic
teshsuite/msg/task_destroy_cancel
teshsuite/msg/pid
teshsuite/simix/check_defaults
teshsuite/simix/stack_overflow
teshsuite/simdag/availability/availability_test
-teshsuite/simdag/basic0
-teshsuite/simdag/basic1
-teshsuite/simdag/basic2
-teshsuite/simdag/basic3
-teshsuite/simdag/basic4
-teshsuite/simdag/basic5
-teshsuite/simdag/basic6
+teshsuite/simdag/basic/basic0
+teshsuite/simdag/basic/basic1
+teshsuite/simdag/basic/basic2
+teshsuite/simdag/basic/basic3
+teshsuite/simdag/basic/basic4
+teshsuite/simdag/basic/basic5
+teshsuite/simdag/basic/basic6
teshsuite/simdag/incomplete
teshsuite/simdag/network/mxn/test_intra_all2all
teshsuite/simdag/network/mxn/test_intra_independent_comm
teshsuite/simdag/platforms/basic_link_test
teshsuite/simdag/platforms/evaluate_get_route_time
teshsuite/simdag/platforms/evaluate_parse_time
+teshsuite/simdag/platforms/graphicator
teshsuite/simdag/partask/test_comp_only_par
teshsuite/simdag/partask/test_comp_only_seq
-teshsuite/xbt/log_large_test
-teshsuite/xbt/parallel_log_crashtest
+teshsuite/surf/lmm_usage/lmm_usage
+teshsuite/surf/maxmin_bench/maxmin_bench
+teshsuite/surf/surf_usage/surf_usage
+teshsuite/surf/surf_usage/surf_usage2
+teshsuite/surf/trace_usage/trace_usage
+teshsuite/xbt/log_large/log_large_test
teshsuite/xbt/mmalloc_test
-teshsuite/xbt/parmap_test
+teshsuite/xbt/graphxml_usage/graphxml_usage
+teshsuite/xbt/heap_bench/heap_bench
+teshsuite/xbt/log_usage/log_usage
+teshsuite/xbt/parallel_log/parallel_log_crashtest
+teshsuite/xbt/parmap_bench/parmap_bench
+teshsuite/xbt/parmap_test/parmap_test
+
tools/tesh/tesh
examples/msg/tracing/categories
examples/msg/tracing/ms
test_sg
examples/smpi/smpi_traced.trace
examples/simdag/dot/simulate_dot
-teshsuite/simdag/platforms/graphicator
#########################################
## touched files to track the dependencies of java examples
Simulation time: 1e3 seconds.
\endverbatim
-\subsection options_model_smpi_detached Simulating MPI detached send
+\subsection options_smpi_global Automatic privatization of global variables
+
+MPI executables are meant to be executed in separated processes, but SMPI is
+executed in only one process. Global variables from executables will be placed
+in the same memory zone and shared between processes, causing hard to find bugs.
+To avoid this, several options are possible :
+ - Manual edition of the code, for example to add __thread keyword before data
+ declaration, which allows the resulting code to work with SMPI, but only
+ if the thread factory (see \ref options_virt_factory) is used, as global
+ variables are then placed in the TLS (thread local storage) segment.
+ - Source-to-source transformation, to add a level of indirection
+ to the global variables. SMPI does this for F77 codes compiled with smpiff,
+ and used to provide coccinelle scripts for C codes, which are not functional anymore.
+ - Compilation pass, to have the compiler automatically put the data in
+ an adapted zone.
+ - Runtime automatic switching of the data segments. SMPI stores a copy of
+ each global data segment for each process, and at each context switch replaces
+ the actual data with its copy from the right process. This mechanism uses mmap,
+ and is for now limited to systems supporting this functionnality (all Linux
+ and some BSD should be compatible).
+ Another limitation is that SMPI only accounts for global variables defined in
+ the executable. If the processes use external global variables from dynamic
+ libraries, they won't be switched correctly. To avoid this, using static
+ linking is advised (but not with the simgrid library, to avoid replicating
+ its own global variables).
+
+ To use this runtime automatic switching, the variable \b smpi/privatize_global_variables
+ should be set to yes
-(this configuration item is experimental and may change or disapear)
+
+
+\subsection options_model_smpi_detached Simulating MPI detached send
This threshold specifies the size in bytes under which the send will return
immediately. This is different from the threshold detailed in \ref options_model_network_asyncsend
1 init
2 init
+0 compute 1e9
0 send 1 1e6
0 compute 1e9
0 recv 2 1e6
1 Irecv 0 1e6
-1 compute 1e9
+1 compute 5e8
+1 test
+1 compute 5e8
1 wait
1 send 2 1e6
+2 compute 2e9
2 Irecv 1 1e6
-2 compute 5e8
+2 compute 2.5e8
+2 test
+2 compute 2.5e8
2 wait
2 Isend 0 1e6
2 compute 5e8
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'smpi/cpu_threshold' to '-1'
> [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
> [Jupiter:1:(0) 0.000000] [smpi_replay/VERBOSE] 1 Irecv 0 1e6 0.000000
-> [Fafard:2:(0) 0.000000] [smpi_replay/VERBOSE] 2 Irecv 1 1e6 0.000000
-> [Tremblay:0:(0) 0.164463] [smpi_replay/VERBOSE] 0 send 1 1e6 0.164463
-> [Fafard:2:(0) 6.553424] [smpi_replay/VERBOSE] 2 compute 5e8 6.553424
-> [Tremblay:0:(0) 10.358662] [smpi_replay/VERBOSE] 0 compute 1e9 10.194200
-> [Jupiter:1:(0) 13.106847] [smpi_replay/VERBOSE] 1 compute 1e9 13.106847
+> [Jupiter:1:(0) 6.553424] [smpi_replay/VERBOSE] 1 compute 5e8 6.553424
+> [Jupiter:1:(0) 6.553424] [smpi_replay/VERBOSE] 1 test 0.000000
+> [Tremblay:0:(0) 10.194200] [smpi_replay/VERBOSE] 0 compute 1e9 10.194200
+> [Tremblay:0:(0) 10.358662] [smpi_replay/VERBOSE] 0 send 1 1e6 0.164463
+> [Jupiter:1:(0) 13.106847] [smpi_replay/VERBOSE] 1 compute 5e8 6.553424
> [Jupiter:1:(0) 13.106847] [smpi_replay/VERBOSE] 1 wait 0.000000
-> [Fafard:2:(0) 13.294318] [smpi_replay/VERBOSE] 2 wait 6.740894
-> [Jupiter:1:(0) 13.294318] [smpi_replay/VERBOSE] 1 send 2 1e6 0.187471
-> [Fafard:2:(0) 13.294318] [smpi_replay/VERBOSE] 2 Isend 0 1e6 0.000000
-> [Tremblay:0:(0) 13.447633] [smpi_replay/VERBOSE] 0 recv 2 1e6 3.088971
-> [Fafard:2:(0) 19.847741] [smpi_replay/VERBOSE] 2 compute 5e8 6.553424
-> [Fafard:2:(0) 19.847741] [smpi_replay/INFO] Simulation time 19.847741
+> [Tremblay:0:(0) 20.552862] [smpi_replay/VERBOSE] 0 compute 1e9 10.194200
+> [Fafard:2:(0) 26.213694] [smpi_replay/VERBOSE] 2 compute 2e9 26.213694
+> [Fafard:2:(0) 26.213694] [smpi_replay/VERBOSE] 2 Irecv 1 1e6 0.000000
+> [Jupiter:1:(0) 26.401165] [smpi_replay/VERBOSE] 1 send 2 1e6 13.294318
+> [Fafard:2:(0) 29.490406] [smpi_replay/VERBOSE] 2 compute 2.5e8 3.276712
+> [Fafard:2:(0) 29.490406] [smpi_replay/VERBOSE] 2 test 0.000000
+> [Fafard:2:(0) 32.767118] [smpi_replay/VERBOSE] 2 compute 2.5e8 3.276712
+> [Fafard:2:(0) 32.767118] [smpi_replay/VERBOSE] 2 Isend 0 1e6 0.000000
+> [Tremblay:0:(0) 32.920433] [smpi_replay/VERBOSE] 0 recv 2 1e6 12.367571
+> [Fafard:2:(0) 39.320541] [smpi_replay/VERBOSE] 2 compute 5e8 6.553424
+> [Fafard:2:(0) 39.320541] [smpi_replay/INFO] Simulation time 39.320541
$ rm -f replay/one_trace
#ifndef SMPI_H
#define SMPI_H
+#include <unistd.h>
#include <stddef.h>
#include <sys/time.h>
#include <xbt/misc.h>
XBT_PUBLIC(void) smpi_set_host_power_peak_at(int pstate_index);
XBT_PUBLIC(double) smpi_get_host_consumed_energy(void);
+XBT_PUBLIC(int) smpi_usleep(useconds_t usecs);
XBT_PUBLIC(unsigned int) smpi_sleep(unsigned int secs);
XBT_PUBLIC(int) smpi_gettimeofday(struct timeval *tv, void* tz);
XBT_PUBLIC(unsigned long long) smpi_rastro_resolution (void);
jobject jhost; /* global reference to the java host instance returned */
/* get the C string from the java string */
- const char *name = (*env)->GetStringUTFChars(env, jname, 0);
- if (name == NULL) {
+ if (jname == NULL) {
jxbt_throw_null(env,bprintf("No host can have a null name"));
return NULL;
}
+ const char *name = (*env)->GetStringUTFChars(env, jname, 0);
/* get the host by name (the hosts are created during the grid resolution) */
host = MSG_get_host_by_name(name);
fprintf(trace_file, "%s irecv %d %d %s\n", process_id, extra->src,
extra->send_size, extra->datatype1);
break;
+ case TRACING_TEST:
+ fprintf(trace_file, "%s test\n", process_id);
+ break;
case TRACING_WAIT:
fprintf(trace_file, "%s wait\n", process_id);
break;
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_RECV,
TRACING_IRECV,
TRACING_SENDRECV,
+ TRACING_TEST,
TRACING_WAIT,
TRACING_WAITALL,
TRACING_WAITANY,
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;
xbt_cfgelm_boolean, 1, 1, NULL, NULL);
xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/display_timing", "no");
+ xbt_cfg_register(&_sg_cfg_set, "smpi/simulate_computation",
+ "Boolean indicating whether the computational part of the simulated application should be simulated.",
+ xbt_cfgelm_boolean, 1, 1, NULL, NULL);
+ xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/simulate_computation", "yes");
+
xbt_cfg_register(&_sg_cfg_set, "smpi/use_shared_malloc",
"Boolean indicating whether we should use shared memory when using SMPI_SHARED_MALLOC. Allows user to disable it for debug purposes.",
xbt_cfgelm_boolean, 1, 1, NULL, NULL);
"Small messages timings (MPI_Recv minimum time for small messages)",
xbt_cfgelm_string, 1, 1, NULL, NULL);
xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/or", "1:0:0:0:0");
+
xbt_cfg_register(&_sg_cfg_set, "smpi/iprobe",
"Minimum time to inject inside a call to MPI_Iprobe",
xbt_cfgelm_double, 1, 1, NULL, NULL);
xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/iprobe", 1e-4);
+
xbt_cfg_register(&_sg_cfg_set, "smpi/coll_selector",
"Which collective selector to use",
xbt_cfgelm_string, 1, 1, NULL, NULL);
"wait", "1 1 0",
"waitall", "0.78 0.78 0",
"waitany", "0.78 0.78 0.58",
+ "test", "0.52 0.52 0",
"allgather", "1 0 0",
"allgatherv", "1 0.52 0.52",
"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
+ if (!TRACE_smpi_is_enabled()) {
+ 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 ("test", NULL, type);
+ new_pajePushStateWithExtra (SIMIX_get_clock(), container, type, value, (void*)extra);
+}
+
+void TRACE_smpi_testing_out(int rank)
+{
+ if (!TRACE_smpi_is_enabled()) 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_ptp_in(int rank, int src, int dst, const char *operation, instr_extra_data extra)
{
if (!TRACE_smpi_is_enabled()) {
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);
void TRACE_smpi_release(void);
void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation, instr_extra_data extra);
xbt_backtrace_display_current();
xbt_die("Aborting.");
}
- smpi_execute(xbt_os_timer_elapsed(timer));
+ // Simulate the benchmarked computation unless disabled via command-line argument
+ if (sg_cfg_get_boolean("smpi/simulate_computation")) {
+ 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 secs;
+ return 0;
}
+unsigned int smpi_sleep(unsigned int secs)
+{
+ return private_sleep((double)secs);
+}
+
+int smpi_usleep(useconds_t usecs)
+{
+ return (int)private_sleep((double)usecs / 1000000.0);
+}
+
+
int smpi_gettimeofday(struct timeval *tv, void* tz)
{
double now;
int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
{
int retval = 0;
-
smpi_bench_end();
if (request == NULL || flag == NULL) {
retval = MPI_ERR_ARG;
smpi_empty_status(status);
retval = MPI_ERR_REQUEST;
} else {
+#ifdef HAVE_TRACING
+ int rank = request && (*request)->comm != MPI_COMM_NULL
+ ? smpi_process_index()
+ : -1;
+
+ instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
+ extra->type = TRACING_TEST;
+ TRACE_smpi_testing_in(rank, extra);
+#endif
*flag = smpi_mpi_test(request, status);
+#ifdef HAVE_TRACING
+ TRACE_smpi_testing_out(rank);
+#endif
retval = MPI_SUCCESS;
}
smpi_bench_begin();
log_timed_action (action, clock);
}
+static void action_test(const char *const *action){
+ double clock = smpi_process_simulated_elapsed();
+ MPI_Request request;
+ MPI_Status status;
+ int flag = TRUE;
+
+ request = xbt_dynar_pop_as(reqq[smpi_comm_rank(MPI_COMM_WORLD)],MPI_Request);
+ xbt_assert(request != NULL, "found null request in reqq");
+
+#ifdef HAVE_TRACING
+ int rank = smpi_comm_rank(MPI_COMM_WORLD);
+ instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
+ extra->type=TRACING_TEST;
+ TRACE_smpi_testing_in(rank, extra);
+#endif
+ flag = smpi_mpi_test(&request, &status);
+ XBT_DEBUG("MPI_Test result: %d", flag);
+ /* push back request in dynar to be caught by a subsequent wait. if the test
+ * did succeed, the request is now NULL.
+ */
+ xbt_dynar_push_as(reqq[smpi_comm_rank(MPI_COMM_WORLD)],MPI_Request, request);
+
+#ifdef HAVE_TRACING
+ TRACE_smpi_testing_out(rank);
+#endif
+
+ log_timed_action (action, clock);
+}
+
static void action_wait(const char *const *action){
double clock = smpi_process_simulated_elapsed();
MPI_Request request;
"action wait not preceded by any irecv or isend: %s",
xbt_str_join_array(action," "));
request = xbt_dynar_pop_as(reqq[smpi_comm_rank(MPI_COMM_WORLD)],MPI_Request);
- xbt_assert(request != NULL, "found null request in reqq");
+
+ if (!request){
+ /* Assuming that the trace is well formed, this mean the comm might have
+ * been caught by a MPI_test. Then just return.
+ */
+ return;
+ }
+
#ifdef HAVE_TRACING
int rank = request->comm != MPI_COMM_NULL
? smpi_comm_rank(request->comm)
xbt_replay_action_register("Isend", action_Isend);
xbt_replay_action_register("recv", action_recv);
xbt_replay_action_register("Irecv", action_Irecv);
+ xbt_replay_action_register("test", action_test);
xbt_replay_action_register("wait", action_wait);
xbt_replay_action_register("waitAll", action_waitall);
xbt_replay_action_register("barrier", action_barrier);