Skip to content

Commit

Permalink
DBM: Add checksum validation to miniapp
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed Aug 26, 2022
1 parent 245edd6 commit e50bdd6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/dbm/dbm_miniapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ void benchmark_multiply(const int M, const int N, const int K, const int m,
1e-8, &flop);
const double time_end_multiply = omp_get_wtime();

// Validate checksum.
// Since all matrix elements were set to 1.0 the checksum is an integer.
const double expected = (int64_t)M * (int64_t)m * (int64_t)N * (int64_t)n *
(int64_t)K * (int64_t)K * (int64_t)k * (int64_t)k;
const double checksum = dbm_checksum(matrix_c);
if (checksum != expected) {
printf("ERROR: Expected checksum %f but got %f.\n", expected, checksum);
exit(1);
}

dbm_release(matrix_a);
dbm_release(matrix_b);
dbm_release(matrix_c);
Expand Down

0 comments on commit e50bdd6

Please sign in to comment.