[CMake] Use libtorch_cuda list defined in bzl file (#49429)

Summary:
Since NCCL is an optional CUDA dependency, remove nccl.cpp from the core filelist

Pull Request resolved: https://github.com/pytorch/pytorch/pull/49429

Reviewed By: nikithamalgifb

Differential Revision: D25569883

Pulled By: malfet

fbshipit-source-id: 61371a4c6b0438e4e0a7f094975b9a9f9ffa4032
This commit is contained in:
Nikita Shulga
2020-12-15 20:49:28 -08:00
committed by Facebook GitHub Bot
parent 22c6dafd33
commit 58551e52f0
2 changed files with 6 additions and 55 deletions

View File

@ -515,59 +515,7 @@ if(NOT INTERN_BUILD_MOBILE OR NOT BUILD_CAFFE2_MOBILE)
endif()
if(USE_CUDA OR USE_ROCM)
list(APPEND Caffe2_GPU_HIP_JIT_FUSERS_SRCS
${TORCH_SRC_DIR}/csrc/jit/codegen/fuser/cuda/fused_kernel.cpp
${TORCH_SRC_DIR}/csrc/autograd/profiler_cuda.cpp
${TORCH_SRC_DIR}/csrc/autograd/functions/comm.cpp
${TORCH_SRC_DIR}/csrc/cuda/comm.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/arith.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/compute_at.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/codegen.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/dispatch.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/expr_evaluator.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/executor.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/executor_kernel_arg.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/executor_launch_params.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/executor_utils.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/fusion.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/graph_fuser.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/index_compute.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/instrumentation.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/ir_base_nodes.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/ir_cloner.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/ir_graphviz.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/ir_nodes.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/ir_iostream.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/iter_visitor.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/kernel.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/kernel_cache.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/kernel_ir.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/kernel_ir_builder.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/kernel_ir_printer.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/lower_index.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/lower_alias_memory.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/lower_insert_syncs.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/lower_loops.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/lower_thread_predicate.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/lower_unroll.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/lower_utils.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/lower_validation.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/lower2device.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/manager.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/mutator.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/parser.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/partition.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/predicate_compute.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/register_interface.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/scheduler.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/shape_inference.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/tensor_view.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/transform_iter.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/transform_replay.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/transform_rfactor.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/type.cpp
${TORCH_SRC_DIR}/csrc/jit/tensorexpr/cuda_codegen.cpp
)
append_filelist("libtorch_cuda_core_sources" Caffe2_GPU_HIP_JIT_FUSERS_SRCS)
endif()
if(USE_CUDA)

View File

@ -353,9 +353,8 @@ libtorch_extra_sources = libtorch_core_jit_sources + [
def libtorch_sources(gencode_pattern = ":generate-code[{}]"):
return libtorch_generated_sources(gencode_pattern) + libtorch_core_sources + libtorch_distributed_sources + libtorch_extra_sources
libtorch_cuda_sources = [
libtorch_cuda_core_sources = [
"torch/csrc/cuda/comm.cpp",
"torch/csrc/cuda/nccl.cpp",
"torch/csrc/jit/codegen/fuser/cuda/fused_kernel.cpp",
"torch/csrc/autograd/profiler_cuda.cpp",
"torch/csrc/autograd/functions/comm.cpp",
@ -408,6 +407,10 @@ libtorch_cuda_sources = [
"torch/csrc/jit/tensorexpr/cuda_codegen.cpp",
]
libtorch_cuda_sources = libtorch_cuda_core_sources + [
"torch/csrc/cuda/nccl.cpp",
]
torch_cpp_srcs = [
"torch/csrc/api/src/cuda.cpp", # this just forwards stuff, no real CUDA
"torch/csrc/api/src/data/datasets/mnist.cpp",