diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b4ba06e..580d081 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,10 +3,20 @@ on: push: branches: - master + pull_request: + # The toolchain, GPU and MPI pages are generated from BinaryBuilderBase, Yggdrasil + # and the General registry, so rebuild weekly to pick up their changes. + schedule: + - cron: '0 6 * * 1' + workflow_dispatch: + permissions: - contents: write + contents: read + jobs: - build-and-deploy: + # Builds the site with read-only permissions, since it runs code downloaded from + # Yggdrasil (see utils.jl). Pull requests stop here. + build: runs-on: ubuntu-latest steps: - name: Checkout @@ -17,14 +27,36 @@ jobs: uses: julia-actions/setup-julia@v3 with: version: '1' - - run: julia -e ' - using Pkg; Pkg.add(["NodeJS", "Franklin"]); + - name: Build site + run: julia --project=. -e ' + using Pkg; Pkg.instantiate(); using NodeJS; run(`$(npm_cmd()) install highlight.js`); using Franklin; - Pkg.activate("."); Pkg.instantiate(); optimize(minify=false)' - - name: Build and Deploy - uses: JamesIves/github-pages-deploy-action@releases/v4 + - name: Upload site + uses: actions/upload-artifact@v7 + with: + name: site + path: __site + + deploy: + needs: build + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Download site + uses: actions/download-artifact@v8 + with: + name: site + path: __site + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 with: token: ${{ secrets.GITHUB_TOKEN }} branch: gh-pages diff --git a/.gitignore b/.gitignore index 0804690..5177325 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ .DS_Store __site +Manifest.toml +node_modules/ +package.json +package-lock.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index c26e6c8..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,9 +0,0 @@ -pages: - stage: deploy - script: - - mv __site public - artifacts: - paths: - - public - only: - - master diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..edc7fe4 --- /dev/null +++ b/Project.toml @@ -0,0 +1,14 @@ +[deps] +BinaryBuilderBase = "7f725544-6523-48cd-82d1-3fa08ff4056e" +Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" +Franklin = "713c75ef-9fc9-4b05-94a9-213340da978e" +NodeJS = "2bd173c7-0d6d-553b-b6af-13a54713934c" +RegistryInstances = "2792f1a3-b283-48e8-9a74-f99dce5104f3" + +[compat] +BinaryBuilderBase = "1.49" +Downloads = "1" +Franklin = "0.10" +NodeJS = "2" +RegistryInstances = "0.1" +julia = "1.10" diff --git a/_assets/hamburger.svg b/_assets/hamburger.svg deleted file mode 100644 index 233bf21..0000000 --- a/_assets/hamburger.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/_assets/rndimg.jpg b/_assets/rndimg.jpg deleted file mode 100644 index 98be38d..0000000 Binary files a/_assets/rndimg.jpg and /dev/null differ diff --git a/_assets/scripts/generate_results.jl b/_assets/scripts/generate_results.jl deleted file mode 100644 index 8823354..0000000 --- a/_assets/scripts/generate_results.jl +++ /dev/null @@ -1,27 +0,0 @@ -# Parent file to run all scripts which may generate -# some output that you want to display on the website. -# this can be used as a tester to check that all the code -# on your website runs properly. - -dir = @__DIR__ - -""" - genplain(s) - -Small helper function to run some code and redirect the output (stdout) to a file. -""" -function genplain(s::String) - open(joinpath(dir, "output", "$(splitext(s)[1]).txt"), "w") do outf - redirect_stdout(outf) do - include(joinpath(dir, s)) - end - end -end - -# output - -genplain("script1.jl") - -# plots - -include("script2.jl") diff --git a/_assets/scripts/output/script1.out b/_assets/scripts/output/script1.out deleted file mode 100644 index 234405e..0000000 --- a/_assets/scripts/output/script1.out +++ /dev/null @@ -1,5 +0,0 @@ -*---------1.3 -**--------1.3 -***-------1.3 -****------1.3 -*****-----1.3 diff --git a/_assets/scripts/output/script2.svg b/_assets/scripts/output/script2.svg deleted file mode 100644 index 56bb295..0000000 --- a/_assets/scripts/output/script2.svg +++ /dev/null @@ -1,581 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/_assets/scripts/script1.jl b/_assets/scripts/script1.jl deleted file mode 100644 index bc4dc52..0000000 --- a/_assets/scripts/script1.jl +++ /dev/null @@ -1,10 +0,0 @@ -using LinearAlgebra # HIDE -using Random:seed! # HIDE -seed!(0) # HIDE - # HIDE -x = randn(5) -y = randn(5) - -for i in 1:5 - println(rpad("*"^i, 10, '-'), round(dot(x, y), digits=1)) -end diff --git a/_assets/scripts/script2.jl b/_assets/scripts/script2.jl deleted file mode 100644 index 0fa6c42..0000000 --- a/_assets/scripts/script2.jl +++ /dev/null @@ -1,4 +0,0 @@ -using PyPlot -x = range(0, stop=1, length=50) -plot(x, sin.(2x).*exp.(-x/3)) -savefig(joinpath(@__DIR__, "output", "script2.svg")) diff --git a/_assets/yggdrasil.svg b/_assets/yggdrasil.svg new file mode 100644 index 0000000..d3921c8 --- /dev/null +++ b/_assets/yggdrasil.svg @@ -0,0 +1,311 @@ + + + + diff --git a/_css/franklin.css b/_css/franklin.css index 11ced6e..9ca577b 100644 --- a/_css/franklin.css +++ b/_css/franklin.css @@ -239,3 +239,50 @@ return{c:[{cN:"metaj",b:/^julia>/,r:10,starts:{e:/^(?![ ]{6})/,sL:"julia"},alias color: white; border-radius: 0.3em; } + +.titlebar a { + color: inherit; + text-decoration: none; +} +.intro p a { + color: inherit; + text-decoration: underline; +} + +/* Section heading with a centered icon, e.g. Yggdrasil on the homepage */ +.section-head { + text-align: center; + margin: 1.5em 0 2em 0; +} +.section-head img { + display: block; + height: 6em; + margin: 0 auto 0.5em auto; +} +.franklin-content .section-head h2 { + text-align: center; + margin: 0 0 0.3em 0; +} +.section-head p { + margin: 0; +} + +/* Generated toolchain tables (see utils.jl) */ +.table-scroll { + overflow-x: auto; + margin: 1em 0; +} +.franklin-content table.toolchains { + font-size: 90%; +} +.franklin-content table.toolchains th { + background-color: #f2f2f2; + padding: 6px 10px; +} +.franklin-content table.toolchains td { + text-align: left; + padding: 6px 10px; +} +.franklin-content table.toolchains td code { + white-space: nowrap; +} diff --git a/_layout/foot.html b/_layout/foot.html index 77f7f93..4a3be05 100644 --- a/_layout/foot.html +++ b/_layout/foot.html @@ -5,6 +5,6 @@ {{ if hascode }} {{ insert foot_highlight.html }} {{ end }} - + {{ispage index.html}}{{end}} diff --git a/_layout/head.html b/_layout/head.html index 676c7fc..f6e108c 100644 --- a/_layout/head.html +++ b/_layout/head.html @@ -6,7 +6,7 @@ - + {{ispage index.html}}{{end}} {{if hasmath}} {{insert head_katex.html }} {{end}} {{if hascode}} {{insert head_highlight.html }} {{end}} @@ -19,14 +19,15 @@
-

BinaryBuilder

+

BinaryBuilder

+ {{ispage index.html}}
-

Build native binaries for 18 platforms in minutes. See how.

+

Build native binaries for {{platform_count}} platforms in minutes. See how.

-
@@ -39,5 +40,6 @@

BinaryBuilder

+ {{end}} diff --git a/config.md b/config.md index 399fb68..f7149a8 100644 --- a/config.md +++ b/config.md @@ -6,3 +6,6 @@ @def generate_rss = false \newcommand{\style}[2]{~~~
~~~!#2~~~
~~~} + + +@def ignore = ["Project.toml", "Manifest.toml", "package.json", "package-lock.json"] diff --git a/gpus.md b/gpus.md new file mode 100644 index 0000000..c100569 --- /dev/null +++ b/gpus.md @@ -0,0 +1,55 @@ +@def title = "Yggdrasil GPUs" +@def hasmath = false +@def hascode = false + +# GPUs + +[Yggdrasil](https://github.com/JuliaPackaging/Yggdrasil/), the community build tree for BinaryBuilder recipes, builds packages for NVIDIA, AMD, Intel and Apple GPUs, and for the cross-vendor OpenCL, Vulkan and SPIR-V standards. Library versions on this page are the latest ones in Julia's General registry when the site was built. + +## NVIDIA + +Yggdrasil recipes that use CUDA are built for {{cuda_default_count}} of the {{cuda_count}} CUDA toolkits below by default. Each build is tagged with its CUDA version, and Julia installs the one that works with the user's CUDA runtime: a build for CUDA 12.2 works with any CUDA 12 runtime from 12.2 onwards. Program NVIDIA GPUs from Julia with [CUDA.jl](https://github.com/JuliaGPU/CUDA.jl), and start a recipe from the [`HelloWorldCUDA`](https://github.com/JuliaPackaging/Yggdrasil/tree/master/H/HelloWorldCUDA) example. + +~~~ +{{cuda_table}} +~~~ + +From CUDA 13, a single aarch64 build covers both ARM servers and Jetson. Toolkits marked opt-in or preview are left out of `CUDA.supported_platforms()` by default; recipes include them with its `min_version` and `prereleases` keywords. + +~~~ +{{gpu_packages NVIDIA}} +~~~ + +## AMD + +Program AMD GPUs from Julia with [AMDGPU.jl](https://github.com/JuliaGPU/AMDGPU.jl). + +~~~ +{{gpu_packages AMD}} +~~~ + +## Intel + +Program Intel GPUs from Julia with [oneAPI.jl](https://github.com/JuliaGPU/oneAPI.jl). + +~~~ +{{gpu_packages Intel}} +~~~ + +## Apple + +Program Apple GPUs from Julia with [Metal.jl](https://github.com/JuliaGPU/Metal.jl). + +~~~ +{{gpu_packages Apple}} +~~~ + +## OpenCL, Vulkan and SPIR-V + +Use OpenCL from Julia with [OpenCL.jl](https://github.com/JuliaGPU/OpenCL.jl) and Vulkan with [Vulkan.jl](https://github.com/JuliaGPU/Vulkan.jl). + +~~~ +{{gpu_packages Cross-vendor}} +~~~ + +The CUDA toolkits come from Yggdrasil's [`platforms/cuda.jl`](https://github.com/JuliaPackaging/Yggdrasil/blob/master/platforms/cuda.jl) each time the site is built. diff --git a/index.md b/index.md index b79e6f2..16e7959 100644 --- a/index.md +++ b/index.md @@ -7,24 +7,24 @@
- +

Toolchains

-

45 well maintained toolchains for major platforms

+

{{toolchain_count}} well maintained toolchains for major platforms

- +

Sandbox

-

All the tools you need in one isolated Linux environment

+

All the tools you need in one isolated Linux environment

- +

Audit

Automated analysis finds and fixes common mistakes

- +

Wizard

-

An interactive environment simplifies authoring

+

An interactive environment simplifies authoring

@@ -33,39 +33,62 @@

OS Support

-

BinaryBuilder produces binaries for Linux, macOS, Windows and FreeBSD with a single script.

+

BinaryBuilder produces binaries for {{os_list}} with a single script.

CPU support

-

BinaryBuilder supports x86_64, x86, ARMv6, ARMv7, AArch64, PPC64LE, and Riscv64. Automatically!

+

BinaryBuilder supports {{cpu_list}}. Automatically!

Language support

-

Build native binaries for your C, C++, Fortran, Rust and Go packages.

+

Build native binaries for your C, C++, Fortran, Rust, Go and OCaml packages.

Just tarballs

-

BinaryBuilder output is just a tarball. Grab the one for your ABI and go. No root or special tools required!

+

BinaryBuilder output is just a tarball. Grab the one for your ABI and go. No root or special tools required!

Hints

-

Common build systems are automatically detected. The wizard will give you the right command.

+

Common build systems are automatically detected. The wizard will give you the right command.

-

Sensible defaults

-

If your build system is simple, our defaults will probably work for you.

+

Cross-platform consistency

+

You can build for several platforms using the same toolchain, getting consistent binaries across all target systems.

+
+ +
+ +
+ +

Yggdrasil

+

Yggdrasil is the community build tree for BinaryBuilder recipes, where the binary packages of the Julia ecosystem are built.

+
+ +
-

Experience

-

We've shipped millions of binaries this way. Where possible we've automated our learnings to help improve your binaries.

+

Community-driven

+

Build recipes for thousands of packages are already available, contributed by the community.

-

Cross-platform consistency

-

You can build for several platforms using the same toolchain, getting consistent binaries across all target systems.

+

JLL packages

+

Every merged recipe is built, uploaded and registered as a JLL package, so Julia users get the binaries with using LibFoo_jll.

-

Community-driven

-

Build recipes for hundreds of packages are already available in the community buildtree, Yggdrasil.

+

Contributing

+

Add or update a package by opening a pull request with its recipe. CI builds it for every platform it targets.

+
+
+

GPUs

+

Build code for NVIDIA, AMD, Intel and Apple GPUs. For CUDA, Julia automatically installs the build that matches the user's CUDA version.

+
+
+

Parallelism

+

Build MPI and OpenMP code for parallel computing. Users can switch between MPI implementations, such as MPICH and Open MPI, without rebuilding.

+
+
+

Agents

+

Agents simplify authoring, guided by Yggdrasil's agent guide.

diff --git a/mpi.md b/mpi.md new file mode 100644 index 0000000..ada0815 --- /dev/null +++ b/mpi.md @@ -0,0 +1,25 @@ +@def title = "Yggdrasil MPI" +@def hasmath = false +@def hascode = false + +# MPI + +[Yggdrasil](https://github.com/JuliaPackaging/Yggdrasil/), the community build tree for BinaryBuilder recipes, builds packages that use MPI once for each of the {{mpi_count}} MPI implementations below, and tags each build with its implementation. Users choose an implementation with [MPIPreferences.jl](https://juliaparallel.org/MPI.jl/stable/configuration/); without a preference, Julia uses MPICH, or Microsoft MPI on Windows. Julia then installs the matching build of every package, so switching implementations doesn't require rebuilding anything. + +Use MPI from Julia with [MPI.jl](https://github.com/JuliaParallel/MPI.jl), and start a recipe from the [`HelloWorldMPI`](https://github.com/JuliaPackaging/Yggdrasil/tree/master/H/HelloWorldMPI) example. + +## Implementations + +~~~ +{{mpi_table}} +~~~ + +Compatible versions are the versions of each implementation that the builds work with. [`MPICH_CUDA_jll`](https://github.com/JuliaBinaryWrappers/MPICH_CUDA_jll.jl), a build of MPICH with CUDA support, can be selected in place of MPICH. Latest versions are the latest ones in Julia's General registry when the site was built. + +## Platforms + +~~~ +{{mpi_platform_table}} +~~~ + +The implementations come from Yggdrasil's [`platforms/mpi.jl`](https://github.com/JuliaPackaging/Yggdrasil/blob/master/platforms/mpi.jl) each time the site is built. diff --git a/toolchains.md b/toolchains.md new file mode 100644 index 0000000..c6b64a0 --- /dev/null +++ b/toolchains.md @@ -0,0 +1,25 @@ +@def title = "BinaryBuilder Toolchains" +@def hasmath = false +@def hascode = false + +# Toolchains + +BinaryBuilder provides {{toolchain_count}} compiler versions for {{platform_count}} platforms. All of them run in the same [sandboxed Linux environment](https://docs.binarybuilder.org/stable/rootfs/), so one build recipe produces binaries for every platform. + +A recipe chooses its compilers with the `compilers` keyword of `build_tarballs` and their versions with `preferred_gcc_version`, `preferred_llvm_version`, `preferred_rust_version`, `preferred_go_version` and `preferred_ocaml_version`. By default you get the oldest GCC that supports the platform, because older GCC versions produce binaries that run on more systems, and the newest LLVM, Rust, Go and OCaml. See [Building Packages](https://docs.binarybuilder.org/stable/building/) and the [build tips for each language](https://docs.binarybuilder.org/stable/build_tips/). + +## Compilers + +~~~ +{{toolchain_table}} +~~~ + +## Platforms + +These are the platforms returned by `supported_platforms()`, the default set that recipes build for. The table shows which GCC, Rust and OCaml versions are available for each one; the GCC versions are those usable with the default LLVM, {{default_llvm}}. LLVM/Clang and Go are not listed here because each version is a single build that targets every platform, although older releases can predate newer targets such as Apple silicon or RISC-V. See [Platforms](https://docs.binarybuilder.org/stable/building/#Platforms) in the documentation to choose which platforms a recipe builds for. + +~~~ +{{platform_table}} +~~~ + +This page is generated from [BinaryBuilderBase](https://github.com/JuliaPackaging/BinaryBuilderBase.jl) v{{bbb_version}} each time the site is built. The toolchains themselves are built by the recipes in [`Yggdrasil/0_RootFS`](https://github.com/JuliaPackaging/Yggdrasil/tree/master/0_RootFS). diff --git a/utils.jl b/utils.jl new file mode 100644 index 0000000..000931b --- /dev/null +++ b/utils.jl @@ -0,0 +1,416 @@ +# Helper functions for the Franklin build of binarybuilder.org. +# +# The platform, toolchain, GPU and MPI data shown on the site is computed at build +# time, so it stays in sync with what BinaryBuilder and Yggdrasil offer instead of +# being maintained by hand. See +# https://github.com/JuliaPackaging/binarybuilder.org/issues/2 +# +# Sources: +# - BinaryBuilderBase: platforms and compiler toolchains +# - Yggdrasil's platforms/cuda.jl and platforms/mpi.jl: CUDA and MPI builds +# - The General registry: latest versions of GPU and MPI packages + +using BinaryBuilderBase +using Base.BinaryPlatforms: AbstractPlatform, triplet, platforms_match, arch, os, tags +using Downloads, RegistryInstances + +const BBB = BinaryBuilderBase + +## HTML helpers +# +# Table cells are escaped unless wrapped in `Raw`, so text that comes from upstream +# data can't inject markup into the site. + +struct Raw + html::String +end + +escape_html(x) = replace(string(x), '&' => "&", '<' => "<", '>' => ">", '"' => """) +cell(x::Raw) = x.html +cell(x) = escape_html(x) + +const CHECK = Raw("✓") +const DASH = Raw("—") +code(s) = Raw("$(escape_html(s))") +link(href, text) = Raw("$(cell(text))") +jll_link(name) = link("https://github.com/JuliaBinaryWrappers/$(name).jl", code(name)) + +html_table(header, rows) = string( + "
\n", + join("" for h in header), + "\n\n", + join("" * join("" for c in row) * "\n" for row in rows), + "
$(cell(h))
$(cell(c))
\n") + +# "a, b and c" +join_and(xs) = length(xs) <= 1 ? join(xs) : join(xs[1:end-1], ", ") * " and " * last(xs) + +## Platforms + +const PLATFORMS = supported_platforms() + +# Display names, in the order they are listed on the site. +const OS_NAMES = ["linux" => "Linux", "macos" => "macOS", "windows" => "Windows", + "freebsd" => "FreeBSD"] +const ARCH_NAMES = ["x86_64" => "x86_64", "i686" => "i686", "armv6l" => "ARMv6", + "armv7l" => "ARMv7", "aarch64" => "AArch64", "powerpc64le" => "PPC64LE", + "riscv64" => "RISC-V"] +os_name(p) = get(Dict(OS_NAMES), os(p), os(p)) + +# Display names of the values `f` takes over the supported platforms, with any value +# missing from `names` listed last under its own name. +function display_names(f, names) + present = unique(f.(PLATFORMS)) + return [[name for (key, name) in names if key in present]; + [key for key in present if !any(n -> first(n) == key, names)]] +end + +""" + {{platform_count}} + +Number of platforms returned by `supported_platforms()`. +""" +hfun_platform_count() = string(length(PLATFORMS)) + +""" + {{os_list}} + +The operating systems of the supported platforms, e.g. "Linux, macOS, Windows and FreeBSD". +""" +hfun_os_list() = escape_html(join_and(display_names(os, OS_NAMES))) + +""" + {{cpu_list}} + +The CPU architectures of the supported platforms, e.g. "x86_64, i686 and AArch64". +""" +hfun_cpu_list() = escape_html(join_and(display_names(arch, ARCH_NAMES))) + +## Toolchains + +all_versions(builds) = sort(unique(BBB.getversion.(builds))) + +const COMPILERS = [ + (name = "GCC", versions = all_versions(BBB.available_gcc_builds), + note = "Cross-compiler and binutils built for each target platform."), + (name = "LLVM/Clang", versions = all_versions(BBB.available_llvm_builds), + note = "One build per version that targets every platform."), + (name = "Rust", versions = all_versions(BBB.available_rust_builds), + note = "Standard library built for each target platform."), + (name = "Go", versions = all_versions(BBB.available_go_builds), + note = "One build per version that targets every platform."), + (name = "OCaml", versions = all_versions(BBB.available_ocaml_builds), + note = "Cross-compiler built for each target platform."), +] +versions_of(name) = only(c.versions for c in COMPILERS if c.name == name) + +# Targets of each compiler shard, by shard name and version. Only one archive type +# is looked at, otherwise every shard would be counted twice (squashfs and unpacked). +const SHARD_TARGETS = let targets = Dict{Tuple{String,VersionNumber},Vector{AbstractPlatform}}() + for cs in BBB.all_compiler_shards() + (cs.archive_type === :unpacked && cs.target !== nothing) || continue + push!(get!(targets, (cs.name, cs.version), AbstractPlatform[]), cs.target) + end + targets +end +has_shard(name, version, p) = + any(t -> platforms_match(t, p), get(SHARD_TARGETS, (name, version), AbstractPlatform[])) + +# Versions of `compiler` whose `shard` exists for platform `p`. +shard_versions(shard, compiler, p) = filter(v -> has_shard(shard, v, p), versions_of(compiler)) + +# `choose_shards` defaults to the newest LLVM. +const DEFAULT_LLVM = BBB.getversion(last(BBB.available_llvm_builds)) + +# Mirror `BinaryBuilderBase.choose_shards`: a GCC build is usable for a platform if +# its shard exists for that target and `gcc_version` doesn't filter it out, given the +# default LLVM (e.g. riscv64 needs GCC 14 or later, and FreeBSD needs GCC 6 or later +# with LLVM 12 or later). +function gcc_versions(p) + builds = filter(b -> has_shard("GCCBootstrap", BBB.getversion(b), p), BBB.available_gcc_builds) + return sort(BBB.gcc_version(p, builds, [:c]; llvm_version=DEFAULT_LLVM)) +end + +# Show a long list of versions as a range when it contains every version of `all` +# between its endpoints, so that gaps (e.g. a platform missing some GCC versions) +# stay visible. Prerelease builds such as GCC 12.0.1-iains (which exists for +# aarch64-apple-darwin only) don't count as gaps. +function format_versions(vs, all) + isempty(vs) && return DASH + lo, hi = first(vs), last(vs) + between = filter(v -> lo <= v <= hi && (isempty(v.prerelease) || v in vs), all) + if length(vs) > 3 && between == vs + return Raw("$(escape_html(lo)) – $(escape_html(hi)) ($(length(vs)))") + end + return join(string.(vs), ", ") +end + +""" + {{toolchain_count}} + +Number of distinct compiler versions (GCC, LLVM, Rust, Go and OCaml) available. +""" +hfun_toolchain_count() = string(sum(length(c.versions) for c in COMPILERS)) + +""" + {{bbb_version}} + +Version of BinaryBuilderBase the toolchain data was generated from. +""" +hfun_bbb_version() = string(pkgversion(BinaryBuilderBase)) + +""" + {{default_llvm}} + +The LLVM version that recipes get by default. +""" +hfun_default_llvm() = string(DEFAULT_LLVM) + +""" + {{toolchain_table}} + +One row per compiler, listing every available version. +""" +hfun_toolchain_table() = html_table( + ["Compiler", "Versions", "Count", "Notes"], + [[c.name, join(string.(c.versions), ", "), length(c.versions), c.note] for c in COMPILERS]) + +""" + {{platform_table}} + +One row per supported platform, with the GCC, Rust and OCaml versions available for it. +""" +function hfun_platform_table() + rows = map(PLATFORMS) do p + [code(triplet(p)), os_name(p), arch(p), + format_versions(gcc_versions(p), versions_of("GCC")), + format_versions(shard_versions("RustToolchain", "Rust", p), versions_of("Rust")), + format_versions(shard_versions("OCaml", "OCaml", p), versions_of("OCaml"))] + end + return html_table(["Platform", "OS", "Architecture", "GCC", "Rust", "OCaml"], rows) +end + +## Yggdrasil's CUDA and MPI helpers +# +# CUDA and MPI builds are defined by Yggdrasil's platforms/cuda.jl and +# platforms/mpi.jl, not by BinaryBuilderBase, so they are loaded from Yggdrasil's +# master branch at build time. Set YGGDRASIL_DIR to read them from a local checkout +# instead. If they can't be loaded, the build fails, so the deployed site keeps its +# last good version rather than publishing wrong data. + +const YGGDRASIL_PLATFORMS_URL = + "https://raw.githubusercontent.com/JuliaPackaging/Yggdrasil/master/platforms/" + +function read_yggdrasil_file(file) + dir = get(ENV, "YGGDRASIL_DIR", "") + isempty(dir) || return read(joinpath(dir, "platforms", file), String) + url = YGGDRASIL_PLATFORMS_URL * file + for attempt in 1:3 + try + return String(take!(Downloads.download(url, IOBuffer()))) + catch err + attempt == 3 && error("Could not download $url: $(sprint(showerror, err))") + sleep(5 * attempt) + end + end +end + +function load_yggdrasil_helper(file, modname) + src = read_yggdrasil_file(file) + # The helpers only use types that BinaryBuilder re-exports from BinaryBuilderBase, + # so load them against BinaryBuilderBase instead of installing all of BinaryBuilder. + pattern = r"^(\s*)(using|import) BinaryBuilder\b"m + occursin(pattern, src) || + error("Yggdrasil's platforms/$file no longer loads BinaryBuilder as utils.jl expects") + src = replace(src, pattern => + s"\1using BinaryBuilderBase; const BinaryBuilder = BinaryBuilderBase; \2 BinaryBuilderBase") + m = Module() + try + Base.include_string(m, src, "Yggdrasil/platforms/$file") + return Base.invokelatest(getglobal, m, modname) + catch err + error("Could not load Yggdrasil's platforms/$file: $(sprint(showerror, err))") + end +end + +const CUDA_HELPER = load_yggdrasil_helper("cuda.jl", :CUDA) +const MPI_HELPER = load_yggdrasil_helper("mpi.jl", :MPI) + +## Registry + +const GENERAL = let regs = filter(r -> r.name == "General", RegistryInstances.reachable_registries()) + isempty(regs) && error("The General registry isn't installed; add it with `Pkg.Registry.add(\"General\")`") + first(regs) +end + +# Latest registered version of a package, without its build number. +function latest_version(name) + uuids = RegistryInstances.uuids_from_name(GENERAL, name) + if isempty(uuids) + @warn "$name is not registered in the General registry" + return nothing + end + info = RegistryInstances.registry_info(GENERAL[first(uuids)]) + versions = [v for (v, vinfo) in info.version_info if !vinfo.yanked] + isempty(versions) && return nothing + v = maximum(versions) + return VersionNumber(v.major, v.minor, v.patch, v.prerelease) +end +format_version(v) = v === nothing ? DASH : string(v) + +## CUDA + +cuda_series(v::VersionNumber) = "$(v.major).$(v.minor)" +const CUDA_VERSIONS = sort([CUDA_HELPER.cuda_full_versions; CUDA_HELPER.cuda_prerelease_versions]) +const CUDA_ALL_PLATFORMS = CUDA_HELPER.supported_platforms(; min_version=nothing, prereleases=true) +const CUDA_DEFAULT_SERIES = Set(tags(p)["cuda"] for p in CUDA_HELPER.supported_platforms()) +is_default_cuda(v) = + !(v in CUDA_HELPER.cuda_prerelease_versions) && cuda_series(v) in CUDA_DEFAULT_SERIES + +# The columns of the CUDA table that a build counts for. Before CUDA 13, aarch64 +# builds are split into ARM servers (SBSA) and Jetson by the `cuda_platform` tag; +# from CUDA 13 a single aarch64 build without that tag covers both. +const CUDA_COLUMNS = ["x86_64", "ARM servers (SBSA)", "Jetson"] +const CUDA_PLATFORM_NAMES = Dict("sbsa" => "ARM servers (SBSA)", "jetson" => "Jetson") +function cuda_columns(p) + Sys.islinux(p) && arch(p) == "x86_64" && return ["x86_64"] + if Sys.islinux(p) && arch(p) == "aarch64" + cp = get(tags(p), "cuda_platform", nothing) + return cp === nothing ? ["ARM servers (SBSA)", "Jetson"] : [get(CUDA_PLATFORM_NAMES, cp, cp)] + end + return ["$(os(p)) $(arch(p))"] +end +cuda_columns(ps::Vector) = reduce(vcat, cuda_columns.(ps); init=String[]) + +""" + {{cuda_count}} + +Number of CUDA toolkits that Yggdrasil can build against. +""" +hfun_cuda_count() = string(length(CUDA_VERSIONS)) + +""" + {{cuda_default_count}} + +Number of CUDA toolkits that Yggdrasil builds against by default. +""" +hfun_cuda_default_count() = string(count(is_default_cuda, CUDA_VERSIONS)) + +""" + {{cuda_table}} + +One row per CUDA toolkit, showing which platforms it is built for. +""" +function hfun_cuda_table() + # Show any new kind of platform as an extra column rather than dropping it. + columns = unique([CUDA_COLUMNS; cuda_columns(CUDA_ALL_PLATFORMS)]) + rows = map(CUDA_VERSIONS) do v + built = Set(cuda_columns(filter(p -> tags(p)["cuda"] == cuda_series(v), CUDA_ALL_PLATFORMS))) + status = v in CUDA_HELPER.cuda_prerelease_versions ? "Preview" : + is_default_cuda(v) ? "Yes" : "Opt-in" + [string(v), (c in built ? CHECK : DASH for c in columns)..., status] + end + return html_table(["CUDA toolkit", columns..., "Built by default"], rows) +end + +## GPU libraries +# +# The names and descriptions are curated; the versions come from the registry. + +const GPU_PACKAGES = Dict( + "NVIDIA" => [ + ("CUDNN_jll", "cuDNN: deep neural network primitives"), + ("CUTENSOR_jll", "cuTENSOR: tensor operations"), + ("CUDSS_jll", "cuDSS: sparse direct solvers"), + ("cuSolverMp_jll", "cuSOLVERMp: distributed dense linear algebra"), + ("cuQuantum_jll", "cuQuantum: quantum circuit simulation"), + ("NCCL_jll", "NCCL: communication between GPUs"), + ("TensorRT_jll", "TensorRT: deep learning inference"), + ("NVTX_jll", "NVTX: annotations for profilers"), + ], + "AMD" => [ + ("AMDGPU_LLVM_Backend_jll", "LLVM code generator for AMD GPUs"), + ("ROCmDeviceLibs_jll", "ROCm device libraries"), + ("hsa_rocr_jll", "ROCm runtime (HSA)"), + ("HIP_jll", "HIP runtime"), + ("rocBLAS_jll", "rocBLAS: dense linear algebra"), + ("rocSPARSE_jll", "rocSPARSE: sparse linear algebra"), + ("rocRAND_jll", "rocRAND: random number generation"), + ("MIOpen_jll", "MIOpen: deep learning primitives"), + ("rocminfo_jll", "rocminfo: device information tool"), + ], + "Intel" => [ + ("NEO_jll", "Compute runtime for Intel GPUs (NEO)"), + ("libigc_jll", "Intel Graphics Compiler"), + ("gmmlib_jll", "Intel graphics memory management library"), + ("oneAPI_Level_Zero_Loader_jll", "oneAPI Level Zero loader"), + ("oneAPI_Level_Zero_Headers_jll", "oneAPI Level Zero headers"), + ("oneAPI_Support_jll", "Support library for oneAPI.jl"), + ], + "Apple" => [ + ("Metal_LLVM_Tools_jll", "LLVM tools for generating Metal code"), + ("Metal_Shader_Converter_jll", "Metal shader converter"), + ], + "Cross-vendor" => [ + ("OpenCL_jll", "OpenCL ICD loader"), + ("OpenCL_Headers_jll", "OpenCL headers"), + ("pocl_jll", "PoCL: portable OpenCL implementation for CPUs"), + ("intel_opencl_rt_jll", "Intel OpenCL runtime for x86_64 CPUs"), + ("Vulkan_Loader_jll", "Vulkan loader"), + ("Vulkan_Headers_jll", "Vulkan headers"), + ("SPIRV_Tools_jll", "SPIR-V tools"), + ("SPIRV_LLVM_Translator_jll", "Translator between LLVM IR and SPIR-V"), + ("SPIRV_LLVM_Backend_jll", "LLVM code generator for SPIR-V"), + ], +) + +""" + {{gpu_packages vendor}} + +Table of the GPU libraries for `vendor` (a key of `GPU_PACKAGES`) with the latest +version of each in the General registry. +""" +function hfun_gpu_packages(params::Vector{String}) + rows = [[jll_link(name), desc, format_version(latest_version(name))] + for (name, desc) in GPU_PACKAGES[only(params)]] + return html_table(["Package", "Description", "Latest version"], rows) +end + +## MPI + +const MPI_ABIS = [(abi = abi, jll = pkg.name, compat = compat, platforms = filter(f, PLATFORMS)) + for (abi, pkg, compat, f) in MPI_HELPER.mpi_abis] + +# Show a Pkg compat entry such as "4.1.11, 5.0.14" as "4.x (≥ 4.1.11), 5.x (≥ 5.0.14)"; +# anything more complex is shown as it is. +function format_compat(compat) + parts = strip.(split(compat, ',')) + all(p -> occursin(r"^[1-9]\d*(\.\d+){0,2}$", p), parts) || return compat + return Raw(join(("$(first(split(p, '.'))).x (≥ $p)" for p in parts), ", ")) +end + +""" + {{mpi_count}} + +Number of MPI implementations that recipes are built for. +""" +hfun_mpi_count() = string(length(MPI_ABIS)) + +""" + {{mpi_table}} + +One row per MPI implementation that recipes are built for. +""" +hfun_mpi_table() = html_table( + ["Implementation", "Package", "Compatible versions", "Latest version", "Platforms"], + [[m.abi, jll_link(m.jll), format_compat(m.compat), format_version(latest_version(m.jll)), + "$(length(m.platforms)) of $(length(PLATFORMS))"] for m in MPI_ABIS]) + +""" + {{mpi_platform_table}} + +One row per supported platform, showing which MPI implementations are built for it. +""" +hfun_mpi_platform_table() = html_table( + ["Platform", (m.abi for m in MPI_ABIS)...], + [[code(triplet(p)), (p in m.platforms ? CHECK : DASH for m in MPI_ABIS)...] for p in PLATFORMS])