Skip to content

Commit

Permalink
Remove leading zeros in version_config.hpp (#793)
Browse files Browse the repository at this point in the history
Since we switched to CalVer, the version strings contain leading zeros, e.g. `21.08.00`. This leads to the generated header `version_config.hpp` to contain
```cpp
#define RMM_VERSION_MAJOR 21
#define RMM_VERSION_MINOR 08
#define RMM_VERSION_PATCH 00
```
in which `08` is an invalid octal literal. See the resulting CI failure at https://gpuci.gpuopenanalytics.com/job/rapidsai/job/conda/job/xgboost/job/xgboost-conda-build/229/CUDA=11.0,PYTHON=3.7/console. The generated header is used by XGBoost.

Fix: Remove the leading zeros in the C++ constants so that we'd get
```cpp
```cpp
#define RMM_VERSION_MAJOR 21
#define RMM_VERSION_MINOR 8
#define RMM_VERSION_PATCH 0
```

Authors:
  - Philip Hyunsu Cho (https://github.com/hcho3)

Approvers:
  - Jake Hemstad (https://github.com/jrhemstad)

URL: #793
  • Loading branch information
hcho3 authored Jun 7, 2021
1 parent 2fb42a3 commit e2832e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cmake/Modules/Version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# Generate version_config.hpp from the version found in CMakeLists.txt
function(write_version)
message(STATUS "RMM VERSION: ${RMM_VERSION}")
math(EXPR RMM_VERSION_MAJOR_CPP_HEADER "${RMM_VERSION_MAJOR} + 0" OUTPUT_FORMAT DECIMAL)
math(EXPR RMM_VERSION_MINOR_CPP_HEADER "${RMM_VERSION_MINOR} + 0" OUTPUT_FORMAT DECIMAL)
math(EXPR RMM_VERSION_PATCH_CPP_HEADER "${RMM_VERSION_PATCH} + 0" OUTPUT_FORMAT DECIMAL)
configure_file(${RMM_SOURCE_DIR}/cmake/version_config.hpp.in
${RMM_BINARY_DIR}/include/rmm/version_config.hpp @ONLY)
endfunction(write_version)
6 changes: 3 additions & 3 deletions cmake/version_config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
*/
#pragma once

#define RMM_VERSION_MAJOR @RMM_VERSION_MAJOR@
#define RMM_VERSION_MINOR @RMM_VERSION_MINOR@
#define RMM_VERSION_PATCH @RMM_VERSION_PATCH@
#define RMM_VERSION_MAJOR @RMM_VERSION_MAJOR_CPP_HEADER@
#define RMM_VERSION_MINOR @RMM_VERSION_MINOR_CPP_HEADER@
#define RMM_VERSION_PATCH @RMM_VERSION_PATCH_CPP_HEADER@

0 comments on commit e2832e3

Please sign in to comment.