Skip to content

Commit

Permalink
Add OpenBLAS BinaryBuilder installation scaffolding
Browse files Browse the repository at this point in the history
Also make it easier to add more BB-cached versions of dependencies in the future
  • Loading branch information
staticfloat committed Dec 26, 2018
1 parent 67e610e commit e005a04
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 28 deletions.
3 changes: 1 addition & 2 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 15 additions & 1 deletion contrib/normalize_triplet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <host triplet>")
print("Usage: %s <host triplet> [<gcc version>]")
sys.exit(1)

arch_mapping = {
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
#
Expand Down
21 changes: 21 additions & 0 deletions deps/blas.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 > $@
Expand Down Expand Up @@ -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
26 changes: 1 addition & 25 deletions deps/llvm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions deps/openblas.version
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
OPENBLAS_BRANCH=v0.3.3
OPENBLAS_SHA1=fd8d1868a126bb9f12bbc43b36ee30d1ba943fbb
OPENBLAS_VER=0.3.0
OPENBLAS_BB_REL=3
33 changes: 33 additions & 0 deletions deps/tools/bb-install.mk
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e005a04

Please sign in to comment.