mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Link NCCL lib to TORCH_PYTHON_LINK_LIBRARIES when USE_NCCL=1 (#36948)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/36948 Compiling with USE_DISTRIBUTED=0 fails as it would still try to compile python_nccl.cpp which requires NCCL but the NCCL lib is not linked. Test Plan: Imported from OSS Differential Revision: D21142012 Pulled By: mrshenli fbshipit-source-id: 6ca94056ca859da7f833a31edcb4c5260d8625e4
This commit is contained in:
parent
32307efd68
commit
a14a8376aa
|
|
@ -204,6 +204,8 @@ cmake_dependent_option(
|
|||
cmake_dependent_option(
|
||||
USE_GLOO "Use Gloo. Only available if USE_DISTRIBUTED is on." ON
|
||||
"USE_DISTRIBUTED" OFF)
|
||||
# NB: USE_NCCL is intentionally left independent from USE_DISTRIBUTED, because
|
||||
# DataParallel also uses NCCL.
|
||||
option(USE_TBB "Use TBB" OFF)
|
||||
option(ONNX_ML "Enable traditional ONNX ML API." ON)
|
||||
|
||||
|
|
|
|||
|
|
@ -279,6 +279,7 @@ if(USE_NCCL)
|
|||
list(APPEND TORCH_PYTHON_SRCS
|
||||
${TORCH_SRC_DIR}/csrc/cuda/python_nccl.cpp)
|
||||
list(APPEND TORCH_PYTHON_COMPILE_DEFINITIONS USE_NCCL)
|
||||
list(APPEND TORCH_PYTHON_LINK_LIBRARIES __caffe2_nccl)
|
||||
endif()
|
||||
|
||||
# In the most recent CMake versions, a new 'TRANSFORM' subcommand of 'list' allows much of the boilerplate of defining the lists
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user