Skip to content

Commit

Permalink
Bazel: move cuda/tensorrt stuff back to third_party/
Browse files Browse the repository at this point in the history
  • Loading branch information
storypku committed Jun 28, 2020
1 parent eabc721 commit 68d3569
Show file tree
Hide file tree
Showing 27 changed files with 22 additions and 25 deletions.
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ workspace(name = "apollo")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//tools/gpus:cuda_configure.bzl", "cuda_configure")
load("//tools/tensorrt:tensorrt_configure.bzl", "tensorrt_configure")
load("//third_party/gpus:cuda_configure.bzl", "cuda_configure")
load("//third_party/tensorrt:tensorrt_configure.bzl", "tensorrt_configure")
load("//third_party/py:python_configure.bzl", "python_configure")
load("//third_party/vtk:vtk_configure.bzl", "vtk_configure")

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tools/gpus/README.md → third_party/gpus/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## How to generate "find_cuda_config.py.gz.base64"

```
$ # In tools/gpus/ dir
$ # In third_party/gpus/ dir
$ python3 compress_find_cuda_config.py
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DESCRIPTION:
arguments as is.
NOTES(storypku): Move this file to
//tools/gpus/crosstool/crosstool_wrapper_is_not_gcc ?
//third_party/gpus/crosstool/crosstool_wrapper_is_not_gcc ?
"""

Expand All @@ -53,7 +53,7 @@ PREFIX_DIR = os.path.dirname(GCC_HOST_COMPILER_PATH)
NVCC_VERSION = '%{cuda_version}'

def Log(s):
print('//tools/gpus/crosstool: {0}'.format(s))
print('//third_party/gpus/crosstool: {0}'.format(s))


def GetOptionValue(argv, option):
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions tools/gpus/cuda/BUILD.tpl → third_party/gpus/cuda/BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cuda_header_library(
"cuda/cuda_config.h",
":cuda-include"
],
include_prefix = "tools/gpus",
include_prefix = "third_party/gpus",
includes = [
".", # required to include cuda/cuda/cuda_config.h as cuda/config.h
"cuda/include",
Expand Down Expand Up @@ -66,7 +66,7 @@ cc_library(
cuda_header_library(
name = "cublas_headers",
hdrs = [":cublas-include"],
include_prefix = "tools/gpus/cuda/include",
include_prefix = "third_party/gpus/cuda/include",
strip_include_prefix = "cublas/include",
deps = [":cuda_headers"],
includes = ["cublas/include"],
Expand Down Expand Up @@ -97,7 +97,7 @@ cc_library(
cc_library(
name = "cudnn_header",
hdrs = [":cudnn-include"],
include_prefix = "tools/gpus/cudnn",
include_prefix = "third_party/gpus/cudnn",
strip_include_prefix = "cudnn/include",
deps = [":cuda_headers"],
)
Expand Down Expand Up @@ -131,7 +131,7 @@ cc_library(
cuda_header_library(
name = "cupti_headers",
hdrs = [":cuda-extras"],
include_prefix="tools/gpus",
include_prefix="third_party/gpus",
includes = ["cuda/extras/CUPTI/include/"],
deps = [":cuda_headers"],
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -562,14 +562,14 @@ def _tpl(repository_ctx, tpl, substitutions = {}, out = None):
out = tpl.replace(":", "/")
repository_ctx.template(
out,
Label("//tools/gpus/%s.tpl" % tpl),
Label("//third_party/gpus/%s.tpl" % tpl),
substitutions,
)

def _file(repository_ctx, label):
repository_ctx.template(
label.replace(":", "/"),
Label("//tools/gpus/%s.tpl" % label),
Label("//third_party/gpus/%s.tpl" % label),
{},
)

Expand Down Expand Up @@ -758,7 +758,7 @@ def _compute_cuda_extra_copts(repository_ctx, compute_capabilities):
return str(capability_flags)

def _tpl_path(repository_ctx, filename):
return repository_ctx.path(Label("//tools/gpus/%s.tpl" % filename))
return repository_ctx.path(Label("//third_party/gpus/%s.tpl" % filename))

def _basename(repository_ctx, path_str):
"""Returns the basename of a path of type string.
Expand Down Expand Up @@ -786,7 +786,7 @@ def _create_local_cuda_repository(repository_ctx):
]}
tpl_paths["cuda:BUILD"] = _tpl_path(repository_ctx, "cuda:BUILD")

find_cuda_config_script = repository_ctx.path(Label("//tools/gpus:find_cuda_config.py.gz.base64"))
find_cuda_config_script = repository_ctx.path(Label("//third_party/gpus:find_cuda_config.py.gz.base64"))

cuda_config = _get_cuda_config(repository_ctx, find_cuda_config_script)

Expand Down Expand Up @@ -833,7 +833,7 @@ def _create_local_cuda_repository(repository_ctx):
],
))

check_cuda_libs_script = repository_ctx.path(Label("//tools/gpus:check_cuda_libs.py"))
check_cuda_libs_script = repository_ctx.path(Label("//third_party/gpus:check_cuda_libs.py"))
cuda_libs = _find_libs(repository_ctx, check_cuda_libs_script, cuda_config)
cuda_lib_srcs = []
cuda_lib_outs = []
Expand All @@ -847,7 +847,7 @@ def _create_local_cuda_repository(repository_ctx):
outs = cuda_lib_outs,
))

# copy files mentioned in tools/nccl/build_defs.bzl.tpl
# copy files mentioned in third_party/nccl/build_defs.bzl.tpl
copy_rules.append(make_copy_files_rule(
repository_ctx,
name = "cuda-bin",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cc_library(
"tensorrt/include/tensorrt_config.h",
":tensorrt_include"
],
include_prefix = "tools/tensorrt",
include_prefix = "third_party/tensorrt",
strip_include_prefix = "tensorrt/include",
)

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

load(
"//tools/gpus:cuda_configure.bzl",
"//third_party/gpus:cuda_configure.bzl",
"find_cuda_config",
"lib_name",
"make_copy_files_rule",
Expand Down Expand Up @@ -53,7 +53,7 @@ def _get_tensorrt_headers(tensorrt_version):
return _TF_TENSORRT_HEADERS

def _tpl_path(repository_ctx, filename):
return repository_ctx.path(Label("//tools/tensorrt:%s.tpl" % filename))
return repository_ctx.path(Label("//third_party/tensorrt:%s.tpl" % filename))

def _tpl(repository_ctx, tpl, substitutions):
repository_ctx.template(
Expand All @@ -77,7 +77,7 @@ def _create_dummy_repository(repository_ctx):
# Copy license file in non-remote build.
repository_ctx.template(
"LICENSE",
Label("//tools/tensorrt:LICENSE"),
Label("//third_party/tensorrt:LICENSE"),
{},
)

Expand All @@ -90,7 +90,7 @@ def _create_local_tensorrt_repository(repository_ctx):
# function to be restarted with all previous state being lost. This
# can easily lead to a O(n^2) runtime in the number of labels.
# See https://github.com/tensorflow/tensorflow/commit/62bd3534525a036f07d9851b3199d68212904778
find_cuda_config_path = repository_ctx.path(Label("//tools/gpus:find_cuda_config.py.gz.base64"))
find_cuda_config_path = repository_ctx.path(Label("//third_party/gpus:find_cuda_config.py.gz.base64"))
tpl_paths = {
"build_defs.bzl": _tpl_path(repository_ctx, "build_defs.bzl"),
"BUILD": _tpl_path(repository_ctx, "BUILD"),
Expand Down Expand Up @@ -139,7 +139,7 @@ def _create_local_tensorrt_repository(repository_ctx):
# Copy license file in non-remote build.
repository_ctx.template(
"LICENSE",
Label("//tools/tensorrt:LICENSE"),
Label("//third_party/tensorrt:LICENSE"),
{},
)

Expand Down
2 changes: 1 addition & 1 deletion tools/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ def validate_cuda_config(environ_cp):

# FIXME(all): abs path for find_cuda_config.py
proc = subprocess.Popen(
[environ_cp['PYTHON_BIN_PATH'], 'tools/gpus/find_cuda_config.py'] +
[environ_cp['PYTHON_BIN_PATH'], 'third_party/gpus/find_cuda_config.py'] +
cuda_libraries,
stdout=subprocess.PIPE,
env=environ_cp)
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions tools/gpus/BUILD

This file was deleted.

0 comments on commit 68d3569

Please sign in to comment.