diff --git a/VERSION b/VERSION new file mode 100644 index 0000000000..4a2fe8aa57 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +24.04.00 diff --git a/ci/build_docs.sh b/ci/build_docs.sh index d84ff81fb3..865bf1bded 100755 --- a/ci/build_docs.sh +++ b/ci/build_docs.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2023, NVIDIA CORPORATION. +# Copyright (c) 2023-2024, NVIDIA CORPORATION. set -euo pipefail @@ -25,7 +25,9 @@ rapids-mamba-retry install \ --channel "${PYTHON_CHANNEL}" \ kvikio libkvikio -export RAPIDS_VERSION_NUMBER="24.04" +export RAPIDS_VERSION="$(rapids-version)" +export RAPIDS_VERSION_MAJOR_MINOR="$(rapids-version-major-minor)" +export RAPIDS_VERSION_NUMBER="$RAPIDS_VERSION_MAJOR_MINOR" export RAPIDS_DOCS_DIR="$(mktemp -d)" rapids-logger "Build CPP docs" diff --git a/ci/check_style.sh b/ci/check_style.sh index f073ff969b..cafb0a06c9 100755 --- a/ci/check_style.sh +++ b/ci/check_style.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2020-2023, NVIDIA CORPORATION. +# Copyright (c) 2020-2024, NVIDIA CORPORATION. set -euo pipefail @@ -14,7 +14,9 @@ rapids-dependency-file-generator \ rapids-mamba-retry env create --force -f env.yaml -n checks conda activate checks -FORMAT_FILE_URL=https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-23.04/cmake-format-rapids-cmake.json +RAPIDS_VERSION_MAJOR_MINOR="$(rapids-version-major-minor)" + +FORMAT_FILE_URL=https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_VERSION_MAJOR_MINOR}/cmake-format-rapids-cmake.json export RAPIDS_CMAKE_FORMAT_FILE=/tmp/rapids_cmake_ci/cmake-formats-rapids-cmake.json mkdir -p $(dirname ${RAPIDS_CMAKE_FORMAT_FILE}) wget -O ${RAPIDS_CMAKE_FORMAT_FILE} ${FORMAT_FILE_URL} diff --git a/ci/checks/style.sh b/ci/checks/style.sh deleted file mode 100755 index 53f4e6baf3..0000000000 --- a/ci/checks/style.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Copyright (c) 2022-2023, NVIDIA CORPORATION. -####################### -# kvikio Style Tester # -####################### - -PATH=/conda/bin:$PATH - -# Activate common conda env -. /opt/conda/etc/profile.d/conda.sh -conda activate rapids - -FORMAT_FILE_URL=https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-24.04/cmake-format-rapids-cmake.json -export RAPIDS_CMAKE_FORMAT_FILE=/tmp/rapids_cmake_ci/cmake-formats-rapids-cmake.json -mkdir -p $(dirname ${RAPIDS_CMAKE_FORMAT_FILE}) -wget -O ${RAPIDS_CMAKE_FORMAT_FILE} ${FORMAT_FILE_URL} - -# Run pre-commit checks -pre-commit run --hook-stage manual --all-files --show-diff-on-failure diff --git a/ci/release/update-version.sh b/ci/release/update-version.sh index 1dc6966bd9..d094873da9 100755 --- a/ci/release/update-version.sh +++ b/ci/release/update-version.sh @@ -33,36 +33,13 @@ function sed_runner() { sed -i.bak ''"$1"'' $2 && rm -f ${2}.bak } -# cpp update -sed_runner "/project(/,/)/s/VERSION.*/VERSION ${NEXT_FULL_TAG}/" cpp/CMakeLists.txt - -# Python CMakeLists updates -sed_runner 's/set(kvikio_version.*)/set(kvikio_version '${NEXT_FULL_TAG}')/g' python/CMakeLists.txt - -# Python __init__.py updates -sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/kvikio/__init__.py - -# Python pyproject.toml updates -sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/pyproject.toml - -# rapids-cmake version -sed_runner 's/'"branch-.*\/RAPIDS.cmake"'/'"branch-${NEXT_SHORT_TAG}\/RAPIDS.cmake"'/g' cpp/cmake/fetch_rapids.cmake - -# cmake-format rapids-cmake definitions -sed_runner 's/'"branch-.*\/cmake-format-rapids-cmake.json"'/'"branch-${NEXT_SHORT_TAG}\/cmake-format-rapids-cmake.json"'/g' ci/checks/style.sh - -# doxyfile update -sed_runner 's/PROJECT_NUMBER = .*/PROJECT_NUMBER = '${NEXT_FULL_TAG}'/g' cpp/doxygen/Doxyfile - -# sphinx docs update -sed_runner 's/version = .*/version = '"'${NEXT_SHORT_TAG}'"'/g' docs/source/conf.py -sed_runner 's/release = .*/release = '"'${NEXT_FULL_TAG}'"'/g' docs/source/conf.py +# Centralized version file update +echo "${NEXT_FULL_TAG}" > VERSION # CI files for FILE in .github/workflows/*.yaml; do sed_runner "/shared-workflows/ s/@.*/@branch-${NEXT_SHORT_TAG}/g" "${FILE}" done -sed_runner "s/RAPIDS_VERSION_NUMBER=\".*/RAPIDS_VERSION_NUMBER=\"${NEXT_SHORT_TAG}\"/g" ci/build_docs.sh # .devcontainer files find .devcontainer/ -type f -name devcontainer.json -print0 | while IFS= read -r -d '' filename; do diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 94b06b8021..5bbfb586b6 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -14,7 +14,7 @@ cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR) -include(cmake/fetch_rapids.cmake) +include(cmake/rapids_config.cmake) include(rapids-cmake) include(rapids-cpm) include(rapids-export) @@ -22,7 +22,7 @@ include(rapids-find) project( KvikIO - VERSION 24.04.00 + VERSION "${RAPIDS_VERSION}" LANGUAGES CXX ) diff --git a/cpp/cmake/fetch_rapids.cmake b/cpp/cmake/fetch_rapids.cmake deleted file mode 100644 index 1924369b9c..0000000000 --- a/cpp/cmake/fetch_rapids.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# ============================================================================= -# Copyright (c) 2018-2023, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except -# in compliance with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software distributed under the License -# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express -# or implied. See the License for the specific language governing permissions and limitations under -# the License. -# ============================================================================= -if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/KVIKIO_RAPIDS.cmake) - file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-24.04/RAPIDS.cmake - ${CMAKE_CURRENT_BINARY_DIR}/KVIKIO_RAPIDS.cmake - ) -endif() -include(${CMAKE_CURRENT_BINARY_DIR}/KVIKIO_RAPIDS.cmake) diff --git a/cpp/cmake/rapids_config.cmake b/cpp/cmake/rapids_config.cmake new file mode 100644 index 0000000000..c3a6a0ef13 --- /dev/null +++ b/cpp/cmake/rapids_config.cmake @@ -0,0 +1,36 @@ +# ============================================================================= +# Copyright (c) 2018-2024, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= +file(READ "${CMAKE_CURRENT_LIST_DIR}/../../VERSION" _rapids_version) +if(_rapids_version MATCHES [[^([0-9][0-9])\.([0-9][0-9])\.([0-9][0-9])]]) + set(RAPIDS_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(RAPIDS_VERSION_MINOR "${CMAKE_MATCH_2}") + set(RAPIDS_VERSION_PATCH "${CMAKE_MATCH_3}") + set(RAPIDS_VERSION_MAJOR_MINOR "${RAPIDS_VERSION_MAJOR}.${RAPIDS_VERSION_MINOR}") + set(RAPIDS_VERSION "${RAPIDS_VERSION_MAJOR}.${RAPIDS_VERSION_MINOR}.${RAPIDS_VERSION_PATCH}") +else() + string(REPLACE "\n" "\n " _rapids_version_formatted " ${_rapids_version}") + message( + FATAL_ERROR + "Could not determine RAPIDS version. Contents of VERSION file:\n${_rapids_version_formatted}" + ) +endif() + +if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/KVIKIO_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake") + file( + DOWNLOAD + "https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_VERSION_MAJOR_MINOR}/RAPIDS.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/KVIKIO_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake" + ) +endif() +include("${CMAKE_CURRENT_BINARY_DIR}/KVIKIO_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake") diff --git a/cpp/doxygen/Doxyfile b/cpp/doxygen/Doxyfile index 0775846e26..67dc264246 100644 --- a/cpp/doxygen/Doxyfile +++ b/cpp/doxygen/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "libkvikio" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 24.04.00 +PROJECT_NUMBER = $(RAPIDS_VERSION) # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/docs/source/conf.py b/docs/source/conf.py index 1d4fbda577..089a8033f6 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. +# Copyright (c) 2023-2024, NVIDIA CORPORATION. All rights reserved. # See file LICENSE for terms. # # Configuration file for the Sphinx documentation builder. @@ -17,16 +17,21 @@ # import sys # sys.path.insert(0, os.path.abspath('.')) +from packaging.version import Version + +import kvikio + # -- Project information ----------------------------------------------------- project = "kvikio" copyright = "2023, NVIDIA" author = "NVIDIA" +KVIKIO_VERSION = Version(kvikio.__version__) # The short X.Y version. -version = '24.04' +version = f"{KVIKIO_VERSION.major:02}.{KVIKIO_VERSION.minor:02}" # The full version, including alpha/beta/rc tags -release = '24.04.00' +release = f"{KVIKIO_VERSION.major:02}.{KVIKIO_VERSION.minor:02}.{KVIKIO_VERSION.micro:02}" # -- General configuration --------------------------------------------------- diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index be6f8c7319..039daf7ce9 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at @@ -14,9 +14,7 @@ cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR) -set(kvikio_version 24.04.00) - -include(../cpp/cmake/fetch_rapids.cmake) +include(../cpp/cmake/rapids_config.cmake) include(rapids-cpm) rapids_cpm_init() include(rapids-cuda) @@ -24,7 +22,7 @@ rapids_cuda_init_architectures(kvikio-python) project( kvikio-python - VERSION ${kvikio_version} + VERSION "${RAPIDS_VERSION}" LANGUAGES CXX CUDA ) @@ -36,7 +34,7 @@ option(FIND_KVIKIO_CPP include(../cpp/cmake/Modules/FindcuFile.cmake) if(FIND_KVIKIO_CPP) - find_package(KvikIO ${kvikio_version}) + find_package(KvikIO "${RAPIDS_VERSION}") else() set(KvikIO_FOUND OFF) endif() diff --git a/python/kvikio/VERSION b/python/kvikio/VERSION new file mode 120000 index 0000000000..558194c5a5 --- /dev/null +++ b/python/kvikio/VERSION @@ -0,0 +1 @@ +../../VERSION \ No newline at end of file diff --git a/python/kvikio/__init__.py b/python/kvikio/__init__.py index b16415b235..5186df50f8 100644 --- a/python/kvikio/__init__.py +++ b/python/kvikio/__init__.py @@ -1,11 +1,10 @@ -# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved. +# Copyright (c) 2021-2024, NVIDIA CORPORATION. All rights reserved. # See file LICENSE for terms. from ._lib import libkvikio # type: ignore +from ._version import __version__ # noqa: F401 from .cufile import CuFile # noqa: F401 -__version__ = "24.04.00" - def memory_register(buf) -> None: return libkvikio.memory_register(buf) diff --git a/python/kvikio/_version.py b/python/kvikio/_version.py new file mode 100644 index 0000000000..82fc478d5c --- /dev/null +++ b/python/kvikio/_version.py @@ -0,0 +1,20 @@ +# Copyright (c) 2023-2024, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import importlib.resources + +__version__ = ( + importlib.resources.files("kvikio").joinpath("VERSION").read_text().strip() +) +__git_commit__ = "" diff --git a/python/pyproject.toml b/python/pyproject.toml index 5a4644c1d3..ee49b103ba 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -12,7 +12,7 @@ requires = [ [project] name = "kvikio" -version = "24.04.00" +dynamic = ["version"] description = "KvikIO - GPUDirect Storage" readme = { file = "README.md", content-type = "text/markdown" } authors = [ @@ -117,3 +117,8 @@ ninja.make-fallback = true sdist.exclude = ["*tests*"] sdist.reproducible = true wheel.packages = ["kvikio"] + +[tool.scikit-build.metadata.version] +provider = "scikit_build_core.metadata.regex" +input = "kvikio/VERSION" +regex = "(?P.*)"