Include upstream patch 2672 by request of Marius Hillenbrand.

This commit is contained in:
Susi Lehtola 2020-07-28 11:57:13 +02:00
parent 4ab33d8758
commit 766d57e663
2 changed files with 99 additions and 2 deletions

90
2672.patch Normal file
View File

@ -0,0 +1,90 @@
From 478898b37a91836a39d046f8c70e26c6c9fc06c7 Mon Sep 17 00:00:00 2001
From: Marius Hillenbrand <mhillen@linux.ibm.com>
Date: Wed, 17 Jun 2020 16:08:48 +0200
Subject: [PATCH 1/2] cpp_thread_test/dgemv: cap concurrency to number of hw
threads on small systems
... instead of (number of hw threads - 4) to avoid invalid numbers on
smaller systems. Currently, systems with 4 or fewer CPUs (e.g., small CI
VMs) would fail the test. Fixes one of the issues discussed in #2668
Signed-off-by: Marius Hillenbrand <mhillen@linux.ibm.com>
---
cpp_thread_test/dgemv_thread_safety.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cpp_thread_test/dgemv_thread_safety.cpp b/cpp_thread_test/dgemv_thread_safety.cpp
index 5411fec29..277594ff0 100644
--- a/cpp_thread_test/dgemv_thread_safety.cpp
+++ b/cpp_thread_test/dgemv_thread_safety.cpp
@@ -18,7 +18,7 @@ int main(int argc, char* argv[]){
uint32_t maxHwThreads = omp_get_max_threads();
if (maxHwThreads < 52)
- numConcurrentThreads = maxHwThreads -4;
+ numConcurrentThreads = maxHwThreads;
if (argc > 4){
std::cout<<"ERROR: too many arguments for thread safety tester"<<std::endl;
From de838c38ef9db98a635de1dcedeba8b578ec87b3 Mon Sep 17 00:00:00 2001
From: Marius Hillenbrand <mhillen@linux.ibm.com>
Date: Wed, 17 Jun 2020 16:15:44 +0200
Subject: [PATCH 2/2] 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>
---
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 60ab5bb2f..8005369a8 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!"<<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++){
diff --git a/cpp_thread_test/dgemm_thread_safety.cpp b/cpp_thread_test/dgemm_thread_safety.cpp
index 1c5287524..104c64f2a 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 : "<<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();
diff --git a/cpp_thread_test/dgemv_thread_safety.cpp b/cpp_thread_test/dgemv_thread_safety.cpp
index 277594ff0..20ea38138 100644
--- a/cpp_thread_test/dgemv_thread_safety.cpp
+++ b/cpp_thread_test/dgemv_thread_safety.cpp
@@ -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();

View File

@ -15,7 +15,7 @@
Name: openblas Name: openblas
Version: 0.3.10 Version: 0.3.10
Release: 1%{?dist} Release: 2%{?dist}
Summary: An optimized BLAS library based on GotoBLAS2 Summary: An optimized BLAS library based on GotoBLAS2
License: BSD License: BSD
URL: https://github.com/xianyi/OpenBLAS/ URL: https://github.com/xianyi/OpenBLAS/
@ -30,7 +30,10 @@ Patch2: openblas-0.2.15-constructor.patch
Patch3: openblas-0.3.7-tests.patch Patch3: openblas-0.3.7-tests.patch
# Fix broken detection for z13 support # Fix broken detection for z13 support
Patch4: https://patch-diff.githubusercontent.com/raw/xianyi/OpenBLAS/pull/2669.patch Patch4: https://github.com/xianyi/OpenBLAS/pull/2669.patch
# Fix test suite failure for <= 4 CPUs
Patch5: https://github.com/xianyi/OpenBLAS/pull/2672.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: gcc-c++
@ -245,6 +248,7 @@ cd OpenBLAS-%{version}
%endif %endif
%patch3 -p1 -b .tests %patch3 -p1 -b .tests
%patch4 -p1 -b .s390x %patch4 -p1 -b .s390x
%patch5 -p1 -b .fewcpus
# Fix source permissions # Fix source permissions
find -name \*.f -exec chmod 644 {} \; find -name \*.f -exec chmod 644 {} \;
@ -668,6 +672,9 @@ rm -rf %{buildroot}%{_libdir}/pkgconfig
%endif %endif
%changelog %changelog
* Tue Jul 28 2020 Susi Lehtola <jussilehtola@fedoraproject.org> - 0.3.10-2
- Include upstream patch 2672 to fix test suite on systems with few CPUs.
* Mon Jun 15 2020 Susi Lehtola <jussilehtola@fedoraproject.org> - 0.3.10-1 * Mon Jun 15 2020 Susi Lehtola <jussilehtola@fedoraproject.org> - 0.3.10-1
- Update to 0.3.10. - Update to 0.3.10.