source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/utilities/fpolybench.h

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100755
File size: 6.5 KB
Line 
1/**
2 * polybench.h: This file is part of the PolyBench/Fortran 1.0 test suite.
3 *
4 * Contact: Louis-Noel Pouchet <pouchet@cse.ohio-state.edu>
5 * Web address: http://polybench.sourceforge.net
6 */
7/*
8 * Polybench header for instrumentation.
9 *
10 * Programs must be compiled with `-I utilities utilities/polybench.c'
11 *
12 * Optionally, one can define:
13 *
14 * -DPOLYBENCH_TIME, to report the execution time,
15 * OR (exclusive):
16 * -DPOLYBENCH_PAPI, to use PAPI H/W counters (defined in polybench.c)
17 *
18 *
19 * See README or utilities/polybench.c for additional options.
20 *
21 */
22#ifndef FPOLYBENCH_H
23# define FPOLYBENCH_H
24
25/* Array padding. By default, none is used. */
26# ifndef POLYBENCH_PADDING_FACTOR
27/* default: */
28# define POLYBENCH_PADDING_FACTOR 0
29# endif
30
31
32/* Initialize instruments macros to nothing */
33#define polybench_start_instruments
34#define polybench_stop_instruments
35#define polybench_print_instruments
36#define polybench_declare_instruments
37#define polybench_declare_prevent_dce_vars
38
39
40/* PAPI support */
41#ifdef POLYBENCH_PAPI
42#undef polybench_start_instruments
43#undef polybench_stop_instruments
44#undef polybench_print_instruments
45#undef polybench_declare_instruments
46#define polybench_declare_instruments \
47 integer papi_evid, papi_estatus, polybench_setup_papi_event
48
49#define polybench_start_instruments \
50 call polybench_prepare_instruments(); \
51 call polybench_papi_init(); \
52 papi_evid = 0; \
53 do ; \
54 papi_estatus = polybench_setup_papi_event(papi_evid); \
55 if(papi_estatus == PAPI_EVENT_END) exit; \
56 if(papi_estatus == PAPI_START_FAIL) cycle;
57
58#define polybench_stop_instruments \
59 call polybench_papi_stop_counter(papi_evid); \
60 papi_evid = papi_evid + 1; \
61 end do; \
62 call polybench_papi_close()
63
64#define polybench_print_instruments call polybench_papi_print()
65
66#define PAPI_EVENT_END 0
67#define PAPI_START_FAIL 1
68#define PAPI_START_SUCCESS 2
69#endif
70
71
72/* Timing support. */
73#ifdef POLYBENCH_TIME
74#undef polybench_start_instruments
75#undef polybench_stop_instruments
76#undef polybench_print_instruments
77# define polybench_start_instruments call polybench_timer_start();
78# define polybench_stop_instruments call polybench_timer_stop();
79# define polybench_print_instruments call polybench_timer_print();
80#endif
81
82
83/* Scalar loop bounds in SCoPs. By default, use parametric loop bounds. */
84# ifdef POLYBENCH_USE_SCALAR_LB
85# define POLYBENCH_LOOP_BOUND(x,y) x
86# else
87/* default: */
88# define POLYBENCH_LOOP_BOUND(x,y) y
89# endif
90
91
92/* Dead-code elimination macros. Use argc/argv for the run-time check. */
93# ifndef POLYBENCH_DUMP_ARRAYS
94#undef polybench_declare_prevent_dce_vars
95#define polybench_declare_prevent_dce_vars \
96 integer :: i;\
97 character(LEN = 30) :: arg
98# define POLYBENCH_DCE_ONLY_CODE_BEGIN \
99 call getarg(1, arg); \
100 if( IARGC() > 42 .AND. arg .EQ. '' ) then;
101# define POLYBENCH_DCE_ONLY_CODE_END \
102 end if
103# else
104#undef polybench_declare_prevent_dce_vars
105#define polybench_declare_prevent_dce_vars \
106 integer :: i
107# define POLYBENCH_DCE_ONLY_CODE_BEGIN
108# define POLYBENCH_DCE_ONLY_CODE_END
109# endif
110
111# define polybench_prevent_dce(func)\
112 POLYBENCH_DCE_ONLY_CODE_BEGIN\
113 call func;\
114 POLYBENCH_DCE_ONLY_CODE_END
115
116
117
118/* Macros for array declaration */
119#ifndef POLYBENCH_STACK_ARRAYS
120/* Heap */
121#define POLYBENCH_1D_ARRAY_DECL(NAME, TYPE, SIZE) TYPE, dimension(:), allocatable :: NAME
122#define POLYBENCH_2D_ARRAY_DECL(NAME, TYPE, SIZE1, SIZE2) TYPE, dimension(:,:), allocatable :: NAME
123#define POLYBENCH_3D_ARRAY_DECL(NAME, TYPE, SIZE1, SIZE2, SIZE3) TYPE, dimension(:,:,:), allocatable :: NAME
124#define POLYBENCH_4D_ARRAY_DECL(NAME, TYPE, SIZE1, SIZE2, SIZE3, SIZE4) TYPE, dimension(:,:,:,:), allocatable :: NAME
125#define POLYBENCH_5D_ARRAY_DECL(NAME, TYPE, SIZE1, SIZE2, SIZE3, SIZE4, SIZE5) TYPE, dimension(:,:,:,:,:), allocatable :: NAME
126
127#define POLYBENCH_ALLOC_1D_ARRAY(NAME, SIZE) allocate(NAME(SIZE+POLYBENCH_PADDING_FACTOR), STAT=I); call check_err(I)
128#define POLYBENCH_ALLOC_2D_ARRAY(NAME, SIZE1, SIZE2) allocate(NAME(SIZE1+POLYBENCH_PADDING_FACTOR,SIZE2+POLYBENCH_PADDING_FACTOR), STAT=I); call check_err(I)
129#define POLYBENCH_ALLOC_3D_ARRAY(NAME, SIZE1, SIZE2, SIZE3) allocate(NAME(SIZE1+POLYBENCH_PADDING_FACTOR,SIZE2+POLYBENCH_PADDING_FACTOR,SIZE3+POLYBENCH_PADDING_FACTOR), STAT=I); call check_err(I)
130#define POLYBENCH_ALLOC_4D_ARRAY(NAME, SIZE1, SIZE2, SIZE3, SIZE4) allocate(NAME(SIZE1+POLYBENCH_PADDING_FACTOR,SIZE2+POLYBENCH_PADDING_FACTOR,SIZE3+POLYBENCH_PADDING_FACTOR,SIZE4+POLYBENCH_PADDING_FACTOR), STAT=I); call check_err(I)
131#define POLYBENCH_ALLOC_5D_ARRAY(NAME, SIZE1, SIZE2, SIZE3, SIZE4, SIZE5) allocate(NAME(SIZE1+POLYBENCH_PADDING_FACTOR,SIZE2+POLYBENCH_PADDING_FACTOR,SIZE3+POLYBENCH_PADDING_FACTOR,SIZE4+POLYBENCH_PADDING_FACTOR,SIZE5+POLYBENCH_PADDING_FACTOR), STAT=I); call check_err(I)
132
133#define POLYBENCH_DEALLOC_ARRAY(NAME) deallocate(NAME)
134#define POLYBENCH_FREE_ARRAY(NAME) deallocate(NAME)
135
136#else
137/* Stack */
138#define POLYBENCH_1D_ARRAY_DECL(NAME, TYPE, SIZE) TYPE, dimension(SIZE+POLYBENCH_PADDING_FACTOR) :: NAME
139#define POLYBENCH_2D_ARRAY_DECL(NAME, TYPE, SIZE1, SIZE2) TYPE, dimension(SIZE1+POLYBENCH_PADDING_FACTOR, SIZE2+POLYBENCH_PADDING_FACTOR) :: NAME
140#define POLYBENCH_3D_ARRAY_DECL(NAME, TYPE, SIZE1, SIZE2, SIZE3) TYPE, dimension(SIZE1+POLYBENCH_PADDING_FACTOR, SIZE2+POLYBENCH_PADDING_FACTOR, SIZE3+POLYBENCH_PADDING_FACTOR) :: NAME
141#define POLYBENCH_4D_ARRAY_DECL(NAME, TYPE, SIZE1, SIZE2, SIZE3, SIZE4) TYPE, dimension(SIZE1+POLYBENCH_PADDING_FACTOR, SIZE2+POLYBENCH_PADDING_FACTOR, SIZE3+POLYBENCH_PADDING_FACTOR, SIZE4+POLYBENCH_PADDING_FACTOR) :: NAME
142#define POLYBENCH_5D_ARRAY_DECL(NAME, TYPE, SIZE1, SIZE2, SIZE3, SIZE4, SIZE5) TYPE, dimension(SIZE1+POLYBENCH_PADDING_FACTOR, SIZE2+POLYBENCH_PADDING_FACTOR, SIZE3+POLYBENCH_PADDING_FACTOR, SIZE4+POLYBENCH_PADDING_FACTOR, SIZE5+POLYBENCH_PADDING_FACTOR) :: NAME
143
144#define POLYBENCH_ALLOC_1D_ARRAY(NAME, SIZE)
145#define POLYBENCH_ALLOC_2D_ARRAY(NAME, SIZE1, SIZE2)
146#define POLYBENCH_ALLOC_3D_ARRAY(NAME, SIZE1, SIZE2, SIZE3)
147#define POLYBENCH_ALLOC_4D_ARRAY(NAME, SIZE1, SIZE2, SIZE3, SIZE4)
148#define POLYBENCH_ALLOC_5D_ARRAY(NAME, SIZE1, SIZE2, SIZE3, SIZE4, SIZE5)
149
150#define POLYBENCH_DEALLOC_ARRAY(NAME)
151#define POLYBENCH_FREE_ARRAY(NAME)
152#endif
153
154#endif
Note: See TracBrowser for help on using the repository browser.