nongnu: Add cuda-python and nvidia-cutlass.
* nongnu/packages/nvidia.scm (cuda-python, nvidia-cutlass): Add variables. * nongnu/packages/patches: Add necessary patches.
This commit is contained in:
parent
f22d04bdc1
commit
a719e9e1bc
|
@ -1893,6 +1893,52 @@ libraries for NVIDIA GPUs, all of which are proprietary.")
|
|||
(home-page "https://developer.nvidia.com/cuda-toolkit")
|
||||
(license (package-license cuda-cudart))))
|
||||
|
||||
(define-public cuda-python
|
||||
(package
|
||||
(name "cuda-python")
|
||||
(version "12.1.0")
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/NVIDIA/cuda-python")
|
||||
(commit (string-append "v" version))))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32 "0i0wvx5kxckphsf1n02rr86hrnc2r6p8wlrvq1n1w9c3l6m24d13"))))
|
||||
(build-system pyproject-build-system)
|
||||
(arguments
|
||||
(list
|
||||
#:tests? #f ; FIXME: most tests fail.
|
||||
#:phases
|
||||
#~(modify-phases %standard-phases
|
||||
(add-after 'unpack 'fix-setup.py
|
||||
(lambda _
|
||||
(substitute* "setup.py"
|
||||
(("import versioneer" all)
|
||||
(format #f "~a~%import pyparsing" all)))))
|
||||
(add-before 'build 'set_cuda_paths
|
||||
(lambda _
|
||||
(setenv "CUDA_HOME"
|
||||
#$(this-package-input "cuda-dev"))
|
||||
(setenv "PARALLEL_LEVEL"
|
||||
(number->string (parallel-job-count))))))))
|
||||
(native-inputs (list python-cython
|
||||
python-numpy
|
||||
python-pytest
|
||||
python-pytest-benchmark
|
||||
python-setuptools
|
||||
python-wheel))
|
||||
(inputs (list cuda-dev))
|
||||
(propagated-inputs (list python-pyclibrary))
|
||||
(home-page "https://github.com/NVIDIA/cuda-python")
|
||||
(synopsis "CUDA Python low-level bindings")
|
||||
(description "This package provides Python low-level bindings for NVIDIA
|
||||
CUDA toolkit.")
|
||||
(license
|
||||
(license:nonfree
|
||||
"https://github.com/NVIDIA/cuda-python/blob/main/LICENSE"))))
|
||||
|
||||
(define (nvidia-cudnn-samples system version)
|
||||
(origin
|
||||
(method url-fetch)
|
||||
|
@ -2051,6 +2097,83 @@ functionality on top of the backend API, such as errata filters and
|
|||
autotuning.")
|
||||
(license license-gnu:expat)))
|
||||
|
||||
(define-public nvidia-cutlass
|
||||
(package
|
||||
(name "nvidia-cutlass")
|
||||
(version "3.2.2")
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/NVIDIA/cutlass")
|
||||
(commit (string-append "v" version))))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32 "0qyxkp3pmndlzm3aw9xwrx57znj9p4xlvqahavgzq8c1nd7bj3wp"))
|
||||
(patches
|
||||
(parameterize
|
||||
((%patch-path
|
||||
(map
|
||||
(lambda (directory)
|
||||
(string-append directory "/nongnu/packages/patches"))
|
||||
%load-path)))
|
||||
(search-patches "nvidia-cutlass-3.2.2_disable_static_lib.patch")))))
|
||||
(build-system cmake-build-system)
|
||||
(arguments
|
||||
(list
|
||||
;; XXX: Cutlass is incredibly heavy to build when not specifying target
|
||||
;; GPU architecture (4G), avoid tests, examples and static library.
|
||||
;; Setting the contrary often runs out of RAM even on beefy laptops.
|
||||
#:configure-flags ''("-DCUTLASS_ENABLE_TESTS=OFF"
|
||||
"-DCUTLASS_INSTALL_TESTS=OFF"
|
||||
"-DCUTLASS_BUILD_STATIC_LIBRARY=OFF"
|
||||
"-DCUTLASS_ENABLE_EXAMPLES=OFF"
|
||||
"-DCUTLASS_UNITY_BUILD_ENABLED=ON")
|
||||
#:phases
|
||||
#~(modify-phases %standard-phases
|
||||
;; XXX: This phase is not necessary on earlier versions.
|
||||
;; Remove it when updating.
|
||||
(add-after 'unpack 'fix-cuda-build
|
||||
(lambda _
|
||||
(substitute* "CMakeLists.txt"
|
||||
(("--user")
|
||||
(string-append "--prefix=" #$output)))
|
||||
(setenv "PYTHONPATH"
|
||||
(string-append (getcwd) "/python"))))
|
||||
(add-before 'build 'set_cuda_paths
|
||||
(lambda _
|
||||
(setenv "CUDACXX"
|
||||
#$(file-append (this-package-input "cuda-toolkit")
|
||||
"/bin/nvcc"))))
|
||||
(add-after 'install 'cleanup
|
||||
(lambda _
|
||||
(delete-file-recursively
|
||||
(string-append #$output "/test")))))))
|
||||
(native-inputs (list python python-setuptools))
|
||||
(inputs (list cuda-toolkit))
|
||||
(propagated-inputs (list cuda-python
|
||||
python-networkx
|
||||
python-numpy
|
||||
python-pydot
|
||||
python-scipy
|
||||
python-treelib))
|
||||
(home-page "https://developer.nvidia.com/blog/cutlass-linear-algebra-cuda")
|
||||
(synopsis "CUDA Templates for Linear Algebra Subroutines")
|
||||
(description
|
||||
"This package provides a collection of CUDA C++ template abstractions for
|
||||
implementing high-performance matrix-matrix multiplication (GEMM) and related
|
||||
computations at all levels and scales within CUDA. It incorporates strategies
|
||||
for hierarchical decomposition and data movement similar to those used to
|
||||
implement cuBLAS and cuDNN. CUTLASS decomposes these moving parts into
|
||||
reusable, modular software components abstracted by C++ template
|
||||
classes. Primitives for different levels of a conceptual parallelization
|
||||
hierarchy can be specialized and tuned via custom tiling sizes, data types,
|
||||
and other algorithmic policy. The resulting flexibility simplifies their use
|
||||
as building blocks within custom kernels and applications.")
|
||||
(license
|
||||
(license:nonfree
|
||||
"https://github.com/NVIDIA/cutlass/blob/main/LICENSE.txt"))))
|
||||
|
||||
|
||||
|
||||
;;;
|
||||
|
|
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user