PAPI 7.1.0.0
Loading...
Searching...
No Matches
fp_validation_hl.c
Go to the documentation of this file.
1/* This test runs a "classic" matrix multiply
2 * and then runs it again with the inner loop swapped.
3 * the swapped version should have better MFLIPS/MFLOPS/IPC and we test that.
4 */
5
6#include <stdio.h>
7#include <stdlib.h>
8
9#include "papi.h"
10#include "papi_test.h"
11#include "testcode.h"
12
13int main( int argc, char **argv )
14{
15 int retval;
16 int quiet = 0;
17
18 /* Set TESTS_QUIET variable */
19 quiet = tests_quiet( argc, argv );
20
21 // Flips classic
22 retval = PAPI_hl_region_begin("matrix_multiply_classic");
23 if ( retval != PAPI_OK ) {
24 test_fail( __FILE__, __LINE__, "PAPI_hl_region_begin", retval );
25 }
26 if ( !quiet ) {
27 printf("flops_float_matrix_matrix_multiply()\n");
28 }
30 retval = PAPI_hl_region_end("matrix_multiply_classic");
31 if ( retval != PAPI_OK ) {
32 test_fail( __FILE__, __LINE__, "PAPI_hl_region_end", retval );
33 }
34
35 // Flips swapped
36 retval = PAPI_hl_region_begin("matrix_multiply_swapped");
37 if ( retval != PAPI_OK ) {
38 test_fail( __FILE__, __LINE__, "PAPI_hl_region_begin", retval );
39 }
40 if ( !quiet ) {
41 printf("flops_float_swapped_matrix_matrix_multiply()\n");
42 }
44 retval = PAPI_hl_region_end("matrix_multiply_swapped");
45 if ( retval != PAPI_OK ) {
46 test_fail( __FILE__, __LINE__, "PAPI_hl_region_end", retval );
47 }
48
49 test_hl_pass( __FILE__ );
50
51 return 0;
52}
Read performance events at the beginning of a region.
Read performance events at the end of a region and store the difference to the corresponding beginnin...
float flops_float_swapped_matrix_matrix_multiply(void)
float flops_float_matrix_matrix_multiply(void)
#define PAPI_OK
Definition: f90papi.h:73
Return codes and api definitions.
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
void PAPI_NORETURN test_hl_pass(const char *filename)
Definition: test_utils.c:467
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:491
int main()
Definition: pernode.c:20
int quiet
Definition: rapl_overflow.c:19
int retval
Definition: zero_fork.c:53