Skip to content

Commit

Permalink
[OpenBLAS] Update to v0.3.21 (#5414)
Browse files Browse the repository at this point in the history
* [OpenBLAS] Update to v0.3.21

* [OpenBLAS] Need to push the new platform before using `platforms`

* [OpenBLAS] Add patch which may fix issue with building C tests for FreeBSD
  • Loading branch information
giordano committed Sep 3, 2022
1 parent aea8032 commit 1488c09
Show file tree
Hide file tree
Showing 11 changed files with 569 additions and 3 deletions.
17 changes: 17 additions & 0 deletions O/OpenBLAS/OpenBLAS32@0.3.21/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using BinaryBuilder

include("../common.jl")

# Collection of sources required to build OpenBLAS
name = "OpenBLAS32"
version = v"0.3.21"

sources = openblas_sources(version)
script = openblas_script(openblas32=true)
platforms = openblas_platforms()
products = openblas_products()
dependencies = openblas_dependencies(platforms)

# Build the tarballs
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
preferred_gcc_version=v"6", lock_microarchitecture=false, julia_compat="1.9")
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From d54971fe20a355d225e304cdf8606818675050ce Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Mon, 8 Aug 2022 11:20:38 -0500
Subject: [PATCH 1/1] Fix building tests when NOFORTRAN is not given at all

---
ctest/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ctest/Makefile b/ctest/Makefile
index 236913c3..0fb2450d 100644
--- a/ctest/Makefile
+++ b/ctest/Makefile
@@ -237,7 +237,7 @@ endif

ifeq ($(BUILD_DOUBLE),1)
# Double real
-ifeq ($(NOFORTRAN),0)
+ifeq ($(NOFORTRAN), $(filter 0 2,$(NOFORTRAN)))
xdcblat1: $(dtestl1o) c_dblat1.o $(TOPDIR)/$(LIBNAME)
$(FC) $(FLDFLAGS) -o xdcblat1 c_dblat1.o $(dtestl1o) $(LIB) $(EXTRALIB) $(CEXTRALIB)
xdcblat2: $(dtestl2o) c_dblat2.o $(TOPDIR)/$(LIBNAME)
@@ -256,7 +256,7 @@ endif

ifeq ($(BUILD_COMPLEX),1)
# Single complex
-ifeq ($(NOFORTRAN),0)
+ifeq ($(NOFORTRAN), $(filter 0 2,$(NOFORTRAN)))
xccblat1: $(ctestl1o) c_cblat1.o $(TOPDIR)/$(LIBNAME)
$(FC) $(FLDFLAGS) -o xccblat1 c_cblat1.o $(ctestl1o) $(LIB) $(EXTRALIB) $(CEXTRALIB)
xccblat2: $(ctestl2o) c_cblat2.o $(TOPDIR)/$(LIBNAME)
@@ -278,7 +278,7 @@ endif

ifeq ($(BUILD_COMPLEX16),1)
# Double complex
-ifeq ($(NOFORTRAN),0)
+ifeq ($(NOFORTRAN), $(filter 0 2,$(NOFORTRAN)))
xzcblat1: $(ztestl1o) c_zblat1.o $(TOPDIR)/$(LIBNAME)
$(FC) $(FLDFLAGS) -o xzcblat1 c_zblat1.o $(ztestl1o) $(LIB) $(EXTRALIB) $(CEXTRALIB)
xzcblat2: $(ztestl2o) c_zblat2.o $(TOPDIR)/$(LIBNAME)
--
2.37.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/kernel/arm64/KERNEL.NEOVERSEN1 b/kernel/arm64/KERNEL.NEOVERSEN1
index ea010db4..074d7215 100644
--- a/kernel/arm64/KERNEL.NEOVERSEN1
+++ b/kernel/arm64/KERNEL.NEOVERSEN1
@@ -91,10 +91,10 @@ IDAMAXKERNEL = iamax_thunderx2t99.c
ICAMAXKERNEL = izamax_thunderx2t99.c
IZAMAXKERNEL = izamax_thunderx2t99.c

-SNRM2KERNEL = scnrm2_thunderx2t99.c
-DNRM2KERNEL = dznrm2_thunderx2t99.c
-CNRM2KERNEL = scnrm2_thunderx2t99.c
-ZNRM2KERNEL = dznrm2_thunderx2t99.c
+SNRM2KERNEL = nrm2.S
+DNRM2KERNEL = nrm2.S
+CNRM2KERNEL = znrm2.S
+ZNRM2KERNEL = znrm2.S

DDOTKERNEL = dot_thunderx2t99.c
SDOTKERNEL = dot_thunderx2t99.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/Makefile.power b/Makefile.power
index 28a0bae0..b4869fbd 100644
--- a/Makefile.power
+++ b/Makefile.power
@@ -11,7 +11,7 @@ endif

ifeq ($(CORE), POWER10)
ifneq ($(C_COMPILER), PGI)
-CCOMMON_OPT += -Ofast -mcpu=power10 -mtune=power10 -mvsx -fno-fast-math
+CCOMMON_OPT += -mcpu=power10 -mtune=power10 -mvsx -fno-fast-math
ifeq ($(F_COMPILER), IBM)
FCOMMON_OPT += -O2 -qrecur -qnosave
else
@@ -22,7 +22,7 @@ endif

ifeq ($(CORE), POWER9)
ifneq ($(C_COMPILER), PGI)
-CCOMMON_OPT += -Ofast -mvsx -fno-fast-math
+CCOMMON_OPT += -mvsx -fno-fast-math
ifeq ($(C_COMPILER), GCC)
ifneq ($(GCCVERSIONGT4), 1)
$(warning your compiler is too old to fully support POWER9, getting a newer version of gcc is recommended)
@@ -59,7 +59,7 @@ endif

ifeq ($(CORE), POWER8)
ifneq ($(C_COMPILER), PGI)
-CCOMMON_OPT += -Ofast -mcpu=power8 -mtune=power8 -mvsx -fno-fast-math
+CCOMMON_OPT += -mcpu=power8 -mtune=power8 -mvsx -fno-fast-math
else
CCOMMON_OPT += -fast -Mvect=simd -Mcache_align
endif
170 changes: 170 additions & 0 deletions O/OpenBLAS/OpenBLAS32@0.3.21/bundled/patches/openblas-winexit.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
diff --git a/driver/others/memory.c b/driver/others/memory.c
index 6e654ccf..1d2f9f12 100644
--- a/driver/others/memory.c
+++ b/driver/others/memory.c
@@ -1534,7 +1534,7 @@ void CONSTRUCTOR gotoblas_init(void) {

}

-void DESTRUCTOR gotoblas_quit(void) {
+void gotoblas_quit(void) {

if (gotoblas_initialized == 0) return;

@@ -1572,75 +1572,11 @@ void DESTRUCTOR gotoblas_quit(void) {
}

#if defined(_MSC_VER) && !defined(__clang__)
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- gotoblas_init();
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
-#if defined(SMP)
- blas_thread_memory_cleanup();
-#endif
- break;
- case DLL_PROCESS_DETACH:
- gotoblas_quit();
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-/*
- This is to allow static linking.
- Code adapted from Google performance tools:
- https://gperftools.googlecode.com/git-history/perftools-1.0/src/windows/port.cc
- Reference:
- https://sourceware.org/ml/pthreads-win32/2008/msg00028.html
- http://ci.boost.org/svn-trac/browser/trunk/libs/thread/src/win32/tss_pe.cpp
-*/
-static int on_process_term(void)
-{
- gotoblas_quit();
- return 0;
-}
#ifdef _WIN64
#pragma comment(linker, "/INCLUDE:_tls_used")
#else
#pragma comment(linker, "/INCLUDE:__tls_used")
#endif
-
-#ifdef _WIN64
-#pragma const_seg(".CRT$XLB")
-#else
-#pragma data_seg(".CRT$XLB")
-#endif
-
-#ifdef _WIN64
-static const PIMAGE_TLS_CALLBACK dll_callback(HINSTANCE h, DWORD ul_reason_for_call, PVOID pv) = DllMain;
-#pragma const_seg()
-#else
-static void (APIENTRY *dll_callback)(HINSTANCE h, DWORD ul_reason_for_call, PVOID pv) = DllMain;
-#pragma data_seg()
-#endif
-
-#ifdef _WIN64
-#pragma const_seg(".CRT$XTU")
-#else
-#pragma data_seg(".CRT$XTU")
-#endif
-
-#ifdef _WIN64
-static const int(*p_process_term)(void) = on_process_term;
-#pragma const_seg()
-#else
-static int(*p_process_term)(void) = on_process_term;
-#pragma data_seg()
-#endif
#endif

#if (defined(C_PGI) || (!defined(C_SUN) && defined(F_INTERFACE_SUN))) && (defined(ARCH_X86) || defined(ARCH_X86_64))
@@ -3146,7 +3082,7 @@ void CONSTRUCTOR gotoblas_init(void) {

}

-void DESTRUCTOR gotoblas_quit(void) {
+void gotoblas_quit(void) {

if (gotoblas_initialized == 0) return;

@@ -3175,71 +3111,6 @@ void DESTRUCTOR gotoblas_quit(void) {
#endif
}

-#if defined(_MSC_VER) && !defined(__clang__)
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- gotoblas_init();
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
- break;
- case DLL_PROCESS_DETACH:
- gotoblas_quit();
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-/*
- This is to allow static linking.
- Code adapted from Google performance tools:
- https://gperftools.googlecode.com/git-history/perftools-1.0/src/windows/port.cc
- Reference:
- https://sourceware.org/ml/pthreads-win32/2008/msg00028.html
- http://ci.boost.org/svn-trac/browser/trunk/libs/thread/src/win32/tss_pe.cpp
-*/
-static int on_process_term(void)
-{
- gotoblas_quit();
- return 0;
-}
-#ifdef _WIN64
-#pragma comment(linker, "/INCLUDE:_tls_used")
-#else
-#pragma comment(linker, "/INCLUDE:__tls_used")
-#endif
-
-#ifdef _WIN64
-#pragma const_seg(".CRT$XLB")
-#else
-#pragma data_seg(".CRT$XLB")
-#endif
-static void (APIENTRY *dll_callback)(HINSTANCE h, DWORD ul_reason_for_call, PVOID pv) = DllMain;
-#ifdef _WIN64
-#pragma const_seg()
-#else
-#pragma data_seg()
-#endif
-
-#ifdef _WIN64
-#pragma const_seg(".CRT$XTU")
-#else
-#pragma data_seg(".CRT$XTU")
-#endif
-static int(*p_process_term)(void) = on_process_term;
-#ifdef _WIN64
-#pragma const_seg()
-#else
-#pragma data_seg()
-#endif
-#endif
-
#if (defined(C_PGI) || (!defined(C_SUN) && defined(F_INTERFACE_SUN))) && (defined(ARCH_X86) || defined(ARCH_X86_64))
/* Don't call me; this is just work around for PGI / Sun bug */
void gotoblas_dummy_for_PGI(void) {
18 changes: 18 additions & 0 deletions O/OpenBLAS/OpenBLAS@0.3.21/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using BinaryBuilder

include("../common.jl")

# Collection of sources required to build OpenBLAS
name = "OpenBLAS"
version = v"0.3.21"

sources = openblas_sources(version)
script = openblas_script(;aarch64_ilp64=true, num_64bit_threads=512)
platforms = openblas_platforms(;experimental=true)
push!(platforms, Platform("x86_64", "linux"; sanitize="memory"))
products = openblas_products()
dependencies = openblas_dependencies(platforms)

# Build the tarballs
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
preferred_gcc_version=v"6", lock_microarchitecture=false, julia_compat="1.9")
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From d54971fe20a355d225e304cdf8606818675050ce Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Mon, 8 Aug 2022 11:20:38 -0500
Subject: [PATCH 1/1] Fix building tests when NOFORTRAN is not given at all

---
ctest/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ctest/Makefile b/ctest/Makefile
index 236913c3..0fb2450d 100644
--- a/ctest/Makefile
+++ b/ctest/Makefile
@@ -237,7 +237,7 @@ endif

ifeq ($(BUILD_DOUBLE),1)
# Double real
-ifeq ($(NOFORTRAN),0)
+ifeq ($(NOFORTRAN), $(filter 0 2,$(NOFORTRAN)))
xdcblat1: $(dtestl1o) c_dblat1.o $(TOPDIR)/$(LIBNAME)
$(FC) $(FLDFLAGS) -o xdcblat1 c_dblat1.o $(dtestl1o) $(LIB) $(EXTRALIB) $(CEXTRALIB)
xdcblat2: $(dtestl2o) c_dblat2.o $(TOPDIR)/$(LIBNAME)
@@ -256,7 +256,7 @@ endif

ifeq ($(BUILD_COMPLEX),1)
# Single complex
-ifeq ($(NOFORTRAN),0)
+ifeq ($(NOFORTRAN), $(filter 0 2,$(NOFORTRAN)))
xccblat1: $(ctestl1o) c_cblat1.o $(TOPDIR)/$(LIBNAME)
$(FC) $(FLDFLAGS) -o xccblat1 c_cblat1.o $(ctestl1o) $(LIB) $(EXTRALIB) $(CEXTRALIB)
xccblat2: $(ctestl2o) c_cblat2.o $(TOPDIR)/$(LIBNAME)
@@ -278,7 +278,7 @@ endif

ifeq ($(BUILD_COMPLEX16),1)
# Double complex
-ifeq ($(NOFORTRAN),0)
+ifeq ($(NOFORTRAN), $(filter 0 2,$(NOFORTRAN)))
xzcblat1: $(ztestl1o) c_zblat1.o $(TOPDIR)/$(LIBNAME)
$(FC) $(FLDFLAGS) -o xzcblat1 c_zblat1.o $(ztestl1o) $(LIB) $(EXTRALIB) $(CEXTRALIB)
xzcblat2: $(ztestl2o) c_zblat2.o $(TOPDIR)/$(LIBNAME)
--
2.37.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/kernel/arm64/KERNEL.NEOVERSEN1 b/kernel/arm64/KERNEL.NEOVERSEN1
index ea010db4..074d7215 100644
--- a/kernel/arm64/KERNEL.NEOVERSEN1
+++ b/kernel/arm64/KERNEL.NEOVERSEN1
@@ -91,10 +91,10 @@ IDAMAXKERNEL = iamax_thunderx2t99.c
ICAMAXKERNEL = izamax_thunderx2t99.c
IZAMAXKERNEL = izamax_thunderx2t99.c

-SNRM2KERNEL = scnrm2_thunderx2t99.c
-DNRM2KERNEL = dznrm2_thunderx2t99.c
-CNRM2KERNEL = scnrm2_thunderx2t99.c
-ZNRM2KERNEL = dznrm2_thunderx2t99.c
+SNRM2KERNEL = nrm2.S
+DNRM2KERNEL = nrm2.S
+CNRM2KERNEL = znrm2.S
+ZNRM2KERNEL = znrm2.S

DDOTKERNEL = dot_thunderx2t99.c
SDOTKERNEL = dot_thunderx2t99.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/Makefile.power b/Makefile.power
index 28a0bae0..b4869fbd 100644
--- a/Makefile.power
+++ b/Makefile.power
@@ -11,7 +11,7 @@ endif

ifeq ($(CORE), POWER10)
ifneq ($(C_COMPILER), PGI)
-CCOMMON_OPT += -Ofast -mcpu=power10 -mtune=power10 -mvsx -fno-fast-math
+CCOMMON_OPT += -mcpu=power10 -mtune=power10 -mvsx -fno-fast-math
ifeq ($(F_COMPILER), IBM)
FCOMMON_OPT += -O2 -qrecur -qnosave
else
@@ -22,7 +22,7 @@ endif

ifeq ($(CORE), POWER9)
ifneq ($(C_COMPILER), PGI)
-CCOMMON_OPT += -Ofast -mvsx -fno-fast-math
+CCOMMON_OPT += -mvsx -fno-fast-math
ifeq ($(C_COMPILER), GCC)
ifneq ($(GCCVERSIONGT4), 1)
$(warning your compiler is too old to fully support POWER9, getting a newer version of gcc is recommended)
@@ -59,7 +59,7 @@ endif

ifeq ($(CORE), POWER8)
ifneq ($(C_COMPILER), PGI)
-CCOMMON_OPT += -Ofast -mcpu=power8 -mtune=power8 -mvsx -fno-fast-math
+CCOMMON_OPT += -mcpu=power8 -mtune=power8 -mvsx -fno-fast-math
else
CCOMMON_OPT += -fast -Mvect=simd -Mcache_align
endif
Loading

0 comments on commit 1488c09

Please sign in to comment.