From e005a048b73fe13a7753be90c400dbaa0f9b9eaf Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Sun, 23 Dec 2018 01:08:34 -0800 Subject: [PATCH] Add OpenBLAS BinaryBuilder installation scaffolding Also make it easier to add more BB-cached versions of dependencies in the future --- Make.inc | 3 +-- contrib/normalize_triplet.py | 16 +++++++++++++++- deps/Makefile | 1 + deps/blas.mk | 21 +++++++++++++++++++++ deps/llvm.mk | 26 +------------------------- deps/openblas.version | 2 ++ deps/tools/bb-install.mk | 33 +++++++++++++++++++++++++++++++++ 7 files changed, 74 insertions(+), 28 deletions(-) create mode 100644 deps/tools/bb-install.mk diff --git a/Make.inc b/Make.inc index 08841ff573ff8..e9cb2411981e5 100644 --- a/Make.inc +++ b/Make.inc @@ -232,9 +232,8 @@ INSTALL_F := $(JULIAHOME)/contrib/install.sh 644 INSTALL_M := $(JULIAHOME)/contrib/install.sh 755 # BinaryBuilder options -BINARYBUILDER_TRIPLET = $(shell contrib/normalize_triplet.py $(or $(XC_HOST),$(XC_HOST),$(BUILD_MACHINE))) -USE_BINARYBUILDER_LLVM := 0 USE_BINARYBUILDER_OPENBLAS := 0 +USE_BINARYBUILDER_LLVM := 0 # Use the Assertions build BINARYBUILDER_LLVM_ASSERTS := 0 diff --git a/contrib/normalize_triplet.py b/contrib/normalize_triplet.py index 700835e0f5bc9..42e9a9f5d5c15 100755 --- a/contrib/normalize_triplet.py +++ b/contrib/normalize_triplet.py @@ -6,7 +6,7 @@ # a method `platform_key_abi()` to parse uname-like output into something standarized. if len(sys.argv) < 2: - print("Usage: %s ") + print("Usage: %s []") sys.exit(1) arch_mapping = { @@ -100,6 +100,20 @@ def p(x): return '-' + x return x +# If the user passes in a GCC version (like 8.2.0) use that to force a +# "-gcc8" tag at the end of the triplet, but only if it has otherwise +# not been specified +if gcc_version == "blank_gcc": + if len(sys.argv) == 3: + gcc_version = { + "4": "gcc4", + "5": "gcc4", + "6": "gcc4", + "7": "gcc7", + "8": "gcc8", + }[sys.argv[2][0]] + + print(arch+p(platform)+p(libc)+r(call_abi)+p(gcc_version)+p(cxx_abi)) # Testing suite: diff --git a/deps/Makefile b/deps/Makefile index a759218f6ca03..ba0bb685181db 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -12,6 +12,7 @@ include $(SRCDIR)/Versions.make include $(JULIAHOME)/Make.inc include $(SRCDIR)/tools/common.mk include $(SRCDIR)/tools/git-external.mk +include $(SRCDIR)/tools/bb-install.mk # Special comments: # diff --git a/deps/blas.mk b/deps/blas.mk index c025d4ac26e39..8a30ff0fa41c7 100644 --- a/deps/blas.mk +++ b/deps/blas.mk @@ -92,6 +92,8 @@ endif # Do not overwrite the "-j" flag OPENBLAS_BUILD_OPTS += MAKE_NB_JOBS=0 +ifneq ($(USE_BINARYBUILDER_OPENBLAS), 1) + $(BUILDDIR)/$(OPENBLAS_SRC_DIR)/build-configured: $(BUILDDIR)/$(OPENBLAS_SRC_DIR)/source-extracted perl -i -ple 's/^\s*(EXTRALIB\s*\+=\s*-lSystemStubs)\s*$$/# $$1/g' $(dir $<)/Makefile.system echo 1 > $@ @@ -194,3 +196,22 @@ configure-lapack: extract-lapack compile-lapack: $(BUILDDIR)/lapack-$(LAPACK_VER)/build-compiled fastcheck-lapack: check-lapack check-lapack: $(BUILDDIR)/lapack-$(LAPACK_VER)/build-checked + +else # USE_BINARYBUILDER_OPENBLAS + + +OPENBLAS_BB_URL_BASE := https://github.com/JuliaLinearAlgebra/OpenBLASBuilder/releases/download +OPENBLAS_BB_NAME := OpenBLAS.v$(OPENBLAS_VER) +OPENBLAS_BB_URL := $(OPENBLAS_BB_URL_BASE)/v$(OPENBLAS_VER)-$(OPENBLAS_BB_REL)/$(OPENBLAS_BB_NAME).$(BINARYBUILDER_TRIPLET).tar.gz + +$(eval $(call bb-install,openblas,OPENBLAS,true)) +get-lapack: get-openblas +extract-lapack: extract-openblas +configure-lapack: configure-openblas +compile-lapack: compile-openblas +fastcheck-lapack: fastcheck-openblas +check-lapack: check-openblas +clean-lapack: clean-openblas +distclean-lapack: distclean-openblas +install-lapack: install-openblas +endif diff --git a/deps/llvm.mk b/deps/llvm.mk index bfef4d51abdec..0713d7467a6d4 100644 --- a/deps/llvm.mk +++ b/deps/llvm.mk @@ -520,30 +520,6 @@ else LLVM_BB_NAME := LLVM.asserts endif LLVM_BB_NAME := $(LLVM_BB_NAME).v$(LLVM_VER) -LLVM_BB_URL := $(LLVM_BB_URL_BASE)/v$(LLVM_VER)-$(LLVM_BB_REL)/$(LLVM_BB_NAME).$(BINARYBUILDER_TRIPLET).tar.gz - -$(BUILDDIR)/llvm-$(LLVM_VER)-$(LLVM_BB_REL): - mkdir -p $@ - -$(BUILDDIR)/llvm-$(LLVM_VER)-$(LLVM_BB_REL)/LLVM.$(BINARYBUILDER_TRIPLET).tar.gz: | $(BUILDDIR)/llvm-$(LLVM_VER)-$(LLVM_BB_REL) - $(JLDOWNLOAD) $@ $(LLVM_BB_URL) - -$(BUILDDIR)/llvm-$(LLVM_VER)-$(LLVM_BB_REL)/build-compiled: | $(BUILDDIR)/llvm-$(LLVM_VER)-$(LLVM_BB_REL)/LLVM.$(BINARYBUILDER_TRIPLET).tar.gz - echo 1 > $@ - -$(eval $(call staged-install,llvm,llvm-$$(LLVM_VER)-$$(LLVM_BB_REL),,,,)) - -#Override provision of stage tarball -$(build_staging)/llvm-$(LLVM_VER)-$(LLVM_BB_REL).tgz: $(BUILDDIR)/llvm-$(LLVM_VER)-$(LLVM_BB_REL)/LLVM.$(BINARYBUILDER_TRIPLET).tar.gz | $(build_staging) - cp $< $@ - -clean-llvm: -distclean-llvm: -get-llvm: $(BUILDDIR)/llvm-$(LLVM_VER)-$(LLVM_BB_REL)/LLVM.$(BINARYBUILDER_TRIPLET).tar.gz -extract-llvm: -configure-llvm: -compile-llvm: -fastcheck-llvm: -check-llvm: +$(eval $(call bb-install,llvm,LLVM,false)) endif # USE_BINARYBUILDER_LLVM diff --git a/deps/openblas.version b/deps/openblas.version index fd259abbf7dc4..54f977af1b852 100644 --- a/deps/openblas.version +++ b/deps/openblas.version @@ -1,2 +1,4 @@ OPENBLAS_BRANCH=v0.3.3 OPENBLAS_SHA1=fd8d1868a126bb9f12bbc43b36ee30d1ba943fbb +OPENBLAS_VER=0.3.0 +OPENBLAS_BB_REL=3 diff --git a/deps/tools/bb-install.mk b/deps/tools/bb-install.mk new file mode 100644 index 0000000000000..0c42ef94632c1 --- /dev/null +++ b/deps/tools/bb-install.mk @@ -0,0 +1,33 @@ +define bb-install +# If the user has signified that this is a GCC-multiversioned tarball, then generate the proper tarball +ifeq ($(3),true) +$(2)_BB_TRIPLET := $(shell $(JULIAHOME)/contrib/normalize_triplet.py $(or $(XC_HOST),$(XC_HOST),$(BUILD_MACHINE)) $(lastword $(shell $(FC) --version | head -1))) +else +$(2)_BB_TRIPLET := $(shell $(JULIAHOME)/contrib/normalize_triplet.py $(or $(XC_HOST),$(XC_HOST),$(BUILD_MACHINE))) +endif +$(2)_BB_URL := $$($(2)_BB_URL_BASE)/v$$($(2)_VER)-$($(2)_BB_REL)/$$($(2)_BB_NAME).$$($(2)_BB_TRIPLET).tar.gz + +$$(BUILDDIR)/$(1)-$$($(2)_VER)-$$($(2)_BB_REL): + mkdir -p $$@ + +$$(BUILDDIR)/$(1)-$$($(2)_VER)-$$($(2)_BB_REL)/$(2).$$($(2)_BB_TRIPLET).tar.gz: | $$(BUILDDIR)/$(1)-$$($(2)_VER)-$$($(2)_BB_REL) + $$(JLDOWNLOAD) $$@ $$($(2)_BB_URL) + +$$(BUILDDIR)/$(1)-$$($(2)_VER)-$$($(2)_BB_REL)/build-compiled: | $$(BUILDDIR)/$(1)-$$($(2)_VER)-$$($(2)_BB_REL)/$(2).$$($(2)_BB_TRIPLET).tar.gz + echo 1 > $$@ + +$$(eval $$(call staged-install,$(1),$(1)-$$$$($(2)_VER)-$$$$($(2)_BB_REL),,,,)) + +#Override provision of stage tarball +$$(build_staging)/$(1)-$$($(2)_VER)-$$($(2)_BB_REL).tgz: $$(BUILDDIR)/$(1)-$$($(2)_VER)-$$($(2)_BB_REL)/$(2).$$($(2)_BB_TRIPLET).tar.gz | $$(build_staging) + cp $$< $$@ + +clean-$(1): +distclean-$(1): +get-$(1): $$(BUILDDIR)/$(1)-$$($(2)_VER)-$$($(2)_BB_REL)/$(2).$$($(2)_BB_TRIPLET).tar.gz +extract-$(1): +configure-$(1): +compile-$(1): +fastcheck-$(1): +check-$(1): +endef