pytorch/third_party/cuda.BUILD
Thuyen Ngo e35bf56461 [Bazel] Add CUDA build to CI (#66241)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/35316
On master, bazel cuda build is disabled due to lack of a proper `cu_library` rule. This PR:
- Add `rules_cuda` to the WORKSPACE and forward `cu_library` to `rules_cuda`.
- Use a simple local cuda and cudnn repositories (adopted from TRTorch) for cuda 11.3.
- Fix current broken cuda build.
- Enable cuda build in CI, not just for `:torch` target but all the test binaries to catch undefined symbols.

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

Reviewed By: ejguan

Differential Revision: D31544091

Pulled By: malfet

fbshipit-source-id: fd3c34d0e8f80fee06f015694a4c13a8e9e12206
2021-12-17 13:44:29 -08:00

77 lines
1.7 KiB
Plaintext

# Adopted from: https://github.com/tensorflow/runtime/blob/master/third_party/rules_cuda/private/BUILD.local_cuda
# Library targets are created corresponding to BUILD.bazel's needs.
cc_library(
name = "cuda_headers",
hdrs = glob([
"include/**",
"targets/x86_64-linux/include/**",
]),
includes = [
"include",
"targets/x86_64-linux/include",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "cuda_driver",
srcs = ["lib64/stubs/libcuda.so"],
visibility = ["//visibility:public"],
)
cc_library(
name = "cuda",
srcs = ["targets/x86_64-linux/lib/libcudart.so"],
visibility = ["//visibility:public"],
deps = [":cuda_headers"],
)
cc_library(
name = "cufft",
srcs = ["targets/x86_64-linux/lib/libcufft.so"],
visibility = ["//visibility:public"],
)
cc_library(
name = "cublas",
srcs = [
"targets/x86_64-linux/lib/libcublasLt.so",
"targets/x86_64-linux/lib/libcublas.so",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "curand",
srcs = ["targets/x86_64-linux/lib/libcurand.so"],
visibility = ["//visibility:public"],
)
cc_library(
name = "cusolver",
srcs = ["targets/x86_64-linux/lib/libcusolver.so"],
visibility = ["//visibility:public"],
)
cc_library(
name = "cusparse",
srcs = ["targets/x86_64-linux/lib/libcusparse.so"],
visibility = ["//visibility:public"],
)
cc_library(
name = "nvrtc",
srcs = [
"targets/x86_64-linux/lib/libnvrtc.so",
"targets/x86_64-linux/lib/libnvrtc-builtins.so",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "nvToolsExt",
srcs = [ "lib64/libnvToolsExt.so"],
visibility = ["//visibility:public"],
)