-
Notifications
You must be signed in to change notification settings - Fork 1
Update to cuDSS 0.8 #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,78 +1,71 @@ | ||
| # Function to add cuDSS library to the project | ||
| # | ||
| # Usage: | ||
| # add_cudss(CUDSS_BUILD_PATH "/path/to/cudss/build") | ||
| # add_cudss(VERSION "0.8.0.10") | ||
| # | ||
| # This function will: | ||
| # - Check if a local cuDSS build exists at CUDSS_BUILD_PATH | ||
| # - If found, use the local build (sets CUDSS_NEW_API compile definition) | ||
| # - If not found, download a prebuilt version using FetchContent | ||
| # - Create an imported target 'cudss' that can be linked against | ||
| # This function downloads a prebuilt cuDSS archive (matching the host | ||
| # architecture and the CUDA major version) using FetchContent and creates an | ||
| # imported target 'cudss' that can be linked against. | ||
| # | ||
| # Supported versions: 0.8.0.10 (default) and 0.7.1.4. The cuDSS API differs | ||
| # between 0.7.x and 0.8.x; the C++ sources select the right API based on the | ||
| # CUDSS_VERSION macro from the cuDSS header, so no extra compile definition is | ||
| # needed here. | ||
| # | ||
| # Parameters: | ||
| # CUDSS_BUILD_PATH - Path to the cuDSS build directory (optional, defaults to empty) | ||
| # VERSION - cuDSS version to download (optional, defaults to 0.8.0.10) | ||
| function(add_cudss) | ||
| # Parse arguments | ||
| set(options "") | ||
| set(oneValueArgs CUDSS_BUILD_PATH) | ||
| set(oneValueArgs VERSION) | ||
| set(multiValueArgs "") | ||
| cmake_parse_arguments(CUDSS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
| cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
|
|
||
| if(NOT ARG_VERSION) | ||
| set(ARG_VERSION "0.8.0.10") | ||
| endif() | ||
|
|
||
| # Create imported target | ||
| add_library(cudss STATIC IMPORTED) | ||
|
|
||
| # Check if local build path was provided and exists | ||
| set(LOCAL_CUDSS_BUILD OFF) | ||
| if(CUDSS_CUDSS_BUILD_PATH) | ||
| set(CUDSS_LIB_PATH "${CUDSS_CUDSS_BUILD_PATH}/libcudss_static.a") | ||
| set(CUDSS_INCLUDE_PATH "${CUDSS_CUDSS_BUILD_PATH}/include") | ||
|
|
||
| if(EXISTS "${CUDSS_LIB_PATH}" AND EXISTS "${CUDSS_INCLUDE_PATH}") | ||
| set(LOCAL_CUDSS_BUILD ON) | ||
| message(STATUS "Using local cuDSS build from ${CUDSS_CUDSS_BUILD_PATH}") | ||
| set_target_properties(cudss PROPERTIES | ||
| IMPORTED_LOCATION "${CUDSS_LIB_PATH}" | ||
| INTERFACE_INCLUDE_DIRECTORIES "${CUDSS_INCLUDE_PATH}" | ||
| ) | ||
| endif() | ||
| message(STATUS "Using prebuilt cuDSS ${ARG_VERSION}") | ||
| set(CUDSS_URL_PREFIX "https://developer.download.nvidia.com/compute/cudss/redist/libcudss/") | ||
| message(STATUS "CUDA Compiler Version: ${CMAKE_CUDA_COMPILER_VERSION}") | ||
|
|
||
| # Archive flavor follows the CUDA major version. | ||
| if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_GREATER_EQUAL 13.0) | ||
| set(CUDSS_CUDA_TAG "cuda13") | ||
| message(STATUS "Using CUDA 13.0 or newer") | ||
| else() | ||
| set(CUDSS_CUDA_TAG "cuda12") | ||
| message(STATUS "Using CUDA 12.0 or older") | ||
| endif() | ||
|
|
||
| # If local build not found, use prebuilt version | ||
| if(NOT LOCAL_CUDSS_BUILD) | ||
| message(STATUS "Using prebuilt cuDSS") | ||
| set(CUDSS_URL_PREFIX "https://developer.download.nvidia.com/compute/cudss/redist/libcudss/") | ||
| message(STATUS "CUDA Compiler Version: ${CMAKE_CUDA_COMPILER_VERSION}") | ||
|
|
||
| if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_GREATER_EQUAL 13.0) | ||
| set(CUDSS_URL_AARCH64 ${CUDSS_URL_PREFIX}linux-aarch64/libcudss-linux-aarch64-0.7.1.4_cuda13-archive.tar.xz) | ||
| set(CUDSS_URL_X86_64 ${CUDSS_URL_PREFIX}linux-x86_64/libcudss-linux-x86_64-0.7.1.4_cuda13-archive.tar.xz) | ||
| message(STATUS "Using CUDA 13.0 or newer") | ||
| else() | ||
| set(CUDSS_URL_AARCH64 ${CUDSS_URL_PREFIX}linux-aarch64/libcudss-linux-aarch64-0.7.1.4_cuda12-archive.tar.xz) | ||
| set(CUDSS_URL_X86_64 ${CUDSS_URL_PREFIX}linux-x86_64/libcudss-linux-x86_64-0.7.1.4_cuda12-archive.tar.xz) | ||
| message(STATUS "Using CUDA 12.0 or older") | ||
| endif() | ||
| # The aarch64 archive naming changed between releases: 0.7.x ships as | ||
| # "linux-aarch64", while 0.8+ ships as "linux-sbsa". | ||
| if(${ARG_VERSION} VERSION_GREATER_EQUAL 0.8.0) | ||
| set(CUDSS_AARCH64_NAME "linux-sbsa") | ||
| else() | ||
| set(CUDSS_AARCH64_NAME "linux-aarch64") | ||
| endif() | ||
|
|
||
| if(CMAKE_SYSTEM_PROCESSOR MATCHES "(aarch64)|(AARCH64)") | ||
| set(CUDSS_URL ${CUDSS_URL_AARCH64}) | ||
| else() | ||
| set(CUDSS_URL ${CUDSS_URL_X86_64}) | ||
| endif() | ||
| if(CMAKE_SYSTEM_PROCESSOR MATCHES "(aarch64)|(AARCH64)") | ||
| set(CUDSS_URL "${CUDSS_URL_PREFIX}${CUDSS_AARCH64_NAME}/libcudss-${CUDSS_AARCH64_NAME}-${ARG_VERSION}_${CUDSS_CUDA_TAG}-archive.tar.xz") | ||
| else() | ||
| set(CUDSS_URL "${CUDSS_URL_PREFIX}linux-x86_64/libcudss-linux-x86_64-${ARG_VERSION}_${CUDSS_CUDA_TAG}-archive.tar.xz") | ||
| endif() | ||
|
|
||
| include(FetchContent) | ||
| FetchContent_Declare( | ||
| cudss | ||
| DOWNLOAD_EXTRACT_TIMESTAMP TRUE | ||
| URL ${CUDSS_URL} | ||
| ) | ||
| FetchContent_Populate(cudss) | ||
| message(STATUS "cuDSS download URL: ${CUDSS_URL}") | ||
|
|
||
| set_target_properties(cudss PROPERTIES | ||
| IMPORTED_LOCATION "${cudss_SOURCE_DIR}/lib/libcudss_static.a" | ||
| INTERFACE_INCLUDE_DIRECTORIES "${cudss_SOURCE_DIR}/include" | ||
| ) | ||
| endif() | ||
| include(FetchContent) | ||
| FetchContent_Declare( | ||
| cudss | ||
| DOWNLOAD_EXTRACT_TIMESTAMP TRUE | ||
| URL ${CUDSS_URL} | ||
| ) | ||
| FetchContent_MakeAvailable(cudss) | ||
|
|
||
| # Set parent scope variable to indicate if local build is used | ||
| set(LOCAL_CUDSS_BUILD ${LOCAL_CUDSS_BUILD} PARENT_SCOPE) | ||
| set_target_properties(cudss PROPERTIES | ||
| IMPORTED_LOCATION "${cudss_SOURCE_DIR}/lib/libcudss_static.a" | ||
| INTERFACE_INCLUDE_DIRECTORIES "${cudss_SOURCE_DIR}/include" | ||
| ) | ||
| endfunction() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.