From e5041b0efa6bd4492087139ddbd83370eea61ea2 Mon Sep 17 00:00:00 2001 From: Mathieu Faverge <mathieu.faverge@inria.fr> Date: Sat, 5 Feb 2022 00:54:45 +0100 Subject: [PATCH] testing/norms: replace flops computation by bytes to get GB/s --- testing/testing_zlange.c | 16 +++++++++------- testing/testing_zlanhe.c | 13 ++++++++----- testing/testing_zlansy.c | 14 ++++++++------ testing/testing_zlantr.c | 21 +++++++++++++-------- 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/testing/testing_zlange.c b/testing/testing_zlange.c index a52729801..7b5f2810d 100644 --- a/testing/testing_zlange.c +++ b/testing/testing_zlange.c @@ -26,28 +26,30 @@ static cham_fixdbl_t flops_zlange( cham_normtype_t ntype, int M, int N ) { cham_fixdbl_t flops = 0.; - double coefabs = 1.; + cham_fixdbl_t coefabs = 1.; + cham_fixdbl_t size; #if defined( PRECISION_z ) || defined( PRECISION_c ) coefabs = 3.; #endif + size = (cham_fixdbl_t)M * (cham_fixdbl_t)N; switch ( ntype ) { case ChamMaxNorm: - flops = coefabs * M * N; + flops = coefabs * size; break; case ChamOneNorm: - flops = coefabs * M * N + M * ( N - 1 ); + flops = coefabs * size + M * ( N - 1 ); break; case ChamInfNorm: - flops = coefabs * M * N + N * ( M - 1 ); + flops = coefabs * size + N * ( M - 1 ); break; case ChamFrobeniusNorm: - flops = ( coefabs + 1. ) * M * N; + flops = ( coefabs + 1. ) * size; break; default:; } - return sizeof( CHAMELEON_Complex64_t ) * (double)M * (double)N; - //return flops; + (void)flops; + return sizeof( CHAMELEON_Complex64_t ) * size; } int diff --git a/testing/testing_zlanhe.c b/testing/testing_zlanhe.c index fad62000a..371afc260 100644 --- a/testing/testing_zlanhe.c +++ b/testing/testing_zlanhe.c @@ -25,25 +25,28 @@ static cham_fixdbl_t flops_zlanhe( cham_normtype_t ntype, int N ) { cham_fixdbl_t flops = 0.; - double coefabs = 1.; + cham_fixdbl_t coefabs = 1.; + cham_fixdbl_t size; #if defined( PRECISION_z ) || defined( PRECISION_c ) coefabs = 3.; #endif + size = ( (cham_fixdbl_t)N * ( (cham_fixdbl_t)N + 1. ) ) / 2.; switch ( ntype ) { case ChamMaxNorm: - flops = coefabs * ( N * ( N + 1 ) ) / 2.; + flops = coefabs * size; break; case ChamOneNorm: case ChamInfNorm: - flops = coefabs * ( N * ( N + 1 ) ) / 2. + N * ( N - 1 ); + flops = coefabs * size + N * ( N - 1 ); break; case ChamFrobeniusNorm: - flops = ( coefabs + 1. ) * ( N * ( N + 1 ) ) / 2.; + flops = ( coefabs + 1. ) * size; break; default:; } - return flops; + (void)flops; + return sizeof( CHAMELEON_Complex64_t ) * size; } int diff --git a/testing/testing_zlansy.c b/testing/testing_zlansy.c index 50b2ffe4d..3d9aa0593 100644 --- a/testing/testing_zlansy.c +++ b/testing/testing_zlansy.c @@ -25,26 +25,28 @@ static cham_fixdbl_t flops_zlansy( cham_normtype_t ntype, int N ) { cham_fixdbl_t flops = 0.; - double coefabs = 1.; + cham_fixdbl_t coefabs = 1.; + cham_fixdbl_t size; #if defined( PRECISION_z ) || defined( PRECISION_c ) coefabs = 3.; #endif + size = ( (cham_fixdbl_t)N * ( (cham_fixdbl_t)N + 1. ) ) / 2.; switch ( ntype ) { case ChamMaxNorm: - flops = coefabs * ( N * ( N + 1 ) ) / 2.; + flops = coefabs * size; break; case ChamOneNorm: case ChamInfNorm: - flops = coefabs * ( N * ( N + 1 ) ) / 2. + N * ( N - 1 ); + flops = coefabs * size + N * ( N - 1 ); break; case ChamFrobeniusNorm: - flops = ( coefabs + 1. ) * ( N * ( N + 1 ) ) / 2.; + flops = ( coefabs + 1. ) * size; break; default:; } - return sizeof( CHAMELEON_Complex64_t ) * (double)N * (double)N / 2.; - //return flops; + (void)flops; + return sizeof( CHAMELEON_Complex64_t ) * size; } int diff --git a/testing/testing_zlantr.c b/testing/testing_zlantr.c index 8fe3ded01..251a73cb3 100644 --- a/testing/testing_zlantr.c +++ b/testing/testing_zlantr.c @@ -25,7 +25,8 @@ static cham_fixdbl_t flops_zlantr( cham_normtype_t ntype, cham_uplo_t uplo, int M, int N ) { cham_fixdbl_t flops = 0.; - double coefabs = 1.; + cham_fixdbl_t coefabs = 1.; + cham_fixdbl_t size; #if defined( PRECISION_z ) || defined( PRECISION_c ) coefabs = 3.; #endif @@ -33,25 +34,25 @@ flops_zlantr( cham_normtype_t ntype, cham_uplo_t uplo, int M, int N ) switch ( uplo ) { case ChamUpper: if ( N > M ) { - flops = ( M * ( M + 1 ) / 2 ) + M * ( N - M ); + size = ( M * ( M + 1 ) / 2 ) + M * ( N - M ); } else { - flops = N * ( N + 1 ) / 2; + size = N * ( N + 1 ) / 2; } break; case ChamLower: if ( M > N ) { - flops = ( N * ( N + 1 ) / 2 ) + N * ( M - N ); + size = ( N * ( N + 1 ) / 2 ) + N * ( M - N ); } else { - flops = M * ( M + 1 ) / 2; + size = M * ( M + 1 ) / 2; } break; case ChamUpperLower: default: - flops = M * N; + size = M * N; } - flops *= coefabs; + flops = size * coefabs; switch ( ntype ) { case ChamOneNorm: @@ -61,10 +62,14 @@ flops_zlantr( cham_normtype_t ntype, cham_uplo_t uplo, int M, int N ) flops += M; break; case ChamMaxNorm: + break; case ChamFrobeniusNorm: + flops += size; + break; default:; } - return flops; + (void)flops; + return size; } int -- GitLab