1workspace(name = "pytorch") 2 3load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 4load("//tools/rules:workspace.bzl", "new_patched_local_repository") 5 6http_archive( 7 name = "rules_cc", 8 patches = [ 9 "//:tools/rules_cc/cuda_support.patch", 10 ], 11 strip_prefix = "rules_cc-40548a2974f1aea06215272d9c2b47a14a24e556", 12 urls = [ 13 "https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/40548a2974f1aea06215272d9c2b47a14a24e556.tar.gz", 14 "https://github.com/bazelbuild/rules_cc/archive/40548a2974f1aea06215272d9c2b47a14a24e556.tar.gz", 15 ], 16) 17 18http_archive( 19 name = "rules_cuda", 20 strip_prefix = "runtime-b1c7cce21ba4661c17ac72421c6a0e2015e7bef3/third_party/rules_cuda", 21 urls = ["https://github.com/tensorflow/runtime/archive/b1c7cce21ba4661c17ac72421c6a0e2015e7bef3.tar.gz"], 22) 23 24load("@rules_cuda//cuda:dependencies.bzl", "rules_cuda_dependencies") 25 26rules_cuda_dependencies(with_rules_cc = False) 27 28load("@rules_cc//cc:repositories.bzl", "rules_cc_toolchains") 29 30rules_cc_toolchains() 31 32http_archive( 33 name = "bazel_skylib", 34 urls = [ 35 "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", 36 ], 37) 38 39http_archive( 40 name = "pybind11_bazel", 41 strip_prefix = "pybind11_bazel-b162c7c88a253e3f6b673df0c621aca27596ce6b", 42 urls = ["https://github.com/pybind/pybind11_bazel/archive/b162c7c88a253e3f6b673df0c621aca27596ce6b.zip"], 43) 44 45new_local_repository( 46 name = "pybind11", 47 build_file = "@pybind11_bazel//:pybind11.BUILD", 48 path = "third_party/pybind11", 49) 50 51http_archive( 52 name = "com_github_glog", 53 build_file_content = """ 54licenses(['notice']) 55 56load(':bazel/glog.bzl', 'glog_library') 57# TODO: figure out why enabling gflags leads to SIGSEV on the logging init 58glog_library(with_gflags=0) 59 """, 60 strip_prefix = "glog-0.4.0", 61 urls = [ 62 "https://github.com/google/glog/archive/v0.4.0.tar.gz", 63 ], 64) 65 66http_archive( 67 name = "com_github_gflags_gflags", 68 strip_prefix = "gflags-2.2.2", 69 urls = [ 70 "https://github.com/gflags/gflags/archive/v2.2.2.tar.gz", 71 ], 72) 73 74http_archive( 75 name = "com_github_opentelemetry-cpp", 76 urls = [ 77 "https://github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v1.14.2.tar.gz", 78 ], 79) 80 81new_local_repository( 82 name = "gloo", 83 build_file = "//third_party:gloo.BUILD", 84 path = "third_party/gloo", 85) 86 87new_local_repository( 88 name = "onnx", 89 build_file = "//third_party:onnx.BUILD", 90 path = "third_party/onnx", 91) 92 93local_repository( 94 name = "com_google_protobuf", 95 path = "third_party/protobuf", 96) 97 98new_local_repository( 99 name = "eigen", 100 build_file = "//third_party:eigen.BUILD", 101 path = "third_party/eigen", 102) 103 104new_local_repository( 105 name = "cutlass", 106 build_file = "//third_party:cutlass.BUILD", 107 path = "third_party/cutlass", 108) 109 110new_local_repository( 111 name = "fbgemm", 112 build_file = "//third_party:fbgemm/BUILD.bazel", 113 path = "third_party/fbgemm", 114 repo_mapping = {"@cpuinfo": "@org_pytorch_cpuinfo"}, 115) 116 117new_local_repository( 118 name = "ideep", 119 build_file = "//third_party:ideep.BUILD", 120 path = "third_party/ideep", 121) 122 123new_local_repository( 124 name = "mkl_dnn", 125 build_file = "//third_party:mkl-dnn.BUILD", 126 path = "third_party/ideep/mkl-dnn", 127) 128 129new_local_repository( 130 name = "org_pytorch_cpuinfo", 131 build_file = "//third_party:cpuinfo/BUILD.bazel", 132 path = "third_party/cpuinfo", 133) 134 135new_local_repository( 136 name = "asmjit", 137 build_file = "//third_party:fbgemm/third_party/asmjit.BUILD", 138 path = "third_party/fbgemm/third_party/asmjit", 139) 140 141new_local_repository( 142 name = "sleef", 143 build_file = "//third_party:sleef.BUILD", 144 path = "third_party/sleef", 145) 146 147new_local_repository( 148 name = "fmt", 149 build_file = "//third_party:fmt.BUILD", 150 path = "third_party/fmt", 151) 152 153new_local_repository( 154 name = "kineto", 155 build_file = "//third_party:kineto.BUILD", 156 path = "third_party/kineto", 157) 158 159new_local_repository( 160 name = "opentelemetry-cpp", 161 build_file = "//third_party::opentelemetry-cpp.BUILD", 162 path = "third_party/opentelemetry-cpp", 163) 164 165new_local_repository( 166 name = "cpp-httplib", 167 build_file = "//third_party:cpp-httplib.BUILD", 168 path = "third_party/cpp-httplib", 169) 170 171new_local_repository( 172 name = "nlohmann", 173 build_file = "//third_party:nlohmann.BUILD", 174 path = "third_party/nlohmann", 175) 176 177new_local_repository( 178 name = "tensorpipe", 179 build_file = "//third_party:tensorpipe.BUILD", 180 path = "third_party/tensorpipe", 181) 182 183http_archive( 184 name = "mkl", 185 build_file = "//third_party:mkl.BUILD", 186 sha256 = "59154b30dd74561e90d547f9a3af26c75b6f4546210888f09c9d4db8f4bf9d4c", 187 strip_prefix = "lib", 188 urls = [ 189 "https://anaconda.org/anaconda/mkl/2020.0/download/linux-64/mkl-2020.0-166.tar.bz2", 190 ], 191) 192 193http_archive( 194 name = "mkl_headers", 195 build_file = "//third_party:mkl_headers.BUILD", 196 sha256 = "2af3494a4bebe5ddccfdc43bacc80fcd78d14c1954b81d2c8e3d73b55527af90", 197 urls = [ 198 "https://anaconda.org/anaconda/mkl-include/2020.0/download/linux-64/mkl-include-2020.0-166.tar.bz2", 199 ], 200) 201 202http_archive( 203 name = "rules_python", 204 # TODO Fix bazel linter to support hashes for release tarballs. 205 # 206 # sha256 = "94750828b18044533e98a129003b6a68001204038dc4749f40b195b24c38f49f", 207 strip_prefix = "rules_python-0.21.0", 208 url = "https://github.com/bazelbuild/rules_python/releases/download/0.21.0/rules_python-0.21.0.tar.gz", 209) 210 211load("@rules_python//python:repositories.bzl", "py_repositories") 212 213py_repositories() 214 215load("@rules_python//python:repositories.bzl", "python_register_toolchains") 216 217python_register_toolchains( 218 name = "python3_10", 219 python_version = "3.10", 220) 221 222load("@python3_10//:defs.bzl", "interpreter") 223load("@rules_python//python:pip.bzl", "pip_parse") 224 225pip_parse( 226 name = "pip_deps", 227 python_interpreter_target = interpreter, 228 requirements_lock = "//:tools/build/bazel/requirements.txt", 229) 230 231load("@pip_deps//:requirements.bzl", "install_deps") 232 233install_deps() 234 235load("@pybind11_bazel//:python_configure.bzl", "python_configure") 236 237python_configure( 238 name = "local_config_python", 239 python_interpreter_target = interpreter, 240) 241 242load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") 243 244protobuf_deps() 245 246new_local_repository( 247 name = "cuda", 248 build_file = "@//third_party:cuda.BUILD", 249 path = "/usr/local/cuda", 250) 251 252new_local_repository( 253 name = "cudnn", 254 build_file = "@//third_party:cudnn.BUILD", 255 path = "/usr/local/cuda", 256) 257 258new_local_repository( 259 name = "cudnn_frontend", 260 build_file = "@//third_party:cudnn_frontend.BUILD", 261 path = "third_party/cudnn_frontend/", 262) 263 264local_repository( 265 name = "com_github_google_flatbuffers", 266 path = "third_party/flatbuffers", 267) 268 269local_repository( 270 name = "google_benchmark", 271 path = "third_party/benchmark", 272) 273 274local_repository( 275 name = "com_google_googletest", 276 path = "third_party/googletest", 277) 278 279local_repository( 280 name = "pthreadpool", 281 path = "third_party/pthreadpool", 282 repo_mapping = {"@com_google_benchmark": "@google_benchmark"}, 283) 284 285local_repository( 286 name = "FXdiv", 287 path = "third_party/FXdiv", 288 repo_mapping = {"@com_google_benchmark": "@google_benchmark"}, 289) 290 291local_repository( 292 name = "XNNPACK", 293 path = "third_party/XNNPACK", 294 repo_mapping = {"@com_google_benchmark": "@google_benchmark"}, 295) 296 297local_repository( 298 name = "gemmlowp", 299 path = "third_party/gemmlowp/gemmlowp", 300) 301 302### Unused repos start 303 304# `unused` repos are defined to hide bazel files from submodules of submodules. 305# This allows us to run `bazel build //...` and not worry about the submodules madness. 306# Otherwise everything traverses recursively and a lot of submodules of submodules have 307# they own bazel build files. 308 309local_repository( 310 name = "unused_tensorpipe_googletest", 311 path = "third_party/tensorpipe/third_party/googletest", 312) 313 314local_repository( 315 name = "unused_fbgemm", 316 path = "third_party/fbgemm", 317) 318 319local_repository( 320 name = "unused_ftm_bazel", 321 path = "third_party/fmt/support/bazel", 322) 323 324local_repository( 325 name = "unused_kineto_fmt_bazel", 326 path = "third_party/kineto/libkineto/third_party/fmt/support/bazel", 327) 328 329local_repository( 330 name = "unused_kineto_dynolog_googletest", 331 path = "third_party/kineto/libkineto/third_party/dynolog/third_party/googletest", 332) 333 334local_repository( 335 name = "unused_kineto_dynolog_gflags", 336 path = "third_party/kineto/libkineto/third_party/dynolog/third_party/gflags", 337) 338 339local_repository( 340 name = "unused_kineto_dynolog_glog", 341 path = "third_party/kineto/libkineto/third_party/dynolog/third_party/glog", 342) 343 344local_repository( 345 name = "unused_kineto_googletest", 346 path = "third_party/kineto/libkineto/third_party/googletest", 347) 348 349local_repository( 350 name = "unused_onnx_benchmark", 351 path = "third_party/onnx/third_party/benchmark", 352) 353 354### Unused repos end 355