Skip to content

Commit 140ea48

Browse files
authored
Add submodule (#9385)
* add submodule * add submodule
1 parent d526be2 commit 140ea48

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,4 @@ dataset/
131131
output/
132132

133133
# gen codes
134-
autogen/
134+
autogen/

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "csrc/third_party/cutlass"]
2+
path = csrc/third_party/cutlass
3+
url = https://github.com/NVIDIA/cutlass.git
4+
[submodule "csrc/third_party/nlohmann_json"]
5+
path = csrc/third_party/nlohmann_json
6+
url = https://github.com/nlohmann/json.git

csrc/setup_cuda.py

+8-12
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@
1717

1818
import paddle
1919
from paddle.utils.cpp_extension import CUDAExtension, setup
20+
import subprocess
2021

22+
def update_git_submodule():
23+
try:
24+
subprocess.run(["git", "submodule", "update", "--init"], check=True)
25+
except subprocess.CalledProcessError as e:
26+
print(f"Error occurred while updating git submodule: {str(e)}")
27+
raise
2128

2229
def clone_git_repo(version, repo_url, destination_path):
2330
try:
@@ -121,18 +128,7 @@ def get_gencode_flags():
121128

122129
cutlass_dir = "third_party/cutlass"
123130
nvcc_compile_args = gencode_flags
124-
125-
if not os.path.exists(cutlass_dir) or not os.listdir(cutlass_dir):
126-
if not os.path.exists(cutlass_dir):
127-
os.makedirs(cutlass_dir)
128-
clone_git_repo("v3.5.0", "https://github.com/NVIDIA/cutlass.git", cutlass_dir)
129-
130-
json_dir = "third_party/nlohmann_json"
131-
if not os.path.exists(json_dir) or not os.listdir(json_dir):
132-
if not os.path.exists(json_dir):
133-
os.makedirs(json_dir)
134-
clone_git_repo("v3.11.3", "https://github.com/nlohmann/json.git", json_dir)
135-
131+
update_git_submodule()
136132
nvcc_compile_args += [
137133
"-O3",
138134
"-U__CUDA_NO_HALF_OPERATORS__",

csrc/third_party/cutlass

Submodule cutlass added at 7d49e6c

csrc/third_party/nlohmann_json

Submodule nlohmann_json added at 9cca280

0 commit comments

Comments
 (0)