-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BB downloading for OpenBLAS (#30497)
* Auto-detect binarybuilder triplet * Add OpenBLAS BinaryBuilder installation scaffolding Also make it easier to add more BB-cached versions of dependencies in the future * Enable `fixup-libgfortran.sh` to directly ask `$FC` for paths * Tell Appveyor and Travis to use BinaryBuilder OpenBLAS Also allow the build system to auto-guess the triplet (cherry picked from commit 87c18d8)
- Loading branch information
1 parent
1a2134d
commit a5f63ff
Showing
10 changed files
with
210 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
#!/usr/bin/env python | ||
|
||
import re, sys | ||
|
||
# This script designed to mimick `src/PlatformNames.jl` in `BinaryProvider.jl`, which has | ||
# a method `platform_key_abi()` to parse uname-like output into something standarized. | ||
|
||
if len(sys.argv) < 2: | ||
print("Usage: %s <host triplet> [<gcc version>]") | ||
sys.exit(1) | ||
|
||
arch_mapping = { | ||
'x86_64': '(x86_|amd)64', | ||
'i686': "i\\d86", | ||
'aarch64': "aarch64", | ||
'arm': "arm(v7l)?", | ||
'powerpc64le': "p(ower)?pc64le", | ||
} | ||
platform_mapping = { | ||
'darwin': "-apple-darwin[\\d\\.]*", | ||
'freebsd': "-(.*-)?freebsd[\\d\\.]*", | ||
'windows': "-w64-mingw32", | ||
'linux': "-(.*-)?linux", | ||
} | ||
libc_mapping = { | ||
'blank_libc': "", | ||
'gnu': "-gnu", | ||
'musl': "-musl", | ||
} | ||
call_abi_mapping = { | ||
'blank_call_abi': "", | ||
'eabihf': "eabihf", | ||
} | ||
gcc_version_mapping = { | ||
'blank_gcc': "", | ||
'gcc4': "-gcc4", | ||
'gcc7': "-gcc7", | ||
'gcc8': "-gcc8", | ||
} | ||
cxx_abi_mapping = { | ||
'blank_cxx_abi': "", | ||
'cxx03': "-cxx03", | ||
'cxx11': "-cxx11", | ||
} | ||
|
||
# Helper function to collapse dictionary of mappings down into a regex of | ||
# named capture groups joined by "|" operators | ||
c = lambda mapping: "("+"|".join(["(?P<%s>%s)"%(k,v) for (k, v) in mapping.items()]) + ")" | ||
mondo_regex = re.compile( | ||
"^"+ | ||
c(arch_mapping)+ | ||
c(platform_mapping)+ | ||
c(libc_mapping)+ | ||
c(call_abi_mapping)+ | ||
c(gcc_version_mapping)+ | ||
c(cxx_abi_mapping)+ | ||
"$" | ||
) | ||
|
||
# Apply our mondo regex to our input: | ||
m = mondo_regex.match(sys.argv[1]) | ||
if m is None: | ||
print("ERROR: Unmatchable platform string '%s'!"%(sys.argv[1])) | ||
sys.exit(1) | ||
|
||
# Helper function to find the single named field within the giant regex | ||
# that is not `nothing` for each mapping we give it. | ||
def get_field(m, mapping): | ||
g = m.groupdict() | ||
for k in mapping: | ||
if g[k] is not None: | ||
return k | ||
|
||
arch = get_field(m, arch_mapping) | ||
platform = get_field(m, platform_mapping) | ||
libc = get_field(m, libc_mapping) | ||
call_abi = get_field(m, call_abi_mapping) | ||
gcc_version = get_field(m, gcc_version_mapping) | ||
cxx_abi = get_field(m, cxx_abi_mapping) | ||
|
||
def r(x): | ||
x = x.replace("blank_call_abi", "") | ||
x = x.replace("blank_gcc", "") | ||
x = x.replace("blank_cxx_abi", "") | ||
x = x.replace("blank_libc", "") | ||
return x | ||
|
||
def p(x): | ||
# These contain characters that can't be easily represented as | ||
# capture group names, unfortunately: | ||
os_remapping = { | ||
'darwin': 'apple-darwin14', | ||
'windows': 'w64-mingw32', | ||
'freebsd': 'unknown-freebsd11.1', | ||
} | ||
x = r(x) | ||
if x: | ||
for k in os_remapping: | ||
x = x.replace(k, os_remapping[k]) | ||
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: | ||
# triplets="i686-w64-mingw32 x86_64-pc-linux-musl arm-linux-musleabihf x86_64-linux-gnu arm-linux-gnueabihf x86_64-apple-darwin14 x86_64-unknown-freebsd11.1" | ||
# for t in $triplets; do | ||
# if [[ $(./normalize_triplet.py "$t") != "$t" ]]; then | ||
# echo "ERROR: Failed test on $t" | ||
# fi | ||
# done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.3 | ||
OPENBLAS_BB_REL=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 python $(call cygpath_w,$(JULIAHOME)/contrib/normalize_triplet.py) $(or $(XC_HOST),$(XC_HOST),$(BUILD_MACHINE)) $(lastword $(shell $(FC) --version | head -1))) | ||
else | ||
$(2)_BB_TRIPLET := $(shell python $(call cygpath_w,$(JULIAHOME)/contrib/normalize_triplet.py) $(or $(XC_HOST),$(XC_HOST),$(BUILD_MACHINE))) | ||
endif | ||
$(2)_BB_URL := $$($(2)_BB_URL_BASE)/$$($(2)_BB_NAME).$$($(2)_BB_TRIPLET).tar.gz | ||
|
||
$$(BUILDDIR)/$(1)-$$($(2)_BB_NAME): | ||
mkdir -p $$@ | ||
|
||
$$(BUILDDIR)/$(1)-$$($(2)_BB_NAME)/$(2).$$($(2)_BB_TRIPLET).tar.gz: | $$(BUILDDIR)/$(1)-$$($(2)_BB_NAME) | ||
$$(JLDOWNLOAD) $$@ $$($(2)_BB_URL) | ||
|
||
$$(BUILDDIR)/$(1)-$$($(2)_BB_NAME)/build-compiled: | $$(BUILDDIR)/$(1)-$$($(2)_BB_NAME)/$(2).$$($(2)_BB_TRIPLET).tar.gz | ||
echo 1 > $$@ | ||
|
||
$$(eval $$(call staged-install,$(1),$(1)-$$$$($(2)_BB_NAME),,,,)) | ||
|
||
#Override provision of stage tarball | ||
$$(build_staging)/$(1)-$$($(2)_BB_NAME).tgz: $$(BUILDDIR)/$(1)-$$($(2)_BB_NAME)/$(2).$$($(2)_BB_TRIPLET).tar.gz | $$(build_staging) | ||
cp $$< $$@ | ||
|
||
clean-$(1): | ||
distclean-$(1): | ||
get-$(1): $$(BUILDDIR)/$(1)-$$($(2)_BB_NAME)/$(2).$$($(2)_BB_TRIPLET).tar.gz | ||
extract-$(1): | ||
configure-$(1): | ||
compile-$(1): | ||
fastcheck-$(1): | ||
check-$(1): | ||
endef |