Merge branch 'cuda' into 'master'
cuda : Add cuda-toolkit and its split packages. See merge request nonguix/nonguix!497
This commit is contained in:
commit
6716b878b0
189
guix/import/cuda.scm
Normal file
189
guix/import/cuda.scm
Normal file
|
@ -0,0 +1,189 @@
|
|||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2025 Nicolas Graves <ngraves@ngraves.fr>
|
||||
|
||||
;;; This file is not part of GNU Guix but requires this naming scheme
|
||||
;;; so that the %cuda-updater is properly read when using
|
||||
;;; `guix refresh -L$(pwd) cuda-cccl' in nonguix root.
|
||||
|
||||
(define-module (guix import cuda)
|
||||
#:use-module (gcrypt hash)
|
||||
#:use-module (gnu packages)
|
||||
#:use-module (guix base16)
|
||||
#:use-module (guix base32)
|
||||
#:use-module (guix http-client)
|
||||
#:use-module (guix import json)
|
||||
#:use-module (guix import utils)
|
||||
#:use-module (guix memoization)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix records)
|
||||
#:use-module (guix upstream)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 regex)
|
||||
#:use-module (ice-9 textual-ports)
|
||||
#:use-module (json)
|
||||
#:use-module (nonguix build-system cuda)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:export (%cuda-updater))
|
||||
|
||||
(define %cuda-repository-url
|
||||
"https://developer.download.nvidia.com/compute/cuda/redist/")
|
||||
|
||||
(define (cuda-system->guix-system system)
|
||||
(match system
|
||||
("linux-x86_64" "x86_64-linux")
|
||||
("linux-aarch64" "aarch64-linux")
|
||||
("linux-ppc64le" "powerpc64le-linux")
|
||||
(_ #f)))
|
||||
|
||||
(define (valid-version? version-string)
|
||||
(false-if-exception (version-prefix version-string 3)))
|
||||
|
||||
(define-record-type* <cuda-package>
|
||||
cuda-package make-cuda-package
|
||||
cuda-package? this-cuda-package
|
||||
(name cuda-package-name)
|
||||
(version cuda-package-version valid-version?)
|
||||
(hash-info cuda-package-hash-info cuda-hash-info?))
|
||||
|
||||
(define-record-type* <cuda-hash-info>
|
||||
cuda-hash-info make-cuda-hash-info
|
||||
cuda-hash-info? this-cuda-hash-info
|
||||
(system cuda-hash-info-system)
|
||||
(sha256 cuda-hash-info-sha256))
|
||||
|
||||
(define (cuda-toolkit-latest-version)
|
||||
(let* ((url (string-append %cuda-repository-url "index.html"))
|
||||
(port (http-fetch url #:text? #t)) ; FIXME no error management
|
||||
(html (get-string-all port))
|
||||
(regex "redistrib_[0-9.]*.json")
|
||||
(file-string
|
||||
(fold-matches regex html ""
|
||||
(lambda (matching void)
|
||||
(match:substring matching))))
|
||||
(version-string
|
||||
(string-drop-right
|
||||
(string-drop file-string (string-length "redistrib_"))
|
||||
(string-length ".json"))))
|
||||
(close-port port)
|
||||
version-string))
|
||||
|
||||
(define (cuda-json-pkg-alist->cuda-package cuda-pkg-alist)
|
||||
(make-cuda-package
|
||||
(snake-case (first cuda-pkg-alist))
|
||||
(assoc-ref cuda-pkg-alist "version")
|
||||
(filter
|
||||
identity
|
||||
(map (lambda (system)
|
||||
(let ((inner-alist (assoc-ref cuda-pkg-alist system)))
|
||||
(if inner-alist
|
||||
(make-cuda-hash-info
|
||||
(cuda-system->guix-system system)
|
||||
(bytevector->nix-base32-string
|
||||
(base16-string->bytevector
|
||||
(assoc-ref inner-alist "sha256"))))
|
||||
#f)))
|
||||
(list "linux-x86_64" "linux-aarch64" "linux-ppc64le")))))
|
||||
|
||||
(define cuda-db-fetch
|
||||
(memoize
|
||||
(lambda (toolkit-version)
|
||||
(map
|
||||
cuda-json-pkg-alist->cuda-package
|
||||
(filter list?
|
||||
(json-fetch
|
||||
(string-append %cuda-repository-url
|
||||
"redistrib_" toolkit-version ".json")))))))
|
||||
|
||||
(define (cuda-fetch name tk-version)
|
||||
(let ((candidates (filter
|
||||
(lambda (pkg) (equal? (cuda-package-name pkg) name))
|
||||
(cuda-db-fetch tk-version))))
|
||||
(and (not (null? candidates)) (car candidates))))
|
||||
|
||||
(define* (latest-release package #:key (version #f))
|
||||
"Return an <upstream-source> for the latest-release of PACKAGE."
|
||||
(let* ((name (package-name package))
|
||||
(version (or version (cuda-toolkit-latest-version)))
|
||||
(package (cuda-fetch name version))
|
||||
(version (and=> package cuda-package-version)))
|
||||
(and version
|
||||
(upstream-source
|
||||
(package name)
|
||||
(version version)
|
||||
(urls (list (cuda-module-url name version)))))))
|
||||
|
||||
(define (make-cuda-sexp cuda-package)
|
||||
`(define-public ,(string->symbol (cuda-package-name cuda-package))
|
||||
(package
|
||||
(name ,(cuda-package-name cuda-package))
|
||||
(version ,(cuda-package-version cuda-package))
|
||||
(source
|
||||
(origin
|
||||
(method url-fetch)
|
||||
(uri (cuda-module-url name version))
|
||||
(sha256
|
||||
(base32
|
||||
(match (or (%current-target-system) (%current-system))
|
||||
,@(map
|
||||
(lambda (info)
|
||||
(list (cuda-hash-info-system info)
|
||||
(cuda-hash-info-sha256 info)))
|
||||
(cuda-package-hash-info cuda-package)))))))
|
||||
(build-system cuda-build-system)
|
||||
(synopsis #f)
|
||||
(description #f)
|
||||
(home-page "https://developer.nvidia.com/cuda-toolkit")
|
||||
(license (cuda-license name)))))
|
||||
|
||||
(define (guix-name->cuda-name package)
|
||||
(string-join (string-split package #\-) "_"))
|
||||
|
||||
(define (cuda-package? package)
|
||||
"Return true if PACKAGE is a CUDA Toolkit package."
|
||||
(eq? (package-build-system package) cuda-build-system))
|
||||
|
||||
(define %cuda-updater
|
||||
(upstream-updater
|
||||
(name 'cuda)
|
||||
(description "Updater for Cuda packages")
|
||||
(pred cuda-package?)
|
||||
(import latest-release)))
|
||||
|
||||
;; The issue with guix native importer is that it will only update
|
||||
;; the x64_86 hash, but we do have different sources based on
|
||||
;; (%current-target-system).
|
||||
|
||||
;; To update all hashes of a package, use:
|
||||
;; (make-cuda-sexp (cuda-fetch "cuda-profiler-api" "12.1.1"))
|
||||
|
||||
;; To update all hashes of all packages, use:
|
||||
;; (use-modules (ice-9 pretty-print))
|
||||
;; (for-each
|
||||
;; (lambda (name)
|
||||
;; (pretty-print (make-cuda-sexp (cuda-fetch name "12.1.1"))))
|
||||
;; '("cuda-cccl"
|
||||
;; "cuda-cudart"
|
||||
;; "cuda-cuobjdump"
|
||||
;; "cuda-cuxxfilt"
|
||||
;; "cuda-cupti"
|
||||
;; "cuda-gdb"
|
||||
;; "cuda-nvcc"
|
||||
;; "cuda-nvml-dev"
|
||||
;; "cuda-nvdisasm"
|
||||
;; "cuda-nvprune"
|
||||
;; "cuda-nvrtc"
|
||||
;; "cuda-nvtx"
|
||||
;; "cuda-opencl"
|
||||
;; "cuda-sanitizer-api"
|
||||
;; "libcublas"
|
||||
;; "libcufft"
|
||||
;; "libcurand"
|
||||
;; "libcusolver"
|
||||
;; "libcusparse"
|
||||
;; ;; "libnvfatbin"
|
||||
;; "libnvjitlink"
|
||||
;; "libnvjpeg"
|
||||
;; "libnpp"))
|
||||
|
||||
;; cuda.scm ends here.
|
232
nongnu/packages/machine-learning.scm
Normal file
232
nongnu/packages/machine-learning.scm
Normal file
|
@ -0,0 +1,232 @@
|
|||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
|
||||
|
||||
(define-module (nongnu packages machine-learning)
|
||||
#:use-module ((guix licenses) #:prefix license:)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (guix build-system cmake)
|
||||
#:use-module (guix build-system copy)
|
||||
#:use-module (guix build-system gnu)
|
||||
#:use-module (guix build-system python)
|
||||
#:use-module (guix git-download)
|
||||
#:use-module (gnu packages)
|
||||
#:use-module (gnu packages check)
|
||||
#:use-module (gnu packages cpp)
|
||||
#:use-module (gnu packages libevent)
|
||||
#:use-module (gnu packages machine-learning)
|
||||
#:use-module (gnu packages pkg-config)
|
||||
#:use-module (gnu packages python-xyz)
|
||||
#:use-module (gnu packages serialization)
|
||||
#:use-module (nongnu packages nvidia)
|
||||
#:use-module (ice-9 match))
|
||||
|
||||
(define-public gloo-cuda
|
||||
(let ((version "0.0.0") ; no proper version tag
|
||||
(commit "e6d509b527712a143996f2f59a10480efa804f8b")
|
||||
(revision "2"))
|
||||
(package
|
||||
(name "gloo-cuda")
|
||||
(version (git-version version revision commit))
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/facebookincubator/gloo")
|
||||
(commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"11ywsn1lrd1cpzm1iwvin2c5l962zib5bd852vl54bp12a0w6klj"))))
|
||||
(build-system cmake-build-system)
|
||||
(native-inputs
|
||||
(list googletest))
|
||||
(inputs
|
||||
(modify-inputs (package-inputs gloo)
|
||||
(append cuda-toolkit nvidia-nccl)))
|
||||
(arguments
|
||||
(substitute-keyword-arguments (package-arguments gloo)
|
||||
((#:configure-flags flags ''())
|
||||
#~(cons "-DUSE_CUDA=ON" #$flags))))
|
||||
(synopsis "Collective communications library")
|
||||
(description
|
||||
"Gloo is a collective communications library. It comes with a
|
||||
number of collective algorithms useful for machine learning applications.
|
||||
These include a barrier, broadcast, and allreduce.
|
||||
|
||||
Note: This package provides NVIDIA GPU support.")
|
||||
(home-page "https://github.com/facebookincubator/gloo")
|
||||
(license license:bsd-3))))
|
||||
|
||||
(define %python-pytorch-version "2.4.0")
|
||||
|
||||
(define %python-pytorch-src
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/pytorch/pytorch")
|
||||
(commit (string-append "v" %python-pytorch-version))))
|
||||
(file-name (git-file-name "python-pytorch" %python-pytorch-version))
|
||||
(sha256
|
||||
(base32
|
||||
"18hdhzr12brj0b7ppyiscax0dbra30207qx0cckw78midfkcn7cn"))
|
||||
(patches (search-patches "python-pytorch-system-libraries.patch"
|
||||
"python-pytorch-runpath.patch"
|
||||
"python-pytorch-without-kineto.patch"
|
||||
;; Some autogeneration scripts depend on the
|
||||
;; compile PyTorch library. Therefore, we create
|
||||
;; dummy versions which are regenerated later.
|
||||
"python-pytorch-fix-codegen.patch"))
|
||||
(modules '((guix build utils)))
|
||||
(snippet
|
||||
'(begin
|
||||
;; Bundled or unused code
|
||||
(for-each
|
||||
(lambda (dir)
|
||||
(when (file-exists? dir)
|
||||
(delete-file-recursively dir)))
|
||||
'("android"
|
||||
;; "aten/src/ATen/native/cuda/cutlass_extensions"
|
||||
"aten/src/ATen/native/quantized/cpu/qnnpack"
|
||||
"caffe2/mobile/contrib/libopencl-stub"
|
||||
"caffe2/mobile/contrib/libvulkan-stub"
|
||||
"third_party"))
|
||||
|
||||
;; Autogenerated files
|
||||
(for-each
|
||||
delete-file
|
||||
'("aten/src/ATen/nnapi/nnapi_wrapper.cpp"
|
||||
"aten/src/ATen/nnapi/nnapi_wrapper.h"
|
||||
;; These files contain just lists of floating point values and
|
||||
;; might be as well hand-written.
|
||||
;; "test/cpp/api/init_baseline.h"
|
||||
;; "test/cpp/api/optim_baseline.h"
|
||||
"test/mobile/test_upgrader_bytecode_table_example.cpp"
|
||||
"torch/csrc/jit/mobile/upgrader_mobile.cpp"
|
||||
"torch/csrc/jit/runtime/decomposition_registry_util.cpp"
|
||||
"torch/csrc/jit/runtime/serialized_shape_function_registry.cpp"
|
||||
"torch/csrc/jit/tensorexpr/external_functions_codegen.cpp"
|
||||
"torch/csrc/jit/serialization/mobile_bytecode_generated.h"))
|
||||
(delete-file-recursively ".github")
|
||||
;; These files are needed for CUDA.
|
||||
;; (for-each
|
||||
;; (lambda (dir)
|
||||
;; (for-each
|
||||
;; delete-file
|
||||
;; (find-files dir "\\.cu$")))
|
||||
;; '("aten/src/ATen/native/transformers/cuda/flash_attn/kernels"
|
||||
;; "aten/src/ATen/native/transformers/cuda/mem_eff_attention/kernels"))
|
||||
))))
|
||||
|
||||
(define-public python-pytorch-cuda
|
||||
(package
|
||||
(name "python-pytorch-cuda")
|
||||
(version %python-pytorch-version)
|
||||
(source %python-pytorch-src)
|
||||
(build-system python-build-system)
|
||||
(arguments
|
||||
(substitute-keyword-arguments (package-arguments python-pytorch)
|
||||
((#:phases phases)
|
||||
#~(modify-phases #$phases
|
||||
(add-after 'cmake-patches 'cuda-cmake-patches
|
||||
(lambda _
|
||||
;; XXX: Currently nvidia-cudnn-frontend doesn't install CMake
|
||||
;; configuration files, we must add unbundled nlohmann-json.
|
||||
;; Additionally, it won't work without CUDNN_INCLUDE_DIR.
|
||||
(substitute* "cmake/Dependencies.cmake"
|
||||
(("set\\(CUDNN_FRONTEND_INCLUDE_DIR.*$")
|
||||
(format #f "set(CUDNN_FRONTEND_INCLUDE_DIR ~a/include)
|
||||
target_include_directories(torch::cudnn INTERFACE
|
||||
${CUDNN_INCLUDE_DIR} ${~a/include}
|
||||
)~%"
|
||||
#$(this-package-input "nvidia-cudnn-frontend")
|
||||
#$(this-package-input "nlohmann-json"))))
|
||||
;; XXX: Link the right include dir for cutlass.
|
||||
(substitute* "aten/src/ATen/CMakeLists.txt"
|
||||
(("\
|
||||
\\$\\{CMAKE_CURRENT_SOURCE_DIR\\}/\\.\\./\\.\\./\\.\\./third_party/cutlass")
|
||||
#$(this-package-input "nvidia-cutlass")))
|
||||
;; XXX: Not linking gtest+gtest_main breaks compilation
|
||||
(substitute* '("c10/cuda/test/CMakeLists.txt"
|
||||
"caffe2/CMakeLists.txt")
|
||||
(("target_link_libraries\\((.* gtest_main)\\)" all content)
|
||||
(format #f "target_link_libraries(~a gtest)"
|
||||
content)))))
|
||||
(add-after 'use-system-libraries 'use-cuda-libraries
|
||||
(lambda _
|
||||
(setenv "USE_CUDA" "1")
|
||||
(setenv "CUDA_HOME" #$(this-package-input "cuda-dev"))
|
||||
(setenv "CUDA_TOOLKIT_ROOT_DIR"
|
||||
#$(this-package-input "cuda-dev"))
|
||||
(setenv "CUDA_USE_STATIC_CUDA_RUNTIME" "0")
|
||||
(setenv "CUDA_PROPAGATE_HOST_FLAGS" "0")
|
||||
(setenv "CUSPARSELT_LIBRARY"
|
||||
#$(file-append
|
||||
(this-package-input "cuda-dev") "/lib"))
|
||||
(setenv "CUSPARSELT_INCLUDE_DIR"
|
||||
#$(file-append
|
||||
(this-package-input "cuda-dev") "/include"))
|
||||
(setenv "USE_CUDNN" "1")
|
||||
(setenv "CUDNN_LIB_DIR"
|
||||
#$(file-append
|
||||
(this-package-input "nvidia-cudnn") "/lib"))
|
||||
(setenv "CUDNN_INCLUDE_DIR"
|
||||
#$(file-append
|
||||
(this-package-input "nvidia-cudnn") "/include"))
|
||||
;; XXX: 3.5, 5.0 and 9.0a break tests compilation
|
||||
;; See https://github.com/pytorch/pytorch/issues/113948
|
||||
(setenv "TORCH_CUDA_ARCH_LIST" "8.0 8.6 8.9 9.0")
|
||||
;; XXX: Current cutlass package doesn't have necessary
|
||||
;; headers to enable this option.
|
||||
(setenv "USE_ROCM" "0")))))))
|
||||
(native-inputs (package-native-inputs python-pytorch))
|
||||
(inputs
|
||||
(modify-inputs (package-inputs python-pytorch)
|
||||
(replace "tensorpipe" tensorpipe-cuda)
|
||||
(replace "gloo" gloo-cuda)
|
||||
(append nvidia-cudnn
|
||||
nvidia-cudnn-frontend
|
||||
cuda-dev
|
||||
nlohmann-json
|
||||
nvidia-cutlass
|
||||
nvidia-nccl)))
|
||||
(propagated-inputs (package-propagated-inputs python-pytorch))
|
||||
(home-page "https://pytorch.org/")
|
||||
(synopsis "Python library for tensor computation and deep neural networks")
|
||||
(description
|
||||
"PyTorch is a Python package that provides two high-level features:
|
||||
|
||||
@itemize
|
||||
@item tensor computation (like NumPy) with strong GPU acceleration;
|
||||
@item deep neural networks (DNNs) built on a tape-based autograd system.
|
||||
@end itemize
|
||||
|
||||
You can reuse Python packages such as NumPy, SciPy, and Cython to extend
|
||||
PyTorch when needed.
|
||||
|
||||
Note: This package provides NVIDIA GPU support.")
|
||||
(license license:bsd-3)))
|
||||
|
||||
(define-public tensorpipe-cuda
|
||||
(package
|
||||
(name "tensorpipe-cuda")
|
||||
(version (package-version tensorpipe))
|
||||
(source (package-source tensorpipe))
|
||||
(build-system cmake-build-system)
|
||||
(arguments
|
||||
(list
|
||||
#:configure-flags
|
||||
''("-DBUILD_SHARED_LIBS=ON" "-DTP_USE_CUDA=1")
|
||||
;; There are no tests
|
||||
#:tests? #f))
|
||||
(inputs (list cuda-nvml-dev cuda-toolkit libuv))
|
||||
(native-inputs (list googletest pkg-config pybind11 libnop))
|
||||
(home-page "https://github.com/pytorch/tensorpipe")
|
||||
(synopsis "Tensor-aware point-to-point communication primitive for
|
||||
machine learning")
|
||||
(description "TensorPipe provides a tensor-aware channel to transfer
|
||||
rich objects from one process to another while using the fastest transport for
|
||||
the tensors contained therein.
|
||||
Note: This version includes NVIDIA CUDA API and headers.")
|
||||
(license license:bsd-3)))
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,43 @@
|
|||
From 1b73d8d74b3ec7949e21d926d28385543c202dc7 Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Graves <ngraves@ngraves.fr>
|
||||
Date: Thu, 25 Jul 2024 14:33:24 +0200
|
||||
Subject: [PATCH] Find dlpack package instead of building it.
|
||||
|
||||
---
|
||||
python/CMakeLists.txt | 13 +++----------
|
||||
1 file changed, 3 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
|
||||
index cdfbf55..4168411 100644
|
||||
--- a/python/CMakeLists.txt
|
||||
+++ b/python/CMakeLists.txt
|
||||
@@ -2,15 +2,8 @@ cmake_minimum_required(VERSION 3.18)
|
||||
|
||||
Include(FetchContent)
|
||||
|
||||
-# Fetch and build dlpack
|
||||
-set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
||||
-set(BUILD_MOCK OFF)
|
||||
-FetchContent_Declare(
|
||||
- dlpack
|
||||
- GIT_REPOSITORY https://github.com/dmlc/dlpack
|
||||
- GIT_TAG v0.8
|
||||
-)
|
||||
-FetchContent_MakeAvailable(dlpack)
|
||||
+# Find dlpack
|
||||
+find_package(dlpack CONFIG REQUIRED)
|
||||
|
||||
# Find python
|
||||
find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED)
|
||||
@@ -60,7 +53,7 @@ target_compile_definitions(_compiled_module PRIVATE NV_CUDNN_FRONTEND_USE_DYNAMI
|
||||
target_link_libraries(
|
||||
_compiled_module
|
||||
|
||||
- PRIVATE dlpack
|
||||
+ PRIVATE dlpack::dlpack
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
--
|
||||
2.45.2
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
From 3f7a23cc5a84af36442c4035db78e616d884b540 Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Graves <ngraves@ngraves.fr>
|
||||
Date: Thu, 25 Jul 2024 16:43:12 +0200
|
||||
Subject: [PATCH] Find unbundled nlohmann-json package.
|
||||
|
||||
---
|
||||
CMakeLists.txt | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index adf22fc..8211fcd 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -16,6 +16,11 @@ endif()
|
||||
|
||||
add_library(cudnn_frontend INTERFACE)
|
||||
|
||||
+# Find the nlohmann_json package
|
||||
+if(NOT CUDNN_FRONTEND_SKIP_NLOHMANN_JSON)
|
||||
+ find_package(nlohmann_json CONFIG REQUIRED)
|
||||
+endif()
|
||||
+
|
||||
target_compile_definitions(
|
||||
cudnn_frontend INTERFACE
|
||||
$<$<BOOL:${CUDNN_FRONTEND_SKIP_JSON_LIB}>:CUDNN_FRONTEND_SKIP_JSON_LIB>
|
||||
@@ -25,6 +30,7 @@ target_include_directories(
|
||||
cudnn_frontend INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
+ $<$<NOT:$<BOOL:${CUDNN_FRONTEND_SKIP_NLOHMANN_JSON}>>:$<TARGET_PROPERTY:nlohmann_json::nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES>>
|
||||
)
|
||||
|
||||
# Find the cuda compiler
|
||||
--
|
||||
2.45.2
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
From 0c16ed53cae242b02069a1f6fed463dc819526e0 Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Graves <ngraves@ngraves.fr>
|
||||
Date: Thu, 25 Jul 2024 14:58:42 +0200
|
||||
Subject: [PATCH] Use absolute store cudnn.so path.
|
||||
|
||||
---
|
||||
python/cudnn/__init__.py | 16 +---------------
|
||||
1 file changed, 1 insertion(+), 15 deletions(-)
|
||||
|
||||
diff --git a/python/cudnn/__init__.py b/python/cudnn/__init__.py
|
||||
index 35eb883..39dc047 100644
|
||||
--- a/python/cudnn/__init__.py
|
||||
+++ b/python/cudnn/__init__.py
|
||||
@@ -137,21 +137,7 @@ pygraph.execute_plan_at_index = _execute_plan_at_index
|
||||
|
||||
|
||||
def _dlopen_cudnn():
|
||||
- # First look at python site packages
|
||||
- lib_path = glob.glob(
|
||||
- os.path.join(
|
||||
- sysconfig.get_path("purelib"), "nvidia/cudnn/lib/libcudnn.so.*[0-9]"
|
||||
- )
|
||||
- )
|
||||
-
|
||||
- if lib_path:
|
||||
- assert (
|
||||
- len(lib_path) == 1
|
||||
- ), f"Found {len(lib_path)} libcudnn.so.x in nvidia-cudnn-cuXX."
|
||||
- lib = ctypes.CDLL(lib_path[0])
|
||||
- else: # Fallback
|
||||
- lib = ctypes.CDLL("libcudnn.so")
|
||||
-
|
||||
+ lib = ctypes.CDLL(@store-cudnn.so-path@)
|
||||
handle = ctypes.cast(lib._handle, ctypes.c_void_p).value
|
||||
_compiled_module._set_dlhandle_cudnn(handle)
|
||||
|
||||
--
|
||||
2.45.2
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
From 7ee9ec4c2636cca833761d3466df27edc4e3f952 Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Graves <ngraves@ngraves.fr>
|
||||
Date: Tue, 30 Jul 2024 14:13:09 +0200
|
||||
Subject: [PATCH] Add CUTLASS_BUILD_STATIC_LIBRARY option
|
||||
|
||||
---
|
||||
tools/library/CMakeLists.txt | 22 ++++++++++++++++++----
|
||||
1 file changed, 18 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tools/library/CMakeLists.txt b/tools/library/CMakeLists.txt
|
||||
index a11ebcf6..79f7ccd1 100644
|
||||
--- a/tools/library/CMakeLists.txt
|
||||
+++ b/tools/library/CMakeLists.txt
|
||||
@@ -34,6 +34,7 @@ include(GNUInstallDirs)
|
||||
|
||||
set(CUTLASS_BUILD_MONO_LIBRARY OFF CACHE BOOL
|
||||
"Determines whether the cutlass library is generated as a single file or multiple files.")
|
||||
+option(CUTLASS_BUILD_STATIC_LIBRARY "Build static libary for CUTLASS" ON)
|
||||
|
||||
################################################################################
|
||||
|
||||
@@ -126,7 +127,9 @@ function(cutlass_add_cutlass_library)
|
||||
# simply link the generated object files to the default library.
|
||||
|
||||
target_link_libraries(${DEFAULT_NAME} PRIVATE $<BUILD_INTERFACE:${__NAME}_objs>)
|
||||
- target_link_libraries(${DEFAULT_NAME}_static PRIVATE $<BUILD_INTERFACE:${__NAME}_objs>)
|
||||
+ if (CUTLASS_BUILD_STATIC_LIBRARY)
|
||||
+ target_link_libraries(${DEFAULT_NAME}_static PRIVATE $<BUILD_INTERFACE:${__NAME}_objs>)
|
||||
+ endif()
|
||||
|
||||
else()
|
||||
|
||||
@@ -152,7 +155,7 @@ function(cutlass_add_cutlass_library)
|
||||
)
|
||||
|
||||
set_target_properties(${__NAME} PROPERTIES DEBUG_POSTFIX "${CUTLASS_LIBRARY_DEBUG_POSTFIX}")
|
||||
-
|
||||
+ if (CUTLASS_BUILD_STATIC_LIBRARY)
|
||||
cutlass_add_library(
|
||||
${__NAME}_static
|
||||
STATIC
|
||||
@@ -189,6 +192,15 @@ function(cutlass_add_cutlass_library)
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
+ else()
|
||||
+ install(
|
||||
+ TARGETS ${__NAME}
|
||||
+ EXPORT NvidiaCutlass
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ )
|
||||
+ endif()
|
||||
|
||||
if (__SUFFIX)
|
||||
|
||||
@@ -197,8 +209,10 @@ function(cutlass_add_cutlass_library)
|
||||
# commands to pull in all kernels by default.
|
||||
|
||||
target_link_libraries(${DEFAULT_NAME} INTERFACE ${__NAME})
|
||||
- target_link_libraries(${DEFAULT_NAME}_static INTERFACE ${__NAME}_static)
|
||||
-
|
||||
+ if (CUTLASS_BUILD_STATIC_LIBRARY)
|
||||
+ target_link_libraries(${DEFAULT_NAME}_static INTERFACE ${__NAME}_static)
|
||||
+ endif()
|
||||
+
|
||||
endif()
|
||||
|
||||
endif()
|
||||
--
|
||||
2.45.2
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
From ce4a14ae4041d6cfb69987fef5a65c50754c89b6 Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Graves <ngraves@ngraves.fr>
|
||||
Date: Sun, 28 Jul 2024 16:57:16 +0200
|
||||
Subject: [PATCH] Add option CUTLASS_BUILD_STATIC_LIBRARY
|
||||
|
||||
---
|
||||
tools/library/CMakeLists.txt | 26 +++++++++++++++++++++-----
|
||||
1 file changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tools/library/CMakeLists.txt b/tools/library/CMakeLists.txt
|
||||
index 60a6cca5..f096c84d 100644
|
||||
--- a/tools/library/CMakeLists.txt
|
||||
+++ b/tools/library/CMakeLists.txt
|
||||
@@ -34,6 +34,7 @@ include(GNUInstallDirs)
|
||||
|
||||
set(CUTLASS_BUILD_MONO_LIBRARY OFF CACHE BOOL
|
||||
"Determines whether the cutlass library is generated as a single file or multiple files.")
|
||||
+option(CUTLASS_BUILD_STATIC_LIBRARY "Build static libary for CUTLASS" ON)
|
||||
|
||||
################################################################################
|
||||
|
||||
@@ -126,7 +127,9 @@ function(cutlass_add_cutlass_library)
|
||||
# simply link the generated object files to the default library.
|
||||
|
||||
target_link_libraries(${DEFAULT_NAME} PRIVATE $<BUILD_INTERFACE:${__NAME}_objs>)
|
||||
- target_link_libraries(${DEFAULT_NAME}_static PRIVATE $<BUILD_INTERFACE:${__NAME}_objs>)
|
||||
+ if (CUTLASS_BUILD_STATIC_LIBRARY)
|
||||
+ target_link_libraries(${DEFAULT_NAME}_static PRIVATE $<BUILD_INTERFACE:${__NAME}_objs>)
|
||||
+ endif()
|
||||
|
||||
else()
|
||||
|
||||
@@ -154,7 +157,7 @@ function(cutlass_add_cutlass_library)
|
||||
)
|
||||
|
||||
set_target_properties(${__NAME} PROPERTIES DEBUG_POSTFIX "${CUTLASS_LIBRARY_DEBUG_POSTFIX}")
|
||||
-
|
||||
+ if (CUTLASS_BUILD_STATIC_LIBRARY)
|
||||
cutlass_add_library(
|
||||
${__NAME}_static
|
||||
STATIC
|
||||
@@ -193,6 +196,15 @@ function(cutlass_add_cutlass_library)
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
+ else()
|
||||
+ install(
|
||||
+ TARGETS ${__NAME}
|
||||
+ EXPORT NvidiaCutlass
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ )
|
||||
+ endif()
|
||||
|
||||
if (__SUFFIX)
|
||||
|
||||
@@ -201,7 +213,9 @@ function(cutlass_add_cutlass_library)
|
||||
# commands to pull in all kernels by default.
|
||||
|
||||
target_link_libraries(${DEFAULT_NAME} PUBLIC ${__NAME})
|
||||
- target_link_libraries(${DEFAULT_NAME}_static PUBLIC ${__NAME}_static)
|
||||
+ if (CUTLASS_BUILD_STATIC_LIBRARY)
|
||||
+ target_link_libraries(${DEFAULT_NAME}_static PUBLIC ${__NAME}_static)
|
||||
+ endif()
|
||||
|
||||
endif()
|
||||
|
||||
@@ -250,7 +264,9 @@ cutlass_add_cutlass_library(
|
||||
|
||||
# For backward compatibility with the old name
|
||||
add_library(cutlass_lib ALIAS cutlass_library)
|
||||
-add_library(cutlass_lib_static ALIAS cutlass_library_static)
|
||||
+if (CUTLASS_BUILD_STATIC_LIBRARY)
|
||||
+ add_library(cutlass_lib_static ALIAS cutlass_library_static)
|
||||
+endif()
|
||||
|
||||
################################################################################
|
||||
|
||||
--
|
||||
2.45.2
|
||||
|
181
nonguix/build-system/cuda.scm
Normal file
181
nonguix/build-system/cuda.scm
Normal file
|
@ -0,0 +1,181 @@
|
|||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
|
||||
|
||||
(define-module (nonguix build-system cuda)
|
||||
#:use-module (gnu packages gcc)
|
||||
#:use-module (guix store)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix monads)
|
||||
#:use-module (guix derivations)
|
||||
#:use-module (guix search-paths)
|
||||
#:use-module (guix build-system)
|
||||
#:use-module (guix build-system gnu)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (nonguix build-system binary)
|
||||
#:use-module (nonguix utils)
|
||||
#:use-module ((nonguix licenses) #:prefix license:)
|
||||
#:export (cuda-license
|
||||
cuda-current-system
|
||||
cuda-module-url
|
||||
guix-system->cuda-system
|
||||
|
||||
%cuda-build-system-modules
|
||||
lower
|
||||
cuda-build
|
||||
cuda-build-system))
|
||||
|
||||
;; Commentary:
|
||||
;;
|
||||
;; Standard build procedure for Cuda binary packages. This is
|
||||
;; implemented as an extension of `binary-build-system'.
|
||||
;;
|
||||
;; Code:
|
||||
|
||||
(define %cuda-build-system-modules
|
||||
;; Build-side modules imported by default.
|
||||
`((nonguix build cuda-build-system)
|
||||
(nonguix build utils)
|
||||
,@%binary-build-system-modules))
|
||||
|
||||
(define (build-patchelf-plan wrapper-plan inputs)
|
||||
#~(let ((patchelf-inputs
|
||||
(list #$@(map car inputs))))
|
||||
(map (lambda (file)
|
||||
(cons file (cons* "out" patchelf-inputs)))
|
||||
#$wrapper-plan)))
|
||||
|
||||
(define (cuda-license name)
|
||||
(license:nonfree
|
||||
(format #f "\
|
||||
https://developer.download.nvidia.com/compute/cuda/redist/~a/LICENSE.txt"
|
||||
(string-join (string-split name #\-) "_"))))
|
||||
|
||||
(define (guix-system->cuda-system system)
|
||||
(match system
|
||||
("x86_64-linux" "linux-x86_64")
|
||||
("aarch64-linux" "linux-aarch64")
|
||||
("powerpc64le-linux" "linux-ppc64le")
|
||||
(_ #f)))
|
||||
|
||||
(define (cuda-current-system)
|
||||
(guix-system->cuda-system
|
||||
(or (%current-target-system) (%current-system))))
|
||||
|
||||
(define (cuda-module-url name version)
|
||||
(let ((system (cuda-current-system))
|
||||
(snake-name (string-join (string-split name #\-) "_")))
|
||||
(format #f
|
||||
"https://developer.download.nvidia.com/compute/cuda/redist\
|
||||
/~a/~a/~a-~a-~a-archive.tar.xz"
|
||||
snake-name
|
||||
system
|
||||
snake-name
|
||||
system
|
||||
version)))
|
||||
|
||||
(define* (lower name
|
||||
#:key source inputs native-inputs outputs system target
|
||||
(patchelf (default-patchelf))
|
||||
(glibc (default-glibc))
|
||||
#:allow-other-keys
|
||||
#:rest arguments)
|
||||
"Return a bag for NAME."
|
||||
(define private-keywords
|
||||
'(#:target #:patchelf #:inputs #:native-inputs))
|
||||
(define host-inputs
|
||||
`(,@(if source
|
||||
`(("source" ,source))
|
||||
'())
|
||||
|
||||
("gcc:lib" ,gcc "lib")
|
||||
("glibc" ,glibc)
|
||||
|
||||
,@inputs
|
||||
;; Keep the standard inputs of 'gnu-build-system'.
|
||||
,@(standard-packages)))
|
||||
|
||||
(and (not target) ;XXX: no cross-compilation
|
||||
(bag
|
||||
(name name)
|
||||
(system system)
|
||||
(host-inputs host-inputs)
|
||||
(build-inputs `(("patchelf" ,patchelf)
|
||||
,@native-inputs
|
||||
;; If current system is i686, the *32 packages will be the
|
||||
;; same as the non-32, but that's OK.
|
||||
("libc32" ,(to32 glibc))))
|
||||
(outputs outputs)
|
||||
(build cuda-build)
|
||||
(arguments (append
|
||||
(strip-keyword-arguments private-keywords arguments)
|
||||
(list #:wrap-inputs (alist-delete "source" host-inputs)))))))
|
||||
|
||||
(define* (cuda-build name inputs
|
||||
#:key
|
||||
guile source wrap-inputs
|
||||
(outputs '("out"))
|
||||
(patchelf-inputs ''("gcc" "glibc"))
|
||||
(patchelf-plan ''())
|
||||
(install-plan ''(("." "./")))
|
||||
(search-paths '())
|
||||
(out-of-source? #t)
|
||||
(validate-runpath? #t)
|
||||
(patch-shebangs? #t)
|
||||
(strip-binaries? #t)
|
||||
(strip-flags ''("--strip-debug"))
|
||||
(strip-directories ''("lib" "lib64" "libexec"
|
||||
"bin" "sbin"))
|
||||
(phases '(@ (nonguix build cuda-build-system)
|
||||
%standard-phases))
|
||||
(system (%current-system))
|
||||
(imported-modules %cuda-build-system-modules)
|
||||
(modules '((nonguix build cuda-build-system)
|
||||
(guix build utils)
|
||||
(nonguix build utils)))
|
||||
(substitutable? #t)
|
||||
allowed-references
|
||||
disallowed-references)
|
||||
"Build SOURCE using binary-build-system."
|
||||
(define builder
|
||||
(with-imported-modules imported-modules
|
||||
#~(begin
|
||||
(use-modules #$@modules)
|
||||
|
||||
#$(with-build-variables inputs outputs
|
||||
#~(cuda-build #:source #+source
|
||||
#:system #$system
|
||||
#:outputs %outputs
|
||||
#:inputs %build-inputs
|
||||
#:patchelf-inputs #$patchelf-inputs
|
||||
#:patchelf-plan #$patchelf-plan
|
||||
#:install-plan #$install-plan
|
||||
#:search-paths '#$(map search-path-specification->sexp
|
||||
search-paths)
|
||||
#:phases #$phases
|
||||
#:out-of-source? #$out-of-source?
|
||||
#:validate-runpath? #$validate-runpath?
|
||||
#:patch-shebangs? #$patch-shebangs?
|
||||
#:strip-binaries? #$strip-binaries?
|
||||
#:strip-flags #$strip-flags
|
||||
#:strip-directories #$strip-directories)))))
|
||||
|
||||
(mlet %store-monad ((guile (package->derivation (or guile (default-guile))
|
||||
system #:graft? #f)))
|
||||
(gexp->derivation name builder
|
||||
#:system system
|
||||
#:target #f
|
||||
#:substitutable? substitutable?
|
||||
#:allowed-references allowed-references
|
||||
#:disallowed-references disallowed-references
|
||||
#:guile-for-build guile)))
|
||||
|
||||
(define cuda-build-system
|
||||
(build-system
|
||||
(name 'cuda)
|
||||
(description "The Cuda build system")
|
||||
(lower lower)))
|
||||
|
||||
;;; cuda.scm ends here
|
|
@ -3,6 +3,7 @@
|
|||
;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
|
||||
;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org>
|
||||
;;; Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
|
||||
;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
|
||||
|
||||
(define-module (nonguix build binary-build-system)
|
||||
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
|
||||
|
@ -11,6 +12,7 @@
|
|||
#:use-module (ice-9 match)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:export (%standard-phases
|
||||
autopatchelf
|
||||
binary-build))
|
||||
|
||||
;; Commentary:
|
||||
|
@ -140,6 +142,27 @@ The inputs are optional when the file is an executable."
|
|||
patchelf-plan)))
|
||||
#t)
|
||||
|
||||
(define* (autopatchelf #:key inputs outputs patchelf-plan patchelf-inputs
|
||||
#:allow-other-keys)
|
||||
"Automatically build patchelf-plan if not defined, then run patchelf phase.
|
||||
|
||||
The plan is the product of all elf-files with all inputs and \"out\"."
|
||||
(if (equal? patchelf-plan '())
|
||||
(let* ((elf-files (find-files
|
||||
"." (lambda (name stat)
|
||||
(and (elf-file? name)
|
||||
(not (eq? 'symlink (stat:type stat)))))))
|
||||
(plan (map (lambda (file)
|
||||
(list file (cons* "out" patchelf-inputs)))
|
||||
elf-files)))
|
||||
(format #t "Applying patchelf-plan: ~a~%" plan)
|
||||
(patchelf #:inputs inputs
|
||||
#:outputs outputs
|
||||
#:patchelf-plan plan))
|
||||
(patchelf #:inputs inputs
|
||||
#:outputs outputs
|
||||
#:patchelf-plan patchelf-plan)))
|
||||
|
||||
(define (deb-file? binary-file)
|
||||
(string-suffix? ".deb" binary-file))
|
||||
|
||||
|
|
73
nonguix/build/cuda-build-system.scm
Normal file
73
nonguix/build/cuda-build-system.scm
Normal file
|
@ -0,0 +1,73 @@
|
|||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
|
||||
|
||||
(define-module (nonguix build cuda-build-system)
|
||||
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
|
||||
#:use-module ((nonguix build binary-build-system) #:prefix binary:)
|
||||
#:use-module (guix build utils)
|
||||
#:use-module (nonguix build utils)
|
||||
#:use-module (ice-9 ftw)
|
||||
#:use-module (ice-9 match)
|
||||
#:export (%standard-phases
|
||||
cuda-build))
|
||||
|
||||
;; Commentary:
|
||||
;;
|
||||
;; Builder-side code of the Cuda binary build procedure.
|
||||
;;
|
||||
;; Code:
|
||||
|
||||
;;; XXX: Copied from upstream guix in tests/store-deduplication.scm
|
||||
(define (cartesian-product . lst)
|
||||
"Return the Cartesian product of all the given lists."
|
||||
(match lst
|
||||
((head)
|
||||
(map list head))
|
||||
((head . rest)
|
||||
(let ((others (apply cartesian-product rest)))
|
||||
(apply append
|
||||
(map
|
||||
(lambda (init)
|
||||
(map (lambda (lst)
|
||||
(cons init lst))
|
||||
others))
|
||||
head))))
|
||||
(()
|
||||
'())))
|
||||
|
||||
(define* (install-pkg-config-files #:key outputs #:allow-other-keys)
|
||||
(if (directory-exists? "pkg-config")
|
||||
(with-directory-excursion "pkg-config"
|
||||
(for-each
|
||||
(match-lambda
|
||||
((output file)
|
||||
(substitute* file
|
||||
(("^cudaroot=.*")
|
||||
(string-append "cudaroot=" output "\n"))
|
||||
(("^libdir=.*")
|
||||
(string-append "libdir=" output "/lib\n"))
|
||||
(("^includedir=.*")
|
||||
(string-append "includedir=" output "/include\n")))
|
||||
(install-file file
|
||||
(string-append output "/share/pkg-config"))
|
||||
(with-directory-excursion
|
||||
(string-append output "/share/pkg-config")
|
||||
(symlink (basename file)
|
||||
(string-append
|
||||
(string-take file (string-index file #\-)) ".pc")))))
|
||||
(cartesian-product (map cdr outputs) (find-files "." "\\.pc"))))
|
||||
(format #t "pkg-config directory doesn't exist, nothing to be done.~%")))
|
||||
|
||||
(define %standard-phases
|
||||
(modify-phases binary:%standard-phases
|
||||
(replace 'patchelf binary:autopatchelf)
|
||||
(add-after 'install 'install-static install-static-output)
|
||||
(add-after 'install-static 'install-pkg-config-files
|
||||
install-pkg-config-files)))
|
||||
|
||||
(define* (cuda-build #:key inputs (phases %standard-phases)
|
||||
#:allow-other-keys #:rest args)
|
||||
"Build the given package, applying all of PHASES in order."
|
||||
(apply gnu:gnu-build #:inputs inputs #:phases phases args))
|
||||
|
||||
;;; cuda-build-system.scm ends here
|
|
@ -12,7 +12,8 @@
|
|||
#:export (64-bit?
|
||||
make-wrapper
|
||||
concatenate-files
|
||||
build-paths-from-inputs))
|
||||
build-paths-from-inputs
|
||||
install-static-output))
|
||||
|
||||
(define (64-bit? file)
|
||||
"Return true if ELF file is in 64-bit format, false otherwise.
|
||||
|
@ -97,3 +98,22 @@ contents:
|
|||
(call-with-output-file result
|
||||
(lambda (port)
|
||||
(for-each (cut dump <> port) files))))
|
||||
|
||||
(define* (install-static-output #:key outputs #:allow-other-keys)
|
||||
(let ((out (assoc-ref outputs "out"))
|
||||
(static (assoc-ref outputs "static")))
|
||||
(if static
|
||||
(begin
|
||||
(for-each
|
||||
(lambda (file)
|
||||
(if (eq? 'symlink (stat:type (lstat file)))
|
||||
(with-directory-excursion (string-append static "/lib")
|
||||
(symlink (basename (readlink file))
|
||||
(basename file)))
|
||||
(install-file file (string-append static "/lib")))
|
||||
(delete-file file))
|
||||
(find-files (string-append out "/lib") "\\.a$"))
|
||||
(for-each
|
||||
(cute install-file <> (string-append static "/include"))
|
||||
(find-files (string-append out "/include"))))
|
||||
(format #t "no static output, nothing to be done~%"))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user