Skip to content
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

Remove hard-coding of RAPIDS version where possible #1496

Merged
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR)

include(fetch_rapids.cmake)
include(rapids_config.cmake)

include(rapids-cmake)
include(rapids-cpm)
Expand All @@ -23,7 +23,7 @@ include(rapids-find)

project(
RMM
VERSION 24.04.00
VERSION "${RAPIDS_VERSION}"
LANGUAGES CXX)

# Write the version header
Expand Down Expand Up @@ -173,7 +173,8 @@ rapids_export(
add_custom_command(
OUTPUT RMM_DOXYGEN
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doxygen
COMMAND doxygen Doxyfile
COMMAND ${CMAKE_COMMAND} -E env "RAPIDS_VERSION=${RAPIDS_VERSION}"
"RAPIDS_VERSION_MAJOR_MINOR=${RAPIDS_VERSION_MAJOR_MINOR}" doxygen Doxyfile
VERBATIM
COMMENT "Custom command for RMM doxygen docs")

Expand Down
4 changes: 3 additions & 1 deletion ci/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ rapids-mamba-retry install \
--channel "${PYTHON_CHANNEL}" \
rmm librmm

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"
Expand Down
3 changes: 2 additions & 1 deletion ci/check_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ 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-24.04/cmake-format-rapids-cmake.json
RAPIDS_VERSION_NUMBER="$(rapids-version-major-minor)"
FORMAT_FILE_URL="https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_VERSION_NUMBER}/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}
Expand Down
19 changes: 0 additions & 19 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,9 @@ function sed_runner() {
sed -i.bak ''"$1"'' $2 && rm -f ${2}.bak
}

# cpp update
sed_runner 's/'" VERSION .*"'/'" VERSION ${NEXT_FULL_TAG}"'/g' CMakeLists.txt

# Python update
sed_runner 's/'"rmm_version .*)"'/'"rmm_version ${NEXT_FULL_TAG})"'/g' python/CMakeLists.txt

# Centralized version file update
echo "${NEXT_FULL_TAG}" > VERSION

# rapids-cmake version
sed_runner 's/'"branch-.*\/RAPIDS.cmake"'/'"branch-${NEXT_SHORT_TAG}\/RAPIDS.cmake"'/g' 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/check_style.sh

# doxyfile update
sed_runner 's/'"PROJECT_NUMBER = .*"'/'"PROJECT_NUMBER = ${NEXT_SHORT_TAG}"'/g' doxygen/Doxyfile

# sphinx docs update
sed_runner 's/'"version =.*"'/'"version = \"${NEXT_SHORT_TAG}\""'/g' python/docs/conf.py
sed_runner 's/'"release =.*"'/'"release = \"${NEXT_FULL_TAG}\""'/g' python/docs/conf.py

# CI files
for FILE in .github/workflows/*.yaml; do
sed_runner "/shared-workflows/ s/@.*/@branch-${NEXT_SHORT_TAG}/g" "${FILE}"
Expand Down
2 changes: 1 addition & 1 deletion doxygen/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = RMM
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 24.04
PROJECT_NUMBER = $(RAPIDS_VERSION_MAJOR_MINOR)

# 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
Expand Down
18 changes: 0 additions & 18 deletions fetch_rapids.cmake

This file was deleted.

8 changes: 3 additions & 5 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@

cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR)

set(rmm_version 24.04.00)

include(../fetch_rapids.cmake)
include(../rapids_config.cmake)

project(
rmm-python
VERSION ${rmm_version}
VERSION "${RAPIDS_VERSION}"
LANGUAGES CXX)

option(FIND_RMM_CPP "Search for existing RMM C++ installations before defaulting to local files"
OFF)

# If the user requested it we attempt to find RMM.
if(FIND_RMM_CPP)
find_package(rmm ${rmm_version})
find_package(rmm "${RAPIDS_VERSION}")
else()
set(rmm_FOUND OFF)
endif()
Expand Down
11 changes: 9 additions & 2 deletions python/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
import os
import re

from packaging.version import Version

import rmm

# -- Project information -----------------------------------------------------

project = "rmm"
Expand All @@ -23,10 +27,13 @@
# |version| and |release|, also used in various other places throughout the
# built documents.
#
RMM_VERSION = Version(rmm.__version__)
# The short X.Y version.
version = "24.04"
version = f"{RMM_VERSION.major:02}.{RMM_VERSION.minor:02}"
# The full version, including alpha/beta/rc tags.
release = "24.04.00"
release = (
f"{RMM_VERSION.major:02}.{RMM_VERSION.minor:02}.{RMM_VERSION.micro:02}"
)


# -- General configuration ---------------------------------------------------
Expand Down
34 changes: 34 additions & 0 deletions rapids_config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# =============================================================================
# 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}/RMM_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}/RMM_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake")
endif()
include("${CMAKE_CURRENT_BINARY_DIR}/RMM_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake")
3 changes: 3 additions & 0 deletions scripts/doxygen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ if [ ! $(version "$DOXYGEN_VERSION") -eq $(version "1.9.1") ] ; then
exit 0
fi

export RAPIDS_VERSION="$(sed -E -e 's/^([0-9]{2})\.([0-9]{2})\.([0-9]{2}).*$/\1.\2.\3/')"
export RAPIDS_VERSION_MAJOR_MINOR="$(sed -E -e 's/^([0-9]{2})\.([0-9]{2})\.([0-9]{2}).*$/\1.\2/')"
bdice marked this conversation as resolved.
Show resolved Hide resolved

# Run doxygen, ignore missing tag files error
TAG_ERROR1="error: Tag file '.*.tag' does not exist or is not a file. Skipping it..."
TAG_ERROR2="error: cannot open tag file .*.tag for writing"
Expand Down
Loading