OpenMPI  0.1.1
vt_unimci.h
1 /**
2  * VampirTrace
3  * http://www.tu-dresden.de/zih/vampirtrace
4  *
5  * Copyright (c) 2005-2012, ZIH, TU Dresden, Federal Republic of Germany
6  *
7  * Copyright (c) 1998-2005, Forschungszentrum Juelich, Juelich Supercomputing
8  * Centre, Federal Republic of Germany
9  *
10  * See the file COPYING in the package base directory for details
11  **/
12 
13 #ifndef _VT_UNIMCI_H
14 #define _VT_UNIMCI_H
15 
16 #ifdef __cplusplus
17 # define EXTERN extern "C"
18 #else
19 # define EXTERN extern
20 #endif
21 
22 #ifdef VT_UNIMCI
23 
24 # include "config.h"
25 
26 # include "vt_defs.h"
27 # include "vt_inttypes.h"
28 # include "vt_thrd.h"
29 # include "vt_trc.h"
30 
31 /* if all MPI2 parts are available define 'UNIMCI_MPI2' before
32  including 'unimci.h' */
33 # if (defined(HAVE_MPI2_1SIDED) && HAVE_MPI2_1SIDED) && \
34  (defined(HAVE_MPI2_EXTCOLL) && HAVE_MPI2_EXTCOLL) && \
35  (defined(HAVE_MPI2_THREAD) && HAVE_MPI2_THREAD) && \
36  (defined(HAVE_MPI2_IO) && HAVE_MPI2_IO) && \
37  (defined(HAVE_MPI_REGISTER_DATAREP) && HAVE_MPI_REGISTER_DATAREP)
38 # define UNIMCI_MPI2
39 # endif /* HAVE_MPI2_* */
40 # include "unimci.h"
41 
42 # define VT_UNIMCI_DO_CHECK() \
43  (vt_is_alive && \
44  VTTHRD_TRACE_STATUS(VTThrdv[VT_MY_THREAD]) != VT_TRACE_OFF_PERMANENT && \
45  vt_unimci_is_initialized)
46 
47 # define VT_UNIMCI_SET_BINDING_LANGUAGE_C() \
48  if (vt_unimci_is_initialized) \
49  UNIMCI_set_binding_language(UNIMCI_LANGUAGE_C)
50 
51 # define VT_UNIMCI_SET_BINDING_LANGUAGE_FORTRAN() \
52  if (vt_unimci_is_initialized) \
53  UNIMCI_set_binding_language(UNIMCI_LANGUAGE_FORTRAN)
54 
55 # define VT_UNIMCI_CHECK_PRE(_call, _args, _record, _time) \
56  if (VT_UNIMCI_DO_CHECK()) { \
57  UNIMCI_check_pre__##_call _args; \
58  vt_unimci_check_msg(_record, _time); \
59  }
60 
61 # define VT_UNIMCI_CHECK_POST(_call, _args, _record, _time) \
62  if (VT_UNIMCI_DO_CHECK()) { \
63  UNIMCI_check_post__##_call _args; \
64  vt_unimci_check_msg(_record, _time); \
65  }
66 
67 EXTERN void vt_unimci_init(void);
68 
69 EXTERN void vt_unimci_finalize(void);
70 
71 EXTERN void vt_unimci_check_msg(uint8_t record, uint64_t* time);
72 
73 EXTERN uint8_t vt_unimci_is_initialized;
74 
75 #else /* VT_UNIMCI */
76 
77 # define VT_UNIMCI_SET_BINDING_LANGUAGE_C()
78 # define VT_UNIMCI_SET_BINDING_LANGUAGE_FORTRAN()
79 # define VT_UNIMCI_CHECK_PRE(_call, _args, _record, _time) \
80  (void)(_record) /* needed to avoid compiler warnings (unused but set) */
81 # define VT_UNIMCI_CHECK_POST(_call, _args, _record, _time)
82 
83 #endif /* VT_UNIMCI */
84 
85 #endif /* _VT_UNIMCI_H */