Skip to content

Commit d20e803

Browse files
authored
BLD: Fix default GPU toolchain (#524)
* Refactor build to work outside of docker
1 parent aa16608 commit d20e803

File tree

17 files changed

+1532
-53
lines changed

17 files changed

+1532
-53
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ cd addons
7474
7575
# If building GPU Ops (Requires CUDA 10.0 and CuDNN 7)
7676
export TF_NEED_CUDA=1
77+
export CUDA_HOME="/path/to/cuda10" (default: /usr/local/cuda)
78+
export CUDNN_INSTALL_PATH="/path/to/cudnn" (default: /usr/lib/x86_64-linux-gnu)
7779
7880
# This script links project with TensorFlow dependency
7981
./configure.sh

WORKSPACE

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
22
load("//build_deps/tf_dependency:tf_configure.bzl", "tf_configure")
3-
load("//build_deps/gpu:cuda_configure.bzl", "cuda_configure")
4-
3+
load("//build_deps/toolchains/gpu:cuda_configure.bzl", "cuda_configure")
54

65
http_archive(
76
name = "cub_archive",
8-
build_file = "//build_deps/gpu:cub.BUILD",
7+
build_file = "//build_deps/toolchains/gpu:cub.BUILD",
98
sha256 = "6bfa06ab52a650ae7ee6963143a0bbc667d6504822cbd9670369b598f18c58c3",
109
strip_prefix = "cub-1.8.0",
1110
urls = [

build_deps/gpu/crosstool/BUILD.tpl renamed to build_deps/toolchains/gpu/crosstool/BUILD.tpl

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ licenses(["restricted"])
22

33
package(default_visibility = ["//visibility:public"])
44

5+
load(":cc_toolchain_config.bzl", "cc_toolchain_config")
6+
7+
58
toolchain(
69
name = "toolchain-linux-x86_64",
710
exec_compatible_with = [
@@ -20,64 +23,37 @@ cc_toolchain_suite(
2023
name = "toolchain",
2124
toolchains = {
2225
"local|compiler": ":cc-compiler-local",
23-
"darwin|compiler": ":cc-compiler-darwin",
24-
"x64_windows|msvc-cl": ":cc-compiler-windows",
25-
"x64_windows": ":cc-compiler-windows",
26-
"arm": ":cc-compiler-local",
2726
"k8": ":cc-compiler-local",
28-
"piii": ":cc-compiler-local",
29-
"ppc": ":cc-compiler-local",
30-
"darwin": ":cc-compiler-darwin",
3127
},
3228
)
3329

3430
cc_toolchain(
3531
name = "cc-compiler-local",
3632
all_files = "%{linker_files}",
3733
compiler_files = ":empty",
38-
cpu = "local",
3934
dwp_files = ":empty",
40-
dynamic_runtime_libs = [":empty"],
4135
linker_files = "%{linker_files}",
4236
objcopy_files = ":empty",
43-
static_runtime_libs = [":empty"],
4437
strip_files = ":empty",
4538
# To support linker flags that need to go to the start of command line
4639
# we need the toolchain to support parameter files. Parameter files are
4740
# last on the command line and contain all shared libraries to link, so all
4841
# regular options will be left of them.
4942
supports_param_files = 1,
43+
toolchain_config = ":cc-compiler-local-config",
5044
toolchain_identifier = "local_linux",
5145
)
5246

53-
cc_toolchain(
54-
name = "cc-compiler-darwin",
55-
all_files = "%{linker_files}",
56-
compiler_files = ":empty",
57-
cpu = "darwin",
58-
dwp_files = ":empty",
59-
dynamic_runtime_libs = [":empty"],
60-
linker_files = "%{linker_files}",
61-
objcopy_files = ":empty",
62-
static_runtime_libs = [":empty"],
63-
strip_files = ":empty",
64-
supports_param_files = 0,
65-
toolchain_identifier = "local_darwin",
66-
)
67-
68-
cc_toolchain(
69-
name = "cc-compiler-windows",
70-
all_files = "%{win_linker_files}",
71-
compiler_files = ":empty",
72-
cpu = "x64_windows",
73-
dwp_files = ":empty",
74-
dynamic_runtime_libs = [":empty"],
75-
linker_files = "%{win_linker_files}",
76-
objcopy_files = ":empty",
77-
static_runtime_libs = [":empty"],
78-
strip_files = ":empty",
79-
supports_param_files = 1,
80-
toolchain_identifier = "local_windows",
47+
cc_toolchain_config(
48+
name = "cc-compiler-local-config",
49+
cpu = "local",
50+
builtin_include_directories = "%{cxx_builtin_include_directories}".split(","),
51+
extra_no_canonical_prefixes_flags = ["-fno-canonical-system-headers"],
52+
host_compiler_path = "clang/bin/crosstool_wrapper_driver_is_not_gcc",
53+
host_compiler_prefix = "/usr/bin",
54+
host_compiler_warnings = [],
55+
host_unfiltered_compile_flags = [],
56+
linker_bin_path = "/usr/bin",
8157
)
8258

8359
filegroup(
@@ -88,9 +64,4 @@ filegroup(
8864
filegroup(
8965
name = "crosstool_wrapper_driver_is_not_gcc",
9066
srcs = ["clang/bin/crosstool_wrapper_driver_is_not_gcc"],
91-
)
92-
93-
filegroup(
94-
name = "windows_msvc_wrapper_files",
95-
srcs = glob(["windows/msvc_*"]),
9667
)
File renamed without changes.

0 commit comments

Comments
 (0)