Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Add caller location to tracefiles
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Fri, 1 Apr 2016 13:18:14 +0000 (15:18 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Thu, 19 May 2016 14:37:23 +0000 (16:37 +0200)
Please note that we can't use stack unwinding because that
would make the simulation less faithful, as it introduces
non-neglegible overhead.

This implementation is still subject to change.

12 files changed:
include/smpi/mpi.h
include/smpi/smpi.h
include/smpi/smpi_extended_traces.h [new file with mode: 0644]
include/smpi/smpi_extended_traces_fortran.h [new file with mode: 0644]
src/instr/instr_paje_header.cpp
src/instr/instr_paje_trace.cpp
src/instr/instr_private.h
src/instr/instr_smpi.h [new file with mode: 0644]
src/instr/instr_trace.cpp
src/smpi/smpi_bench.cpp
src/smpi/smpi_global.cpp
tools/smpi/generate_smpi_defines.pl [new file with mode: 0755]

index 2cb6aca..a5474a6 100644 (file)
@@ -25,4 +25,9 @@
 #define assert(x) MC_assert(x)
 #endif
 
+#if TRACE_CALL_LOCATION
+#include "src/instr/instr_smpi.h"
+#include "smpi_extended_traces.h"
+#endif
+
 #endif
index 11afb63..d392f25 100644 (file)
@@ -14,6 +14,7 @@
 #include <xbt/misc.h>
 #include <xbt/function_types.h>
 
+#include "src/instr/instr_smpi.h"
 
 #ifdef _WIN32
 #define MPI_CALL(type,name,args) \
@@ -811,6 +812,12 @@ XBT_PUBLIC(unsigned long long) smpi_rastro_timestamp (void);
 XBT_PUBLIC(void) smpi_sample_1(int global, const char *file, int line, int iters, double threshold);
 XBT_PUBLIC(int) smpi_sample_2(int global, const char *file, int line);
 XBT_PUBLIC(void) smpi_sample_3(int global, const char *file, int line);
+XBT_PUBLIC(void) smpi_trace_set_call_location(const char *file, int line);
+/** Fortran binding **/
+XBT_PUBLIC(void) smpi_trace_set_call_location_(const char *file, int* line);
+/** Fortran binding + -fsecond-underscore **/
+XBT_PUBLIC(void) smpi_trace_set_call_location__(const char *file, int* line);
+XBT_PUBLIC(smpi_trace_call_location_t*) smpi_process_get_call_location(void);
 
 #define SMPI_SAMPLE_LOCAL(iters,thres) for(smpi_sample_1(0, __FILE__, __LINE__, iters, thres); \
                                            smpi_sample_2(0, __FILE__, __LINE__);      \
@@ -909,5 +916,6 @@ if(!name) {                                         \
 
 #define SMPI_VARGET_STATIC(name) name[smpi_process_index()]
 
+
 SG_END_DECL()
 #endif
diff --git a/include/smpi/smpi_extended_traces.h b/include/smpi/smpi_extended_traces.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/include/smpi/smpi_extended_traces_fortran.h b/include/smpi/smpi_extended_traces_fortran.h
new file mode 100644 (file)
index 0000000..3b2904f
--- /dev/null
@@ -0,0 +1,246 @@
+! This file has been automatically generated by the script
+! in ./generate_smpi_defines.pl
+! DO NOT EDIT MANUALLY. ALL CHANGES WILL BE OVERWRITTEN!
+#define MPI_INIT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_init
+#define MPI_FINALIZE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_finalize
+#define MPI_FINALIZED smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_finalized
+#define MPI_INIT_THREAD smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_init_thread
+#define MPI_QUERY_THREAD smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_query_thread
+#define MPI_IS_THREAD_MAIN smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_is_thread_main
+#define MPI_ABORT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_abort
+#define MPI_WTIME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_wtime
+#define MPI_WTICK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_wtick
+#define MPI_ADDRESS smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_address
+#define MPI_GET_ADDRESS smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_get_address
+#define MPI_TYPE_FREE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_free
+#define MPI_TYPE_SIZE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_size
+#define MPI_TYPE_GET_EXTENT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_get_extent
+#define MPI_TYPE_GET_TRUE_EXTENT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_get_true_extent
+#define MPI_TYPE_EXTENT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_extent
+#define MPI_TYPE_LB smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_lb
+#define MPI_TYPE_UB smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_ub
+#define MPI_TYPE_COMMIT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_commit
+#define MPI_TYPE_HINDEXED smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_hindexed
+#define MPI_TYPE_CREATE_HINDEXED smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_create_hindexed
+#define MPI_TYPE_CREATE_HINDEXED_BLOCK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_create_hindexed_block
+#define MPI_TYPE_HVECTOR smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_hvector
+#define MPI_TYPE_CREATE_HVECTOR smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_create_hvector
+#define MPI_TYPE_INDEXED smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_indexed
+#define MPI_TYPE_CREATE_INDEXED smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_create_indexed
+#define MPI_TYPE_CREATE_INDEXED_BLOCK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_create_indexed_block
+#define MPI_TYPE_STRUCT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_struct
+#define MPI_TYPE_CREATE_STRUCT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_create_struct
+#define MPI_TYPE_VECTOR smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_vector
+#define MPI_TYPE_CONTIGUOUS smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_contiguous
+#define MPI_TESTALL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_testall
+#define MPI_OP_CREATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_op_create
+#define MPI_OP_FREE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_op_free
+#define MPI_GROUP_FREE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_free
+#define MPI_GROUP_SIZE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_size
+#define MPI_GROUP_RANK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_rank
+#define MPI_GROUP_TRANSLATE_RANKS smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_translate_ranks
+#define MPI_GROUP_COMPARE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_compare
+#define MPI_GROUP_UNION smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_union
+#define MPI_GROUP_INTERSECTION smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_intersection
+#define MPI_GROUP_DIFFERENCE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_difference
+#define MPI_GROUP_INCL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_incl
+#define MPI_GROUP_EXCL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_excl
+#define MPI_GROUP_RANGE_INCL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_range_incl
+#define MPI_GROUP_RANGE_EXCL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_range_excl
+#define MPI_COMM_RANK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_rank
+#define MPI_COMM_SIZE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_size
+#define MPI_COMM_GET_NAME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_get_name
+#define MPI_GET_PROCESSOR_NAME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_get_processor_name
+#define MPI_GET_COUNT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_get_count
+#define MPI_COMM_GROUP smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_group
+#define MPI_COMM_COMPARE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_compare
+#define MPI_COMM_CREATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_create
+#define MPI_COMM_FREE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_free
+#define MPI_COMM_DISCONNECT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_disconnect
+#define MPI_COMM_SPLIT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_split
+#define MPI_SEND_INIT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_send_init
+#define MPI_RECV_INIT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_recv_init
+#define MPI_START smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_start
+#define MPI_STARTALL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_startall
+#define MPI_REQUEST_FREE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_request_free
+#define MPI_IRECV smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_irecv
+#define MPI_ISEND smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_isend
+#define MPI_RECV smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_recv
+#define MPI_SEND smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_send
+#define MPI_SENDRECV smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_sendrecv
+#define MPI_SENDRECV_REPLACE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_sendrecv_replace
+#define MPI_TEST smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_test
+#define MPI_TESTANY smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_testany
+#define MPI_WAIT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_wait
+#define MPI_WAITANY smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_waitany
+#define MPI_WAITALL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_waitall
+#define MPI_WAITSOME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_waitsome
+#define MPI_TESTSOME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_testsome
+#define MPI_BCAST smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_bcast
+#define MPI_BARRIER smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_barrier
+#define MPI_GATHER smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_gather
+#define MPI_GATHERV smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_gatherv
+#define MPI_ALLGATHER smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_allgather
+#define MPI_ALLGATHERV smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_allgatherv
+#define MPI_SCATTER smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_scatter
+#define MPI_SCATTERV smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_scatterv
+#define MPI_REDUCE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_reduce
+#define MPI_ALLREDUCE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_allreduce
+#define MPI_SCAN smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_scan
+#define MPI_REDUCE_SCATTER smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_reduce_scatter
+#define MPI_REDUCE_SCATTER_BLOCK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_reduce_scatter_block
+#define MPI_ALLTOALL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_alltoall
+#define MPI_ALLTOALLV smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_alltoallv
+#define MPI_IPROBE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_iprobe
+#define MPI_PROBE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_probe
+#define MPI_GET_VERSION smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_get_version
+#define MPI_GET_LIBRARY_VERSION smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_get_library_version
+#define MPI_REDUCE_LOCAL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_reduce_local
+#define MPI_WIN_FREE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_free
+#define MPI_WIN_CREATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_create
+#define MPI_WIN_SET_NAME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_set_name
+#define MPI_WIN_GET_NAME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_get_name
+#define MPI_WIN_GET_GROUP smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_get_group
+#define MPI_WIN_FENCE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_fence
+#define MPI_GET smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_get
+#define MPI_PUT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_put
+#define MPI_ACCUMULATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_accumulate
+#define MPI_ALLOC_MEM smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_alloc_mem
+#define MPI_FREE_MEM smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_free_mem
+#define MPI_TYPE_F2C smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_f2c
+#define MPI_TYPE_C2F smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_c2f
+#define MPI_GROUP_F2C smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_f2c
+#define MPI_GROUP_C2F smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_c2f
+#define MPI_REQUEST_F2C smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_request_f2c
+#define MPI_REQUEST_C2F smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_request_c2f
+#define MPI_WIN_F2C smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_f2c
+#define MPI_WIN_C2F smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_c2f
+#define MPI_OP_F2C smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_op_f2c
+#define MPI_OP_C2F smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_op_c2f
+#define MPI_COMM_F2C smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_f2c
+#define MPI_COMM_C2F smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_c2f
+#define MPI_INFO_F2C smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_info_f2c
+#define MPI_INFO_C2F smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_info_c2f
+#define MPI_ERRHANDLER_F2C smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_errhandler_f2c
+#define MPI_ERRHANDLER_C2F smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_errhandler_c2f
+#define MPI_PACK_SIZE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_pack_size
+#define MPI_CART_COORDS smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_cart_coords
+#define MPI_CART_CREATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_cart_create
+#define MPI_CART_GET smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_cart_get
+#define MPI_CART_MAP smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_cart_map
+#define MPI_CART_RANK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_cart_rank
+#define MPI_CART_SHIFT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_cart_shift
+#define MPI_CART_SUB smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_cart_sub
+#define MPI_CARTDIM_GET smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_cartdim_get
+#define MPI_GRAPH_CREATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_graph_create
+#define MPI_GRAPH_GET smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_graph_get
+#define MPI_GRAPH_MAP smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_graph_map
+#define MPI_GRAPH_NEIGHBORS smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_graph_neighbors
+#define MPI_GRAPH_NEIGHBORS_COUNT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_graph_neighbors_count
+#define MPI_GRAPHDIMS_GET smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_graphdims_get
+#define MPI_TOPO_TEST smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_topo_test
+#define MPI_ERROR_CLASS smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_error_class
+#define MPI_ERRHANDLER_CREATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_errhandler_create
+#define MPI_ERRHANDLER_FREE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_errhandler_free
+#define MPI_ERRHANDLER_GET smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_errhandler_get
+#define MPI_ERROR_STRING smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_error_string
+#define MPI_ERRHANDLER_SET smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_errhandler_set
+#define MPI_COMM_SET_ERRHANDLER smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_set_errhandler
+#define MPI_COMM_GET_ERRHANDLER smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_get_errhandler
+#define MPI_COMM_CREATE_ERRHANDLER smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_create_errhandler
+#define MPI_COMM_CALL_ERRHANDLER smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_call_errhandler
+#define MPI_ADD_ERROR_CLASS smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_add_error_class
+#define MPI_ADD_ERROR_CODE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_add_error_code
+#define MPI_ADD_ERROR_STRING smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_add_error_string
+#define MPI_CANCEL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_cancel
+#define MPI_BUFFER_ATTACH smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_buffer_attach
+#define MPI_BUFFER_DETACH smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_buffer_detach
+#define MPI_COMM_TEST_INTER smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_test_inter
+#define MPI_COMM_GET_ATTR smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_get_attr
+#define MPI_COMM_SET_ATTR smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_set_attr
+#define MPI_COMM_DELETE_ATTR smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_delete_attr
+#define MPI_COMM_CREATE_KEYVAL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_create_keyval
+#define MPI_COMM_FREE_KEYVAL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_free_keyval
+#define MPI_TYPE_GET_ATTR smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_get_attr
+#define MPI_TYPE_SET_ATTR smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_set_attr
+#define MPI_TYPE_DELETE_ATTR smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_delete_attr
+#define MPI_TYPE_CREATE_KEYVAL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_create_keyval
+#define MPI_TYPE_FREE_KEYVAL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_free_keyval
+#define MPI_TYPE_DUP smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_dup
+#define MPI_TYPE_SET_NAME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_set_name
+#define MPI_TYPE_GET_NAME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_get_name
+#define MPI_UNPACK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_unpack
+#define MPI_SSEND smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_ssend
+#define MPI_SSEND_INIT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_ssend_init
+#define MPI_INTERCOMM_CREATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_intercomm_create
+#define MPI_INTERCOMM_MERGE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_intercomm_merge
+#define MPI_BSEND smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_bsend
+#define MPI_BSEND_INIT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_bsend_init
+#define MPI_IBSEND smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_ibsend
+#define MPI_COMM_REMOTE_GROUP smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_remote_group
+#define MPI_COMM_REMOTE_SIZE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_remote_size
+#define MPI_ISSEND smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_issend
+#define MPI_ATTR_DELETE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_attr_delete
+#define MPI_ATTR_GET smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_attr_get
+#define MPI_ATTR_PUT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_attr_put
+#define MPI_RSEND smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_rsend
+#define MPI_RSEND_INIT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_rsend_init
+#define MPI_IRSEND smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_irsend
+#define MPI_KEYVAL_CREATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_keyval_create
+#define MPI_KEYVAL_FREE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_keyval_free
+#define MPI_TEST_CANCELLED smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_test_cancelled
+#define MPI_PACK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_pack
+#define MPI_GET_ELEMENTS smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_get_elements
+#define MPI_DIMS_CREATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_dims_create
+#define MPI_INITIALIZED smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_initialized
+#define MPI_PCONTROL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_pcontrol
+#define MPI_INFO_CREATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_info_create
+#define MPI_INFO_SET smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_info_set
+#define MPI_INFO_GET smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_info_get
+#define MPI_INFO_FREE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_info_free
+#define MPI_INFO_DELETE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_info_delete
+#define MPI_INFO_DUP smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_info_dup
+#define MPI_INFO_GET_NKEYS smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_info_get_nkeys
+#define MPI_INFO_GET_NTHKEY smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_info_get_nthkey
+#define MPI_INFO_GET_VALUELEN smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_info_get_valuelen
+#define MPI_WIN_SET_ERRHANDLER smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_set_errhandler
+#define MPI_TYPE_GET_ENVELOPE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_get_envelope
+#define MPI_TYPE_GET_CONTENTS smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_get_contents
+#define MPI_TYPE_CREATE_DARRAY smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_create_darray
+#define MPI_PACK_EXTERNAL_SIZE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_pack_external_size
+#define MPI_PACK_EXTERNAL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_pack_external
+#define MPI_UNPACK_EXTERNAL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_unpack_external
+#define MPI_TYPE_CREATE_RESIZED smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_create_resized
+#define MPI_TYPE_CREATE_SUBARRAY smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_create_subarray
+#define MPI_TYPE_MATCH_SIZE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_match_size
+#define MPI_ALLTOALLW smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_alltoallw
+#define MPI_EXSCAN smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_exscan
+#define MPI_COMM_SET_NAME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_set_name
+#define MPI_COMM_SET_INFO smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_set_info
+#define MPI_COMM_GET_INFO smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_get_info
+#define MPI_COMM_DUP smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_dup
+#define MPI_COMM_DUP_WITH_INFO smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_dup_with_info
+#define MPI_COMM_SPLIT_TYPE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_split_type
+#define MPI_COMM_CONNECT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_connect
+#define MPI_REQUEST_GET_STATUS smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_request_get_status
+#define MPI_GREQUEST_START smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_grequest_start
+#define MPI_GREQUEST_COMPLETE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_grequest_complete
+#define MPI_STATUS_SET_CANCELLED smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_status_set_cancelled
+#define MPI_STATUS_SET_ELEMENTS smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_status_set_elements
+#define MPI_UNPUBLISH_NAME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_unpublish_name
+#define MPI_PUBLISH_NAME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_publish_name
+#define MPI_LOOKUP_NAME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_lookup_name
+#define MPI_COMM_JOIN smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_join
+#define MPI_OPEN_PORT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_open_port
+#define MPI_CLOSE_PORT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_close_port
+#define MPI_COMM_ACCEPT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_accept
+#define MPI_COMM_SPAWN smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_spawn
+#define MPI_COMM_SPAWN_MULTIPLE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_spawn_multiple
+#define MPI_COMM_GET_PARENT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_get_parent
+#define MPI_WIN_COMPLETE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_complete
+#define MPI_WIN_LOCK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_lock
+#define MPI_WIN_POST smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_post
+#define MPI_WIN_START smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_start
+#define MPI_WIN_TEST smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_test
+#define MPI_WIN_UNLOCK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_unlock
+#define MPI_WIN_WAIT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_wait
index 2d76e28..90514aa 100644 (file)
@@ -163,6 +163,10 @@ static void TRACE_header_PajePushState (int basic, int size)
   fprintf(tracing_file, "%%       Container string\n");
   fprintf(tracing_file, "%%       Value string\n");
   if (size) fprintf(tracing_file, "%%       Size int\n");
+  if (false) {
+    fprintf(tracing_file, "%%       Filename string\n");
+    fprintf(tracing_file, "%%       Linenumber int\n");
+  }
   fprintf(tracing_file, "%%EndEventDef\n");
 }
 
index 9a9e631..02a5974 100644 (file)
@@ -222,6 +222,12 @@ void print_pajeSetState(paje_event_t event) {
 
   print_default_pajeState_row<setState_t>(event);
   stream << " " << static_cast<setState_t>(event->data)->value->id;
+
+  if (true) { // If (sg_config("tracing/caller_location"))
+    stream << " " << static_cast<setState_t>(event->data)->filename
+           << " " << static_cast<setState_t>(event->data)->linenumber;
+  }
+
   print_row();
 }
 
@@ -239,6 +245,12 @@ void print_pajePushState(paje_event_t event) {
       stream << 0;
     }
   }
+
+  if (true) { // If (sg_config("tracing/caller_location"))
+    stream << " " << static_cast<pushState_t>(event->data)->filename
+           << " " << static_cast<pushState_t>(event->data)->linenumber;
+  }
+
   print_row();
 
   if (static_cast<pushState_t>(event->data)->extra != NULL) {
index bd861c1..c9f3272 100644 (file)
@@ -175,6 +175,8 @@ typedef struct s_setState {
   container_t container;
   type_t type;
   val_t value;
+  const char* filename;
+  int linenumber;
 }s_setState_t;
 
 typedef struct s_pushState *pushState_t;
@@ -183,6 +185,8 @@ typedef struct s_pushState {
   type_t type;
   val_t value;
   int size;
+  const char* filename;
+  int linenumber;
   void* extra;
 }s_pushState_t;
 
diff --git a/src/instr/instr_smpi.h b/src/instr/instr_smpi.h
new file mode 100644 (file)
index 0000000..a4596f9
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef INSTR_SMPI_H_
+#define INSTR_SMPI_H_ 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct smpi_trace_call_location {
+  const char* filename;
+  int linenumber;
+
+  const char* previous_filename;
+  int previous_linenumber;
+} smpi_trace_call_location_t;
+
+smpi_trace_call_location_t* smpi_trace_get_call_location();
+
+#ifdef __cplusplus
+}
+#endif
+#endif
index c98e2a9..149f937 100644 (file)
@@ -5,6 +5,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/instr/instr_private.h"
+#include "src/instr/instr_smpi.h"
 #include "xbt/virtu.h" /* sg_cmdline */
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_trace, instr, "tracing event system");
@@ -341,6 +342,11 @@ void new_pajeSetState (double timestamp, container_t container, type_t type, val
   ((setState_t)(event->data))->container = container;
   ((setState_t)(event->data))->value = value;
 
+  smpi_trace_call_location_t* loc = smpi_trace_get_call_location();
+  ((setState_t)(event->data))->filename   = loc->filename;
+  ((setState_t)(event->data))->linenumber = loc->linenumber;
+
   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event->event_type, event->timestamp);
 
   insert_into_buffer (event);
@@ -360,6 +366,10 @@ void new_pajePushStateWithExtra (double timestamp, container_t container, type_t
   ((pushState_t)(event->data))->value = value;
   ((pushState_t)(event->data))->extra = extra;
 
+  smpi_trace_call_location_t* loc = smpi_trace_get_call_location();
+  ((pushState_t)(event->data))->filename   = loc->filename;
+  ((pushState_t)(event->data))->linenumber = loc->linenumber;
+
   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event->event_type, event->timestamp);
 
   insert_into_buffer (event);
index 5e18345..f4404d5 100644 (file)
@@ -723,3 +723,35 @@ void smpi_destroy_global_memory_segments(){
   xbt_free(smpi_privatisation_regions);
 #endif
 }
+
+extern "C" {
+
+  smpi_trace_call_location_t trace_call_location;
+
+  smpi_trace_call_location_t* smpi_trace_get_call_location() {
+    return smpi_process_get_call_location();
+  }
+
+  void smpi_trace_set_call_location(const char* file, int line) {
+    smpi_trace_call_location_t* loc = smpi_process_get_call_location();
+
+    loc->previous_filename   = loc->filename;
+    loc->previous_linenumber = loc->linenumber;
+    loc->filename            = file;
+    loc->linenumber          = line;
+  }
+
+  /**
+   * Required for Fortran bindings
+   */
+  void smpi_trace_set_call_location_(const char* file, int* line) {
+    smpi_trace_set_call_location(file, *line);
+  }
+
+  /** 
+   * Required for Fortran if -fsecond-underscore is activated
+   */
+  void smpi_trace_set_call_location__(const char* file, int* line) {
+    smpi_trace_set_call_location(file, *line);
+  }
+}
index 672bd27..fcb2d58 100644 (file)
@@ -44,6 +44,7 @@ typedef struct s_smpi_process_data {
   int replaying;                /* is the process replaying a trace */
   xbt_bar_t finalization_barrier;
   int return_value;
+  smpi_trace_call_location_t* trace_call_loc;
 } s_smpi_process_data_t;
 
 static smpi_process_data_t *process_data = NULL;
@@ -228,6 +229,18 @@ int smpi_process_count(void)
   return process_count;
 }
 
+/**
+ * \brief Returns a structure that stores the location (filename + linenumber)
+ *        of the last calls to MPI_* functions.
+ *
+ * \see smpi_trace_set_call_location
+ */
+smpi_trace_call_location_t* smpi_process_get_call_location(void)
+{
+  smpi_process_data_t process_data = smpi_process_data();
+  return process_data->trace_call_loc;
+}
+
 int smpi_process_index(void)
 {
   smpi_process_data_t data = smpi_process_data();
diff --git a/tools/smpi/generate_smpi_defines.pl b/tools/smpi/generate_smpi_defines.pl
new file mode 100755 (executable)
index 0000000..b741fca
--- /dev/null
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+# Copyright 2016 Vincent Danjean <vincent.danjean@inria.fr>
+# 
+# Call this script like this:
+# C/C++  : ./generate_smpi_defines.pl ../../include/smpi/smpi.h
+# FORTRAN: ./generate_smpi_defines.pl -f ../../include/smpi/smpi.h
+#
+# It will generate macros that are useful for adding file and line numbers to
+# traces without obtaining a backtrace (as this would be very slow and make
+# the simulation/trace unreliable when compared to a "real" trace as obtained
+# with MPI+TAU).
+use strict;
+use warnings;
+use Getopt::Std; 
+
+my %options=();
+getopts("fc", \%options);
+
+# $incall denotes whether we are currently parsing a macro or not...
+my $incall=0;
+
+my $commentChar="//";
+if (defined $options{f}) {
+  $commentChar="!"
+}
+
+print "$commentChar This file has been automatically generated by the script\n";
+print "$commentChar in " . __FILE__ ."\n";
+print "$commentChar DO NOT EDIT MANUALLY. ALL CHANGES WILL BE OVERWRITTEN!\n";
+
+# Formatting of the output
+sub output_macro {
+  my $line = shift;
+  my @parts = split (/\s*,\s*/, $line);
+  my $id = $parts[1];
+
+  # This is a GCC extension. The last statement is the value of the expression
+  # in parentheses.
+  if (defined $options{f}) {
+    print "#define ". uc($id) ." smpi_trace_set_call_location(__FILE__,__LINE__); call ". lc $id ."\n";
+  }
+  else {
+    print "#define $id(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); $id(__VA_ARGS__); })\n";
+  }
+}
+
+my $wholemacro;
+my $line;
+while (defined($line = <>)) {
+  chomp($line);
+  if ($line =~ /^MPI_CALL/) {
+    if ($incall) {
+        output_macro($wholemacro);
+    }
+    $incall=1;
+    $wholemacro = $line;
+  } elsif ($incall && $line =~ /^\s+\S/) { 
+    # Did we already start parsing an MPI_CALL macro? If so, just concatenate
+    $wholemacro .= ' '.$line;
+  } elsif ($incall) {
+    output_macro($wholemacro);
+    $incall=0;
+  }
+}