mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-30 16:10:36 +00:00
cudaPackages.libcublas: use standalone cuBLAS releases
NVIDIA publishes standalone cuBLAS releases between CUDA releases. Each is a patch release for one CUDA toolkit update, with the same major and minor version as the cuBLAS that update shipped, and exports the same symbols. Later CUDA updates don't include them: CUDA 13.4 Update 3, released after cuBLAS 13.8.1, still ships 13.8.0.4. A package set pins a standalone release only when it is a newer patch release of its CUDA release's cuBLAS, and evaluation fails otherwise, so a CUDA update that ships a newer cuBLAS must drop or update the pin. That pins 12.8.5.7, 13.4.2.4, 13.6.2.16, and 13.8.2.12 for CUDA 12.8, 13.2, 13.3, and 13.4. CUDA 12.6 has no standalone release, and CUDA's cuBLAS is as new or newer for CUDA 12.9, 13.0, and 13.1. libcublas uses the pin where it has a build for the host; standalone releases have no linux-aarch64 builds, so pre-Thor Jetson with CUDA 12.8 uses CUDA's. The source is visible as libcublas.passthru.redistName. Standalone archives lack the stubs and pkg-config file, so generate them: like NVIDIA's, the stubs define the libraries' versioned functions, each printing a warning, and the build checks they export the same symbols as the libraries. The pkg-config file matches CUDA's. Standalone archives are under the CUDA EULA, which lists cuBLAS as distributable, but buildRedist defaults to nvidiaCudaRedist only for CUDA's redistributables, so set the license. Assisted-by: Claude Code (Claude Opus 5.5)
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
```
|
||||
*/
|
||||
redistNames = [
|
||||
"cublas"
|
||||
"cublasdx" # NOTE: MathDx; no manifests are published, so ours are made by hand
|
||||
"cublasmp"
|
||||
"cuda"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# cublas
|
||||
|
||||
Link: <https://developer.download.nvidia.com/compute/cublas/redist/>
|
||||
|
||||
Requirements: <https://docs.nvidia.com/cuda/cublas/index.html>
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"release_date": "2026-03-16",
|
||||
"release_label": "12.8.5",
|
||||
"release_product": "cublas",
|
||||
"libcublas": {
|
||||
"name": "CUDA cuBLAS",
|
||||
"license": "cuBLAS library",
|
||||
"license_path": "libcublas/LICENSE.txt",
|
||||
"version": "12.8.5.7",
|
||||
"linux-x86_64": {
|
||||
"cuda12": {
|
||||
"relative_path": "libcublas/linux-x86_64/libcublas-linux-x86_64-12.8.5.7_cuda12-archive.tar.xz",
|
||||
"sha256": "d6eb7101b191c456b41c1e8655b06f85faf514cbef7d9ae6aa3a873afe76c275",
|
||||
"md5": "7da3e42ed166faa1a3bef5935e85cd0e",
|
||||
"size": "949916712"
|
||||
}
|
||||
},
|
||||
"cuda_variant": [
|
||||
"12"
|
||||
],
|
||||
"linux-sbsa": {
|
||||
"cuda12": {
|
||||
"relative_path": "libcublas/linux-sbsa/libcublas-linux-sbsa-12.8.5.7_cuda12-archive.tar.xz",
|
||||
"sha256": "770d86795f7c16ad3124e6e230da62086f4e4bf6cfe55da2d04a8095e171bc77",
|
||||
"md5": "bd69ebd722adfb2066b5bbba43de0c97",
|
||||
"size": "950508424"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"release_date": "2026-09-14",
|
||||
"release_label": "13.4.2",
|
||||
"release_product": "cublas",
|
||||
"libcublas": {
|
||||
"name": "CUDA cuBLAS",
|
||||
"license": "cuBLAS library",
|
||||
"license_path": "libcublas/LICENSE.txt",
|
||||
"version": "13.4.2.4",
|
||||
"linux-x86_64": {
|
||||
"cuda13": {
|
||||
"relative_path": "libcublas/linux-x86_64/libcublas-linux-x86_64-13.4.2.4_cuda13-archive.tar.xz",
|
||||
"sha256": "3c5a8468991b97630fe29bd04f9a781f69aef4f376d4cbfe90217b0203edf287",
|
||||
"md5": "e60a359a526db09e63e9ea6617093f47",
|
||||
"size": "807967936"
|
||||
}
|
||||
},
|
||||
"cuda_variant": [
|
||||
"13"
|
||||
],
|
||||
"linux-sbsa": {
|
||||
"cuda13": {
|
||||
"relative_path": "libcublas/linux-sbsa/libcublas-linux-sbsa-13.4.2.4_cuda13-archive.tar.xz",
|
||||
"sha256": "1dba1433fc7a7aee714e0ebf4e1737a175a6341225b7352da07c15419ebefe8e",
|
||||
"md5": "3229659314ae6d7b0c48cfd1d3f7015f",
|
||||
"size": "1021627464"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"release_date": "2026-09-08",
|
||||
"release_label": "13.6.2",
|
||||
"release_product": "cublas",
|
||||
"libcublas": {
|
||||
"name": "CUDA cuBLAS",
|
||||
"license": "cuBLAS library",
|
||||
"license_path": "libcublas/LICENSE.txt",
|
||||
"version": "13.6.2.16",
|
||||
"linux-x86_64": {
|
||||
"cuda13": {
|
||||
"relative_path": "libcublas/linux-x86_64/libcublas-linux-x86_64-13.6.2.16_cuda13-archive.tar.xz",
|
||||
"sha256": "ba1b298674da2c1c850fcc0722108a100ad5f5dacfbcaf4b58d0633b5a4c66c6",
|
||||
"md5": "9463efbb3fed6416fb77fa8a3f20834d",
|
||||
"size": "817853184"
|
||||
}
|
||||
},
|
||||
"cuda_variant": [
|
||||
"13"
|
||||
],
|
||||
"linux-sbsa": {
|
||||
"cuda13": {
|
||||
"relative_path": "libcublas/linux-sbsa/libcublas-linux-sbsa-13.6.2.16_cuda13-archive.tar.xz",
|
||||
"sha256": "950f5d4ce75c26ff34b3c9d4157b30ab3fd4b06018d139c2868f8226b287dfdc",
|
||||
"md5": "964a4400bd977017937409488e255b45",
|
||||
"size": "1031550256"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"release_date": "2026-10-26",
|
||||
"release_label": "13.8.2",
|
||||
"release_product": "cublas",
|
||||
"libcublas": {
|
||||
"name": "CUDA cuBLAS",
|
||||
"license": "cuBLAS library",
|
||||
"license_path": "libcublas/LICENSE.txt",
|
||||
"version": "13.8.2.12",
|
||||
"linux-x86_64": {
|
||||
"cuda13": {
|
||||
"relative_path": "libcublas/linux-x86_64/libcublas-linux-x86_64-13.8.2.12_cuda13-archive.tar.xz",
|
||||
"sha256": "b54be9d26b05e97a27e248c9d82f8fa5dfe72fcef6c41a3a4a834332cf01b689",
|
||||
"md5": "7448ece1297e14222609875324ae6a8a",
|
||||
"size": "877509868"
|
||||
}
|
||||
},
|
||||
"cuda_variant": [
|
||||
"13"
|
||||
],
|
||||
"linux-sbsa": {
|
||||
"cuda13": {
|
||||
"relative_path": "libcublas/linux-sbsa/libcublas-linux-sbsa-13.8.2.12_cuda13-archive.tar.xz",
|
||||
"sha256": "26b32cfadd7025147c9a3f55755c9b401f84ed817c4856c44b6c1ba2afb7b648",
|
||||
"md5": "9343ff7e9eca81cd91eea24bd7951a6e",
|
||||
"size": "1101175684"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,30 @@
|
||||
{
|
||||
backendStdenv,
|
||||
buildRedist,
|
||||
cuda_nvrtc,
|
||||
cudaMajorMinorVersion,
|
||||
lib,
|
||||
manifests,
|
||||
}:
|
||||
let
|
||||
cudaCublasVersion = manifests.cuda.libcublas.version;
|
||||
standaloneVersion = manifests.cublas.libcublas.version;
|
||||
|
||||
# Package sets may select a standalone cuBLAS release, which must be a newer patch release of the cuBLAS shipped with
|
||||
# CUDA. Use it when it has a build for the host.
|
||||
isStandalone =
|
||||
manifests ? cublas
|
||||
&&
|
||||
lib.assertMsg
|
||||
(
|
||||
lib.versions.majorMinor standaloneVersion == lib.versions.majorMinor cudaCublasVersion
|
||||
&& lib.versionOlder cudaCublasVersion standaloneVersion
|
||||
)
|
||||
"libcublas: standalone cuBLAS ${standaloneVersion} is not a newer patch release of CUDA's cuBLAS ${cudaCublasVersion}; drop or update the cublas pin"
|
||||
&& manifests.cublas.libcublas ? ${backendStdenv.hostRedistSystem};
|
||||
in
|
||||
buildRedist (finalAttrs: {
|
||||
redistName = "cuda";
|
||||
redistName = if isStandalone then "cublas" else "cuda";
|
||||
pname = "libcublas";
|
||||
|
||||
# libcublasLt dlopens NVRTC to compile kernels at runtime; absent before 12.8.
|
||||
@@ -21,11 +41,48 @@ buildRedist (finalAttrs: {
|
||||
"stubs"
|
||||
];
|
||||
|
||||
# Standalone archives lack the stubs and pkg-config file shipped with CUDA's cuBLAS, so generate them. Like NVIDIA's,
|
||||
# the stubs define the libraries' versioned functions, each of which prints a warning.
|
||||
${if isStandalone then "postUnpack" else null} = ''
|
||||
mkdir "$sourceRoot/lib/stubs"
|
||||
for base in cublas cublasLt; do
|
||||
real="$sourceRoot/lib/lib$base.so"
|
||||
stub="$sourceRoot/lib/stubs/lib$base.so"
|
||||
nixLog "generating $stub"
|
||||
$NM --dynamic --defined-only --format=posix "$real" | awk -v base="$base" '
|
||||
BEGIN { print "#include <stdio.h>" > base ".c" }
|
||||
$2 == "T" {
|
||||
split($1, sym, "@@")
|
||||
print "int " sym[1] "(void) { return puts(\"You are running using the stub version of " base "\"); }" > base ".c"
|
||||
syms[sym[2]] = syms[sym[2]] " " sym[1] ";"
|
||||
}
|
||||
END { for (ver in syms) print ver " { global:" syms[ver] " local: *; };" > base ".map" }
|
||||
'
|
||||
$CC -shared -fPIC -o "$stub" "$base.c" -Wl,--version-script="$base.map" \
|
||||
-Wl,-soname,"$($READELF --dynamic "$real" | sed -n 's/.*(SONAME).*\[\(.*\)\]$/\1/p')"
|
||||
diff <($NM --dynamic --defined-only "$real" | cut -d' ' -f2-) <($NM --dynamic --defined-only "$stub" | cut -d' ' -f2-)
|
||||
done
|
||||
|
||||
mkdir "$sourceRoot/pkg-config"
|
||||
cat >"$sourceRoot/pkg-config/cublas-${cudaMajorMinorVersion}.pc" <<'EOF'
|
||||
cudaroot=/usr/local/cuda-${cudaMajorMinorVersion}
|
||||
libdir=''${cudaroot}/lib
|
||||
includedir=''${cudaroot}/include
|
||||
|
||||
Name: cublas
|
||||
Description: CUDA Basic Linear Algebra Subprograms
|
||||
Version: ${cudaMajorMinorVersion}
|
||||
Libs: -L''${libdir} -lcublas
|
||||
Cflags: -I''${includedir}
|
||||
EOF
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "CUDA Basic Linear Algebra Subroutine library";
|
||||
longDescription = ''
|
||||
The cuBLAS library is an implementation of BLAS (Basic Linear Algebra Subprograms) on top of the NVIDIA CUDA runtime.
|
||||
'';
|
||||
homepage = "https://developer.nvidia.com/cublas";
|
||||
license = lib.licenses.nvidiaCudaRedist;
|
||||
};
|
||||
})
|
||||
|
||||
@@ -33,6 +33,14 @@ let
|
||||
# - TensorRT 11.x has no linux-sbsa build for CUDA 12 and dropped JetPack support with 11.2.1, so Jetson devices use
|
||||
# TensorRT 10.x with CUDA 12 and CUDA 13.0 and 13.1, and TensorRT 11.1.0 (which supports Orin and Thor with
|
||||
# CUDA 13.2 and later) with CUDA 13.2 and later.
|
||||
# - cublas: a package set selects a standalone release only when it is a newer patch release of the cuBLAS shipped
|
||||
# with its CUDA release (same major and minor version); evaluation fails otherwise, so drop or update the pin when
|
||||
# updating CUDA. libcublas uses it on every platform with a build: standalone releases have no linux-aarch64
|
||||
# (pre-Thor Jetson) builds, so those use CUDA's. As of writing:
|
||||
# - CUDA 12.8 (cuBLAS 12.8.5.5), 13.2 (13.4.1.3), 13.3 (13.6.0.2), and 13.4 (13.8.0.4): standalone 12.8.5.7,
|
||||
# 13.4.2.4, 13.6.2.16, and 13.8.2.12.
|
||||
# - CUDA 12.6, 12.9, 13.0, and 13.1: no newer standalone release (12.9.2.7 and 13.1.1.2 are older than CUDA's
|
||||
# 12.9.2.10 and 13.1.1.3; 13.2.2.2 is the same as CUDA 13.1's).
|
||||
# - cublasdx (MathDx): 25.06.1 is the last release for CUDA 12, and 26.x requires CUDA 13.
|
||||
# - cudnn:
|
||||
# - NVIDIA dropped linux-aarch64 (pre-Thor Jetson) support for CUDA 12 after 9.20.0, so we keep 9.20.0 for Jetson with
|
||||
@@ -68,6 +76,7 @@ let
|
||||
};
|
||||
|
||||
cudaPackages_12_8 = mkCudaPackages {
|
||||
cublas = "12.8.5";
|
||||
cublasdx = "25.06.1";
|
||||
cublasmp = "0.10.0";
|
||||
cuda = "12.8.2";
|
||||
@@ -152,6 +161,7 @@ let
|
||||
};
|
||||
|
||||
cudaPackages_13_2 = mkCudaPackages {
|
||||
cublas = "13.4.2";
|
||||
cublasdx = "26.06.1";
|
||||
cublasmp = "0.10.0";
|
||||
cuda = "13.2.2";
|
||||
@@ -170,6 +180,7 @@ let
|
||||
};
|
||||
|
||||
cudaPackages_13_3 = mkCudaPackages {
|
||||
cublas = "13.6.2";
|
||||
cublasdx = "26.06.1";
|
||||
cublasmp = "0.10.0";
|
||||
cuda = "13.3.1";
|
||||
@@ -188,6 +199,7 @@ let
|
||||
};
|
||||
|
||||
cudaPackages_13_4 = mkCudaPackages {
|
||||
cublas = "13.8.2";
|
||||
cublasdx = "26.06.1";
|
||||
cublasmp = "0.10.0";
|
||||
cuda = "13.4.3";
|
||||
|
||||
Reference in New Issue
Block a user