From 2e8cd9f3adcd5427101f42b613a9eb729b16c0b8 Mon Sep 17 00:00:00 2001 From: TiborGY Date: Fri, 15 Mar 2019 13:26:36 +0100 Subject: [PATCH] more output, use OMP for simultaneous thread launch Launching threads sequentially has a significant chance of giving a false negative. If an OMP parallel for construct is used to launch the concurrent calculations, then all threads start almost exactly at the same time, thus they have the highest chance of clashing. --- cpp_thread_test/dgemm_thread_safety.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/cpp_thread_test/dgemm_thread_safety.cpp b/cpp_thread_test/dgemm_thread_safety.cpp index 8b91d0232..9d42829dc 100644 --- a/cpp_thread_test/dgemm_thread_safety.cpp +++ b/cpp_thread_test/dgemm_thread_safety.cpp @@ -2,11 +2,12 @@ #include #include #include +#include #include "/opt/OpenBLAS_zen_serial/include/cblas.h" const blasint randomMatSize = 1024; //dimension of the random square matrices used -const uint32_t numConcurrentThreads = 64; //number of concurrent calls of the functions being tested -const uint32_t numTestRounds = 32; //number of testing rounds before success exit +const uint32_t numConcurrentThreads = 52; //number of concurrent calls of the functions being tested +const uint32_t numTestRounds = 8; //number of testing rounds before success exit inline void pauser(){ /// a portable way to pause a program @@ -60,6 +61,14 @@ int main(){ std::vector> matBlock(numConcurrentThreads*3); std::vector> futureBlock(numConcurrentThreads); + std::cout<<"*----------------------------*\n"; + std::cout<<"| DGEMM thread safety tester |\n"; + std::cout<<"*----------------------------*\n"; + std::cout<<"Size of random matrices(N=M=K): "<(randomMatSize*randomMatSize)*numConcurrentThreads*3*8)/static_cast(1024*1024)<<" MiB of RAM\n"< 1.0E-13){ std::cout<<"ERROR: one of the threads returned a different result!"<