Browse Source

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 <mhillen@linux.ibm.com>
tags/v0.3.11^2
Marius Hillenbrand 5 years ago
parent
commit
de838c38ef
3 changed files with 12 additions and 0 deletions
  1. +8
    -0
      cpp_thread_test/cpp_thread_safety_common.h
  2. +2
    -0
      cpp_thread_test/dgemm_thread_safety.cpp
  3. +2
    -0
      cpp_thread_test/dgemv_thread_safety.cpp

+ 8
- 0
cpp_thread_test/cpp_thread_safety_common.h View File

@@ -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!"<<std::endl;
std::cout<<"CBLAS DGEMV thread safety test FAILED!"<<std::endl;
exit(-1);
}
}

void FillMatrices(std::vector<std::vector<double>>& matBlock, std::mt19937_64& PRNG, std::uniform_real_distribution<double>& rngdist, const blasint randomMatSize, const uint32_t numConcurrentThreads, const uint32_t numMat){
for(uint32_t i=0; i<numMat; i++){
for(uint32_t j = 0; j < static_cast<uint32_t>(randomMatSize*randomMatSize); j++){


+ 2
- 0
cpp_thread_test/dgemm_thread_safety.cpp View File

@@ -46,6 +46,8 @@ int main(int argc, char* argv[]){
std::cout<<"Number of concurrent calls into OpenBLAS : "<<numConcurrentThreads<<'\n';
std::cout<<"Number of testing rounds : "<<numTestRounds<<'\n';
std::cout<<"This test will need "<<(static_cast<uint64_t>(randomMatSize*randomMatSize)*numConcurrentThreads*3*8)/static_cast<double>(1024*1024)<<" MiB of RAM\n"<<std::endl;

FailIfThreadsAreZero(numConcurrentThreads);
std::cout<<"Initializing random number generator..."<<std::flush;
std::mt19937_64 PRNG = InitPRNG();


+ 2
- 0
cpp_thread_test/dgemv_thread_safety.cpp View File

@@ -47,6 +47,8 @@ int main(int argc, char* argv[]){
std::cout<<"Number of concurrent calls into OpenBLAS : "<<numConcurrentThreads<<'\n';
std::cout<<"Number of testing rounds : "<<numTestRounds<<'\n';
std::cout<<"This test will need "<<((static_cast<uint64_t>(randomMatSize*randomMatSize)*numConcurrentThreads*8)+(static_cast<uint64_t>(randomMatSize)*numConcurrentThreads*8*2))/static_cast<double>(1024*1024)<<" MiB of RAM\n"<<std::endl;

FailIfThreadsAreZero(numConcurrentThreads);
std::cout<<"Initializing random number generator..."<<std::flush;
std::mt19937_64 PRNG = InitPRNG();


Loading…
Cancel
Save