From a9939111d7a8e4eb797921ac1c7ea46afaf703fb Mon Sep 17 00:00:00 2001 From: Mayank Raj <75212485+Mayank-Raj3@users.noreply.github.com> Date: Sun, 24 Jul 2022 11:51:25 +0530 Subject: [PATCH] Update dgemv_thread_safety.cpp --- cpp_thread_test/dgemv_thread_safety.cpp | 56 +++++++++++++++---------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/cpp_thread_test/dgemv_thread_safety.cpp b/cpp_thread_test/dgemv_thread_safety.cpp index 20ea38138..a48d9c279 100644 --- a/cpp_thread_test/dgemv_thread_safety.cpp +++ b/cpp_thread_test/dgemv_thread_safety.cpp @@ -6,12 +6,14 @@ #include "../cblas.h" #include "cpp_thread_safety_common.h" -void launch_cblas_dgemv(double* A, double* x, double* y, const blasint randomMatSize){ +void launch_cblas_dgemv(double* A, double* x, double* y, const blasint randomMatSize) + { const blasint inc = 1; cblas_dgemv(CblasColMajor, CblasNoTrans, randomMatSize, randomMatSize, 1.0, A, randomMatSize, x, inc, 0.1, y, inc); -} + } -int main(int argc, char* argv[]){ +int main(int argc, char* argv[]) + { blasint randomMatSize = 1024; //dimension of the random square matrices and vectors being used uint32_t numConcurrentThreads = 52; //number of concurrent calls of the functions being tested uint32_t numTestRounds = 16; //number of testing rounds before success exit @@ -20,20 +22,23 @@ int main(int argc, char* argv[]){ if (maxHwThreads < 52) numConcurrentThreads = maxHwThreads; - if (argc > 4){ + if (argc > 4) + { std::cout<<"ERROR: too many arguments for thread safety tester"< cliArgs; - for (int i = 1; i < argc; i++){ + for (int i = 1; i < argc; i++) + { cliArgs.push_back(argv[i]); std::cout< rngdist{-1.0, 1.0}; std::vector> matBlock(numConcurrentThreads); @@ -56,15 +61,18 @@ int main(int argc, char* argv[]){ std::cout<<"Preparing to test CBLAS DGEMV thread safety\n"; std::cout<<"Allocating matrices..."<(randomMatSize); j++){ + for(uint32_t j = 0; j < static_cast(randomMatSize); j++) + { if (std::abs(vecBlock[i+1][j] - vecBlock[1][j]) > 1.0E-13){ //i+1 is the index of vector y, for a given thread std::cout<<"ERROR: one of the threads returned a different result! Index : "<