From b91d8031bb392545546a25d9792f1ac68de5ecce Mon Sep 17 00:00:00 2001 From: schnorr Date: Thu, 5 Aug 2010 14:19:30 +0000 Subject: [PATCH] initial instrumentation points for the smpi component 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 | 1 + src/instr/private.h | 6 ++++ src/instr/smpi_instr.c | 40 +++++++++++++++++++++++++++ src/smpi/private.h | 1 + src/smpi/smpi_global.c | 12 ++++++++ src/smpi/smpi_mpi.c | 6 ++++ 6 files changed, 66 insertions(+) create mode 100644 src/instr/smpi_instr.c diff --git a/buildtools/Cmake/DefinePackages.cmake b/buildtools/Cmake/DefinePackages.cmake index ddeb0e4b1d..4d3eb88a2b 100755 --- a/buildtools/Cmake/DefinePackages.cmake +++ b/buildtools/Cmake/DefinePackages.cmake @@ -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 ) diff --git a/src/instr/private.h b/src/instr/private.h index 61c9d38f52..19150d14ff 100644 --- a/src/instr/private.h +++ b/src/instr/private.h @@ -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 index 0000000000..f9056e891c --- /dev/null +++ b/src/instr/smpi_instr.c @@ -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 + diff --git a/src/smpi/private.h b/src/smpi/private.h index 483ba79b9d..d646ac8aaa 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -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; diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index 6f92d0fdab..6c9f390148 100644 --- a/src/smpi/smpi_global.c +++ b/src/smpi/smpi_global.c @@ -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; } diff --git a/src/smpi/smpi_mpi.c b/src/smpi/smpi_mpi.c index fa6bcd90ac..65a0596a4f 100644 --- a/src/smpi/smpi_mpi.c +++ b/src/smpi/smpi_mpi.c @@ -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; -- 2.20.1