#include #include #include #include #include #include "../cblas.h" #include "cpp_thread_safety_common.h" void launch_cblas_dgemm(double* A, double* B, double* C, const blasint randomMatSize){ cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, randomMatSize, randomMatSize, randomMatSize, 1.0, A, randomMatSize, B, randomMatSize, 0.1, C, randomMatSize); } 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"< cliArgs; for (int i = 1; i < argc; i++){ cliArgs.push_back(argv[i]); std::cout< rngdist{-1.0, 1.0}; 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"<(randomMatSize*randomMatSize); j++){ if (std::abs(matBlock[i+2][j] - matBlock[2][j]) > 1.0E-13){ //i+2 is the index of matrix C, for a given thread std::cout<<"ERROR: one of the threads returned a different result! Index : "<