diff --git a/roofline/src/aikern.c b/roofline/src/aikern.c index 72d53d3..f043d01 100644 --- a/roofline/src/aikern.c +++ b/roofline/src/aikern.c @@ -20,45 +20,115 @@ static void bail_out(char* fmt, ...); */ static double pin_time(void); -void kernel_1_16_simple(double* a, double* b, double* c, size_t size) +kern_result kernel_dispatch(kernel_t kernel, + double* a, double* b, double* c, + size_t size, size_t runs) +{ + + kern_result result; + result.runs = runs; + result.starts = malloc(sizeof(double)*(runs)); + result.ends = malloc(sizeof(double)*(runs)); + + if(result.starts==NULL || result.ends==NULL) + { + bail_out("One of the mallocs failed\n. starts = %p, ends=%p", result.starts, result.ends); + } + + + switch(kernel) + { + + case SIMPLE_1_16: + result.flops = 1; + for(size_t r=0; r unpredictable. */ -void kernel_1_8_vo_dangerous(double* a, double* b, double* c, size_t size); +void kernel_1_8_vo_dangerous(double* a, size_t size); /**************************************** diff --git a/roofline/src/roofline b/roofline/src/roofline new file mode 100755 index 0000000..617c4c5 Binary files /dev/null and b/roofline/src/roofline differ diff --git a/roofline/src/roofline.c b/roofline/src/roofline.c index 77539c4..aa91fdc 100644 --- a/roofline/src/roofline.c +++ b/roofline/src/roofline.c @@ -64,6 +64,11 @@ static double pin_time(void); */ static void testkern(double* a, double* b, double* c, size_t size); +/** + * @brief pretty prints a kern_result + */ +static void print_kernresult(kern_result* result); + int main(int argc, char* argv[]) { prog_name = argv[0]; @@ -130,34 +135,12 @@ int main(int argc, char* argv[]) { t = pin_time() - t; printf("Machine heating took %.4f microseconds = %.4f seconds (with test OI kernel)\n", (t*1.0E6), t); - - /* - TESTS!! + kern_result simple16 = kernel_dispatch(SIMPLE_1_16, a, b, c, size, runs); + kern_result fma16 = kernel_dispatch(FMA_1_16, a, b, c, size, runs); + kern_result simple8 = kernel_dispatch(SIMPLE_8_1, a, b, c, size, runs); + kern_result fma8 = kernel_dispatch(FMA_8_1, a, b, c, size, runs); - */ - printf("1/16 simple\n"); - t = pin_time(); - kernel_1_16_simple(a,b,c, size); - t = pin_time() - t; - printf("Cache warming took %.4f microseconds = %.4f seconds (with test AI of 1/16 FLOPs/Byte)\n", (t*1.0E6), t); - - printf("1/16 fuseaware\n"); - t = pin_time(); - kernel_1_16_fuseaware(a,b,c, size); - t = pin_time() - t; - printf("Cache warming took %.4f microseconds = %.4f seconds (with test AI of 1/16 FLOPs/Byte)\n", (t*1.0E6), t); - - printf("8 simple\n"); - t = pin_time(); - kernel_8_1_simple(a,b,c, size); - t = pin_time() - t; - printf("Cache warming took %.4f microseconds = %.4f seconds (with test AI of 1/16 FLOPs/Byte)\n", (t*1.0E6), t); - - printf("8 fuseaware\n"); - t = pin_time(); - kernel_8_1_fuseaware(a,b,c, size); - t = pin_time() - t; - printf("Cache warming took %.4f microseconds = %.4f seconds (with test AI of 1/16 FLOPs/Byte)\n", (t*1.0E6), t); + print_kernresult(&simple16); exit(EXIT_SUCCESS); } @@ -249,3 +232,7 @@ static void bail_out(char* fmt, ...) exit(EXIT_FAILURE); } + +static void print_kernresult(kern_result* result){ + return; +} diff --git a/roofline/src/roofline_fma b/roofline/src/roofline_fma new file mode 100755 index 0000000..3d5832b Binary files /dev/null and b/roofline/src/roofline_fma differ diff --git a/roofline/src/roofline_fma_fast_fastmath_o3 b/roofline/src/roofline_fma_fast_fastmath_o3 new file mode 100755 index 0000000..1bd004a Binary files /dev/null and b/roofline/src/roofline_fma_fast_fastmath_o3 differ diff --git a/roofline/src/roofline_fma_fast_o3 b/roofline/src/roofline_fma_fast_o3 new file mode 100755 index 0000000..1bd004a Binary files /dev/null and b/roofline/src/roofline_fma_fast_o3 differ diff --git a/roofline/src/roofline_fma_o3 b/roofline/src/roofline_fma_o3 new file mode 100755 index 0000000..bc3903e Binary files /dev/null and b/roofline/src/roofline_fma_o3 differ diff --git a/roofline/src/roofline_o3 b/roofline/src/roofline_o3 new file mode 100755 index 0000000..43a7d01 Binary files /dev/null and b/roofline/src/roofline_o3 differ