From 48af5d08fdbec89ef35b09bb55e230e18a099c4b Mon Sep 17 00:00:00 2001 From: AJ Schmidt Date: Wed, 15 Dec 2021 10:43:12 -0500 Subject: [PATCH 1/2] Update `CUDA_STANDARD` and `CXX_STANDARD` to `17` This PR updates the `CUDA_STANDARD` and `CXX_STANDARD` properties in CMake to be `17`. This resolves some build issues that are currently occurring in RAPIDS Docker builds. --- cmake/Utils.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake index d675145f9223..b4400d50d3d0 100644 --- a/cmake/Utils.cmake +++ b/cmake/Utils.cmake @@ -170,7 +170,7 @@ function(xgboost_set_cuda_flags target) endif (MSVC) set_target_properties(${target} PROPERTIES - CUDA_STANDARD 14 + CUDA_STANDARD 17 CUDA_STANDARD_REQUIRED ON CUDA_SEPARABLE_COMPILATION OFF) endfunction(xgboost_set_cuda_flags) @@ -190,7 +190,7 @@ endmacro(xgboost_link_nccl) # compile options macro(xgboost_target_properties target) set_target_properties(${target} PROPERTIES - CXX_STANDARD 14 + CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON POSITION_INDEPENDENT_CODE ON) if (HIDE_CXX_SYMBOLS) From 1bc28ea27caebf8b614b3f5fac3eda7ed95ed06a Mon Sep 17 00:00:00 2001 From: AJ Schmidt Date: Wed, 15 Dec 2021 11:03:24 -0500 Subject: [PATCH 2/2] fix linting errors --- python-package/xgboost/core.py | 4 ++-- python-package/xgboost/data.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python-package/xgboost/core.py b/python-package/xgboost/core.py index 45a3d68d6586..cdca6e38e8cf 100644 --- a/python-package/xgboost/core.py +++ b/python-package/xgboost/core.py @@ -229,7 +229,7 @@ def _numpy2ctypes_type(dtype): } if np.intc is not np.int32: # Windows _NUMPY_TO_CTYPES_MAPPING[np.intc] = _NUMPY_TO_CTYPES_MAPPING[np.int32] - if dtype not in _NUMPY_TO_CTYPES_MAPPING.keys(): + if dtype not in _NUMPY_TO_CTYPES_MAPPING: raise TypeError( f"Supported types: {_NUMPY_TO_CTYPES_MAPPING.keys()}, got: {dtype}" ) @@ -266,7 +266,7 @@ def ctypes2cupy(cptr, length, dtype): from cupy.cuda.memory import UnownedMemory CUPY_TO_CTYPES_MAPPING = {cupy.float32: ctypes.c_float, cupy.uint32: ctypes.c_uint} - if dtype not in CUPY_TO_CTYPES_MAPPING.keys(): + if dtype not in CUPY_TO_CTYPES_MAPPING: raise RuntimeError(f"Supported types: {CUPY_TO_CTYPES_MAPPING.keys()}") addr = ctypes.cast(cptr, ctypes.c_void_p).value # pylint: disable=c-extension-no-member,no-member diff --git a/python-package/xgboost/data.py b/python-package/xgboost/data.py index e4b5a690359a..d2e58db0e7e0 100644 --- a/python-package/xgboost/data.py +++ b/python-package/xgboost/data.py @@ -747,7 +747,7 @@ def dispatch_data_backend( def _to_data_type(dtype: str, name: str): dtype_map = {'float32': 1, 'float64': 2, 'uint32': 3, 'uint64': 4} - if dtype not in dtype_map.keys(): + if dtype not in dtype_map: raise TypeError( f'Expecting float32, float64, uint32, uint64, got {dtype} ' + f'for {name}.')