1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #ifndef UTILITIES_H
- #define UTILITIES_H
- #include <stdio.h>
- #include <stdbool.h>
- #include <string.h>
- #include <getopt.h>
- #include <math.h>
- #include "time_entry.h"
- #include "timer.h"
- typedef enum _OutputType {
- OUT_MILLISECONDS,
- OUT_SECONDS,
- OUT_MFLOPS,
- OUT_GFLOPS,
- OUT_THROUGHTPUT_GBS,
- OUT_THROUGHTPUT_MBS,
- OUT_NONE
- } OutputType;
- #define N_DIMS 3
- #define MIN_POW2 1
- #define MAX_POW2 15
- #define MIN_RUNS 1
- #define MAX_RUNS 100
- static int N_RUNS = 4;
- static const int DIMS[N_DIMS] = {1, 2, 3};
- static int N_POWERS_INTERVALS[N_DIMS][2] = {{5, 11}, {8, 11}, {7, 7}};
- #define PRINT_DIM(dim) printf ("%dD:", dim);
- #define PRINT_DIM_SIZE(side_size,dim) { \
- printf(" %zu", side_size); while (dim != 1) { printf("x%zu", side_size);dim--; } printf("."); }
- #define OCL_CHECK_ERROR(error) { \
- if ((error) != CL_SUCCESS) fprintf (stderr, "OpenCL error <%s:%i>\n", __FILE__, __LINE__); }
- #define PRINT_DIMS(dim,side_size) { \
- if (dim == 1) { printf (" %zu", side_size); } \
- else if (dim == 2) { printf (" %zux%zu", side_size, side_size); } \
- else { printf (" %zux%zux%zu", side_size, side_size, side_size); } }
- void write_headers_in_file (int n_dims, int only_time, FILE *fp);
- void write_time_entries_in_file (TimeEntry* time_entries,
- int num_entries, int n_dims, int only_time,
- bool new_line,
- FILE *fp);
- OutputType get_output_type_by_measure(char *measure);
- bool get_fft_range(char *val1, char *val2, int *out_range);
- bool get_number_of_runs(char *val, int *out);
- void print_usage(char *app_name, struct option long_options[],
- char **options_descritions, int exit_code);
- double get_measurements_with_format (OutputType outputType,
- size_t size_bytes, double time_sec);
- #endif
|