Skip to content

Commit

Permalink
download cub using CMake FetchContent (deepmodeling#2870)
Browse files Browse the repository at this point in the history
Many people suggest not using `git submodule`. CMake FetchContent might
be a better option (which we have used for googletest and lammps).

(only take effect for CUDA 10; CUDA 11 contains cub)

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
  • Loading branch information
njzjz committed Sep 27, 2023
1 parent 73a5362 commit 218ff45
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
dp_variant: clang
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: '3.11'
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
submodules: true
# https://github.com/pypa/setuptools_scm/issues/480
fetch-depth: 0
- uses: docker/setup-qemu-action@v3
Expand All @@ -77,8 +76,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v4
name: Install Python
with:
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

3 changes: 1 addition & 2 deletions doc/install/install-from-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ Please follow our [GitHub](https://github.com/deepmodeling/deepmd-kit) webpage t
Or get the DeePMD-kit source code by `git clone`
```bash
cd /some/workspace
git clone --recursive https://github.com/deepmodeling/deepmd-kit.git deepmd-kit
git clone https://github.com/deepmodeling/deepmd-kit.git deepmd-kit
```
The `--recursive` option clones all [submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) needed by DeePMD-kit.

For convenience, you may want to record the location of the source to a variable, saying `deepmd_source_dir` by
```bash
Expand Down
12 changes: 11 additions & 1 deletion source/lib/src/gpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@ if(USE_CUDA_TOOLKIT)
# cub has been included in CUDA Toolkit 11, we do not need to include it any
# more see https://github.com/NVIDIA/cub
if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_LESS "11")
include_directories(cub)
include(FetchContent)
FetchContent_Declare(
cub_download
GIT_REPOSITORY https://github.com/NVIDIA/cub
GIT_TAG b229817e3963fc942c7cc2c61715a6b2b2c49bed)
FetchContent_GetProperties(cub_download)
if(NOT cub_download_POPULATED)
FetchContent_Populate(cub_download)
set(CUB_SOURCE_ROOT ${cub_download_SOURCE_DIR})
endif()
include_directories(${CUB_SOURCE_ROOT})
endif()
if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_LESS "9")
message(FATAL_ERROR "CUDA version must be >= 9.0")
Expand Down
1 change: 0 additions & 1 deletion source/lib/src/gpu/cub
Submodule cub deleted from b22981

0 comments on commit 218ff45

Please sign in to comment.