Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
initial instrumentation points for the smpi component
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 5 Aug 2010 14:19:30 +0000 (14:19 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 5 Aug 2010 14:19:30 +0000 (14:19 +0000)
details:
- nothing is traced yet, just coupling smpi with the tracing module
- compile simgrid with enable_trace = on
- execute it with --cfg=tracing/smpi:1
- TODO: add an option "--trace" to smpirun when this is completed
that is translated to the previously cited execution parameter

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8123 48e7efb5-ca39-0410-a469-dd3cf9ba447f

buildtools/Cmake/DefinePackages.cmake
src/instr/private.h
src/instr/smpi_instr.c [new file with mode: 0644]
src/smpi/private.h
src/smpi/smpi_global.c
src/smpi/smpi_mpi.c

index ddeb0e4..4d3eb88 100755 (executable)
@@ -333,6 +333,7 @@ set(TRACING_SRC
        src/instr/msg_volume.c
        src/instr/smx_instr.c
        src/instr/surf_instr.c
+       src/instr/smpi_instr.c
        src/instr/variables_instr.c
        src/instr/private.h
 )
index 61c9d38..19150d1 100644 (file)
@@ -129,6 +129,12 @@ int TRACE_surf_gtnets_get_src (void *action);
 int TRACE_surf_gtnets_get_dst (void *action);
 void TRACE_surf_gtnets_destroy (void *action);
 
+/* from smpi_instr.c */
+void TRACE_smpi_init (int rank);
+void TRACE_smpi_finalize (int rank);
+void TRACE_smpi_start (void);
+void TRACE_smpi_end (void);
+
 /* from instr_config.c */
 int _TRACE_configured (void);
 int _TRACE_smpi_enabled (void);
diff --git a/src/instr/smpi_instr.c b/src/instr/smpi_instr.c
new file mode 100644 (file)
index 0000000..f9056e8
--- /dev/null
@@ -0,0 +1,40 @@
+/* Copyright (c) 2010. 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. */
+
+#include "instr/private.h"
+
+#ifdef HAVE_TRACING
+
+void TRACE_smpi_start (void)
+{
+  if (IS_TRACING_SMPI){
+    TRACE_start ();
+  }
+}
+
+void TRACE_smpi_end (void)
+{
+  if (IS_TRACING_SMPI){
+    TRACE_end();
+  }
+}
+
+void TRACE_smpi_init (int rank)
+{
+  if (!IS_TRACING_SMPI) return;
+  //double time = SIMIX_get_clock();
+  //smx_host_t host = SIMIX_host_self();
+}
+
+void TRACE_smpi_finalize (int rank)
+{
+  if (!IS_TRACING_SMPI) return;
+  //double time = SIMIX_get_clock();
+  //smx_host_t host = SIMIX_host_self();
+}
+
+#endif
+
index 483ba79..d646ac8 100644 (file)
@@ -11,6 +11,7 @@
 #include "xbt/xbt_os_time.h"
 #include "simix/simix.h"
 #include "smpi/smpi.h"
+#include "instr/private.h"
 
 struct s_smpi_process_data;
 typedef struct s_smpi_process_data* smpi_process_data_t;
index 6f92d0f..6c9f390 100644 (file)
@@ -183,8 +183,16 @@ int main(int argc, char **argv)
                    "Minimal computation time (in seconds) not discarded.",
                    xbt_cfgelm_double, &default_threshold, 1, 1, NULL, NULL);
 
+#ifdef HAVE_TRACING
+  TRACE_global_init (&argc, argv);
+#endif
+
   SIMIX_global_init(&argc, argv);
 
+#ifdef HAVE_TRACING
+  TRACE_smpi_start ();
+#endif
+
   // parse the platform file: get the host list
   SIMIX_create_environment(argv[1]);
 
@@ -212,6 +220,10 @@ int main(int argc, char **argv)
 
   SIMIX_message_sizes_output("toto.txt");
 
+#ifdef HAVE_TRACING
+  TRACE_smpi_end ();
+#endif
+
   SIMIX_clean();
   return 0;
 }
index fa6bcd9..65a0596 100644 (file)
@@ -16,10 +16,16 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi,
 int MPI_Init(int* argc, char*** argv) {
   smpi_process_init(argc, argv);
   smpi_bench_begin(-1, NULL);
+#ifdef HAVE_TRACING
+  TRACE_smpi_init(smpi_process_index());
+#endif
   return MPI_SUCCESS;
 }
 
 int MPI_Finalize(void) {
+#ifdef HAVE_TRACING
+  TRACE_smpi_finalize(smpi_process_index());
+#endif
   smpi_bench_end(-1, NULL);
   smpi_process_destroy();
   return MPI_SUCCESS;