Skip to content

Commit 4ed682c

Browse files
minsiifacebook-github-bot
authored andcommitted
build rccl module only when USE_RCCL is ON (#325)
Summary: Pull Request resolved: #325 Current code always builds nccl module as long as USE_ROCM is ON. However, we should build it only when USE_RCCL is ON. This patch fixes it by adding the hipified nccl files in nccl/CMakeLists.txt which will be included only when USE_RCCL is ON. Reviewed By: jiayisuse Differential Revision: D35636872 fbshipit-source-id: b3a5a36912b674bc43a474adafddb40d5af0ab6c
1 parent 3e45c75 commit 4ed682c

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

gloo/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,10 @@ if(USE_ROCM)
6666
file(GLOB GLOO_HIP_SRCS
6767
"${HIPIFY_OUTPUT_DIR}/hip*.cc"
6868
"${HIPIFY_OUTPUT_DIR}/hip*.hip"
69-
"${HIPIFY_OUTPUT_DIR}/nccl/nccl.hip"
7069
)
7170

7271
file(GLOB GLOO_HIP_HDRS
7372
"${HIPIFY_OUTPUT_DIR}/hip*.h"
74-
"${HIPIFY_OUTPUT_DIR}/nccl/nccl.h"
7573
)
7674
endif()
7775

gloo/nccl/CMakeLists.txt

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
1-
set(GLOO_NCCL_SRCS
2-
"${CMAKE_CURRENT_SOURCE_DIR}/nccl.cu"
3-
)
4-
5-
set(GLOO_NCCL_HDRS
6-
"${CMAKE_CURRENT_SOURCE_DIR}/nccl.h"
7-
)
8-
9-
list(APPEND GLOO_CUDA_SRCS ${GLOO_NCCL_SRCS})
10-
list(APPEND GLOO_CUDA_HDRS ${GLOO_NCCL_HDRS})
11-
set(GLOO_CUDA_SRCS ${GLOO_CUDA_SRCS} PARENT_SCOPE)
12-
set(GLOO_CUDA_HDRS ${GLOO_CUDA_HDRS} PARENT_SCOPE)
1+
if(USE_CUDA)
2+
set(GLOO_NCCL_SRCS
3+
"${CMAKE_CURRENT_SOURCE_DIR}/nccl.cu"
4+
)
5+
6+
set(GLOO_NCCL_HDRS
7+
"${CMAKE_CURRENT_SOURCE_DIR}/nccl.h"
8+
)
9+
10+
list(APPEND GLOO_CUDA_SRCS ${GLOO_NCCL_SRCS})
11+
list(APPEND GLOO_CUDA_HDRS ${GLOO_NCCL_HDRS})
12+
set(GLOO_CUDA_SRCS ${GLOO_CUDA_SRCS} PARENT_SCOPE)
13+
set(GLOO_CUDA_HDRS ${GLOO_CUDA_HDRS} PARENT_SCOPE)
14+
endif()
15+
16+
if(USE_ROCM)
17+
set(GLOO_NCCL_SRCS
18+
"${CMAKE_CURRENT_SOURCE_DIR}/nccl.hip"
19+
)
20+
21+
set(GLOO_NCCL_HDRS
22+
"${CMAKE_CURRENT_SOURCE_DIR}/nccl.h"
23+
)
24+
25+
list(APPEND GLOO_HIP_SRCS ${GLOO_NCCL_SRCS})
26+
list(APPEND GLOO_HIP_HDRS ${GLOO_NCCL_HDRS})
27+
set(GLOO_HIP_SRCS ${GLOO_HIP_SRCS} PARENT_SCOPE)
28+
set(GLOO_HIP_HDRS ${GLOO_HIP_HDRS} PARENT_SCOPE)
29+
endif()

0 commit comments

Comments
 (0)