Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
tracing MPI collective operations implemented in SMPI
[simgrid.git] / src / instr / smpi_instr.c
1 /* Copyright (c) 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5   * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "instr/private.h"
8
9 #ifdef HAVE_TRACING
10
11 static char *_TRACE_smpi_container (int rank, char *container, int n)
12 {
13   snprintf (container, n, "rank-%d", rank);
14   return container;
15 }
16
17 void TRACE_smpi_start (void)
18 {
19   if (IS_TRACING_SMPI){
20     TRACE_start ();
21   }
22 }
23
24 void TRACE_smpi_end (void)
25 {
26   if (IS_TRACING_SMPI){
27     TRACE_end();
28   }
29 }
30
31 void TRACE_smpi_init (int rank)
32 {
33   if (!IS_TRACING_SMPI) return;
34
35   char str[100];
36   _TRACE_smpi_container (rank, str, 100);
37   pajeCreateContainer (SIMIX_get_clock(), str, "MPI_PROCESS",
38       SIMIX_host_get_name(SIMIX_host_self()), str);
39 }
40
41 void TRACE_smpi_finalize (int rank)
42 {
43   if (!IS_TRACING_SMPI) return;
44
45   char str[100];
46   pajeDestroyContainer (SIMIX_get_clock(), "MPI_PROCESS",
47       _TRACE_smpi_container (rank, str, 100));
48 }
49
50 void TRACE_smpi_collective_in (int rank, int root, const char *operation)
51 {
52   if (!IS_TRACING_SMPI) return;
53
54   char str[100];
55   pajePushState (SIMIX_get_clock(), "MPI_STATE",
56       _TRACE_smpi_container (rank, str, 100), operation);
57 }
58
59 void TRACE_smpi_collective_out (int rank, int root, const char *operation)
60 {
61   if (!IS_TRACING_SMPI) return;
62
63   char str[100];
64   pajePopState (SIMIX_get_clock(), "MPI_STATE",
65       _TRACE_smpi_container (rank, str, 100));
66 }
67
68 #endif
69