Skip to content

Commit 218ff45

Browse files
authored
download cub using CMake FetchContent (#2870)
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 <[email protected]>
1 parent 73a5362 commit 218ff45

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

.github/workflows/build_cc.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ jobs:
2121
dp_variant: clang
2222
steps:
2323
- uses: actions/checkout@v4
24-
with:
25-
submodules: true
2624
- uses: actions/setup-python@v4
2725
with:
2826
python-version: '3.11'

.github/workflows/build_wheel.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ jobs:
5656
steps:
5757
- uses: actions/checkout@v4
5858
with:
59-
submodules: true
6059
# https://github.com/pypa/setuptools_scm/issues/480
6160
fetch-depth: 0
6261
- uses: docker/setup-qemu-action@v3
@@ -77,8 +76,6 @@ jobs:
7776
runs-on: ubuntu-latest
7877
steps:
7978
- uses: actions/checkout@v4
80-
with:
81-
submodules: true
8279
- uses: actions/setup-python@v4
8380
name: Install Python
8481
with:

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

doc/install/install-from-source.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ Please follow our [GitHub](https://github.com/deepmodeling/deepmd-kit) webpage t
55
Or get the DeePMD-kit source code by `git clone`
66
```bash
77
cd /some/workspace
8-
git clone --recursive https://github.com/deepmodeling/deepmd-kit.git deepmd-kit
8+
git clone https://github.com/deepmodeling/deepmd-kit.git deepmd-kit
99
```
10-
The `--recursive` option clones all [submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) needed by DeePMD-kit.
1110

1211
For convenience, you may want to record the location of the source to a variable, saying `deepmd_source_dir` by
1312
```bash

source/lib/src/gpu/CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,17 @@ if(USE_CUDA_TOOLKIT)
2626
# cub has been included in CUDA Toolkit 11, we do not need to include it any
2727
# more see https://github.com/NVIDIA/cub
2828
if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_LESS "11")
29-
include_directories(cub)
29+
include(FetchContent)
30+
FetchContent_Declare(
31+
cub_download
32+
GIT_REPOSITORY https://github.com/NVIDIA/cub
33+
GIT_TAG b229817e3963fc942c7cc2c61715a6b2b2c49bed)
34+
FetchContent_GetProperties(cub_download)
35+
if(NOT cub_download_POPULATED)
36+
FetchContent_Populate(cub_download)
37+
set(CUB_SOURCE_ROOT ${cub_download_SOURCE_DIR})
38+
endif()
39+
include_directories(${CUB_SOURCE_ROOT})
3040
endif()
3141
if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_LESS "9")
3242
message(FATAL_ERROR "CUDA version must be >= 9.0")

source/lib/src/gpu/cub

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)