Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions C/CUDNN/build_10.2.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
platforms_and_sources = Dict(
Platform("x86_64", "linux") => [
ArchiveSource("https://developer.nvidia.com/compute/machine-learning/cudnn/secure/8.2.4/10.2_20210831/cudnn-10.2-linux-x64-v8.2.4.15.tgz",
"d23c94a3115a1c77116a6c127d9175fbf59f723364374f26a34699075f3222f1")],
ArchiveSource("https://developer.nvidia.com/compute/cudnn/secure/8.3.2/local_installers/10.2/cudnn-linux-x86_64-8.3.2.44_cuda10.2-archive.tar.xz",
"d6f56ef9ca8cf8f91eb73210ba6c3dca49ba4446c1661bfafe55c1ec40b669ac")],
Platform("x86_64", "windows") => [
ArchiveSource("https://developer.nvidia.com/compute/machine-learning/cudnn/secure/8.2.4/10.2_20210831/cudnn-10.2-windows10-x64-v8.2.4.15.zip",
"a13eb10cfd7e6b7b8f39d8593038855b911012c29f03990878622bdae873c4a8")],
Platform("aarch64", "linux") => [
FileSource("https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/arm64/libcudnn8_8.2.4.15-1+cuda10.2_arm64.deb", "3f08dbe14c3becb9fa1ed85cd4a080efb30edb0c4beb2fc1a2e14da3f2eefb79"),
FileSource("https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/arm64/libcudnn8-dev_8.2.4.15-1+cuda10.2_arm64.deb", "4816575e8a14baf3fc1619cb01c6dc2afd4f1b39210079d271208088ecc48702")
]
ArchiveSource("https://developer.nvidia.com/compute/cudnn/secure/8.3.2/local_installers/10.2/cudnn-windows-x86_64-8.3.2.44_cuda10.2-archive.zip",
"3810b7a4313614aedd28260785f0ebaa69204bb38fa61e439f75c75a4ba07b3d")],
)
1 change: 0 additions & 1 deletion C/CUDNN/build_11.0.jl

This file was deleted.

1 change: 0 additions & 1 deletion C/CUDNN/build_11.1.jl

This file was deleted.

1 change: 0 additions & 1 deletion C/CUDNN/build_11.2.jl

This file was deleted.

1 change: 0 additions & 1 deletion C/CUDNN/build_11.3.jl

This file was deleted.

1 change: 0 additions & 1 deletion C/CUDNN/build_11.4.jl

This file was deleted.

1 change: 0 additions & 1 deletion C/CUDNN/build_11.5.jl

This file was deleted.

14 changes: 14 additions & 0 deletions C/CUDNN/build_11.5.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
platforms_and_sources = Dict(
Platform("x86_64", "linux") => [
ArchiveSource("https://developer.nvidia.com/compute/cudnn/secure/8.3.2/local_installers/11.5/cudnn-linux-x86_64-8.3.2.44_cuda11.5-archive.tar.xz",
"5500953c08c5e5d1dddcfda234f9efbddcdbe43a53b26dc0a82c723fa170c457")],
Platform("powerpc64le", "linux") => [
ArchiveSource("https://developer.nvidia.com/compute/cudnn/secure/8.3.2/local_installers/11.5/cudnn-linux-ppc64le-8.3.2.44_cuda11.5-archive.tar.xz",
"0581bce48023a3ee71c3a819aaefcabe693eca18b61e2521dc5f8e6e71567b1b")],
Platform("aarch64", "linux") => [
ArchiveSource("https://developer.nvidia.com/compute/cudnn/secure/8.3.2/local_installers/11.5/cudnn-linux-sbsa-8.3.2.44_cuda11.5-archive.tar.xz",
"7eb8c96bfeec98e8aa7cea1e95633d2a9481fc99040eb0311d31bf137a7aa6ea")],
Platform("x86_64", "windows") => [
ArchiveSource("https://developer.nvidia.com/compute/cudnn/secure/8.3.2/local_installers/11.5/cudnn-windows-x86_64-8.3.2.44_cuda11.5-archive.zip",
"9e36eef803f1cf9ab24846dc133a3014fdc548775ee29073e8466d415957a1c0")],
)
1 change: 0 additions & 1 deletion C/CUDNN/build_11.6.jl

This file was deleted.

14 changes: 0 additions & 14 deletions C/CUDNN/build_11.jl

This file was deleted.

84 changes: 48 additions & 36 deletions C/CUDNN/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -1,44 +1,26 @@
using BinaryBuilder, Pkg
using Base.BinaryPlatforms: arch, os

include("../../fancy_toys.jl")
const YGGDRASIL_DIR = "../.."
include(joinpath(YGGDRASIL_DIR, "fancy_toys.jl"))
include(joinpath(YGGDRASIL_DIR, "platforms", "cuda.jl"))

name = "CUDNN"
version = v"8.2.4"
version = v"8.3.2"

script = raw"""
mkdir -p ${libdir} ${prefix}/include

cd ${WORKSPACE}/srcdir
if [[ ${target} == powerpc64le-linux-gnu ]]; then
cd cuda/targets/ppc64le-linux
find .
cd ${WORKSPACE}/srcdir/cudnn*

install_license NVIDIA_SLA_cuDNN_Support.txt
install_license LICENSE

if [[ ${target} == powerpc64le-linux-gnu ]]; then
mv lib/libcudnn*.so* ${libdir}
mv include/* ${prefix}/include
elif [[ ${target} == aarch64-linux-gnu && ${bb_full_target} == aarch64-linux-gnu-*-cuda+10.2 ]]; then
apk add dpkg
dpkg-deb -x libcudnn8_*.deb .
dpkg-deb -x libcudnn8-dev_*.deb .
mv -nv ./usr/include/aarch64-linux-gnu/* ${includedir}
mv -nv ./usr/lib/aarch64-linux-gnu/libcudnn*.so* ${libdir}
install_license ./usr/src/cudnn_samples_v8/NVIDIA_SLA_cuDNN_Support.txt
elif [[ ${target} == *-linux-gnu ]]; then
cd cuda
find .

install_license NVIDIA_SLA_cuDNN_Support.txt

mv lib64/libcudnn*.so* ${libdir}
mv lib/libcudnn*.so* ${libdir}
mv include/* ${prefix}/include
elif [[ ${target} == x86_64-w64-mingw32 ]]; then
cd cuda
find .

install_license NVIDIA_SLA_cuDNN_Support.txt

mv bin/cudnn*64_*.dll ${libdir}
mv include/* ${prefix}/include

Expand All @@ -49,29 +31,59 @@ elif [[ ${target} == x86_64-w64-mingw32 ]]; then
fi
"""

products = [
LibraryProduct(["libcudnn", "cudnn64_$(version.major)"], :libcudnn, dont_dlopen = true),
]
augment_platform_block = """
using Base.BinaryPlatforms

using CUDA_Runtime_jll
$(CUDA.augment)

# XXX: CUDA_loader_jll's CUDA tag should match the library's CUDA version compatibility.
# lacking that, we can't currently dlopen the library
function augment_platform!(platform::Platform)
augment_cuda_dependent!(platform)
end"""

dependencies = [Dependency(PackageSpec(name="CUDA_loader_jll"))]
products = [
LibraryProduct(["libcudnn", "cudnn64_$(version.major)"], :libcudnn),
]

cuda_versions = [v"10.2", v"11.0", v"11.1", v"11.2", v"11.3", v"11.4"]
# determine exactly which tarballs we should build
builds = []
cuda_versions = [v"10.2", v"11.5"]
for cuda_version in cuda_versions
cuda_tag = "$(cuda_version.major).$(cuda_version.minor)"
include("build_$(cuda_tag).jl")

for (platform, sources) in platforms_and_sources
augmented_platform = Platform(arch(platform), os(platform); cuda=cuda_tag)
augmented_platform = deepcopy(platform)
augmented_platform[CUDA.platform_name] = CUDA.platform(cuda_version)
should_build_platform(triplet(augmented_platform)) || continue

if platform == Platform("x86_64", "windows")
push!(sources,
ArchiveSource("http://www.winimage.com/zLibDll/zlib123dllx64.zip",
"fd324c6923aa4f45a60413665e0b68bb34a7779d0861849e02d2711ff8efb9a4"))
end
build_tarballs(ARGS, name, version, sources, script, [augmented_platform],
products, dependencies; lazy_artifacts=true)

dependencies = [Dependency(PackageSpec(name="CUDA_Runtime_jll", uuid="76a88914-d11a-5bdc-97e0-2f5a05c973a2");
platforms=[augmented_platform])]

push!(builds, (;
sources, dependencies, platforms=[augmented_platform],
))
end
end

# don't allow `build_tarballs` to override platform selection based on ARGS.
# we handle that ourselves by calling `should_build_platform`
non_platform_ARGS = filter(arg -> startswith(arg, "--"), ARGS)

# `--register` should only be passed to the latest `build_tarballs` invocation
non_reg_ARGS = filter(arg -> arg != "--register", non_platform_ARGS)

for (i,build) in enumerate(builds)
build_tarballs(i == lastindex(builds) ? non_platform_ARGS : non_reg_ARGS,
name, version, build.sources, script,
build.platforms, products, build.dependencies;
julia_compat="1.6", lazy_artifacts=true,
augment_platform_block)
end

16 changes: 13 additions & 3 deletions platforms/cuda.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const platform_name = "cuda"
const augment = """
using Libdl
using Base: thisminor
using Base.BinaryPlatforms: set_compare_strategy!


#
Expand Down Expand Up @@ -53,6 +54,7 @@ const augment = """

cuda_version_override = get(ENV, "JULIA_CUDA_VERSION", nothing)
# TODO: support for Preferences.jl-based override?
# XXX: this doesn't work, because it doesn't trigger re-compilation

# "[...] applications built against any of the older CUDA Toolkits always continued
# to function on newer drivers due to binary backward compatibility"
Expand Down Expand Up @@ -99,7 +101,13 @@ const augment = """

# imported by caller: CUDA_Runtime_jll

function cuda_comparison_strategy(a::String, b::String, a_requested::Bool, b_requested::Bool)
function cuda_comparison_strategy(a::String, b::String,
a_requested::Bool, b_requested::Bool)
if a == "none" || b == "none"
# FIXME: does this need to respec assymetry?
# can it happen we request cuda=none on a platform with CUDA?
return false
end
a = VersionNumber(a)
b = VersionNumber(b)

Expand All @@ -126,9 +134,11 @@ const augment = """
end

function augment_cuda_dependent!(platform::Platform)
if !haskey(platform, "cuda")
platform = CUDA_Runtime_jll.augment_cuda_toolkit!(platform)
end
set_compare_strategy!(platform, "cuda", cuda_comparison_strategy)
haskey(platform, "cuda") && return platform
CUDA_Runtime_jll.augment_cuda_toolkit!(platform)
return platform
end"""

function platform(cuda::VersionNumber)
Expand Down