common.h (3839B)
1 /**************************************************************************** 2 * * 3 * OpenMP MicroBenchmark Suite - Version 3.1 * 4 * * 5 * produced by * 6 * * 7 * Mark Bull, Fiona Reid and Nix Mc Donnell * 8 * * 9 * at * 10 * * 11 * Edinburgh Parallel Computing Centre * 12 * * 13 * email: markb@epcc.ed.ac.uk or fiona@epcc.ed.ac.uk * 14 * * 15 * * 16 * This version copyright (c) The University of Edinburgh, 2015. * 17 * * 18 * * 19 * Licensed under the Apache License, Version 2.0 (the "License"); * 20 * you may not use this file except in compliance with the License. * 21 * You may obtain a copy of the License at * 22 * * 23 * http://www.apache.org/licenses/LICENSE-2.0 * 24 * * 25 * Unless required by applicable law or agreed to in writing, software * 26 * distributed under the License is distributed on an "AS IS" BASIS, * 27 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 28 * See the License for the specific language governing permissions and * 29 * limitations under the License. * 30 * * 31 ****************************************************************************/ 32 33 #ifndef COMMON_H 34 #define COMMON_H 35 36 #define DEFAULT_DELAY_LENGTH -1 // -1 means the delay length should be auto generated 37 #define DEFAULT_OUTER_REPS 20 // Outer repetitions 38 #define DEFAULT_TEST_TARGET_TIME 1000.0 // Test Target time in microseconds. 39 #ifdef SCHEDBENCH 40 #define DEFAULT_DELAY_TIME 15.0 // Default delaytime in microseconds for schedbench 41 #else 42 #define DEFAULT_DELAY_TIME 0.10 // Default delaytime in microseconds 43 #endif 44 45 extern int nthreads; // Number of OpenMP threads 46 extern int delaylength; // The number of iterations to delay for 47 extern int outerreps; // Outer repetitions 48 extern unsigned long innerreps; // Inner repetitions 49 extern double delaytime; // Delay time in microseconds 50 extern double targettesttime; // The length of time in microseconds the test 51 // should run for 52 extern double *times; // Array to store results in 53 54 void init(int argc, char **argv); 55 56 void initreference(char *name); 57 58 void finalisereference(char *name); 59 60 void intitest(char *name); 61 62 void finalisetest(char *name); 63 64 double getclock(); 65 66 void delay(int delaylength); 67 68 void array_delay(int delaylength, double a[1]); 69 70 int getdelaylengthfromtime(double delaytime); 71 72 int returnfalse(void); 73 74 void finalise(void); 75 76 void benchmark(char *name, void (*test)(void)); 77 78 void reference(char *name, void (*refer)(void)); 79 80 #endif //COMMON_H