|
| 1 | +module( |
| 2 | + name = "torch_tensorrt", |
| 3 | + version = "2.5.0a0", |
| 4 | + repo_name = "org_pytorch_tensorrt", |
| 5 | +) |
| 6 | + |
| 7 | +bazel_dep(name = "googletest", version = "1.14.0") |
| 8 | +bazel_dep(name = "platforms", version = "0.0.10") |
| 9 | +bazel_dep(name = "rules_cc", version = "0.0.9") |
| 10 | +bazel_dep(name = "rules_python", version = "0.34.0") |
| 11 | + |
| 12 | +python = use_extension("@rules_python//python/extensions:python.bzl", "python") |
| 13 | +python.toolchain( |
| 14 | + ignore_root_user_error = True, |
| 15 | + python_version = "3.12", |
| 16 | +) |
| 17 | + |
| 18 | +bazel_dep(name = "rules_pkg", version = "1.0.1") |
| 19 | +git_override( |
| 20 | + module_name = "rules_pkg", |
| 21 | + commit = "17c57f4", |
| 22 | + remote = "https://github.com/narendasan/rules_pkg", |
| 23 | +) |
| 24 | + |
| 25 | +local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository") |
| 26 | + |
| 27 | +# External dependency for torch_tensorrt if you already have precompiled binaries. |
| 28 | +local_repository( |
| 29 | + name = "torch_tensorrt", |
| 30 | + path = "/usr/local/lib/python3.12/dist-packages/torch_tensorrt/", |
| 31 | +) |
| 32 | + |
| 33 | +new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository") |
| 34 | + |
| 35 | + |
| 36 | +# CUDA should be installed on the system locally |
| 37 | +new_local_repository( |
| 38 | + name = "cuda", |
| 39 | + build_file = "@//third_party/cuda:BUILD", |
| 40 | + path = "/usr/local/cuda/", |
| 41 | +) |
| 42 | + |
| 43 | +http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
| 44 | + |
| 45 | + |
| 46 | +#################################################################################### |
| 47 | +# Locally installed dependencies (use in cases of custom dependencies or aarch64) |
| 48 | +#################################################################################### |
| 49 | + |
| 50 | +# NOTE: In the case you are using just the pre-cxx11-abi path or just the cxx11 abi path |
| 51 | +# with your local libtorch, just point deps at the same path to satisfy bazel. |
| 52 | + |
| 53 | +# NOTE: NVIDIA's aarch64 PyTorch (python) wheel file uses the CXX11 ABI unlike PyTorch's standard |
| 54 | +# x86_64 python distribution. If using NVIDIA's version just point to the root of the package |
| 55 | +# for both versions here and do not use --config=pre-cxx11-abi |
| 56 | + |
| 57 | +new_local_repository( |
| 58 | + name = "libtorch", |
| 59 | + path = "/usr/local/lib/python3.12/dist-packages/torch/", |
| 60 | + build_file = "third_party/libtorch/BUILD" |
| 61 | +) |
| 62 | + |
| 63 | +new_local_repository( |
| 64 | + name = "libtorch_pre_cxx11_abi", |
| 65 | + path = "/usr/local/lib/python3.12/dist-packages/torch/", |
| 66 | + build_file = "third_party/libtorch/BUILD" |
| 67 | +) |
| 68 | + |
| 69 | +new_local_repository( |
| 70 | + name = "tensorrt", |
| 71 | + path = "/usr/", |
| 72 | + build_file = "@//third_party/tensorrt/local:BUILD" |
| 73 | +) |
0 commit comments