Skip to content

Commit

Permalink
Merge pull request #6715 from cms-sw/avx512-build
Browse files Browse the repository at this point in the history
Added AVX512 build support
  • Loading branch information
smuzaffar committed Mar 11, 2021
2 parents d0d4a67 + ef3753c commit 35eeff6
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 7 deletions.
13 changes: 13 additions & 0 deletions OpenBLAS-disable-tests.patch
@@ -0,0 +1,13 @@
diff --git a/Makefile b/Makefile
index a22e16b..2103691 100644
--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,7 @@ SUBDIRS_ALL = $(SUBDIRS) test ctest utest exports benchmark ../laswp ../bench cp
.PHONY : all libs netlib $(RELA) test ctest shared install
.NOTPARALLEL : all libs $(RELA) prof lapack-test install blas-test

-all :: libs netlib $(RELA) tests shared
+all :: libs netlib $(RELA) shared
@echo
@echo " OpenBLAS build complete. ($(LIB_COMPONENTS))"
@echo
22 changes: 22 additions & 0 deletions OpenBLAS-fix-dynamic-arch.patch
@@ -0,0 +1,22 @@
diff --git a/Makefile.x86_64 b/Makefile.x86_64
index f2de51e..e1c348a 100644
--- a/Makefile.x86_64
+++ b/Makefile.x86_64
@@ -9,7 +9,7 @@ endif
endif

ifeq ($(CORE), SKYLAKEX)
-ifndef DYNAMIC_ARCH
+ifneq ($(DYNAMIC_ARCH), 1)
ifndef NO_AVX512
CCOMMON_OPT += -march=skylake-avx512
FCOMMON_OPT += -march=skylake-avx512
@@ -28,7 +28,7 @@ endif
endif

ifeq ($(CORE), HASWELL)
-ifndef DYNAMIC_ARCH
+ifneq ($(DYNAMIC_ARCH), 1)
ifndef NO_AVX2
ifeq ($(C_COMPILER), GCC)
CCOMMON_OPT += -mavx2
4 changes: 4 additions & 0 deletions OpenBLAS.spec
@@ -1,11 +1,15 @@
### RPM external OpenBLAS 0.3.9
## INCLUDE compilation_flags
Source: https://github.com/xianyi/OpenBLAS/archive/v%{realversion}.tar.gz
Patch0: OpenBLAS-fix-dynamic-arch
Patch1: OpenBLAS-disable-tests

# Will be part of future release

%prep
%setup -n %{n}-%{realversion}
%patch0 -p1
%patch1 -p1

%build

Expand Down
9 changes: 4 additions & 5 deletions tensorflow.spec
@@ -1,13 +1,12 @@
### RPM external tensorflow 2.4.1
%define source_package tensorflow-sources
%if "%{?vectorized_package:set}" != "set"
%define source_package tensorflow-sources
%else
%define source_package tensorflow-sources_%{vectorized_package}
%endif
BuildRequires: %{source_package}
%define tf_root %(echo %{source_package}_ROOT | tr '[a-z-]' '[A-Z_]')
%define tf_version %(echo %{source_package}_VERSION | tr '[a-z-]' '[A-Z_]')
%else
BuildRequires: %{source_package}_%{vectorized_package}
%define tf_root %(echo %{source_package}_%{vectorized_package}_ROOT | tr '[a-z-]' '[A-Z_]')
%endif
Provides: libtensorflow_cc.so(tensorflow)(64bit)
Source: none

Expand Down
2 changes: 1 addition & 1 deletion vecgeom-fix-vector.patch
Expand Up @@ -7,7 +7,7 @@ index 6f5833f..d4bfd51 100644

if(CMAKE_SYSTEM_PROCESSOR MATCHES "(i686|x86_64)")
- set(VECGEOM_ARCH sse2 sse3 ssse3 sse4.1 sse4.2 avx avx2 mic mic_avx512 native empty)
+ set(VECGEOM_ARCH sse2 sse3 ssse3 sse4.1 sse4.2 avx avx2 mic mic_avx512 native empty arch=nehalem arch=sandybridge arch=haswell)
+ set(VECGEOM_ARCH sse2 sse3 ssse3 sse4.1 sse4.2 avx avx2 mic mic_avx512 native empty arch=nehalem arch=sandybridge arch=haswell arch=skylake-avx512)
else()
set(VECGEOM_ARCH empty)
endif()
8 changes: 7 additions & 1 deletion vectorization/cmsdist_packages.py
Expand Up @@ -19,12 +19,17 @@
"nehalem": "-march=nehalem",
"sandybridge": "-march=sandybridge",
"haswell": "-march=haswell",
"skylake-avx512":"-march=skylake-avx512",
}

def fix_tensorflow_sources(vec, value):
return [(DEFAULT_VECTORIZED_FLAG,"%s %s" % (value, "--distinct_host_configuration=true"))]

def fix_vecgeom(vec, value):
return [(DEFAULT_VECTORIZED_FLAG.replace("-m", ""), value.replace("-m", ""))]

def fix_OpenBLAS(vec, value):
if vec=="skylake-avx512": vec="SKYLAKEX"
return [("TARGET=CORE2", "TARGET=%s" % vec.upper())]

def packages(virtual_packages, *args):
Expand All @@ -39,7 +44,8 @@ def packages(virtual_packages, *args):
vpkg = "%s_%s" % (pkg, v)
rdata = [(DEFAULT_VECTORIZED_FLAG, VALID_VECTORIZATION[v])]
try:
rdata = eval('fix_%s' % pkg)(v, rdata[0][1])
ndata = eval('fix_%s' % pkg.replace("-","_").replace(".","_"))(v, rdata[0][1])
if ndata is not None: rdata = ndata
except:
pass
xregexp = ""
Expand Down

0 comments on commit 35eeff6

Please sign in to comment.