Merge pull request #2549 from martin-frbg/fixthreadtest
authorMartin Kroeker <martin@ruby.chemie.uni-freiburg.de>
Fri, 10 Apr 2020 21:54:40 +0000 (23:54 +0200)
committerGitHub <noreply@github.com>
Fri, 10 Apr 2020 21:54:40 +0000 (23:54 +0200)
Match thread count in cpp_thread_test to host capability

cpp_thread_test/dgemm_thread_safety.cpp
cpp_thread_test/dgemv_thread_safety.cpp

index 1b6ad38..1c52875 100644 (file)
@@ -14,7 +14,11 @@ int main(int argc, char* argv[]){
        blasint randomMatSize = 1024; //dimension of the random square matrices used
        uint32_t numConcurrentThreads = 96; //number of concurrent calls of the functions being tested
        uint32_t numTestRounds = 16; //number of testing rounds before success exit
+       uint32_t maxHwThreads = omp_get_max_threads();
        
+       if (maxHwThreads < 96)
+               numConcurrentThreads = maxHwThreads;
+
        if (argc > 4){
                std::cout<<"ERROR: too many arguments for thread safety tester"<<std::endl;
                abort();
index 22505d0..5411fec 100644 (file)
@@ -15,6 +15,10 @@ 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
+       uint32_t maxHwThreads = omp_get_max_threads();
+       
+       if (maxHwThreads < 52)
+               numConcurrentThreads = maxHwThreads -4;
        
        if (argc > 4){
                std::cout<<"ERROR: too many arguments for thread safety tester"<<std::endl;