From cc6e1a17601c5dc34bc289a11ea5a147c8694623 Mon Sep 17 00:00:00 2001 From: rhdong Date: Sun, 8 Oct 2023 12:08:12 +0800 Subject: [PATCH] [CI] optimze bazel compile guidance --- .bazeliskrc | 2 +- .bazelrc | 4 +-- README.md | 27 ++++++++++++++----- build_deps/gpus/find_cuda_config.py | 40 ++++++++++++++++++----------- 4 files changed, 49 insertions(+), 24 deletions(-) diff --git a/.bazeliskrc b/.bazeliskrc index 8676a7e5c..821303c5c 100644 --- a/.bazeliskrc +++ b/.bazeliskrc @@ -1 +1 @@ -USE_BAZEL_VERSION=5.3.1 +USE_BAZEL_VERSION=5.0.0 diff --git a/.bazelrc b/.bazelrc index 1035dba2f..f70da5a8c 100644 --- a/.bazelrc +++ b/.bazelrc @@ -15,9 +15,9 @@ build --host_cxxopt=-std=c++17 build:cuda --crosstool_top=@local_config_cuda//crosstool:toolchain # CUDA options -build:cuda --action_env GCC_HOST_COMPILER_PATH="/opt/rh/devtoolset-9/root/usr/bin/gcc" +build:cuda --action_env GCC_HOST_COMPILER_PATH="/usr/bin/gcc" build:cuda --action_env CUDA_TOOLKIT_PATH="/usr/local/cuda" build:cuda --action_env CUDA_VERSION="11" build:cuda --action_env CUDNN_VERSION="8" -build:cuda --action_env CUDNN_INSTALL_PATH="/usr/local/cuda" +build:cuda --action_env CUDNN_INSTALL_PATH="/usr/" build:cuda --action_env CUDA_COMPUTE_CAPABILITIES="7.5" diff --git a/README.md b/README.md index 9840c2b50..7cc225911 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,13 @@ and also open for public contributions, bug fixes, and documentation. [[Contribu Basically, HierarchicalKV is a headers only library, the commands below only create binaries for benchmark and unit testing. +Your environment must meet the following requirements: + +- CUDA version >= 11.2 +- NVIDIA GPU with compute capability 8.0, 8.6, 8.7 or 9.0 +- GCC supports `C++17' standard or later. +- Bazel version >= 3.7.2 (Bazel compile only) + ### with cmake ```shell git clone --recursive https://github.com/NVIDIA-Merlin/HierarchicalKV.git @@ -176,9 +183,21 @@ For Unit Test: ``` ### with bazel + +- DON'T use the option of `--recursive` for `git clone`. +- Please modify the environment variables in the `.bazelrc` file in advance if using the customized docker images. +- The docker images maintained on `nvcr.io/nvidia/tensorflow` are highly recommended. + +Pull the docker image: ```shell -git clone --recursive https://github.com/NVIDIA-Merlin/HierarchicalKV.git -cd HierarchicalKV && bazel build --config=cuda //... +docker pull nvcr.io/nvidia/tensorflow:22.09-tf2-py3 +docker run --gpus all -it --rm nvcr.io/nvidia/tensorflow:22.09-tf2-py3 +``` + +Compile in docker container: +```shell +git clone https://github.com/NVIDIA-Merlin/HierarchicalKV.git +cd HierarchicalKV && bash bazel_build.sh ``` For Benchmark: @@ -186,10 +205,6 @@ For Benchmark: ./benchmark_util ``` -Your environment must meet the following requirements: - -- CUDA version >= 11.2 -- NVIDIA GPU with compute capability 8.0, 8.6, 8.7 or 9.0 ## Benchmark & Performance(W.I.P) diff --git a/build_deps/gpus/find_cuda_config.py b/build_deps/gpus/find_cuda_config.py index e384feaaf..3e8d4266b 100644 --- a/build_deps/gpus/find_cuda_config.py +++ b/build_deps/gpus/find_cuda_config.py @@ -306,9 +306,11 @@ def _find_cublas_config(base_paths, required_version, cuda_version): if _at_least_version(cuda_version, "10.1"): def get_header_version(path): - version = (_get_header_version(path, name) - for name in ("CUBLAS_VER_MAJOR", "CUBLAS_VER_MINOR", - "CUBLAS_VER_PATCH")) + version = (v for v in (_get_header_version(path, name) + for name in ("CUBLAS_VER_MAJOR", + "CUBLAS_VER_MINOR", + "CUBLAS_VER_PATCH", + "CUBLAS_VER_BUILD")) if v != "") return ".".join(version) header_path, header_version = _find_header(base_paths, "cublas_api.h", @@ -338,9 +340,11 @@ def _find_cusolver_config(base_paths, required_version, cuda_version): if _at_least_version(cuda_version, "11.0"): def get_header_version(path): - version = (_get_header_version(path, name) - for name in ("CUSOLVER_VER_MAJOR", "CUSOLVER_VER_MINOR", - "CUSOLVER_VER_PATCH")) + version = (v for v in (_get_header_version(path, name) + for name in ("CUSOLVER_VER_MAJOR", + "CUSOLVER_VER_MINOR", + "CUSOLVER_VER_PATCH", + "CUSOLVER_VER_BUILD")) if v != "") return ".".join(version) header_path, header_version = _find_header(base_paths, @@ -369,9 +373,11 @@ def _find_curand_config(base_paths, required_version, cuda_version): if _at_least_version(cuda_version, "11.0"): def get_header_version(path): - version = (_get_header_version(path, name) - for name in ("CURAND_VER_MAJOR", "CURAND_VER_MINOR", - "CURAND_VER_PATCH")) + version = (v for v in (_get_header_version(path, name) + for name in ("CURAND_VER_MAJOR", + "CURAND_VER_MINOR", + "CURAND_VER_PATCH", + "CURAND_VER_BUILD")) if v != "") return ".".join(version) header_path, header_version = _find_header(base_paths, "curand.h", @@ -398,9 +404,11 @@ def _find_cufft_config(base_paths, required_version, cuda_version): if _at_least_version(cuda_version, "11.0"): def get_header_version(path): - version = (_get_header_version(path, name) - for name in ("CUFFT_VER_MAJOR", "CUFFT_VER_MINOR", - "CUFFT_VER_PATCH")) + version = (v for v in (_get_header_version(path, name) + for name in ("CUFFT_VER_MAJOR", + "CUFFT_VER_MINOR", + "CUFFT_VER_PATCH", + "CUFFT_VER_BUILD")) if v != "") return ".".join(version) header_path, header_version = _find_header(base_paths, "cufft.h", @@ -451,9 +459,11 @@ def _find_cusparse_config(base_paths, required_version, cuda_version): if _at_least_version(cuda_version, "11.0"): def get_header_version(path): - version = (_get_header_version(path, name) - for name in ("CUSPARSE_VER_MAJOR", "CUSPARSE_VER_MINOR", - "CUSPARSE_VER_PATCH")) + version = (v for v in (_get_header_version(path, name) + for name in ("CUSPARSE_VER_MAJOR", + "CUSPARSE_VER_MINOR", + "CUSPARSE_VER_PATCH", + "CUSPARSE_VER_BUILD")) if v != "") return ".".join(version) header_path, header_version = _find_header(base_paths, "cusparse.h",