From de838c38ef9db98a635de1dcedeba8b578ec87b3 Mon Sep 17 00:00:00 2001 From: Marius Hillenbrand Date: Wed, 17 Jun 2020 16:15:44 +0200 Subject: [PATCH] cpp_thread_test/dgemv: fail early if concurrency is zero The two test cases dgemv_tester and dgemm_tester accept the degree of concurrency as command line argument (amongst others). Fail early if value 0 has been specified, instead of later with less-clear symptoms. Signed-off-by: Marius Hillenbrand --- cpp_thread_test/cpp_thread_safety_common.h | 8 ++++++++ cpp_thread_test/dgemm_thread_safety.cpp | 2 ++ cpp_thread_test/dgemv_thread_safety.cpp | 2 ++ 3 files changed, 12 insertions(+) diff --git a/cpp_thread_test/cpp_thread_safety_common.h b/cpp_thread_test/cpp_thread_safety_common.h index 60ab5bb..8005369 100644 --- a/cpp_thread_test/cpp_thread_safety_common.h +++ b/cpp_thread_test/cpp_thread_safety_common.h @@ -5,6 +5,14 @@ inline void pauser(){ std::getline(std::cin, dummy); } +void FailIfThreadsAreZero(uint32_t numConcurrentThreads) { + if(numConcurrentThreads == 0) { + std::cout<<"ERROR: Invalid parameter 0 for number of concurrent calls into OpenBLAS!"<>& matBlock, std::mt19937_64& PRNG, std::uniform_real_distribution& rngdist, const blasint randomMatSize, const uint32_t numConcurrentThreads, const uint32_t numMat){ for(uint32_t i=0; i(randomMatSize*randomMatSize); j++){ diff --git a/cpp_thread_test/dgemm_thread_safety.cpp b/cpp_thread_test/dgemm_thread_safety.cpp index 1c52875..104c64f 100644 --- a/cpp_thread_test/dgemm_thread_safety.cpp +++ b/cpp_thread_test/dgemm_thread_safety.cpp @@ -46,6 +46,8 @@ int main(int argc, char* argv[]){ std::cout<<"Number of concurrent calls into OpenBLAS : "<(randomMatSize*randomMatSize)*numConcurrentThreads*3*8)/static_cast(1024*1024)<<" MiB of RAM\n"<(randomMatSize*randomMatSize)*numConcurrentThreads*8)+(static_cast(randomMatSize)*numConcurrentThreads*8*2))/static_cast(1024*1024)<<" MiB of RAM\n"<