Skip to content

Commit 2625178

Browse files
authored
No NCCL on macOS (#11652)
* Make paddle no longer depend on boost * Update enforce.h
1 parent 60647c9 commit 2625178

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

paddle/fluid/platform/dynload/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
cc_library(dynamic_loader SRCS dynamic_loader.cc DEPS glog gflags enforce)
22

3-
list(APPEND CUDA_SRCS cublas.cc cudnn.cc curand.cc nccl.cc)
3+
list(APPEND CUDA_SRCS cublas.cc cudnn.cc curand.cc)
4+
5+
# There is no macOS version of NCCL.
6+
if (NOT APPLE)
7+
list(APPEND CUDA_SRCS nccl.cc)
8+
endif()
9+
410
if (TENSORRT_FOUND)
511
list(APPEND CUDA_SRCS tensorrt.cc)
612
endif()
713

8-
914
configure_file(cupti_lib_path.h.in ${CMAKE_CURRENT_BINARY_DIR}/cupti_lib_path.h)
1015
if (CUPTI_FOUND)
1116
list(APPEND CUDA_SRCS cupti.cc)

paddle/fluid/platform/enforce.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ limitations under the License. */
4444
#include "paddle/fluid/platform/dynload/cublas.h"
4545
#include "paddle/fluid/platform/dynload/cudnn.h"
4646
#include "paddle/fluid/platform/dynload/curand.h"
47+
#ifndef __APPLE__
4748
#include "paddle/fluid/platform/dynload/nccl.h"
48-
#endif
49+
#endif // __APPLE__
50+
#endif // PADDLE_WITH_CUDA
4951

5052
namespace paddle {
5153
namespace platform {
@@ -174,6 +176,7 @@ inline typename std::enable_if<sizeof...(Args) != 0, void>::type throw_on_error(
174176
throw std::runtime_error(err + string::Sprintf(args...));
175177
}
176178

179+
#ifndef __APPLE__
177180
template <typename... Args>
178181
inline typename std::enable_if<sizeof...(Args) != 0, void>::type throw_on_error(
179182
ncclResult_t stat, const Args&... args) {
@@ -184,7 +187,7 @@ inline typename std::enable_if<sizeof...(Args) != 0, void>::type throw_on_error(
184187
string::Sprintf(args...));
185188
}
186189
}
187-
190+
#endif // __APPLE__
188191
#endif // PADDLE_WITH_CUDA
189192

190193
template <typename T>

0 commit comments

Comments
 (0)