aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party
diff options
context:
space:
mode:
Diffstat (limited to 'third_party')
-rw-r--r--third_party/android/BUILD0
-rw-r--r--third_party/android/android.bzl.tpl9
-rw-r--r--third_party/android/android_configure.BUILD.tpl0
-rw-r--r--third_party/android/android_configure.bzl87
-rw-r--r--third_party/aws.BUILD3
-rw-r--r--third_party/clang_toolchain/BUILD0
-rw-r--r--third_party/clang_toolchain/cc_configure_clang.bzl27
-rw-r--r--third_party/clang_toolchain/download_clang.bzl60
-rw-r--r--third_party/curl.BUILD36
-rw-r--r--third_party/double_conversion.BUILD42
-rw-r--r--third_party/eigen.BUILD7
-rw-r--r--third_party/eigen3/BUILD54
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/Core46
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/NeuralNetworks35
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/FixedPointTypes.h6
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProduct.h86
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProductAVX2.h482
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProductNEON.h9
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatVecProduct.h39
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h8
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX512.h6
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/TypeCastingAVX2.h16
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/TypeCastingAVX512.h53
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Activations.h116
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Attention.h209
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/BackwardCuboidConvolutions.h523
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/BackwardSpatialConvolutions.h351
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/CuboidConvolution.h179
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Patch3d.h240
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Pooling.h433
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/SoftMax.h83
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/SpatialConvolutions.h775
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/TensorConvolutionByFFT.h289
-rw-r--r--third_party/eigen_fix_cuda_compilation.patch38
-rw-r--r--third_party/examples/eager/spinn/README.md4
-rw-r--r--third_party/examples/eager/spinn/spinn.py147
-rw-r--r--third_party/farmhash.BUILD8
-rw-r--r--third_party/fft2d/fft2d.BUILD10
-rw-r--r--third_party/flatbuffers/BUILD16
-rw-r--r--third_party/flatbuffers/BUILD.bazel (renamed from third_party/flatbuffers/flatbuffers.BUILD)21
-rw-r--r--third_party/flatbuffers/BUILD.system38
-rw-r--r--third_party/flatbuffers/build_defs.bzl371
-rw-r--r--third_party/flatbuffers/workspace.bzl19
-rw-r--r--third_party/gif.BUILD9
-rw-r--r--third_party/googleapis.BUILD45
-rw-r--r--third_party/gpus/crosstool/BUILD.tpl20
-rw-r--r--third_party/gpus/crosstool/CROSSTOOL.tpl1408
-rw-r--r--third_party/gpus/crosstool/CROSSTOOL_clang.tpl299
-rw-r--r--third_party/gpus/crosstool/CROSSTOOL_nvcc.tpl249
-rwxr-xr-xthird_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl6
-rw-r--r--third_party/gpus/crosstool/windows/msvc_wrapper_for_nvcc.bat.tpl20
-rw-r--r--third_party/gpus/crosstool/windows/msvc_wrapper_for_nvcc.py.tpl192
-rw-r--r--third_party/gpus/cuda/BUILD.tpl9
-rw-r--r--third_party/gpus/cuda/BUILD.windows.tpl164
-rw-r--r--third_party/gpus/cuda/remote.BUILD.tpl5
-rw-r--r--third_party/gpus/cuda_configure.bzl2182
-rw-r--r--third_party/gpus/download_clang.bzl54
-rw-r--r--third_party/hadoop/BUILD12
-rw-r--r--third_party/hadoop/hdfs.h6
-rw-r--r--third_party/highwayhash.BUILD1
-rw-r--r--third_party/jpeg/jpeg.BUILD479
-rw-r--r--third_party/jsoncpp.BUILD7
-rw-r--r--third_party/kafka/BUILD48
-rw-r--r--third_party/libxsmm.BUILD4
-rw-r--r--third_party/llvm/llvm.autogenerated.BUILD (renamed from third_party/llvm/llvm.BUILD)395
-rw-r--r--third_party/llvm/llvm.bzl477
-rw-r--r--third_party/lmdb.BUILD6
-rw-r--r--third_party/mkl/BUILD61
-rw-r--r--third_party/mkl/MKL_LICENSE201
-rw-r--r--third_party/mkl/build_defs.bzl125
-rw-r--r--third_party/mkl/mkl.BUILD27
-rw-r--r--third_party/mkl_dnn/BUILD11
-rw-r--r--third_party/mkl_dnn/LICENSE201
-rw-r--r--third_party/mkl_dnn/build_defs.bzl13
-rw-r--r--third_party/mkl_dnn/mkldnn.BUILD44
-rw-r--r--third_party/mpi/BUILD12
-rw-r--r--third_party/nanopb.BUILD23
-rw-r--r--third_party/nasm.BUILD192
-rw-r--r--third_party/nccl/BUILD0
-rw-r--r--third_party/nccl/LICENSE203
-rw-r--r--third_party/nccl/nccl_archive.BUILD (renamed from third_party/nccl.BUILD)2
-rw-r--r--third_party/nccl/nccl_configure.bzl165
-rw-r--r--third_party/nccl/remote.BUILD.tpl6
-rw-r--r--third_party/nccl/system.BUILD.tpl26
-rw-r--r--third_party/ngraph/BUILD1
-rw-r--r--third_party/ngraph/LICENSE201
-rw-r--r--third_party/ngraph/NGRAPH_LICENSE201
-rw-r--r--third_party/ngraph/build_defs.bzl11
-rw-r--r--third_party/ngraph/ngraph.BUILD37
-rw-r--r--third_party/ngraph/ngraph_tf.BUILD88
-rw-r--r--third_party/ngraph/nlohmann_json.BUILD15
-rw-r--r--third_party/png.BUILD39
-rw-r--r--third_party/png_fix_rpi.patch16
-rw-r--r--third_party/py/python_configure.bzl24
-rw-r--r--third_party/python_runtime/BUILD8
-rw-r--r--third_party/repo.bzl214
-rw-r--r--third_party/snappy.BUILD90
-rw-r--r--third_party/sqlite.BUILD9
-rw-r--r--third_party/swig.BUILD6
-rw-r--r--third_party/sycl/BUILD12
-rw-r--r--third_party/sycl/sycl/BUILD12
-rwxr-xr-xthird_party/sycl/sycl/BUILD.tpl2
-rw-r--r--third_party/systemlibs/BUILD0
-rw-r--r--third_party/systemlibs/BUILD.tpl0
-rw-r--r--third_party/systemlibs/astor.BUILD12
-rw-r--r--third_party/systemlibs/build_defs.bzl.tpl32
-rw-r--r--third_party/systemlibs/curl.BUILD12
-rw-r--r--third_party/systemlibs/cython.BUILD13
-rw-r--r--third_party/systemlibs/gif.BUILD12
-rw-r--r--third_party/systemlibs/grpc.BUILD54
-rw-r--r--third_party/systemlibs/jemalloc.BUILD30
-rw-r--r--third_party/systemlibs/jpeg.BUILD12
-rw-r--r--third_party/systemlibs/jsoncpp.BUILD37
-rw-r--r--third_party/systemlibs/lmdb.BUILD12
-rw-r--r--third_party/systemlibs/nasm.BUILD12
-rw-r--r--third_party/systemlibs/nsync.BUILD23
-rw-r--r--third_party/systemlibs/pcre.BUILD12
-rw-r--r--third_party/systemlibs/png.BUILD12
-rw-r--r--third_party/systemlibs/re2.BUILD12
-rw-r--r--third_party/systemlibs/six.BUILD11
-rw-r--r--third_party/systemlibs/snappy.BUILD12
-rw-r--r--third_party/systemlibs/sqlite.BUILD15
-rw-r--r--third_party/systemlibs/swig.BUILD23
-rw-r--r--third_party/systemlibs/syslibs_configure.bzl158
-rw-r--r--third_party/systemlibs/termcolor.BUILD12
-rw-r--r--third_party/systemlibs/zlib.BUILD12
-rw-r--r--third_party/tensorrt/tensorrt_configure.bzl4
-rw-r--r--third_party/tflite_ovic_testdata.BUILD12
-rw-r--r--third_party/toolchains/BUILD37
-rw-r--r--third_party/toolchains/clang6/CROSSTOOL.tpl3
-rw-r--r--third_party/toolchains/cpus/py/BUILD242
-rw-r--r--third_party/toolchains/cpus/py3/BUILD234
-rw-r--r--third_party/toolchains/gpus/crosstool/BUILD20
-rw-r--r--third_party/toolchains/gpus/crosstool/CROSSTOOL1123
-rw-r--r--third_party/toolchains/gpus/cuda/BUILD36
-rw-r--r--third_party/toolchains/gpus/cuda/build_defs.bzl8
-rw-r--r--third_party/toolchains/gpus/cuda/cuda/cuda_config.h6
-rw-r--r--third_party/toolchains/gpus/py/BUILD22
-rw-r--r--third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/WORKSPACE2
-rwxr-xr-xthird_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/BUILD1268
-rwxr-xr-xthird_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/build_defs.bzl33
-rwxr-xr-xthird_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/cuda/cuda_config.h26
-rwxr-xr-xthird_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/BUILD73
-rwxr-xr-xthird_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/CROSSTOOL1410
-rwxr-xr-xthird_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/clang/bin/crosstool_wrapper_driver_is_not_gcc264
-rwxr-xr-xthird_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/windows/msvc_wrapper_for_nvcc.bat20
-rwxr-xr-xthird_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/windows/msvc_wrapper_for_nvcc.py192
-rwxr-xr-xthird_party/toolchains/preconfig/ubuntu14.04/nccl2/BUILD25
-rw-r--r--third_party/toolchains/preconfig/ubuntu14.04/nccl2/WORKSPACE2
-rwxr-xr-xthird_party/toolchains/preconfig/ubuntu14.04/py3/BUILD176
-rw-r--r--third_party/toolchains/preconfig/ubuntu14.04/py3/WORKSPACE2
-rw-r--r--third_party/zlib.BUILD15
152 files changed, 12909 insertions, 6262 deletions
diff --git a/third_party/android/BUILD b/third_party/android/BUILD
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/third_party/android/BUILD
diff --git a/third_party/android/android.bzl.tpl b/third_party/android/android.bzl.tpl
new file mode 100644
index 0000000000..e6ed4994f3
--- /dev/null
+++ b/third_party/android/android.bzl.tpl
@@ -0,0 +1,9 @@
+"""Set up configurable Android SDK and NDK dependencies."""
+
+def android_workspace():
+ # String for replacement in Bazel template.
+ # These will either be replaced by android_sdk_repository if various ENV
+ # variables are set when `local_config_android` repo_rule is run, or they
+ # will be replaced by noops otherwise.
+ MAYBE_ANDROID_SDK_REPOSITORY
+ MAYBE_ANDROID_NDK_REPOSITORY
diff --git a/third_party/android/android_configure.BUILD.tpl b/third_party/android/android_configure.BUILD.tpl
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/third_party/android/android_configure.BUILD.tpl
diff --git a/third_party/android/android_configure.bzl b/third_party/android/android_configure.bzl
new file mode 100644
index 0000000000..da09bdf39e
--- /dev/null
+++ b/third_party/android/android_configure.bzl
@@ -0,0 +1,87 @@
+"""Repository rule for Android SDK and NDK autoconfiguration.
+
+`android_configure` depends on the following environment variables:
+
+ * `ANDROID_NDK_HOME`: Location of Android NDK root.
+ * `ANDROID_SDK_HOME`: Location of Android SDK root.
+ * `ANDROID_SDK_API_LEVEL`: Desired Android SDK API version.
+ * `ANDROID_NDK_API_LEVEL`: Desired Android NDK API version.
+ * `ANDROID_BUILD_TOOLS_VERSION`: Desired Android build tools version.
+"""
+
+# TODO(mikecase): Move logic for getting default values for the env variables
+# from configure.py script into this rule.
+
+_ANDROID_NDK_HOME = "ANDROID_NDK_HOME"
+_ANDROID_SDK_HOME = "ANDROID_SDK_HOME"
+_ANDROID_NDK_API_VERSION = "ANDROID_NDK_API_LEVEL"
+_ANDROID_SDK_API_VERSION = "ANDROID_SDK_API_LEVEL"
+_ANDROID_BUILD_TOOLS_VERSION = "ANDROID_BUILD_TOOLS_VERSION"
+
+_ANDROID_SDK_REPO_TEMPLATE = """
+ native.android_sdk_repository(
+ name="androidsdk",
+ path="%s",
+ api_level=%s,
+ build_tools_version="%s",
+ )
+"""
+
+_ANDROID_NDK_REPO_TEMPLATE = """
+ native.android_ndk_repository(
+ name="androidndk",
+ path="%s",
+ api_level=%s,
+ )
+"""
+
+def _android_autoconf_impl(repository_ctx):
+ """Implementation of the android_autoconf repository rule."""
+ sdk_home = repository_ctx.os.environ.get(_ANDROID_SDK_HOME)
+ sdk_api_level = repository_ctx.os.environ.get(_ANDROID_SDK_API_VERSION)
+ build_tools_version = repository_ctx.os.environ.get(
+ _ANDROID_BUILD_TOOLS_VERSION)
+ ndk_home = repository_ctx.os.environ.get(_ANDROID_NDK_HOME)
+ ndk_api_level = repository_ctx.os.environ.get(_ANDROID_NDK_API_VERSION)
+
+ sdk_rule = "pass"
+ if all([sdk_home, sdk_api_level, build_tools_version]):
+ sdk_rule = _ANDROID_SDK_REPO_TEMPLATE % (
+ sdk_home, sdk_api_level, build_tools_version)
+
+ ndk_rule = "pass"
+ if all([ndk_home, ndk_api_level]):
+ ndk_rule = _ANDROID_NDK_REPO_TEMPLATE % (ndk_home, ndk_api_level)
+
+ repository_ctx.template(
+ "BUILD",
+ Label("//third_party/android:android_configure.BUILD.tpl"))
+ repository_ctx.template(
+ "android.bzl",
+ Label("//third_party/android:android.bzl.tpl"),
+ substitutions={
+ "MAYBE_ANDROID_SDK_REPOSITORY": sdk_rule,
+ "MAYBE_ANDROID_NDK_REPOSITORY": ndk_rule,
+ })
+
+android_configure = repository_rule(
+ implementation = _android_autoconf_impl,
+ environ = [
+ _ANDROID_SDK_API_VERSION,
+ _ANDROID_NDK_API_VERSION,
+ _ANDROID_BUILD_TOOLS_VERSION,
+ _ANDROID_NDK_HOME,
+ _ANDROID_SDK_HOME,
+ ],
+)
+"""Writes Android SDK and NDK rules.
+
+Add the following to your WORKSPACE FILE:
+
+```python
+android_configure(name = "local_config_android")
+```
+
+Args:
+ name: A unique name for this workspace rule.
+"""
diff --git a/third_party/aws.BUILD b/third_party/aws.BUILD
index 2dc921933c..5426f79e46 100644
--- a/third_party/aws.BUILD
+++ b/third_party/aws.BUILD
@@ -46,6 +46,8 @@ cc_library(
"aws-cpp-sdk-core/source/utils/xml/**/*.cpp",
"aws-cpp-sdk-core/source/utils/crypto/*.cpp",
"aws-cpp-sdk-core/source/utils/crypto/factory/**/*.cpp",
+ "aws-cpp-sdk-kinesis/include/**/*.h",
+ "aws-cpp-sdk-kinesis/source/**/*.cpp",
"aws-cpp-sdk-s3/include/**/*.h",
"aws-cpp-sdk-s3/source/**/*.cpp",
]),
@@ -72,6 +74,7 @@ cc_library(
}),
includes = [
"aws-cpp-sdk-core/include/",
+ "aws-cpp-sdk-kinesis/include/",
"aws-cpp-sdk-s3/include/",
],
deps = [
diff --git a/third_party/clang_toolchain/BUILD b/third_party/clang_toolchain/BUILD
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/third_party/clang_toolchain/BUILD
diff --git a/third_party/clang_toolchain/cc_configure_clang.bzl b/third_party/clang_toolchain/cc_configure_clang.bzl
new file mode 100644
index 0000000000..0778c43c53
--- /dev/null
+++ b/third_party/clang_toolchain/cc_configure_clang.bzl
@@ -0,0 +1,27 @@
+""" Downloads clang and configures the crosstool using bazel's autoconf."""
+
+load("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_autoconf_impl")
+load(":download_clang.bzl", "download_clang")
+
+_TF_DOWNLOAD_CLANG = "TF_DOWNLOAD_CLANG"
+_TF_NEED_CUDA = "TF_NEED_CUDA"
+
+def _cc_clang_autoconf(repo_ctx):
+ if repo_ctx.os.environ.get(_TF_DOWNLOAD_CLANG) != "1":
+ return
+ if repo_ctx.os.environ.get(_TF_NEED_CUDA) == "1":
+ # Clang is handled separately for CUDA configs.
+ # See cuda_configure.bzl for more details.
+ return
+
+ download_clang(repo_ctx, out_folder = "extra_tools")
+ overriden_tools = {"gcc": "extra_tools/bin/clang"}
+ cc_autoconf_impl(repo_ctx, overriden_tools)
+
+cc_download_clang_toolchain = repository_rule(
+ environ = [
+ _TF_DOWNLOAD_CLANG,
+ _TF_NEED_CUDA,
+ ],
+ implementation = _cc_clang_autoconf,
+)
diff --git a/third_party/clang_toolchain/download_clang.bzl b/third_party/clang_toolchain/download_clang.bzl
new file mode 100644
index 0000000000..e782739661
--- /dev/null
+++ b/third_party/clang_toolchain/download_clang.bzl
@@ -0,0 +1,60 @@
+""" Helpers to download a recent clang release."""
+
+def _get_platform_folder(os_name):
+ os_name = os_name.lower()
+ if os_name.startswith("windows"):
+ return "Win"
+ if os_name.startswith("mac os"):
+ return "Mac"
+ if not os_name.startswith("linux"):
+ fail("Unknown platform")
+ return "Linux_x64"
+
+def _download_chromium_clang(
+ repo_ctx,
+ platform_folder,
+ package_version,
+ sha256,
+ out_folder):
+ cds_url = "https://commondatastorage.googleapis.com/chromium-browser-clang"
+ cds_file = "clang-%s.tgz" % package_version
+ cds_full_url = "{0}/{1}/{2}".format(cds_url, platform_folder, cds_file)
+ repo_ctx.download_and_extract(cds_full_url, output = out_folder, sha256 = sha256)
+
+def download_clang(repo_ctx, out_folder):
+ """ Download a fresh clang release and put it into out_folder.
+
+ Clang itself will be located in 'out_folder/bin/clang'.
+ We currently download one of the latest releases of clang by the
+ Chromium project (see
+ https://chromium.googlesource.com/chromium/src/+/master/docs/clang.md).
+
+ Args:
+ repo_ctx: An instance of repository_context object.
+ out_folder: A folder to extract the compiler into.
+ """
+ # TODO(ibiryukov): we currently download and extract some extra tools in the
+ # clang release (e.g., sanitizers). We should probably remove the ones
+ # we don't need and document the ones we want provide in addition to clang.
+
+ # Latest CLANG_REVISION and CLANG_SUB_REVISION of the Chromiums's release
+ # can be found in https://chromium.googlesource.com/chromium/src/tools/clang/+/master/scripts/update.py
+ CLANG_REVISION = "340427"
+ CLANG_SUB_REVISION = 1
+
+ package_version = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION)
+
+ checksums = {
+ "Linux_x64": "8a8f21fb624fc7be7e91e439a13114847185375bb932db51ba590174ecaf764b",
+ "Mac": "ba894536b7c8d37103a5ddba784f268d55e65bb2ea1200a2cf9f2ef1590eaacd",
+ "Win": "c3f5bd977266dfd011411c94a13e00974b643b70fb0225a5fb030f7f703fa474",
+ }
+
+ platform_folder = _get_platform_folder(repo_ctx.os.name)
+ _download_chromium_clang(
+ repo_ctx,
+ platform_folder,
+ package_version,
+ checksums[platform_folder],
+ out_folder,
+ )
diff --git a/third_party/curl.BUILD b/third_party/curl.BUILD
index 4def6f9489..c93fac6549 100644
--- a/third_party/curl.BUILD
+++ b/third_party/curl.BUILD
@@ -7,6 +7,7 @@ exports_files(["COPYING"])
CURL_WIN_COPTS = [
"/Iexternal/curl/lib",
+ "/DBUILDING_LIBCURL",
"/DHAVE_CONFIG_H",
"/DCURL_DISABLE_FTP",
"/DCURL_DISABLE_NTLM",
@@ -49,6 +50,8 @@ cc_library(
"lib/curl_addrinfo.c",
"lib/curl_addrinfo.h",
"lib/curl_base64.h",
+ "lib/curl_ctype.c",
+ "lib/curl_ctype.h",
"lib/curl_des.h",
"lib/curl_endian.h",
"lib/curl_fnmatch.c",
@@ -75,6 +78,7 @@ cc_library(
"lib/curl_sec.h",
"lib/curl_setup.h",
"lib/curl_setup_once.h",
+ "lib/curl_sha256.h",
"lib/curl_sspi.c",
"lib/curl_sspi.h",
"lib/curl_threads.c",
@@ -134,6 +138,8 @@ cc_library(
"lib/md5.c",
"lib/memdebug.c",
"lib/memdebug.h",
+ "lib/mime.c",
+ "lib/mime.h",
"lib/mprintf.c",
"lib/multi.c",
"lib/multihandle.h",
@@ -153,8 +159,8 @@ cc_library(
"lib/pop3.h",
"lib/progress.c",
"lib/progress.h",
- "lib/rawstr.c",
- "lib/rawstr.h",
+ "lib/rand.c",
+ "lib/rand.h",
"lib/rtsp.c",
"lib/rtsp.h",
"lib/security.c",
@@ -162,8 +168,11 @@ cc_library(
"lib/select.h",
"lib/sendf.c",
"lib/sendf.h",
+ "lib/setopt.c",
+ "lib/setopt.h",
"lib/setup-os400.h",
"lib/setup-vms.h",
+ "lib/sha256.c",
"lib/share.c",
"lib/share.h",
"lib/sigpipe.h",
@@ -179,10 +188,10 @@ cc_library(
"lib/splay.c",
"lib/splay.h",
"lib/ssh.h",
+ "lib/strcase.c",
+ "lib/strcase.h",
"lib/strdup.c",
"lib/strdup.h",
- "lib/strequal.c",
- "lib/strequal.h",
"lib/strerror.c",
"lib/strerror.h",
"lib/strtok.c",
@@ -234,28 +243,26 @@ cc_library(
"lib/vtls/darwinssl.c",
],
"@org_tensorflow//tensorflow:windows": CURL_WIN_SRCS,
- "@org_tensorflow//tensorflow:windows_msvc": CURL_WIN_SRCS,
"//conditions:default": [
"lib/vtls/openssl.c",
],
}),
hdrs = [
"include/curl/curl.h",
- "include/curl/curlbuild.h",
- "include/curl/curlrules.h",
"include/curl/curlver.h",
"include/curl/easy.h",
"include/curl/mprintf.h",
"include/curl/multi.h",
"include/curl/stdcheaders.h",
+ "include/curl/system.h",
"include/curl/typecheck-gcc.h",
],
copts = select({
"@org_tensorflow//tensorflow:windows": CURL_WIN_COPTS,
- "@org_tensorflow//tensorflow:windows_msvc": CURL_WIN_COPTS,
"//conditions:default": [
"-Iexternal/curl/lib",
"-D_GNU_SOURCE",
+ "-DBUILDING_LIBCURL",
"-DHAVE_CONFIG_H",
"-DCURL_DISABLE_FTP",
"-DCURL_DISABLE_NTLM", # turning it off in configure is not enough
@@ -271,10 +278,6 @@ cc_library(
# See curl.h for discussion of write size and Windows
"/DCURL_MAX_WRITE_SIZE=16384",
],
- "@org_tensorflow//tensorflow:windows_msvc": [
- # See curl.h for discussion of write size and Windows
- "/DCURL_MAX_WRITE_SIZE=16384",
- ],
"//conditions:default": [
"-DCURL_MAX_WRITE_SIZE=65536",
],
@@ -298,12 +301,6 @@ cc_library(
"-DEFAULTLIB:crypt32.lib",
"-DEFAULTLIB:Normaliz.lib",
],
- "@org_tensorflow//tensorflow:windows_msvc": [
- "-DEFAULTLIB:ws2_32.lib",
- "-DEFAULTLIB:advapi32.lib",
- "-DEFAULTLIB:crypt32.lib",
- "-DEFAULTLIB:Normaliz.lib",
- ],
"//conditions:default": [
"-lrt",
],
@@ -314,7 +311,6 @@ cc_library(
] + select({
"@org_tensorflow//tensorflow:ios": [],
"@org_tensorflow//tensorflow:windows": [],
- "@org_tensorflow//tensorflow:windows_msvc": [],
"//conditions:default": [
"@boringssl//:ssl",
],
@@ -417,7 +413,6 @@ cc_binary(
],
copts = select({
"@org_tensorflow//tensorflow:windows": CURL_BIN_WIN_COPTS,
- "@org_tensorflow//tensorflow:windows_msvc": CURL_BIN_WIN_COPTS,
"//conditions:default": [
"-Iexternal/curl/lib",
"-D_GNU_SOURCE",
@@ -676,6 +671,7 @@ genrule(
"# define SIZEOF_INT 4",
"# define SIZEOF_LONG 8",
"# define SIZEOF_OFF_T 8",
+ "# define SIZEOF_CURL_OFF_T 8",
"# define SIZEOF_SHORT 2",
"# define SIZEOF_SIZE_T 8",
"# define SIZEOF_TIME_T 8",
diff --git a/third_party/double_conversion.BUILD b/third_party/double_conversion.BUILD
new file mode 100644
index 0000000000..d875a1a2b5
--- /dev/null
+++ b/third_party/double_conversion.BUILD
@@ -0,0 +1,42 @@
+# Bazel(http://bazel.io) BUILD file
+
+licenses(["notice"])
+
+exports_files(["LICENSE"])
+
+config_setting(
+ name = "windows",
+ values = {"cpu": "x64_windows"},
+)
+
+cc_library(
+ name = "double-conversion",
+ srcs = [
+ "double-conversion/bignum.cc",
+ "double-conversion/bignum-dtoa.cc",
+ "double-conversion/cached-powers.cc",
+ "double-conversion/diy-fp.cc",
+ "double-conversion/double-conversion.cc",
+ "double-conversion/fast-dtoa.cc",
+ "double-conversion/fixed-dtoa.cc",
+ "double-conversion/strtod.cc",
+ "double-conversion/utils.h",
+ ],
+ hdrs = [
+ "double-conversion/bignum.h",
+ "double-conversion/bignum-dtoa.h",
+ "double-conversion/cached-powers.h",
+ "double-conversion/diy-fp.h",
+ "double-conversion/double-conversion.h",
+ "double-conversion/fast-dtoa.h",
+ "double-conversion/fixed-dtoa.h",
+ "double-conversion/ieee.h",
+ "double-conversion/strtod.h",
+ ],
+ includes = ["."],
+ linkopts = select({
+ ":windows": [],
+ "//conditions:default": ["-lm"],
+ }),
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/eigen.BUILD b/third_party/eigen.BUILD
index 07bb6645eb..759f8a9be9 100644
--- a/third_party/eigen.BUILD
+++ b/third_party/eigen.BUILD
@@ -64,7 +64,14 @@ cc_library(
# This define (mostly) guarantees we don't link any problematic
# code. We use it, but we do not rely on it, as evidenced above.
"EIGEN_MPL2_ONLY",
+ "EIGEN_MAX_ALIGN_BYTES=64",
],
includes = ["."],
visibility = ["//visibility:public"],
)
+
+filegroup(
+ name = "eigen_header_files",
+ srcs = EIGEN_MPL2_HEADER_FILES,
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/eigen3/BUILD b/third_party/eigen3/BUILD
index f661093bc9..f072f2545a 100644
--- a/third_party/eigen3/BUILD
+++ b/third_party/eigen3/BUILD
@@ -17,21 +17,23 @@ load("//tensorflow:tensorflow.bzl", "if_mkl")
# INTEL_MKL end
load("//tensorflow:tensorflow.bzl", "if_mkl")
+EIGEN3_THIRD_PARTY_HEADERS = [
+ "Eigen/Core",
+ "Eigen/LU",
+ "Eigen/Cholesky",
+ "Eigen/Eigenvalues",
+ "Eigen/QR",
+ "Eigen/SVD",
+ "unsupported/Eigen/MatrixFunctions",
+ "unsupported/Eigen/SpecialFunctions",
+ "unsupported/Eigen/CXX11/ThreadPool",
+ "unsupported/Eigen/CXX11/Tensor",
+ "unsupported/Eigen/CXX11/FixedPoint",
+] + glob(["unsupported/Eigen/CXX11/src/FixedPoint/*.h"])
+
cc_library(
name = "eigen3",
- hdrs = glob(["unsupported/Eigen/CXX11/src/FixedPoint/*.h"]) + [
- "Eigen/Core",
- "Eigen/LU",
- "Eigen/Cholesky",
- "Eigen/Eigenvalues",
- "Eigen/QR",
- "Eigen/SVD",
- "unsupported/Eigen/MatrixFunctions",
- "unsupported/Eigen/SpecialFunctions",
- "unsupported/Eigen/CXX11/ThreadPool",
- "unsupported/Eigen/CXX11/Tensor",
- "unsupported/Eigen/CXX11/FixedPoint",
- ],
+ hdrs = EIGEN3_THIRD_PARTY_HEADERS,
includes = if_mkl(["./mkl_include"]),
visibility = ["//visibility:public"],
deps = [
@@ -48,3 +50,29 @@ filegroup(
),
visibility = ["//tensorflow:__subpackages__"],
)
+
+filegroup(
+ name = "eigen_third_party_header_files",
+ srcs = EIGEN3_THIRD_PARTY_HEADERS,
+ visibility = ["//visibility:public"],
+)
+
+genrule(
+ name = "install_eigen_headers",
+ srcs = [
+ "@eigen_archive//:eigen_header_files",
+ ":eigen_third_party_header_files",
+ ],
+ outs = ["include"],
+ cmd = """
+ mkdir $@
+ for f in $(SRCS); do
+ d="$${f%/*}"
+ d="$${d#*external/eigen_archive/}"
+
+ mkdir -p "$@/$${d}"
+ cp "$${f}" "$@/$${d}/"
+ done
+ """,
+ tags = ["manual"],
+)
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/Core b/third_party/eigen3/unsupported/Eigen/CXX11/Core
deleted file mode 100644
index 1b3690716c..0000000000
--- a/third_party/eigen3/unsupported/Eigen/CXX11/Core
+++ /dev/null
@@ -1,46 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2013 Christian Seiler <christian@iwakd.de>
-// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla
-// Public License v. 2.0. If a copy of the MPL was not distributed
-// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#ifndef EIGEN_CXX11_CORE_MODULE
-#define EIGEN_CXX11_CORE_MODULE
-
-#include <Eigen/Core>
-
-#include <Eigen/src/Core/util/DisableStupidWarnings.h>
-
-/** \defgroup CXX11_Core_Module C++11 Core Module
- *
- * This module provides common core features for all modules that
- * explicitly depend on C++11. Currently, this is only the Tensor
- * module. Note that at this stage, you should not need to include
- * this module directly.
- *
- * It also provides a limited fallback for compilers that don't support
- * CXX11 yet, such as nvcc.
- *
- * \code
- * #include <Eigen/CXX11/Core>
- * \endcode
- */
-
-// Only a subset of cxx11 is allowed at Google, so we default to emulate the
-// cxx11 functionality that we need.
-#include "src/Core/util/FixedSizeVector.h"
-#if 1
-#include <vector>
-#include "src/Core/util/EmulateCXX11Meta.h"
-#else
-#include "src/Core/util/CXX11Workarounds.h"
-#include "src/Core/util/CXX11Meta.h"
-#endif
-#include <Eigen/src/Core/util/ReenableStupidWarnings.h>
-
-#endif // EIGEN_CXX11_CORE_MODULE
-
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/NeuralNetworks b/third_party/eigen3/unsupported/Eigen/CXX11/NeuralNetworks
deleted file mode 100644
index 7741b68d8a..0000000000
--- a/third_party/eigen3/unsupported/Eigen/CXX11/NeuralNetworks
+++ /dev/null
@@ -1,35 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla
-// Public License v. 2.0. If a copy of the MPL was not distributed
-// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#ifndef EIGEN_CXX11_NEURAL_NETWORKS_MODULE
-#define EIGEN_CXX11_NEURAL_NETWORKS_MODULE
-
-#include "unsupported/Eigen/CXX11/Tensor"
-
-/** \defgroup CXX11_NeuralNetworks_Module Neural Networks Module
- *
- * This module provides an efficient implementation of the common primitives
- * used by neural networks.
- * The primitives are built on top of the tensor library.
- *
- * \code
- * #include <Eigen/CXX11/NeuralNetworks>
- * \endcode
- */
-
-#include "unsupported/Eigen/CXX11/src/NeuralNetworks/Activations.h"
-#include "unsupported/Eigen/CXX11/src/NeuralNetworks/Attention.h"
-#include "unsupported/Eigen/CXX11/src/NeuralNetworks/Pooling.h"
-#include "unsupported/Eigen/CXX11/src/NeuralNetworks/SoftMax.h"
-#include "unsupported/Eigen/CXX11/src/NeuralNetworks/BackwardCuboidConvolutions.h"
-#include "unsupported/Eigen/CXX11/src/NeuralNetworks/CuboidConvolution.h"
-#include "unsupported/Eigen/CXX11/src/NeuralNetworks/BackwardSpatialConvolutions.h"
-#include "unsupported/Eigen/CXX11/src/NeuralNetworks/SpatialConvolutions.h"
-
-#endif // EIGEN_CXX11_NEURAL_NETWORKS_MODULE
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/FixedPointTypes.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/FixedPointTypes.h
index 6b625abc3e..5ab3664918 100644
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/FixedPointTypes.h
+++ b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/FixedPointTypes.h
@@ -7,8 +7,8 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef EIGEN_CXX11_FIXED_POINT_TYPES_H
-#define EIGEN_CXX11_FIXED_POINT_TYPES_H
+#ifndef CXX11_SRC_FIXEDPOINT_FIXEDPOINTTYPES_H_
+#define CXX11_SRC_FIXEDPOINT_FIXEDPOINTTYPES_H_
#include <cmath>
#include <iostream>
@@ -339,4 +339,4 @@ EIGEN_STRONG_INLINE std::ostream& operator<<(std::ostream& os, QInt32 a) {
} // namespace Eigen
-#endif // EIGEN_CXX11_FIXED_POINT_TYPES_H
+#endif // CXX11_SRC_FIXEDPOINT_FIXEDPOINTTYPES_H_
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProduct.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProduct.h
index 4d0dca07df..e6f4080ae1 100644
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProduct.h
+++ b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProduct.h
@@ -7,9 +7,8 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef EIGEN_CXX11_FIXED_POINT_MAT_MAT_PRODUCT_H
-#define EIGEN_CXX11_FIXED_POINT_MAT_MAT_PRODUCT_H
-
+#ifndef CXX11_SRC_FIXEDPOINT_MATMATPRODUCT_H_
+#define CXX11_SRC_FIXEDPOINT_MATMATPRODUCT_H_
namespace Eigen {
namespace internal {
@@ -24,6 +23,14 @@ template<> struct scalar_product_traits<QInt8, QInt8>
typedef QInt32 ReturnType;
};
+// Accumulate the product of 2 QInt16 inputs on 32 bits to prevent
+// overflows
+template <>
+struct scalar_product_traits<QInt16, QInt16> {
+ enum { Defined = 1 };
+ typedef QInt32 ReturnType;
+};
+
// Accumulate the product of QInt8 inputs with QUint8 inputs on 32 bits
// to prevent overflows
template<> struct scalar_product_traits<QInt8, QUInt8>
@@ -247,9 +254,76 @@ void gebp_kernel<QUInt8, QInt8, Index, DataMapper, mr, nr, ConjugateLhs, Conjuga
}
#endif
-} // namespace internal
-} // namespace Eigen
+#ifndef EIGEN_USE_OPTIMIZED_INT16_INT16_MAT_MAT_PRODUCT
+
+template <bool _ConjLhs, bool _ConjRhs>
+class gebp_traits<QInt16, QInt16, _ConjLhs, _ConjRhs> {
+ public:
+ typedef QInt16 LhsScalar;
+ typedef QInt16 RhsScalar;
+ typedef QInt32 ResScalar;
+
+ enum {
+ // register block size along the M and N directions
+ // One for the current implementation
+ nr = 1,
+ mr = 1,
+ // Progress made at each iteration of the product loop
+ // also 1 for the current implementation
+ LhsProgress = 1,
+ RhsProgress = 1
+ };
+};
+
+// The signed 16bit Mat-Mat product itself.
+template <typename Index, typename DataMapper, int mr, int nr,
+ bool ConjugateLhs, bool ConjugateRhs>
+struct gebp_kernel<QInt16, QInt16, Index, DataMapper, mr, nr, ConjugateLhs,
+ ConjugateRhs> {
+ EIGEN_DONT_INLINE
+ void operator()(const DataMapper& res, const QInt16* blockA,
+ const QInt16* blockB, Index rows, Index depth, Index cols,
+ QInt32 alpha, Index strideA = -1, Index strideB = -1,
+ Index offsetA = 0, Index offsetB = 0);
+};
+
+template <typename Index, typename DataMapper, int mr, int nr,
+ bool ConjugateLhs, bool ConjugateRhs>
+EIGEN_DONT_INLINE void gebp_kernel<QInt16, QInt16, Index, DataMapper, mr, nr,
+ ConjugateLhs, ConjugateRhs>::
+operator()(const DataMapper& res, const QInt16* blockA, const QInt16* blockB,
+ Index rows, Index depth, Index cols, QInt32 alpha, Index strideA,
+ Index strideB, Index offsetA, Index offsetB) {
+ EIGEN_STATIC_ASSERT(!ConjugateLhs, YOU_MADE_A_PROGRAMMING_MISTAKE);
+ EIGEN_STATIC_ASSERT(!ConjugateRhs, YOU_MADE_A_PROGRAMMING_MISTAKE);
+ eigen_assert(alpha.value == 1);
+ eigen_assert(strideA == -1);
+ eigen_assert(strideB == -1);
+ eigen_assert(offsetA == 0);
+ eigen_assert(offsetB == 0);
+
+ eigen_assert(rows > 0);
+ eigen_assert(cols > 0);
+ eigen_assert(depth > 0);
+ eigen_assert(blockA);
+ eigen_assert(blockB);
+
+ for (Index j = 0; j < cols; ++j) {
+ Index startB = j * depth;
+ for (Index i = 0; i < rows; ++i) {
+ Index startA = i * depth;
+
+ for (Index k = 0; k < depth; ++k) {
+ res(i, j) += blockA[startA + k] * blockB[startB + k];
+ }
+ }
+ }
+}
+#endif
+
+} // namespace internal
+} // namespace Eigen
-#endif // EIGEN_CXX11_FIXED_POINT_MAT_MAT_PRODUCT_H
+#endif // CXX11_SRC_FIXEDPOINT_MATMATPRODUCT_H_
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProductAVX2.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProductAVX2.h
index 6b4b0edcfb..66532fb600 100644
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProductAVX2.h
+++ b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProductAVX2.h
@@ -3,18 +3,494 @@
//
// Copyright (C) 2015 Benoit Steiner <benoit.steiner.goog@gmail.com>
// Copyright (C) 2015 Matthew Sarett <msarett@google.com>
+// Copyright (C) 2016 Nishant Patil <nishantpatil@google.com>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef EIGEN_CXX11_FIXED_POINT_MAT_MAT_PRODUCT_AVX2_H
-#define EIGEN_CXX11_FIXED_POINT_MAT_MAT_PRODUCT_AVX2_H
+#ifndef CXX11_SRC_FIXEDPOINT_MATMATPRODUCTAVX2_H_
+#define CXX11_SRC_FIXEDPOINT_MATMATPRODUCTAVX2_H_
namespace Eigen {
namespace internal {
// AVX2 optimized implementation of Mat-Mat product.
+// LHS is encoded using signed 16-bit integers.
+// RHS is encoded using signed 16-bit integers.
+#ifdef EIGEN_USE_OPTIMIZED_INT16_INT16_MAT_MAT_PRODUCT
+
+// Define quantized traits
+template <bool _ConjLhs, bool _ConjRhs>
+class gebp_traits<QInt16, QInt16, _ConjLhs, _ConjRhs> {
+ public:
+ typedef QInt16 LhsScalar;
+ typedef QInt16 RhsScalar;
+ typedef QInt32 ResScalar;
+
+ enum {
+ // Define register blocking scheme.
+ nr = 16,
+ mr = 16,
+ kr = 4,
+ // Ignore progress tracking per loop iteration.
+ LhsProgress = -1,
+ RhsProgress = -1
+ };
+};
+
+// Specialized blocking for quantized implementations.
+// Used by TensorContractionThreadPool, inputs must have dimensions that are
+// multiples of 32.
+template <typename Index, int ShardingType>
+class TensorContractionBlocking<QInt16, QInt16, Index, ShardingType> {
+ public:
+ TensorContractionBlocking(Index k, Index m, Index n, Index num_threads = 1)
+ : kc_(((k + 15) / 16) * 16),
+ mc_(((m + 15) / 16) * 16),
+ nc_(((n + 15) / 16) * 16) {
+ eigen_assert(mc_ % 16 == 0);
+ eigen_assert(kc_ % 16 == 0);
+ if (!k || !m || !n) {
+ return;
+ }
+
+ if (ShardingType == ShardByCol) {
+ eigen_assert(nc_ % 16 == 0);
+ nc_ = (((nc_ / num_threads) + 15) / 16) * 16;
+ } else {
+ eigen_assert(nc_ % 16 == 0);
+ mc_ = (((mc_ / num_threads) + 15) / 16) * 16;
+ }
+ }
+
+ EIGEN_ALWAYS_INLINE Index kc() const { return kc_; }
+ EIGEN_ALWAYS_INLINE Index mc() const { return mc_; }
+ EIGEN_ALWAYS_INLINE Index nc() const { return nc_; }
+
+ private:
+ Index kc_;
+ Index mc_;
+ Index nc_;
+};
+
+// Specialized blocking for quantized implementations.
+// Used by TensorContraction and GeneralMatrixMatrix, inputs are padded to
+// multiples of 32.
+template <int MaxRows, int MaxCols, int MaxDepth, int KcFactor>
+class gemm_blocking_space<ColMajor, QInt16, QInt16, MaxRows, MaxCols, MaxDepth,
+ KcFactor, false>
+ : public level3_blocking<QInt16, QInt16> {
+ DenseIndex m_sizeA;
+ DenseIndex m_sizeB;
+
+ public:
+ gemm_blocking_space(DenseIndex rows, DenseIndex cols, DenseIndex depth,
+ DenseIndex /*num_threads*/, bool /*l3_blocking*/) {
+ this->m_mc = ((rows + 15) / 16) * 16;
+ this->m_nc = ((cols + 15) / 16) * 16;
+ this->m_kc = ((depth + 15) / 16) * 16;
+ m_sizeA = this->m_mc * this->m_kc;
+ m_sizeB = this->m_kc * this->m_nc;
+ }
+ void allocateA() {
+ if (this->m_blockA == 0) this->m_blockA = aligned_new<QInt16>(m_sizeA);
+ }
+ void allocateB() {
+ if (this->m_blockB == 0) this->m_blockB = aligned_new<QInt16>(m_sizeB);
+ }
+ void allocateAll() {
+ allocateA();
+ allocateB();
+ }
+ ~gemm_blocking_space() {
+ aligned_delete(this->m_blockA, m_sizeA);
+ aligned_delete(this->m_blockB, m_sizeB);
+ }
+};
+
+// Below are the fully optimized versions that are correct only for sizes that
+// are multiple of 16. It is about a 10% performance benefit to keep these
+// implementations separate.
+
+// Arrange a block of the left input matrix in contiguous memory.
+//
+// Given column major input (A0 beside A1 in memory):
+// A0 B0 C0 D0 E0 F0 G0 H0 ...
+// A1 B1 C1 D1 E1 F1 G1 H1 ...
+// A2 B2 C2 D2 E2 F2 G2 H2 ...
+// A3 B3 C3 D3 E3 F3 G3 H3 ...
+// A4 B4 C4 D4 E4 F4 G4 H4 ...
+// A5 B5 C5 D5 E5 F5 G5 H5 ...
+// A6 B6 C6 D6 E6 F6 G6 H6 ...
+// A7 B7 C7 D7 E7 F7 G7 H7 ...
+// A8 ...
+// ...
+//
+// Packing with m = 8 yields row major output (A0 beside B0 in memory):
+// A0 B0
+// A1 B1
+// A2 B2
+// A3 B3
+// A4 B4
+// A5 B5
+// A6 B6
+// A7 B7
+// ...
+//
+// The purpose is to collect m rows of size k. Two elements of the same
+// row are arranged contiguously because madd performs an adjacent addition
+// in the kernel.
+
+template <typename Index, typename DataMapper, int Pack1, int Pack2,
+ bool Conjugate, bool PanelMode>
+struct gemm_pack_lhs<QInt16, Index, DataMapper, Pack1, Pack2, ColMajor,
+ Conjugate, PanelMode> {
+ EIGEN_DONT_INLINE void operator()(QInt16* blockA, const DataMapper& lhs,
+ Index depth, Index rows, Index stride = 0,
+ Index offset = 0);
+};
+
+template <typename Index, typename DataMapper, int Pack1, int Pack2,
+ bool Conjugate, bool PanelMode>
+EIGEN_DONT_INLINE void gemm_pack_lhs<QInt16, Index, DataMapper, Pack1, Pack2,
+ ColMajor, Conjugate, PanelMode>::
+operator()(QInt16* blockA, const DataMapper& lhs, Index depth, Index rows,
+ Index stride, Index offset) {
+ eigen_assert(stride == 0);
+ eigen_assert(offset == 0);
+
+ // Use alternate function for weird sizes
+ if (rows % 16 != 0 || depth % 16 != 0) {
+ assert(false &&
+ "only depths and rows that are a multiple of 16 are currently "
+ "supported");
+ // gemm_pack_lhs_any<QInt16, Index, DataMapper, Pack1, Pack2, ColMajor,
+ // Conjugate, PanelMode> lhs_pack;
+ // return lhs_pack(blockA, lhs, depth, rows, stride, offset);
+ }
+
+ // Get vector pointer
+ __m256i* blockA_256 = reinterpret_cast<__m256i*>(blockA);
+
+ // Pack rows in sets of 16
+ for (Index m = 0; m < rows; m += 16) {
+ // Pack depth in sets of 4
+ for (Index k = 0; k < depth; k += 4) {
+ // Load vectors
+ __m256i L_A = lhs.loadPacket(m, k);
+ __m256i L_B = lhs.loadPacket(m, k + 1);
+ __m256i L_C = lhs.loadPacket(m, k + 2);
+ __m256i L_D = lhs.loadPacket(m, k + 3);
+
+ // Rearrange the inputs as required by the kernel
+ __m256i L_AB0_AB7 = _mm256_unpacklo_epi16(L_A, L_B);
+ __m256i L_AB8_AB15 = _mm256_unpackhi_epi16(L_A, L_B);
+ __m256i L_CD0_CD7 = _mm256_unpacklo_epi16(L_C, L_D);
+ __m256i L_CD8_CD15 = _mm256_unpackhi_epi16(L_C, L_D);
+
+ __m256i L_AD0 = _mm256_permute2x128_si256(L_AB0_AB7, L_AB8_AB15, 0x20);
+ _mm256_store_si256(blockA_256++, L_AD0);
+ __m256i L_AD8 = _mm256_permute2x128_si256(L_CD0_CD7, L_CD8_CD15, 0x20);
+ _mm256_store_si256(blockA_256++, L_AD8);
+ __m256i L_AD16 = _mm256_permute2x128_si256(L_AB0_AB7, L_AB8_AB15, 0x31);
+ _mm256_store_si256(blockA_256++, L_AD16);
+ __m256i L_AD24 = _mm256_permute2x128_si256(L_CD0_CD7, L_CD8_CD15, 0x31);
+ _mm256_store_si256(blockA_256++, L_AD24);
+ }
+ }
+}
+
+// Arrange a block of the right input matrix in contiguous memory.
+//
+// Given column major input (A0 beside A1 in memory):
+// A0 B0 C0 D0 E0 F0 G0 H0 ...
+// A1 B1 C1 D1 E1 F1 G1 H1 ...
+// A2 B2 C2 D2 E2 F2 G2 H2 ...
+// A3 B3 C3 D3 E3 F3 G3 H3 ...
+// A4 B4 C4 D4 E4 F4 G4 H4 ...
+// A5 B5 C5 D5 E5 F5 G5 H5 ...
+// A6 B6 C6 D6 E6 F6 G6 H6 ...
+// A7 B7 C7 D7 E7 F7 G7 H7 ...
+// A8 ...
+// ...
+// Packing yields row major output (A0 beside A1 in memory):
+// A0 A1 A2 A3 A4 A5 A6 A7
+// B0 B1 B2 B3 B4 B5 B6 B7
+// ...
+//
+// At least two elements of the same col are arranged contiguously because
+// maddubs and madd both perform an adjacent addition in the kernel. We can
+// save work by leaving 4 adjacent elements because kr = 4.
+// The purpose is to collect n cols of size k. Two elements of the same
+// col are arranged contiguously because madd performs an adjacent addition
+// in the kernel.
+template <typename Index, typename DataMapper, int nr, bool Conjugate,
+ bool PanelMode>
+struct gemm_pack_rhs<QInt16, Index, DataMapper, nr, ColMajor, Conjugate,
+ PanelMode> {
+ EIGEN_DONT_INLINE void operator()(QInt16* blockB, const DataMapper& rhs,
+ Index depth, Index cols, Index stride = 0,
+ Index offset = 0);
+};
+
+template <typename Index, typename DataMapper, int nr, bool Conjugate,
+ bool PanelMode>
+EIGEN_DONT_INLINE void
+gemm_pack_rhs<QInt16, Index, DataMapper, nr, ColMajor, Conjugate, PanelMode>::
+operator()(QInt16* blockB, const DataMapper& rhs, Index depth, Index cols,
+ Index stride, Index offset) {
+ eigen_assert(stride == 0);
+ eigen_assert(offset == 0);
+
+ // Use alternate function for weird sizes
+ if (cols % 16 != 0 || depth % 16 != 0) {
+ assert(false &&
+ "only depths and cols that are a multiple of 16 are currently "
+ "supported");
+ // gemm_pack_rhs_any<QInt16, Index, DataMapper, nr, ColMajor, Conjugate,
+ // PanelMode> rhs_pack;
+ // return rhs_pack(blockB, rhs, depth, cols, stride, offset);
+ }
+
+ // Get vector pointer
+ __m256i* blockB_256 = reinterpret_cast<__m256i*>(blockB);
+
+ // Perform a step of the packing for 4 columns
+ __m256i R_AB_L, R_AB_H, R_CD_L, R_CD_H, R_AD_0, R_AD_4, R_AD_8, R_AD_12;
+#define PACK_STEP \
+ R_AB_L = _mm256_unpacklo_epi64(R_A, R_B); \
+ R_CD_L = _mm256_unpacklo_epi64(R_C, R_D); \
+ R_AB_H = _mm256_unpackhi_epi64(R_A, R_B); \
+ R_CD_H = _mm256_unpackhi_epi64(R_C, R_D); \
+ R_AD_0 = _mm256_permute2x128_si256(R_AB_L, R_CD_L, 0x20); \
+ R_AD_8 = _mm256_permute2x128_si256(R_AB_L, R_CD_L, 0x31); \
+ R_AD_4 = _mm256_permute2x128_si256(R_AB_H, R_CD_H, 0x20); \
+ R_AD_12 = _mm256_permute2x128_si256(R_AB_H, R_CD_H, 0x31); \
+ _mm256_store_si256(blockB_256, R_AD_0); \
+ _mm256_store_si256(blockB_256 + 4, R_AD_4); \
+ _mm256_store_si256(blockB_256 + 8, R_AD_8); \
+ _mm256_store_si256(blockB_256 + 12, R_AD_12); \
+ blockB_256++;
+
+ // Pack cols in sets of 16
+ for (Index n = 0; n < cols; n += 16) {
+ // Pack depth in sets of 16
+ for (Index k = 0; k < depth; k += 16) {
+ __m256i R_A = rhs.loadPacket(k, n);
+ __m256i R_B = rhs.loadPacket(k, n + 1);
+ __m256i R_C = rhs.loadPacket(k, n + 2);
+ __m256i R_D = rhs.loadPacket(k, n + 3);
+ PACK_STEP;
+
+ R_A = rhs.loadPacket(k, n + 4);
+ R_B = rhs.loadPacket(k, n + 5);
+ R_C = rhs.loadPacket(k, n + 6);
+ R_D = rhs.loadPacket(k, n + 7);
+ PACK_STEP;
+
+ R_A = rhs.loadPacket(k, n + 8);
+ R_B = rhs.loadPacket(k, n + 9);
+ R_C = rhs.loadPacket(k, n + 10);
+ R_D = rhs.loadPacket(k, n + 11);
+ PACK_STEP;
+
+ R_A = rhs.loadPacket(k, n + 12);
+ R_B = rhs.loadPacket(k, n + 13);
+ R_C = rhs.loadPacket(k, n + 14);
+ R_D = rhs.loadPacket(k, n + 15);
+ PACK_STEP;
+
+ blockB_256 += 12;
+ }
+ }
+#undef PACK_STEP
+}
+
+// Perform the actual multiplication on packed inputs
+template <typename Index, typename DataMapper, int mr, int nr,
+ bool ConjugateLhs, bool ConjugateRhs>
+struct gebp_kernel<QInt16, QInt16, Index, DataMapper, mr, nr, ConjugateLhs,
+ ConjugateRhs> {
+ typedef typename DataMapper::LinearMapper LinearMapper;
+
+ EIGEN_DONT_INLINE
+ void operator()(const DataMapper& res, const QInt16* blockA,
+ const QInt16* blockB, Index rows, Index depth, Index cols,
+ QInt32 alpha, Index strideA = -1, Index strideB = -1,
+ Index offsetA = 0, Index offsetB = 0);
+};
+
+template <typename Index, typename DataMapper, int mr, int nr,
+ bool ConjugateLhs, bool ConjugateRhs>
+EIGEN_DONT_INLINE void gebp_kernel<QInt16, QInt16, Index, DataMapper, mr, nr,
+ ConjugateLhs, ConjugateRhs>::
+operator()(const DataMapper& res, const QInt16* blockA, const QInt16* blockB,
+ Index rows, Index depth, Index cols, QInt32 alpha, Index strideA,
+ Index strideB, Index offsetA, Index offsetB) {
+ EIGEN_STATIC_ASSERT(!ConjugateLhs, YOU_MADE_A_PROGRAMMING_MISTAKE);
+ EIGEN_STATIC_ASSERT(!ConjugateRhs, YOU_MADE_A_PROGRAMMING_MISTAKE);
+ eigen_assert(alpha.value == 1);
+ eigen_assert(strideA == -1);
+ eigen_assert(strideB == -1);
+ eigen_assert(offsetA == 0);
+ eigen_assert(offsetB == 0);
+ eigen_assert(rows > 0);
+ eigen_assert(cols > 0);
+ eigen_assert(depth > 0);
+ eigen_assert(blockA);
+ eigen_assert(blockB);
+
+ // Use alternate function for weird sizes
+ if (rows % 16 != 0 || cols % 16 != 0 || depth % 16 != 0) {
+ assert(false &&
+ "only depths, cols and rows that are a multiple of 16 are currently "
+ "supported");
+ // gebp_kernel_any<QInt16, QInt16, Index, DataMapper, mr, nr, ConjugateLhs,
+ // ConjugateRhs> gebp;
+ // return gebp(res, blockA, blockB, rows, depth, cols, alpha, strideA,
+ // strideB, offsetA, offsetB);
+ }
+
+ // Create result block
+ QInt32* blockO = aligned_new<QInt32>(16 * 16);
+ memset(blockO, 0, 16 * 16 * sizeof(QInt32));
+
+ // Get vectorized pointers
+ __m256i* blockO_256 = reinterpret_cast<__m256i*>(blockO);
+ const __m256i* blockA_256 = reinterpret_cast<const __m256i*>(blockA);
+ const __m256i* blockB_256 = reinterpret_cast<const __m256i*>(blockB);
+
+ // Loop over blocks of 16 columns
+ for (Index n = 0; n < cols; n += 16) {
+ // Reset index into blockA
+ Index indexL = 0;
+ // Loop over blocks of 16 rows
+ for (Index m = 0; m < rows; m += 16) {
+ // Reset index into blockB
+ Index indexR = n / 16 * depth;
+ // Loop over blocks of 4 on depth
+ for (Index k = 0; k < depth; k += 4) {
+ // Load inputs
+ __m256i L_AD0 = blockA_256[indexL++];
+ __m256i L_AD8 = blockA_256[indexL++];
+ __m256i L_EH0 = blockA_256[indexL++];
+ __m256i L_EH8 = blockA_256[indexL++];
+
+ __m256i R_AH0 = blockB_256[indexR++];
+ __m256i R_AH4 = blockB_256[indexR++];
+ __m256i R_AH8 = blockB_256[indexR++];
+ __m256i R_AH12 = blockB_256[indexR++];
+
+ // Declare variables used in COMPUTE_STEP
+ __m256i P_32_A, P_32_B, P_32;
+
+#define COMPUTE_STEP(R_INPUT_A, R_INPUT_B, OFFSET) \
+ P_32_A = _mm256_madd_epi16(R_INPUT_A, L_AD0); \
+ P_32_B = _mm256_madd_epi16(R_INPUT_B, L_AD8); \
+ P_32 = _mm256_add_epi32(P_32_A, P_32_B); \
+ _mm256_store_si256( \
+ blockO_256 + 2 * OFFSET, \
+ _mm256_add_epi32(_mm256_load_si256(blockO_256 + 2 * OFFSET), P_32)); \
+ \
+ P_32_A = _mm256_madd_epi16(R_INPUT_A, L_EH0); \
+ P_32_B = _mm256_madd_epi16(R_INPUT_B, L_EH8); \
+ P_32 = _mm256_add_epi32(P_32_A, P_32_B); \
+ _mm256_store_si256( \
+ blockO_256 + 2 * OFFSET + 1, \
+ _mm256_add_epi32(_mm256_load_si256(blockO_256 + 2 * OFFSET + 1), P_32));
+
+ // Permute and shuffle to copy a single value across the entire vector
+ // Then compute the multiplication
+ // Replicate lower 128-bits of R_AH0 across both lanes
+ __m256i R_AH0_ = _mm256_permute2x128_si256(R_AH0, R_AH0, 0x00);
+ // Copy first two elements of R_AH0 across entire vector
+ __m256i R_AD0 = _mm256_shuffle_epi32(R_AH0_, 0x00);
+ // Copy second two elements of R_AH0 across entire vector
+ __m256i R_EH0 = _mm256_shuffle_epi32(R_AH0_, 0x55);
+
+ COMPUTE_STEP(R_AD0, R_EH0, 0);
+ __m256i R_AD1 = _mm256_shuffle_epi32(R_AH0_, 0xAA);
+ __m256i R_EH1 = _mm256_shuffle_epi32(R_AH0_, 0xFF);
+ COMPUTE_STEP(R_AD1, R_EH1, 1);
+
+ // Replicate upper 128-bits of R_AH0 across both lanes
+ R_AH0_ = _mm256_permute2x128_si256(R_AH0, R_AH0, 0x11);
+ __m256i R_AD2 = _mm256_shuffle_epi32(R_AH0_, 0x00);
+ __m256i R_EH2 = _mm256_shuffle_epi32(R_AH0_, 0x55);
+ COMPUTE_STEP(R_AD2, R_EH2, 2);
+ __m256i R_AD3 = _mm256_shuffle_epi32(R_AH0_, 0xAA);
+ __m256i R_EH3 = _mm256_shuffle_epi32(R_AH0_, 0xFF);
+ COMPUTE_STEP(R_AD3, R_EH3, 3);
+
+ R_AH0_ = _mm256_permute2x128_si256(R_AH4, R_AH4, 0x00);
+ R_AD0 = _mm256_shuffle_epi32(R_AH0_, 0x00);
+ R_EH0 = _mm256_shuffle_epi32(R_AH0_, 0x55);
+ COMPUTE_STEP(R_AD0, R_EH0, 4);
+ R_AD1 = _mm256_shuffle_epi32(R_AH0_, 0xAA);
+ R_EH1 = _mm256_shuffle_epi32(R_AH0_, 0xFF);
+ COMPUTE_STEP(R_AD1, R_EH1, 5);
+ R_AH0_ = _mm256_permute2x128_si256(R_AH4, R_AH4, 0x11);
+ R_AD2 = _mm256_shuffle_epi32(R_AH0_, 0x00);
+ R_EH2 = _mm256_shuffle_epi32(R_AH0_, 0x55);
+ COMPUTE_STEP(R_AD2, R_EH2, 6);
+ R_AD3 = _mm256_shuffle_epi32(R_AH0_, 0xAA);
+ R_EH3 = _mm256_shuffle_epi32(R_AH0_, 0xFF);
+ COMPUTE_STEP(R_AD3, R_EH3, 7);
+
+ R_AH0_ = _mm256_permute2x128_si256(R_AH8, R_AH8, 0x00);
+ R_AD0 = _mm256_shuffle_epi32(R_AH0_, 0x00);
+ R_EH0 = _mm256_shuffle_epi32(R_AH0_, 0x55);
+ COMPUTE_STEP(R_AD0, R_EH0, 8);
+ R_AD1 = _mm256_shuffle_epi32(R_AH0_, 0xAA);
+ R_EH1 = _mm256_shuffle_epi32(R_AH0_, 0xFF);
+ COMPUTE_STEP(R_AD1, R_EH1, 9);
+ R_AH0_ = _mm256_permute2x128_si256(R_AH8, R_AH8, 0x11);
+ R_AD2 = _mm256_shuffle_epi32(R_AH0_, 0x00);
+ R_EH2 = _mm256_shuffle_epi32(R_AH0_, 0x55);
+ COMPUTE_STEP(R_AD2, R_EH2, 10);
+ R_AD3 = _mm256_shuffle_epi32(R_AH0_, 0xAA);
+ R_EH3 = _mm256_shuffle_epi32(R_AH0_, 0xFF);
+ COMPUTE_STEP(R_AD3, R_EH3, 11);
+
+ R_AH0_ = _mm256_permute2x128_si256(R_AH12, R_AH12, 0x00);
+ R_AD0 = _mm256_shuffle_epi32(R_AH0_, 0x00);
+ R_EH0 = _mm256_shuffle_epi32(R_AH0_, 0x55);
+ COMPUTE_STEP(R_AD0, R_EH0, 12);
+ R_AD1 = _mm256_shuffle_epi32(R_AH0_, 0xAA);
+ R_EH1 = _mm256_shuffle_epi32(R_AH0_, 0xFF);
+ COMPUTE_STEP(R_AD1, R_EH1, 13);
+ R_AH0_ = _mm256_permute2x128_si256(R_AH12, R_AH12, 0x11);
+ R_AD2 = _mm256_shuffle_epi32(R_AH0_, 0x00);
+ R_EH2 = _mm256_shuffle_epi32(R_AH0_, 0x55);
+ COMPUTE_STEP(R_AD2, R_EH2, 14);
+ R_AD3 = _mm256_shuffle_epi32(R_AH0_, 0xAA);
+ R_EH3 = _mm256_shuffle_epi32(R_AH0_, 0xFF);
+ COMPUTE_STEP(R_AD3, R_EH3, 15);
+
+#undef COMPUTE_STEP
+ }
+
+ // Transfer the results to the result matrix
+ Index i = 0;
+ for (Index j = n; j < n + 16; j++) {
+ LinearMapper r0 = res.getLinearMapper(m, j);
+ LinearMapper r1 = res.getLinearMapper(m + 8, j);
+
+ r0.storePacket(0, _mm256_add_epi32(blockO_256[i++], r0.loadPacket(0)));
+ r1.storePacket(0, _mm256_add_epi32(blockO_256[i++], r1.loadPacket(0)));
+ }
+
+ // Zero the result block so it can be reused
+ memset(blockO, 0, 16 * 16 * sizeof(QInt32));
+ }
+ }
+ aligned_delete(blockO, 16 * 16);
+}
+
+#endif
+
+// AVX2 optimized implementation of Mat-Mat product.
// LHS is encoded using signed 8-bit integers.
// RHS is encoded using unsigned 8-bit integers.
#ifdef EIGEN_USE_OPTIMIZED_INT8_UINT8_MAT_MAT_PRODUCT
@@ -1751,4 +2227,4 @@ void gebp_kernel<QInt8, QUInt8, Index, DataMapper, mr, nr, ConjugateLhs, Conjuga
} // namespace internal
} // namespace Eigen
-#endif // EIGEN_CXX11_FIXED_POINT_MAT_MAT_PRODUCT_AVX2_H
+#endif // CXX11_SRC_FIXEDPOINT_MATMATPRODUCTAVX2_H_
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProductNEON.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProductNEON.h
index 99894cafb5..9cd3157023 100644
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProductNEON.h
+++ b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatMatProductNEON.h
@@ -8,9 +8,8 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef EIGEN_CXX11_FIXED_POINT_MAT_MAT_PRODUCT_NEON_H
-#define EIGEN_CXX11_FIXED_POINT_MAT_MAT_PRODUCT_NEON_H
-
+#ifndef CXX11_SRC_FIXEDPOINT_MATMATPRODUCTNEON_H_
+#define CXX11_SRC_FIXEDPOINT_MATMATPRODUCTNEON_H_
namespace Eigen {
namespace internal {
@@ -90,6 +89,4 @@ void gebp_kernel<QInt8, QUInt8, Index, DataMapper, mr, nr, ConjugateLhs, Conjuga
} // namespace internal
} // namespace Eigen
-
-
-#endif // EIGEN_CXX11_FIXED_POINT_MAT_MAT_PRODUCT_NEON_H
+#endif // CXX11_SRC_FIXEDPOINT_MATMATPRODUCTNEON_H_
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatVecProduct.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatVecProduct.h
index 18b5085b89..ad11d3d44b 100644
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatVecProduct.h
+++ b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatVecProduct.h
@@ -7,9 +7,8 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef EIGEN_CXX11_FIXED_POINT_MAT_VEC_PRODUCT_H
-#define EIGEN_CXX11_FIXED_POINT_MAT_VEC_PRODUCT_H
-
+#ifndef CXX11_SRC_FIXEDPOINT_MATVECPRODUCT_H_
+#define CXX11_SRC_FIXEDPOINT_MATVECPRODUCT_H_
namespace Eigen {
namespace internal {
@@ -47,6 +46,36 @@ EIGEN_DONT_INLINE void general_matrix_vector_product<Index,QInt8,LhsMapper,ColMa
}
}
+// Mat-Vec product
+// Both lhs and rhs are encoded as 16bit signed integers
+template <typename Index, typename LhsMapper, bool ConjugateLhs,
+ typename RhsMapper, bool ConjugateRhs, int Version>
+struct general_matrix_vector_product<Index, QInt16, LhsMapper, ColMajor,
+ ConjugateLhs, QInt16, RhsMapper,
+ ConjugateRhs, Version> {
+ EIGEN_DONT_INLINE static void run(Index rows, Index cols,
+ const LhsMapper& lhs, const RhsMapper& rhs,
+ QInt32* res, Index resIncr, QInt16 alpha);
+};
+
+template <typename Index, typename LhsMapper, bool ConjugateLhs,
+ typename RhsMapper, bool ConjugateRhs, int Version>
+EIGEN_DONT_INLINE void general_matrix_vector_product<
+ Index, QInt16, LhsMapper, ColMajor, ConjugateLhs, QInt16, RhsMapper,
+ ConjugateRhs, Version>::run(Index rows, Index cols, const LhsMapper& lhs,
+ const RhsMapper& rhs, QInt32* res,
+ Index resIncr, QInt16 alpha) {
+ eigen_assert(alpha.value == 1);
+ eigen_assert(resIncr == 1);
+ eigen_assert(rows > 0);
+ eigen_assert(cols > 0);
+
+ for (Index i = 0; i < rows; ++i) {
+ for (Index j = 0; j < cols; ++j) {
+ res[i] += lhs(i, j) * rhs(j, 0);
+ }
+ }
+}
// Mat-Vec product
// The lhs is encoded using 8bit signed integers, the rhs using 8bit unsigned integers
@@ -118,6 +147,4 @@ EIGEN_DONT_INLINE void general_matrix_vector_product<Index,QUInt8,LhsMapper,ColM
} // namespace internal
} // namespace Eigen
-
-
-#endif // EIGEN_CXX11_FIXED_POINT_MAT_VEC_PRODUCT_H
+#endif // CXX11_SRC_FIXEDPOINT_MATVECPRODUCT_H_
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h
index cb1636256d..3abd4ee49c 100644
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h
+++ b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h
@@ -1,6 +1,5 @@
-#ifndef EIGEN3_UNSUPPORTED_EIGEN_CXX11_SRC_FIXEDPOINT_PACKETMATHAVX2_H_
-#define EIGEN3_UNSUPPORTED_EIGEN_CXX11_SRC_FIXEDPOINT_PACKETMATHAVX2_H_
-
+#ifndef CXX11_SRC_FIXEDPOINT_PACKETMATHAVX2_H_
+#define CXX11_SRC_FIXEDPOINT_PACKETMATHAVX2_H_
#ifdef _MSC_VER
#include <immintrin.h>
@@ -29,7 +28,6 @@ inline int _mm256_extract_epi8_N1(const __m256i X)
return _mm_extract_epi8(_mm256_extractf128_si256((X), 1 >> 4), 1 % 16);
}
-
namespace Eigen {
namespace internal {
@@ -502,4 +500,4 @@ struct functor_traits<scalar_product_op<QInt32, double>> {
} // end namespace internal
} // end namespace Eigen
-#endif // EIGEN3_UNSUPPORTED_EIGEN_CXX11_SRC_FIXEDPOINT_PACKETMATHAVX2_H_
+#endif // CXX11_SRC_FIXEDPOINT_PACKETMATHAVX2_H_
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX512.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX512.h
index 8f9906dbf9..2092ce1d4c 100644
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX512.h
+++ b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX512.h
@@ -1,5 +1,5 @@
-#ifndef EIGEN3_UNSUPPORTED_EIGEN_CXX11_SRC_FIXEDPOINT_PACKETMATHAVX512_H_
-#define EIGEN3_UNSUPPORTED_EIGEN_CXX11_SRC_FIXEDPOINT_PACKETMATHAVX512_H_
+#ifndef CXX11_SRC_FIXEDPOINT_PACKETMATHAVX512_H_
+#define CXX11_SRC_FIXEDPOINT_PACKETMATHAVX512_H_
#include "PacketMathAVX2.h"
@@ -542,4 +542,4 @@ EIGEN_STRONG_INLINE QInt8 predux_max<Packet64q8i>(const Packet64q8i& a) {
} // end namespace internal
} // end namespace Eigen
-#endif // EIGEN3_UNSUPPORTED_EIGEN_CXX11_SRC_FIXEDPOINT_PACKETMATHAVX512_H_
+#endif // CXX11_SRC_FIXEDPOINT_PACKETMATHAVX512_H_
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/TypeCastingAVX2.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/TypeCastingAVX2.h
index 7b4ecc752f..9561d6a338 100644
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/TypeCastingAVX2.h
+++ b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/TypeCastingAVX2.h
@@ -1,5 +1,5 @@
-#ifndef EIGEN3_UNSUPPORTED_EIGEN_CXX11_SRC_FIXEDPOINT_TYPECASTINGAVX2_H_
-#define EIGEN3_UNSUPPORTED_EIGEN_CXX11_SRC_FIXEDPOINT_TYPECASTINGAVX2_H_
+#ifndef CXX11_SRC_FIXEDPOINT_TYPECASTINGAVX2_H_
+#define CXX11_SRC_FIXEDPOINT_TYPECASTINGAVX2_H_
namespace Eigen {
namespace internal {
@@ -52,8 +52,16 @@ template <>
EIGEN_STRONG_INLINE Packet32q8u
pcast<Packet8q32i, Packet32q8u>(const Packet8q32i& a, const Packet8q32i& b,
const Packet8q32i& c, const Packet8q32i& d) {
+ // _mm256_packus_epi32 trims negative numbers to 0 but we can't allow numbers
+ // that are too large because _mm256_packus_epi16 expects signed input
+ // (example of problem input: 0x11111111, which saturates to 0xffff = -1,
+ // which saturates to 0).
+ const __m256i a_clip = _mm256_min_epi32(a, _mm256_set1_epi32(255));
+ const __m256i b_clip = _mm256_min_epi32(b, _mm256_set1_epi32(255));
+ const __m256i c_clip = _mm256_min_epi32(c, _mm256_set1_epi32(255));
+ const __m256i d_clip = _mm256_min_epi32(d, _mm256_set1_epi32(255));
const __m256i converted = _mm256_packus_epi16(
- _mm256_packs_epi32(a.val, b.val), _mm256_packs_epi32(c.val, d.val));
+ _mm256_packus_epi32(a_clip, b_clip), _mm256_packus_epi32(c_clip, d_clip));
// Since packus does not cross 128 bit lane boundaries,
// we have to permute to properly order the final result.
const __m256i permute_mask = _mm256_set_epi32(7, 3, 6, 2, 5, 1, 4, 0);
@@ -63,4 +71,4 @@ pcast<Packet8q32i, Packet32q8u>(const Packet8q32i& a, const Packet8q32i& b,
} // end namespace internal
} // end namespace Eigen
-#endif // EIGEN3_UNSUPPORTED_EIGEN_CXX11_SRC_FIXEDPOINT_TYPECASTINGAVX2_H_
+#endif // CXX11_SRC_FIXEDPOINT_TYPECASTINGAVX2_H_
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/TypeCastingAVX512.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/TypeCastingAVX512.h
index 26735743d4..a09eac6707 100644
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/TypeCastingAVX512.h
+++ b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/TypeCastingAVX512.h
@@ -1,5 +1,5 @@
-#ifndef EIGEN3_UNSUPPORTED_EIGEN_CXX11_SRC_FIXEDPOINT_TYPECASTINGAVX512_H_
-#define EIGEN3_UNSUPPORTED_EIGEN_CXX11_SRC_FIXEDPOINT_TYPECASTINGAVX512_H_
+#ifndef CXX11_SRC_FIXEDPOINT_TYPECASTINGAVX512_H_
+#define CXX11_SRC_FIXEDPOINT_TYPECASTINGAVX512_H_
namespace Eigen {
namespace internal {
@@ -132,8 +132,15 @@ pcast<Packet16q32i, Packet64q8i>(const Packet16q32i& a,
const Packet16q32i& b,
const Packet16q32i& c,
const Packet16q32i& d) {
- __m512i converted = _mm512_packs_epi16(_mm512_packs_epi32(a.val, b.val),
- _mm512_packs_epi32(c.val, d.val));
+ __m128i a_part = _mm512_cvtsepi32_epi8(a);
+ __m128i b_part = _mm512_cvtsepi32_epi8(b);
+ __m128i c_part = _mm512_cvtsepi32_epi8(c);
+ __m128i d_part = _mm512_cvtsepi32_epi8(d);
+ __m256i ab =
+ _mm256_inserti128_si256(_mm256_castsi128_si256(a_part), b_part, 1);
+ __m256i cd =
+ _mm256_inserti128_si256(_mm256_castsi128_si256(c_part), d_part, 1);
+ __m512i converted = _mm512_inserti64x4(_mm512_castsi256_si512(ab), cd, 1);
return converted;
}
@@ -141,7 +148,10 @@ template <>
EIGEN_STRONG_INLINE Packet32q16i
pcast<Packet16q32i, Packet32q16i>(const Packet16q32i& a,
const Packet16q32i& b) {
- __m512i converted = _mm512_packs_epi32(a.val, b.val);
+ __m256i a_part = _mm512_cvtsepi32_epi16(a);
+ __m256i b_part = _mm512_cvtsepi32_epi16(b);
+ __m512i converted =
+ _mm512_inserti64x4(_mm512_castsi256_si512(a_part), b_part, 1);
return converted;
}
@@ -154,22 +164,45 @@ template <>
EIGEN_STRONG_INLINE Packet64q8u
pcast<Packet16q32i, Packet64q8u>(const Packet16q32i& a, const Packet16q32i& b,
const Packet16q32i& c, const Packet16q32i& d) {
- const __m512i converted = _mm512_packus_epi16(
- _mm512_packus_epi32(a.val, b.val), _mm512_packus_epi32(c.val, d.val));
+ // Brute-force saturation since there isn't a pack operation for unsigned
+ // numbers that keeps the elements in order.
+ __m128i a_part = _mm512_cvtepi32_epi8(_mm512_max_epi32(
+ _mm512_min_epi32(a, _mm512_set1_epi32(255)), _mm512_setzero_si512()));
+ __m128i b_part = _mm512_cvtepi32_epi8(_mm512_max_epi32(
+ _mm512_min_epi32(b, _mm512_set1_epi32(255)), _mm512_setzero_si512()));
+ __m128i c_part = _mm512_cvtepi32_epi8(_mm512_max_epi32(
+ _mm512_min_epi32(c, _mm512_set1_epi32(255)), _mm512_setzero_si512()));
+ __m128i d_part = _mm512_cvtepi32_epi8(_mm512_max_epi32(
+ _mm512_min_epi32(d, _mm512_set1_epi32(255)), _mm512_setzero_si512()));
+ __m256i ab =
+ _mm256_inserti128_si256(_mm256_castsi128_si256(a_part), b_part, 1);
+ __m256i cd =
+ _mm256_inserti128_si256(_mm256_castsi128_si256(c_part), d_part, 1);
+ __m512i converted = _mm512_inserti64x4(_mm512_castsi256_si512(ab), cd, 1);
return converted;
}
+#if 0
+// The type Packet32q16u does not exist for AVX-512 yet
template <>
struct type_casting_traits<QInt32, QUInt16> {
enum { VectorizedCast = 1, SrcCoeffRatio = 2, TgtCoeffRatio = 1 };
};
-#if 0
template <>
EIGEN_STRONG_INLINE Packet32q16u
pcast<Packet16q32i, Packet32q16u>(const Packet16q32i& a,
const Packet16q32i& b) {
- const __m512i converted = _mm512_packus_epi32(a.val, b.val);
+ // Brute-force saturation since there isn't a pack operation for unsigned
+ // numbers that keeps the elements in order.
+ __m256i a_part =
+ _mm512_cvtepi32_epi16(_mm512_max_epi32(
+ _mm512_min_epi32(a, _mm512_set1_epi32(65535)), _mm512_setzero_si512()));
+ __m256i b_part = _mm512_cvtepi32_epi16(
+ _mm512_max_epi32(_mm512_min_epi32(b, _mm512_set1_epi32(65535)),
+ _mm512_setzero_si512()));
+ __m512i converted =
+ _mm512_inserti64x4(_mm512_castsi256_si512(a_part), b_part, 1);
return converted;
}
#endif
@@ -177,4 +210,4 @@ pcast<Packet16q32i, Packet32q16u>(const Packet16q32i& a,
} // end namespace internal
} // end namespace Eigen
-#endif // EIGEN3_UNSUPPORTED_EIGEN_CXX11_SRC_FIXEDPOINT_TYPECASTINGAVX512_H_
+#endif // CXX11_SRC_FIXEDPOINT_TYPECASTINGAVX512_H_
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Activations.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Activations.h
deleted file mode 100644
index cbcce9e282..0000000000
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Activations.h
+++ /dev/null
@@ -1,116 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2015 Benoit Steiner <benoit.steiner.goog@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla
-// Public License v. 2.0. If a copy of the MPL was not distributed
-// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef EIGEN_CXX11_NEURAL_NETWORKS_ACTIVATIONS_H
-#define EIGEN_CXX11_NEURAL_NETWORKS_ACTIVATIONS_H
-
-namespace Eigen {
-
-/** scalar_sigmoid_fast_derivative_op
- * \ingroup CXX11_NeuralNetworks_Module
- * \brief Template functor to compute the fast derivative of a sigmoid
- *
- * Input should be the backpropagated gradient.
- *
- * \sa class CwiseUnaryOp, Cwise::sigmoid_fast_derivative()
- */
-template <typename T>
-struct scalar_sigmoid_fast_derivative_op {
- EIGEN_EMPTY_STRUCT_CTOR(scalar_sigmoid_fast_derivative_op)
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(const T& y) const {
- const T one = T(1);
- return (one - y) * y;
- }
-
- template <typename Packet>
- inline Packet packetOp(const Packet& y) const {
- const Packet one = internal::pset1<Packet>(1);
- return internal::pmul(internal::psub(one, y), y);
- }
-};
-
-namespace internal {
-template <typename T>
-struct functor_traits<scalar_sigmoid_fast_derivative_op<T> > {
- enum {
- Cost = NumTraits<T>::AddCost * 2 + NumTraits<T>::MulCost,
- PacketAccess = packet_traits<T>::HasAdd && packet_traits<T>::HasMul &&
- packet_traits<T>::HasNegate
- };
-};
-} // namespace internal
-
-/** scalar_tanh_fast_derivative_op
- * \ingroup CXX11_NeuralNetworks_Module
- * \brief Template functor to compute the fast derivative of a tanh
- *
- * Input should be the backpropagated gradient.
- *
- * \sa class CwiseUnaryOp, Cwise::tanh_fast_derivative()
- */
-template <typename T>
-struct scalar_tanh_fast_derivative_op {
- EIGEN_EMPTY_STRUCT_CTOR(scalar_tanh_fast_derivative_op)
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(const T& y) const {
- const T one = T(1);
- return one - (y * y);
- }
-
- template <typename Packet>
- inline Packet packetOp(const Packet& y) const {
- const Packet one = internal::pset1<Packet>(1);
- return internal::psub(one, internal::pmul(y, y));
- }
-};
-
-namespace internal {
-template <typename T>
-struct functor_traits<scalar_tanh_fast_derivative_op<T> > {
- enum {
- Cost = NumTraits<T>::AddCost * 2 + NumTraits<T>::MulCost * 1,
- PacketAccess = packet_traits<T>::HasAdd && packet_traits<T>::HasMul &&
- packet_traits<T>::HasNegate
- };
-};
-} // namespace internal
-
-/**
- * \ingroup CXX11_NeuralNetworks_Module
- * \brief Template functor to clip the magnitude of the first scalar.
- *
- * \sa class CwiseBinaryOp, MatrixBase::Clip
- */
-template <typename Scalar>
-struct scalar_clip_op {
- EIGEN_EMPTY_STRUCT_CTOR(scalar_clip_op)
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar
- operator()(const Scalar& a, const Scalar& b) const {
- return numext::mini(numext::maxi(a, -b), b);
- }
- template <typename Packet>
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet
- packetOp(const Packet& a, const Packet& b) const {
- return internal::pmin(internal::pmax(a, internal::pnegate(b)), b);
- }
-};
-
-namespace internal {
-template <typename Scalar>
-struct functor_traits<scalar_clip_op<Scalar> > {
- enum {
- Cost = NumTraits<Scalar>::AddCost * 3,
- PacketAccess = packet_traits<Scalar>::HasMax &&
- packet_traits<Scalar>::HasMin &&
- packet_traits<Scalar>::HasNegate
- };
-};
-} // namespace internal
-
-} // end namespace Eigen
-
-#endif // EIGEN_CXX11_NEURAL_NETWORKS_ACTIVATIONS_H
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Attention.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Attention.h
deleted file mode 100644
index d4bc7a3515..0000000000
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Attention.h
+++ /dev/null
@@ -1,209 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2015 Benoit Steiner <benoit.steiner.goog@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla
-// Public License v. 2.0. If a copy of the MPL was not distributed
-// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef EIGEN_CXX11_NEURAL_NETWORKS_ATTENTION_H
-#define EIGEN_CXX11_NEURAL_NETWORKS_ATTENTION_H
-
-namespace Eigen {
-
-/** ExtractGlimpses
- * \ingroup CXX11_NeuralNetworks_Module
- *
- * \brief Extract glimpses from an input tensor.
- *
- * The input parameter is expected to be a col-major tensor with a rank of 4 (depth, x, y, and batch).
- * The width and height parameters specify the extension of the returned glimpses.
- * The offsets parameter specifies the x, y locations of the center of the glimpses relative to the center of the input image. The vector is expected to contain one IndexPair for each image in the batch dimension.
- * The normalized boolean indicates if incoming coordinates are normalized so that 0.0 and 1.0 correspond to the minimum and maximum of each height and width dimension.
- * The centered boolean indicates if incoming coordinates are centered relative to the image, in which case -1.0 and 1.0 correspond to minimum and maximum of each dimension while 0.0 corresponds to the center.
- *
- * The result can be assigned to a tensor of rank equal to that of the input. The result will be laid out in col-major order (depth, x, y, batch).
- * The dimensions of the result will be equal to the dimensions of the input except for width and height which will be equal to the requested glimpse size.
- */
-namespace {
-template <typename Index>
-struct GlimpseExtractionOp {
- GlimpseExtractionOp(const Index width, const Index height,
- const std::vector<IndexPair<float> >& offsets,
- const bool normalized,
- const bool centered,
- const bool uniform_noise) :
- width_(width), height_(height), offsets_(offsets),
- normalized_(normalized), centered_(centered), uniform_noise_(uniform_noise) { }
-
- template <typename Input>
- DSizes<Index, 4> dimensions(const Input& input) const {
- typedef typename internal::traits<Input>::Index IndexType;
- typedef TensorRef<Tensor<typename internal::traits<Input>::Scalar, 4,
- internal::traits<Input>::Layout, IndexType> > Ref;
- Ref in(input);
-
- DSizes<Index, 4> dims = in.dimensions();
-
- dims[0] = in.dimension(0);
- dims[1] = width_;
- dims[2] = height_;
- dims[3] = in.dimension(3);
- return dims;
- }
-
- template <typename Input, typename Output, typename Device>
- EIGEN_DEVICE_FUNC
- void eval(const Input& input, Output& output, const Device& device) const
- {
- typedef typename internal::traits<Input>::Index IndexType;
- typedef TensorRef<Tensor<typename internal::traits<Input>::Scalar, 4,
- internal::traits<Input>::Layout, IndexType> > Ref;
- Ref in(input);
-
- const Index num_channels = in.dimension(0);
- const Index input_width = in.dimension(1);
- const Index input_height = in.dimension(2);
- const Index batch_size = in.dimension(3);
- eigen_assert(input_width > 0);
- eigen_assert(input_height > 0);
-
- for (Index i = 0; i < batch_size; ++i) {
- float x = offsets_[i].first, y = offsets_[i].second;
-
- // Un-normalize coordinates back to pixel space if normalized.
- if (normalized_) {
- x *= input_width;
- y *= input_height;
- }
- // Un-center if coordinates are centered on the image center.
- if (centered_) {
- x /= 2.0f;
- y /= 2.0f;
- x += input_width / 2.0f;
- y += input_height / 2.0f;
- }
- // Remove half of the glimpse window.
- x -= width_ / 2.0f;
- y -= height_ / 2.0f;
-
- const Index offset_x = (Index) x;
- const Index offset_y = (Index) y;
- Index glimpse_width = width_;
- Index glimpse_height = height_;
- bool partial_overlap = false;
- DSizes<Index, 3> slice_offset(0, offset_x, offset_y);
- DSizes<Index, 3> slice_extent(num_channels, width_, height_);
- DSizes<Index, 3> base_offset(0, 0, 0);
-
- if (offset_x < 0) {
- slice_offset[1] = 0;
- glimpse_width = (std::max<Index>)(0, width_ + offset_x);
- slice_extent[1] = glimpse_width;
- base_offset[1] = width_ - glimpse_width;
- partial_overlap = true;
- } else if (offset_x + width_ >= input_width) {
- glimpse_width = (std::max<Index>)(0, input_width - offset_x);
- slice_extent[1] = glimpse_width;
- partial_overlap = true;
- }
- if (offset_y < 0) {
- slice_offset[2] = 0;
- glimpse_height = (std::max<Index>)(0, height_ + offset_y);
- slice_extent[2] = glimpse_height;
- base_offset[2] = height_ - glimpse_height;
- partial_overlap = true;
- } else if (offset_y + height_ >= input_height) {
- glimpse_height = (std::max<Index>)(0, input_height - offset_y);
- slice_extent[2] = glimpse_height;
- partial_overlap = true;
- }
- slice_extent[1] = std::min<Index>(input_width, slice_extent[1]);
- slice_extent[2] = std::min<Index>(input_height, slice_extent[2]);
-
- if (partial_overlap) {
- if (uniform_noise_) {
- // Initialize the glimpse with uniform noise.
- typedef typename internal::remove_const<
- typename internal::traits<Input>::Scalar>::type Scalar;
- TensorFixedSize<Scalar, Sizes<> > mini;
- mini.device(device) = input.template chip<3>(i).minimum();
- TensorFixedSize<float, Sizes<> > range;
- range.device(device) =
- (input.template chip<3>(i).maximum() - mini).template cast<float>();
-
- DSizes<Index, 3> glimpse_size(num_channels, width_, height_);
- TensorMap<Tensor<float, 3> > tmp(NULL, glimpse_size);
- output.template chip<3>(i).device(device) =
- mini.reshape(Sizes<1,1,1>()).broadcast(glimpse_size) +
- (tmp.random() * range.reshape(Sizes<1,1,1>()).broadcast(glimpse_size)).template cast<Scalar>();
- } else {
- // Initialize the glimpse with white noise: compute the mean and sigma
- // of each channel, and use them to shape the gaussian.
- DSizes<Index, 2> glimpse_size(width_, height_);
- DSizes<Index, 2> input_size(input_width, input_height);
- typedef typename internal::remove_const<
- typename internal::traits<Input>::Scalar>::type Scalar;
-
- for (int j = 0; j < num_channels; ++j) {
- TensorFixedSize<Scalar, Sizes<> > mean;
- mean.device(device) = input.template chip<3>(i).template chip<0>(j).template cast<float>().mean();
- TensorFixedSize<float, Sizes<> > sigma;
- sigma.device(device) =
- (input.template chip<3>(i).template chip<0>(j).template cast<float>() - mean.reshape(Sizes<1,1>()).broadcast(input_size)).square().mean().sqrt();
- TensorFixedSize<Scalar, Sizes<> > mini;
- mini.device(device) = input.template chip<3>(i).template chip<0>(j).minimum();
- TensorFixedSize<float, Sizes<> > maxi;
- maxi.device(device) = input.template chip<3>(i).template chip<0>(j).maximum();
-
- TensorMap<Tensor<float, 2> > tmp(NULL, glimpse_size);
- output.template chip<3>(i).template chip<0>(j).device(device) =
- (mean.reshape(Sizes<1,1>()).broadcast(glimpse_size) +
- (tmp.random(internal::NormalRandomGenerator<float>()) * sigma.reshape(Sizes<1,1>()).broadcast(glimpse_size)).template cast<Scalar>()).cwiseMin(maxi.reshape(Sizes<1,1>()).broadcast(glimpse_size)).cwiseMax(mini.reshape(Sizes<1,1>()).broadcast(glimpse_size));
- }
- }
-
- // Copy the part of the glimpse that cover the input image if any.
- if (glimpse_width == 0 || glimpse_height == 0) {
- continue;
- }
- output.template chip<3>(i).slice(base_offset, slice_extent).device(device) = input.template chip<3>(i).slice(slice_offset, slice_extent);
- } else {
- output.template chip<3>(i).device(device) = input.template chip<3>(i).slice(slice_offset, slice_extent);
- }
- }
- }
-
- private:
- const Index width_;
- const Index height_;
- const std::vector<IndexPair<float> > offsets_;
- const bool normalized_;
- const bool centered_;
- const bool uniform_noise_;
-};
-}
-
-
-template <typename Input>
-EIGEN_ALWAYS_INLINE
-static const TensorCustomUnaryOp<const GlimpseExtractionOp<typename internal::traits<Input>::Index>, const Input>
-ExtractGlimpses(const Input& input,
- const typename internal::traits<Input>::Index width,
- const typename internal::traits<Input>::Index height,
- const std::vector<IndexPair<float> >& offsets,
- const bool normalized = true, const bool centered = true,
- const bool uniform_noise = true)
-{
- EIGEN_STATIC_ASSERT(internal::traits<Input>::Layout == ColMajor, YOU_MADE_A_PROGRAMMING_MISTAKE);
- EIGEN_STATIC_ASSERT(internal::traits<Input>::NumDimensions == 4, YOU_MADE_A_PROGRAMMING_MISTAKE);
-
- typedef typename internal::traits<Input>::Index Index;
- const GlimpseExtractionOp<Index> op(width, height, offsets, normalized,
- centered, uniform_noise);
- return input.customOp(op);
-}
-
-} // end namespace Eigen
-
-#endif // EIGEN_CXX11_NEURAL_NETWORKS_ATTENTION_H
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/BackwardCuboidConvolutions.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/BackwardCuboidConvolutions.h
deleted file mode 100644
index 12ce23444c..0000000000
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/BackwardCuboidConvolutions.h
+++ /dev/null
@@ -1,523 +0,0 @@
-#ifndef EIGEN_CXX11_NEURAL_NETWORKS_BACKWARD_CUBOID_CONVOLUTIONS_H
-#define EIGEN_CXX11_NEURAL_NETWORKS_BACKWARD_CUBOID_CONVOLUTIONS_H
-
-#include "Patch3d.h"
-
-namespace Eigen {
-
-/** CuboidConvolutionBackwardInput
- * \ingroup CXX11_NeuralNetworks_Module
- *
- * \brief Computes the backprop for the input of a 3D convolution.
- *
- * The output_backward parameter is expected to be a tensor with a rank of 4 or more (channels, depth, height, width, and optionally others)
- * The kernel parameter is expected to be a 5D tensor (filters, channels, kernel_depth, kernel_height, kernel_width)
- * output_backward and kernel have to be in the same layout.
- *
- * The dimensions of the result will be filters, depth, height, width (and others if applicable).
- *
- * It is possible to swap the order of the depth, width and height dimensions provided that the same order is used in the input, the kernel, and the output.
- *
- * All dimension orders above are given for col-major, and should be reversed for row-major.
- */
-
-template <typename OutputBackward, typename Kernel>
-EIGEN_ALWAYS_INLINE static const typename internal::conditional<
- internal::traits<OutputBackward>::Layout == ColMajor,
- TensorReshapingOp<
- const DSizes<typename internal::traits<OutputBackward>::Index,
- internal::traits<OutputBackward>::NumDimensions>,
- const TensorContractionOp<
- const array< IndexPair<typename internal::traits<OutputBackward>::Index>, 2>,
- const TensorReshapingOp<
- const DSizes< typename internal::traits<OutputBackward>::Index, 3>,
- const TensorReverseOp<const array<bool, 5>, const Kernel>
- >,
- const TensorReshapingOp<
- const DSizes< typename internal::traits<OutputBackward>::Index, 3>,
- const TensorVolumePatchOp<Dynamic, Dynamic, Dynamic, const OutputBackward>
- >
- >
- >,
- TensorReshapingOp<
- const DSizes<typename internal::traits<OutputBackward>::Index,
- internal::traits<OutputBackward>::NumDimensions>,
- const TensorContractionOp<
- const array< IndexPair<typename internal::traits<OutputBackward>::Index>, 2>,
- const TensorReshapingOp<
- const DSizes< typename internal::traits<OutputBackward>::Index, 3>,
- const TensorVolumePatchOp<Dynamic, Dynamic, Dynamic, const OutputBackward>
- >,
- const TensorReshapingOp<
- const DSizes<typename internal::traits<OutputBackward>::Index, 3>,
- const TensorReverseOp<const array<bool, 5>, const Kernel>
- >
- >
- >
->::type
-CuboidConvolutionBackwardInput(
- const Kernel& kernel, const OutputBackward& output_backward,
- typename internal::traits<OutputBackward>::Index inputPlanes,
- typename internal::traits<OutputBackward>::Index inputRows,
- typename internal::traits<OutputBackward>::Index inputCols,
- const DenseIndex stridePlanes = 1, const DenseIndex strideRows = 1,
- const DenseIndex strideCols = 1) {
- typedef typename internal::traits<OutputBackward>::Index TensorIndex;
- const TensorRef<const Tensor<typename internal::traits<Kernel>::Scalar, internal::traits<Kernel>::NumDimensions, internal::traits<Kernel>::Layout, TensorIndex> > kern(kernel);
- const TensorRef<const Tensor<typename internal::traits<OutputBackward>::Scalar, internal::traits<OutputBackward>::NumDimensions, internal::traits<OutputBackward>::Layout, TensorIndex> > out(output_backward);
-
- EIGEN_STATIC_ASSERT(internal::traits<Kernel>::Layout == internal::traits<OutputBackward>::Layout, YOU_MADE_A_PROGRAMMING_MISTAKE);
-
- static const bool isColMajor = (internal::traits<OutputBackward>::Layout == ColMajor);
-
- static const int NumDims = internal::traits<OutputBackward>::NumDimensions;
-
- // Number of filters to apply. This is the same as the output depth of the result
- const TensorIndex kernelFilters = isColMajor ? kern.dimensions()[0] : kern.dimensions()[4];
- // Number of channels. This is the same as the input depth.
- const TensorIndex kernelChannels = isColMajor ? kern.dimensions()[1] : kern.dimensions()[3];
- const TensorIndex kernelPlanes = isColMajor ? kern.dimensions()[2] : kern.dimensions()[2];
- const TensorIndex kernelRows = isColMajor ? kern.dimensions()[3] : kern.dimensions()[1];
- const TensorIndex kernelCols = isColMajor ? kern.dimensions()[4] : kern.dimensions()[0];
-
- const TensorIndex outputPlanes = isColMajor ? out.dimensions()[1] : out.dimensions()[NumDims - 2];
- const TensorIndex outputRows = isColMajor ? out.dimensions()[2] : out.dimensions()[NumDims - 3];
- const TensorIndex outputCols = isColMajor ? out.dimensions()[3] : out.dimensions()[NumDims - 4];
-
- TensorIndex forward_pad_z, forward_pad_y, forward_pad_x;
- const TensorIndex size_z = ceil(inputPlanes / static_cast<float>(stridePlanes));
- const TensorIndex size_y = ceil(inputRows / static_cast<float>(strideRows));
- const TensorIndex size_x = ceil(inputCols / static_cast<float>(strideCols));
-
- // Infer padding type.
- if (size_z == outputPlanes && size_y == outputRows && size_x == outputCols) {
- // SAME padding.
- const TensorIndex dz = size_z * stridePlanes + kernelPlanes - 1 - inputPlanes;
- const TensorIndex dy = size_y * strideRows + kernelRows - 1 - inputRows;
- const TensorIndex dx = size_x * strideCols + kernelCols - 1 - inputCols;
-
- forward_pad_z = dz - dz / 2;
- forward_pad_y = dy - dy / 2;
- forward_pad_x = dx - dx / 2;
- } else {
- // VALID padding.
- forward_pad_z = 0;
- forward_pad_y = 0;
- forward_pad_x = 0;
- }
- const TensorIndex padding_ztop = kernelPlanes - 1 - forward_pad_z;
- const TensorIndex padding_top = kernelRows - 1 - forward_pad_y;
- const TensorIndex padding_left = kernelCols - 1 - forward_pad_x;
-
- const TensorIndex padding_zbottom = inputPlanes + kernelPlanes - 1 - (outputPlanes - 1) * stridePlanes - 1 - padding_ztop;
- const TensorIndex padding_bottom = inputRows + kernelRows - 1 - (outputRows - 1) * strideRows - 1 - padding_top;
- const TensorIndex padding_right = inputCols + kernelCols - 1 - (outputCols - 1) * strideCols - 1 - padding_left;
-
- eigen_assert(padding_ztop >= 0);
- eigen_assert(padding_zbottom >= 0);
- eigen_assert(padding_top >= 0);
- eigen_assert(padding_left >= 0);
- eigen_assert(padding_bottom >= 0);
- eigen_assert(padding_right >= 0);
-
- // The kernel has dimensions filters X channels X patch_planes X patch_rows X patch_cols.
- // We need to reverse the kernel along the spatial dimensions.
- array<bool, 5> kernel_reverse;
- if (isColMajor) {
- kernel_reverse[0] = false;
- kernel_reverse[1] = false;
- kernel_reverse[2] = true;
- kernel_reverse[3] = true;
- kernel_reverse[4] = true;
- } else {
- kernel_reverse[0] = true;
- kernel_reverse[1] = true;
- kernel_reverse[2] = true;
- kernel_reverse[3] = false;
- kernel_reverse[4] = false;
- }
-
- DSizes<TensorIndex, 3> kernel_dims;
- if (isColMajor) {
- kernel_dims[0] = kernelFilters;
- kernel_dims[1] = kernelChannels;
- kernel_dims[2] = kernelRows * kernelCols * kernelPlanes;
- } else {
- kernel_dims[0] = kernelRows * kernelCols * kernelPlanes;
- kernel_dims[1] = kernelChannels;
- kernel_dims[2] = kernelFilters;
- }
-
- // The output_backward has dimensions out_depth X out_planes X out_rows X out_cols X OTHERS
- // When we extract the image patches from output_backward, it will have dimensions:
- // out_depth X (patch_planes * patch_rows * patch_cols) X (input_planes * input_rows * input_cols * OTHERS)
- DSizes<TensorIndex, 3> pre_contract_dims;
- if (isColMajor) {
- pre_contract_dims[0] = kernelFilters;
- pre_contract_dims[1] = kernelRows * kernelCols * kernelPlanes;
- pre_contract_dims[2] = inputRows * inputCols * inputPlanes;
- for (int i = 4; i < NumDims; ++i) {
- pre_contract_dims[2] *= out.dimension(i);
- }
- } else {
- pre_contract_dims[2] = kernelFilters;
- pre_contract_dims[1] = kernelRows * kernelCols * kernelPlanes;
- pre_contract_dims[0] = inputRows * inputCols * inputPlanes;
- for (int i = 0; i < NumDims - 4; ++i) {
- pre_contract_dims[0] *= out.dimension(i);
- }
- }
-
- // We will contract along dimensions (0, 2) in kernel and (0, 1) in
- // output_backward, if this is col-major, and
- // dimensions (0, 2) in kernel and (1, 2) in output_backward, if this row-major.
- array<IndexPair<TensorIndex>, 2> contract_dims;
- if (isColMajor) {
- // col-major: kernel.contract(output.patches)
- contract_dims[0] = IndexPair<TensorIndex>(0, 0);
- contract_dims[1] = IndexPair<TensorIndex>(2, 1);
- } else {
- // row-major: output.patches.contract(kernel)
- contract_dims[0] = IndexPair<TensorIndex>(1, 0);
- contract_dims[1] = IndexPair<TensorIndex>(2, 2);
- }
-
- // Post contraction, the dimensions of the input_backprop is
- // channels X input_planes X input_rows X input_cols X OTHERS
- DSizes<TensorIndex, NumDims> post_contract_dims;
- if (isColMajor) {
- post_contract_dims[0] = kernelChannels;
- post_contract_dims[1] = inputPlanes;
- post_contract_dims[2] = inputRows;
- post_contract_dims[3] = inputCols;
- for (int i = 4; i < NumDims; ++i) {
- post_contract_dims[i] = out.dimension(i);
- }
- } else {
- post_contract_dims[NumDims - 1] = kernelChannels;
- post_contract_dims[NumDims - 2] = inputPlanes;
- post_contract_dims[NumDims - 3] = inputRows;
- post_contract_dims[NumDims - 4] = inputCols;
- for (int i = 0; i < NumDims - 4; ++i) {
- post_contract_dims[i] = out.dimension(i);
- }
- }
-
- DSizes<TensorIndex, NumDims> strides;
- for (int i = 0; i < NumDims; i++) {
- strides[i] = 1;
- }
- if (isColMajor) {
- strides[1] = stridePlanes;
- strides[2] = strideRows;
- strides[3] = strideCols;
- } else {
- strides[NumDims - 2] = stridePlanes;
- strides[NumDims - 3] = strideRows;
- strides[NumDims - 4] = strideCols;
- }
-
- return choose(
- Cond<internal::traits<OutputBackward>::Layout == ColMajor>(),
- kernel.reverse(kernel_reverse)
- .reshape(kernel_dims)
- .contract(
- output_backward.extract_volume_patches(kernelPlanes, kernelRows, kernelCols,
- 1, 1, 1, stridePlanes, strideRows, strideCols,
- padding_ztop, padding_zbottom,
- padding_top, padding_bottom,
- padding_left, padding_right)
- .reshape(pre_contract_dims),
- contract_dims)
- .reshape(post_contract_dims),
- output_backward.extract_volume_patches(kernelPlanes, kernelRows, kernelCols,
- 1, 1, 1, stridePlanes, strideRows, strideCols,
- padding_ztop, padding_zbottom,
- padding_top, padding_bottom,
- padding_left, padding_right)
- .reshape(pre_contract_dims)
- .contract(kernel.reverse(kernel_reverse).reshape(kernel_dims),
- contract_dims)
- .reshape(post_contract_dims));
-}
-
-
-/** CuboidConvolutionBackwardKernel
- * \ingroup CXX11_NeuralNetworks_Module
- *
- * \brief Computes the backprop for the filter of a 3D convolution.
- *
- * The output_backward parameter is expected to be a tensor with a rank of 4 or more (channels, depth, height, width, and optionally others)
- * The kernel parameter is expected to be a 4D tensor (filters, channels, kernel_depth, kernel_height, kernel_width)
- * output_backward and kernel have to be in the same layout.
- *
- * The dimensions of the result will be filters, depth, height, width (and others if applicable).
- *
- * It is possible to swap the order of the depth, width and height dimensions provided that the same order is used in the input, the kernel, and the output.
- *
- * All dimension orders above are given for col-major, and should be reversed for row-major.
- */
-template <typename OutputBackward, typename Input>
-EIGEN_ALWAYS_INLINE static const typename internal::conditional<
- internal::traits<OutputBackward>::Layout == ColMajor,
- const TensorShufflingOp<
- const array<typename internal::traits<OutputBackward>::Index, 5>,
- const TensorReverseOp<
- const array<bool, 5>,
- const TensorReshapingOp<
- const DSizes<typename internal::traits<OutputBackward>::Index, 5>,
- const TensorContractionOp<
- const array< IndexPair<typename internal::traits<Input>::Index>, 2>,
- const TensorReshapingOp<
- const DSizes<typename internal::traits<Input>::Index, 3>,
- const Input>,
- const TensorReshapingOp<
- const DSizes< typename internal::traits<OutputBackward>::Index, 4>,
- const TensorVolumePatchOp<Dynamic, Dynamic, Dynamic, const OutputBackward>
- >
- >
- >
- >
- >,
- const TensorShufflingOp<
- const array<typename internal::traits<OutputBackward>::Index, 5>,
- const TensorReverseOp<
- const array<bool, 5>,
- const TensorReshapingOp<
- const DSizes<typename internal::traits<OutputBackward>::Index, 5>,
- const TensorContractionOp<
- const array< IndexPair<typename internal::traits<Input>::Index>, 2>,
- const TensorReshapingOp<
- const DSizes< typename internal::traits<OutputBackward>::Index, 4>,
- const TensorVolumePatchOp<Dynamic, Dynamic, Dynamic, const OutputBackward>
- >,
- const TensorReshapingOp<
- const DSizes<typename internal::traits<Input>::Index, 3>,
- const Input
- >
- >
- >
- >
- >
->::type
-CuboidConvolutionBackwardKernel(
- const Input& input, const OutputBackward& output_backward,
- typename internal::traits<Input>::Index kernelPlanes,
- typename internal::traits<Input>::Index kernelRows,
- typename internal::traits<Input>::Index kernelCols,
- const DenseIndex stridePlanes = 1,
- const DenseIndex strideRows = 1,
- const DenseIndex strideCols = 1) {
- typedef typename internal::traits<Input>::Index TensorIndex;
- TensorRef<Tensor<typename internal::traits<Input>::Scalar, internal::traits<Input>::NumDimensions, internal::traits<Input>::Layout, TensorIndex> > in(input);
- TensorRef<Tensor<typename internal::traits<OutputBackward>::Scalar, internal::traits<OutputBackward>::NumDimensions, internal::traits<OutputBackward>::Layout, TensorIndex> > out(output_backward);
-
- EIGEN_STATIC_ASSERT(internal::traits<Input>::Layout == internal::traits<OutputBackward>::Layout, YOU_MADE_A_PROGRAMMING_MISTAKE);
-
- static const bool isColMajor = (internal::traits<Input>::Layout == ColMajor);
-
- static const int NumDims = internal::traits<Input>::NumDimensions;
- EIGEN_STATIC_ASSERT(internal::traits<Input>::NumDimensions == internal::traits<OutputBackward>::NumDimensions, YOU_MADE_A_PROGRAMMING_MISTAKE);
-
- const TensorIndex inputPlanes = isColMajor ? in.dimension(1) : in.dimension(NumDims - 2);
- const TensorIndex inputRows = isColMajor ? in.dimension(2) : in.dimension(NumDims - 3);
- const TensorIndex inputCols = isColMajor ? in.dimension(3) : in.dimension(NumDims - 4);
-
- const TensorIndex outputPlanes = isColMajor ? out.dimension(1) : out.dimension(NumDims - 2);
- const TensorIndex outputRows = isColMajor ? out.dimension(2) : out.dimension(NumDims - 3);
- const TensorIndex outputCols = isColMajor ? out.dimension(3) : out.dimension(NumDims - 4);
-
- const TensorIndex kernelFilters = isColMajor ? out.dimension(0) : out.dimension(NumDims - 1);
- const TensorIndex kernelChannels = isColMajor ? in.dimension(0) : in.dimension(NumDims - 1);
-
- TensorIndex forward_pad_z, forward_pad_y, forward_pad_x;
- const TensorIndex size_z = ceil(inputPlanes / static_cast<float>(stridePlanes));
- const TensorIndex size_y = ceil(inputRows / static_cast<float>(strideRows));
- const TensorIndex size_x = ceil(inputCols / static_cast<float>(strideCols));
-
- // Infer padding type.
- if (size_z == outputPlanes && size_y == outputRows && size_x == outputCols) {
- // SAME padding.
- const TensorIndex dz = size_z * stridePlanes + kernelPlanes - 1 - inputPlanes;
- const TensorIndex dy = size_y * strideRows + kernelRows - 1 - inputRows;
- const TensorIndex dx = size_x * strideCols + kernelCols - 1 - inputCols;
-
- forward_pad_z = dz - dz / 2;
- forward_pad_y = dy - dy / 2;
- forward_pad_x = dx - dx / 2;
- } else {
- // VALID padding.
- forward_pad_z = 0;
- forward_pad_y = 0;
- forward_pad_x = 0;
- }
-
- const TensorIndex padding_ztop = kernelPlanes - 1 - forward_pad_z;
- const TensorIndex padding_top = kernelRows - 1 - forward_pad_y;
- const TensorIndex padding_left = kernelCols - 1 - forward_pad_x;
-
- const TensorIndex padding_zbottom = inputPlanes + kernelPlanes - 1 - (outputPlanes - 1) * stridePlanes - 1 - padding_ztop;
- const TensorIndex padding_bottom = inputRows + kernelRows - 1 - (outputRows - 1) * strideRows - 1 - padding_top;
- const TensorIndex padding_right = inputCols + kernelCols - 1 - (outputCols - 1) * strideCols - 1 - padding_left;
-
- eigen_assert(padding_ztop >= 0);
- eigen_assert(padding_zbottom >= 0);
- eigen_assert(padding_top >= 0);
- eigen_assert(padding_left >= 0);
- eigen_assert(padding_bottom >= 0);
- eigen_assert(padding_right >= 0);
-
- // The output_backward has dimensions out_depth X out_plaens X out_rows X out_cols X OTHERS
- // When we extract the image patches from output_backward (with input as the
- // kernel), it will have dimensions
- // (out_depth) X (input_planes * input_rows * input_cols) X (kernel_planes * kernel_rows * kernel_cols) X OTHERS
- DSizes<TensorIndex, 4> pre_contract_dims;
- if (isColMajor) {
- pre_contract_dims[0] = kernelFilters;
- pre_contract_dims[1] = inputRows * inputCols * inputPlanes;
- pre_contract_dims[2] = kernelRows * kernelCols * kernelPlanes;
- pre_contract_dims[3] = 1;
- for (int i = 4; i < NumDims; ++i) {
- pre_contract_dims[3] *= out.dimension(i);
- }
- } else {
- pre_contract_dims[3] = kernelFilters;
- pre_contract_dims[2] = inputRows * inputCols * inputPlanes;
- pre_contract_dims[1] = kernelRows * kernelCols * kernelPlanes;
- pre_contract_dims[0] = 1;
- for (int i = 0; i < NumDims - 4; ++i) {
- pre_contract_dims[0] *= out.dimension(i);
- }
- }
-
- // The input has dimensions in_depth X (input_planes * input_rows * input_cols) X OTHERS
- DSizes<TensorIndex, 3> input_dims;
- if (isColMajor) {
- input_dims[0] = kernelChannels;
- input_dims[1] = inputRows * inputCols * inputPlanes;
- input_dims[2] = 1;
- for (int i = 4; i < NumDims; ++i) {
- input_dims[2] *= in.dimension(i);
- }
- eigen_assert(input_dims[2] == pre_contract_dims[3]);
- } else {
- input_dims[2] = kernelChannels;
- input_dims[1] = inputRows * inputCols * inputPlanes;
- input_dims[0] = 1;
- for (int i = 0; i < NumDims - 4; ++i) {
- input_dims[0] *= in.dimension(i);
- }
- eigen_assert(input_dims[0] == pre_contract_dims[0]);
- }
-
- // We will contract along dimensions (1, 2) in in and (1, 3) in out, if
- // this is col-major.
- // For row-major, it's dimensions (0, 1) in in and (0, 2) in out.
- array<IndexPair<TensorIndex>, 2> contract_dims;
- if (isColMajor) {
- // col-major: in.contract(output.patches)
- contract_dims[0] = IndexPair<TensorIndex>(1, 1);
- contract_dims[1] = IndexPair<TensorIndex>(2, 3);
- } else {
- // row-major: output.patches.contract(in)
- contract_dims[0] = IndexPair<TensorIndex>(0, 0);
- contract_dims[1] = IndexPair<TensorIndex>(2, 1);
- }
-
- // After the contraction, the kernel will have dimension
- // in_depth X out_depth X kernel_patches X kernel_rows X kernel_cols
- // We will need to shuffle the first two dimensions and reverse the spatial dimensions.
- // The end shape is:
- // out_depth X in_shape X kernel_planes X kernel_rows X kernel_cols
-
- // This is the shape of the kernel *before* the shuffling.
- DSizes<TensorIndex, 5> kernel_dims;
- if (isColMajor) {
- kernel_dims[0] = kernelChannels;
- kernel_dims[1] = kernelFilters;
- kernel_dims[2] = kernelPlanes;
- kernel_dims[3] = kernelRows;
- kernel_dims[4] = kernelCols;
- } else {
- kernel_dims[0] = kernelCols;
- kernel_dims[1] = kernelRows;
- kernel_dims[2] = kernelPlanes;
- kernel_dims[3] = kernelFilters;
- kernel_dims[4] = kernelChannels;
- }
-
- // Flip filters and channels.
- array<TensorIndex, 5> kernel_shuffle;
- if (isColMajor) {
- kernel_shuffle[0] = 1;
- kernel_shuffle[1] = 0;
- kernel_shuffle[2] = 2;
- kernel_shuffle[3] = 3;
- kernel_shuffle[4] = 4;
- } else {
- kernel_shuffle[0] = 0;
- kernel_shuffle[1] = 1;
- kernel_shuffle[2] = 2;
- kernel_shuffle[3] = 4;
- kernel_shuffle[4] = 3;
- }
-
- // Reverse the spatial dimensions.
- array<bool, 5> kernel_reverse;
- if (isColMajor) {
- kernel_reverse[0] = false;
- kernel_reverse[1] = false;
- kernel_reverse[2] = true;
- kernel_reverse[3] = true;
- kernel_reverse[4] = true;
- } else {
- kernel_reverse[0] = true;
- kernel_reverse[1] = true;
- kernel_reverse[2] = true;
- kernel_reverse[3] = false;
- kernel_reverse[4] = false;
- }
-
- DSizes<TensorIndex, NumDims> strides;
- for (int i = 0; i < NumDims; i++) {
- strides[i] = 1;
- }
- if (isColMajor) {
- strides[1] = stridePlanes;
- strides[2] = strideRows;
- strides[3] = strideCols;
- } else {
- strides[NumDims - 2] = stridePlanes;
- strides[NumDims - 3] = strideRows;
- strides[NumDims - 4] = strideCols;
- }
- return choose(
- Cond<internal::traits<Input>::Layout == ColMajor>(),
- input.reshape(input_dims)
- .contract(
- output_backward.extract_volume_patches(
- inputPlanes, inputRows, inputCols, 1,
- 1, 1, stridePlanes, strideRows, strideCols,
-
- padding_ztop, padding_zbottom, padding_top,
- padding_bottom, padding_left, padding_right)
- .reshape(pre_contract_dims),
- contract_dims)
- .reshape(kernel_dims)
- .reverse(kernel_reverse)
- .shuffle(kernel_shuffle),
- output_backward.extract_volume_patches(
- inputPlanes, inputRows, inputCols, 1, 1, 1,
- stridePlanes, strideRows, strideCols, padding_ztop,
- padding_zbottom, padding_top, padding_bottom,
- padding_left, padding_right)
- .reshape(pre_contract_dims)
- .contract(input.reshape(input_dims), contract_dims)
- .reshape(kernel_dims)
- .reverse(kernel_reverse)
- .shuffle(kernel_shuffle));
-}
-
-} // end namespace Eigen
-
-#endif // EIGEN_CXX11_NEURAL_NETWORKS_BACKWARD_CUBOID_CONVOLUTIONS_H
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/BackwardSpatialConvolutions.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/BackwardSpatialConvolutions.h
deleted file mode 100644
index 188dc75bf6..0000000000
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/BackwardSpatialConvolutions.h
+++ /dev/null
@@ -1,351 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2015 Ke Yang <yangke@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla
-// Public License v. 2.0. If a copy of the MPL was not distributed
-// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#ifndef EIGEN_CXX11_NEURAL_NETWORKS_BACKWARD_SPATIAL_CONVOLUTIONS_H
-#define EIGEN_CXX11_NEURAL_NETWORKS_BACKWARD_SPATIAL_CONVOLUTIONS_H
-
-namespace Eigen {
-
-/** SpatialConvolutionBackwardInput
- * \ingroup CXX11_NeuralNetworks_Module
- *
- * \brief Computes the backprop for the input of a 2D convolution.
- *
- * The output_backward parameter is expected to be a tensor with a rank of 3 or more (channels, height, width, and optionally others)
- * The kernel parameter is expected to be a 4D tensor (filters, channels, kernel_height, kernel_width)
- * The output_backward and the kernel must both be in col-major layout. The result will also be in col-major layout.
- *
- * If in_stride > 1, then applies convolution with holes (aka atrous convolution), sampling every in_stride input pixels.
- *
- * The result can be assigned to a tensor of rank equal to the rank of the output_backward. The dimensions of the result will be filters, height, width (and others if applicable).
- *
- * It is possible to swap the order of the width and height dimensions provided that the same order is used in the input, the kernel, and the output.
- *
- */
-
-template <typename OutputBackward, typename Kernel>
-EIGEN_ALWAYS_INLINE
-static const typename internal::conditional<
- internal::traits<OutputBackward>::Layout == ColMajor,
- TensorReshapingOp<const DSizes<typename internal::traits<OutputBackward>::Index, internal::traits<OutputBackward>::NumDimensions>, const TensorContractionOp<const array<IndexPair<typename internal::traits<OutputBackward>::Index>, 2>, const TensorReshapingOp<const DSizes<typename internal::traits<OutputBackward>::Index, 3>, const TensorReverseOp<const array<bool, 4>, const Kernel> >, const TensorReshapingOp<const DSizes<typename internal::traits<OutputBackward>::Index, 3>, const TensorImagePatchOp<Dynamic, Dynamic, const OutputBackward> > > >,
- TensorReshapingOp<const DSizes<typename internal::traits<OutputBackward>::Index, internal::traits<OutputBackward>::NumDimensions>, const TensorContractionOp<const array<IndexPair<typename internal::traits<OutputBackward>::Index>, 2>, const TensorReshapingOp<const DSizes<typename internal::traits<OutputBackward>::Index, 3>, const TensorImagePatchOp<Dynamic, Dynamic, const OutputBackward> >, const TensorReshapingOp<const DSizes<typename internal::traits<OutputBackward>::Index, 3>, const TensorReverseOp<const array<bool, 4>, const Kernel> > > > >::type
-SpatialConvolutionBackwardInput(const Kernel& kernel, const OutputBackward& output_backward, typename internal::traits<OutputBackward>::Index inputRows, typename internal::traits<OutputBackward>::Index inputCols, const DenseIndex stride = 1, const DenseIndex in_stride = 1) {
-
- typedef typename internal::traits<OutputBackward>::Index TensorIndex;
- TensorRef<Tensor<typename internal::traits<Kernel>::Scalar, internal::traits<Kernel>::NumDimensions, internal::traits<Kernel>::Layout, TensorIndex> > kern(kernel);
- TensorRef<Tensor<typename internal::traits<OutputBackward>::Scalar, internal::traits<OutputBackward>::NumDimensions, internal::traits<OutputBackward>::Layout, TensorIndex> > out(output_backward);
-
- EIGEN_STATIC_ASSERT(internal::traits<Kernel>::Layout == internal::traits<OutputBackward>::Layout, YOU_MADE_A_PROGRAMMING_MISTAKE);
-
- static const bool isColMajor = (internal::traits<OutputBackward>::Layout == ColMajor);
-
- static const int NumDims = internal::traits<OutputBackward>::NumDimensions;
-
- // Number of filters to apply. This is the same as the output depth of the result
- const TensorIndex kernelFilters = isColMajor ? kern.dimensions()[0] : kern.dimensions()[3];
- // Number of channels. This is the same as the input depth.
- const TensorIndex kernelChannels = isColMajor ? kern.dimensions()[1] : kern.dimensions()[2];
- const TensorIndex kernelRows = isColMajor ? kern.dimensions()[2] : kern.dimensions()[1];
- const TensorIndex kernelCols = isColMajor ? kern.dimensions()[3] : kern.dimensions()[0];
-
- // This is the effective kernel size, taking into account the (in_stride - 1) zero-values
- // inserted between consecutive kernel elements in atrous convolution
- const TensorIndex kernelRowsEff = kernelRows + (kernelRows - 1) * (in_stride - 1);
- const TensorIndex kernelColsEff = kernelCols + (kernelCols - 1) * (in_stride - 1);
-
- const TensorIndex outputRows = isColMajor ? output_backward.dimension(1) : output_backward.dimension(NumDims - 2);
- const TensorIndex outputCols = isColMajor ? output_backward.dimension(2) : output_backward.dimension(NumDims - 3);
-
- // Computing the forward padding
- const TensorIndex forward_pad_top = ((outputRows - 1) * stride + kernelRowsEff - inputRows) / 2;
- const TensorIndex forward_pad_left = ((outputCols - 1) * stride + kernelColsEff - inputCols) / 2;
-
- const TensorIndex padding_top = kernelRowsEff - 1 - forward_pad_top;
- const TensorIndex padding_left = kernelColsEff - 1 - forward_pad_left;
- const TensorIndex padding_bottom = inputRows + kernelRowsEff - 1 - (outputRows - 1) * stride - 1 - padding_top;
- const TensorIndex padding_right = inputCols + kernelColsEff - 1 - (outputCols - 1) * stride - 1 - padding_left;
-
- eigen_assert(padding_top >= 0);
- eigen_assert(padding_left >= 0);
- eigen_assert(padding_bottom >= 0);
- eigen_assert(padding_right >= 0);
-
- // The kernel has dimensions filters X channels X patch_rows X patch_cols
- // We need to reverse the kernel along dimensions corresponding to rows and
- // cols.
- // TODO(yangke): we can make things slightly faster by collapsing the dimensions
- // where we don't reverse. Try that once we have a faster compiler.
- array<bool, 4> kernel_reverse;
- if (isColMajor) {
- kernel_reverse[0] = false;
- kernel_reverse[1] = false;
- kernel_reverse[2] = true;
- kernel_reverse[3] = true;
- } else {
- kernel_reverse[0] = true;
- kernel_reverse[1] = true;
- kernel_reverse[2] = false;
- kernel_reverse[3] = false;
- }
-
- DSizes<TensorIndex, 3> kernel_dims;
- if (isColMajor) {
- kernel_dims[0] = kernelFilters;
- kernel_dims[1] = kernelChannels;
- kernel_dims[2] = kernelRows * kernelCols;
- } else {
- kernel_dims[0] = kernelRows * kernelCols;
- kernel_dims[1] = kernelChannels;
- kernel_dims[2] = kernelFilters;
- }
-
- // The output_backward has dimensions out_depth X out_rows X out_cols X OTHERS
- // When we extract the image patches from output_backward, it will have dimensions
- // out_depth X (patch_rows * patch_cols) X (input_rows * input_cols * OTHERS)
- DSizes<TensorIndex, 3> pre_contract_dims;
- if (isColMajor) {
- pre_contract_dims[0] = kernelFilters;
- pre_contract_dims[1] = kernelRows * kernelCols;
- pre_contract_dims[2] = inputRows * inputCols;
- for (int i = 3; i < NumDims; ++i) {
- pre_contract_dims[2] *= out.dimension(i);
- }
- } else {
- pre_contract_dims[2] = kernelFilters;
- pre_contract_dims[1] = kernelRows * kernelCols;
- pre_contract_dims[0] = inputRows * inputCols;
- for (int i = 0; i < NumDims - 3; ++i) {
- pre_contract_dims[0] *= out.dimension(i);
- }
- }
-
- // We will contract along dimensions (0, 2) in kernel and (0, 1) in
- // output_backward, if this is col-major, and
- // dimensions (0, 2) in kernel and (1, 2) in output_backward, if this row-major.
- array<IndexPair<TensorIndex>, 2> contract_dims;
- if (isColMajor) {
- // col-major: kernel.contract(output.patches)
- contract_dims[0] = IndexPair<TensorIndex>(0, 0);
- contract_dims[1] = IndexPair<TensorIndex>(2, 1);
- } else {
- // row-major: output.patches.contract(kernel)
- contract_dims[0] = IndexPair<TensorIndex>(1, 0);
- contract_dims[1] = IndexPair<TensorIndex>(2, 2);
- }
-
- // Post contraction, the dimensions of the input_backprop is
- // channels X input_rows X input_cols X OTHERS
- DSizes<TensorIndex, NumDims> post_contract_dims;
- if (isColMajor) {
- post_contract_dims[0] = kernelChannels;
- post_contract_dims[1] = inputRows;
- post_contract_dims[2] = inputCols;
- for (int i = 3; i < NumDims; ++i) {
- post_contract_dims[i] = out.dimension(i);
- }
- } else {
- post_contract_dims[NumDims - 1] = kernelChannels;
- post_contract_dims[NumDims - 2] = inputRows;
- post_contract_dims[NumDims - 3] = inputCols;
- for (int i = 0; i < NumDims - 3; ++i) {
- post_contract_dims[i] = out.dimension(i);
- }
- }
-
- return choose(Cond<internal::traits<OutputBackward>::Layout == ColMajor>(),
- kernel.reverse(kernel_reverse).reshape(kernel_dims).contract(output_backward.extract_image_patches(kernelRows, kernelCols, 1, 1, in_stride, in_stride, stride, stride, padding_top, padding_bottom, padding_left, padding_right, 0).reshape(pre_contract_dims), contract_dims).reshape(post_contract_dims),
- output_backward.extract_image_patches(kernelRows, kernelCols, 1, 1, in_stride, in_stride, stride, stride, padding_top, padding_bottom, padding_left, padding_right, 0).reshape(pre_contract_dims).contract(kernel.reverse(kernel_reverse).reshape(kernel_dims), contract_dims).reshape(post_contract_dims));
-}
-
-
-/** SpatialConvolutionBackwardKernel
- * \ingroup CXX11_NeuralNetworks_Module
- *
- * \brief Computes the backprop for the filter of a 2D convolution.
- *
- * The output_backward parameter is expected to be a tensor with a rank of 3 or more (channels, height, width, and optionally others)
- * The kernel parameter is expected to be a 4D tensor (filters, channels, kernel_height, kernel_width)
- * The output_backward and the kernel must both be in col-major layout. The result will also be in col-major layout.
- *
- * If in_stride > 1, then applies convolution with holes (aka atrous convolution), sampling every in_stride input pixels.
- *
- * The result can be assigned to a tensor of rank equal to the rank of the output_backward. The dimensions of the result will be filters, height, width (and others if applicable).
- *
- * It is possible to swap the order of the width and height dimensions provided that the same order is used in the input, the kernel, and the output.
- *
- */
-// TODO(gpapan): Resolve a bug in TensorContractionInputMapper at SpatialConvolutions.h that yangke circumvented by using .reshape().reshape().
-// This can significantly accelerate SpatialConvolutionBackwardKernel.
-
-template <typename OutputBackward, typename Input>
-EIGEN_ALWAYS_INLINE
-static const typename internal::conditional<
- internal::traits<OutputBackward>::Layout == ColMajor,
- const TensorShufflingOp<const array<typename internal::traits<OutputBackward>::Index, 4>, const TensorReverseOp<const array<bool, 4>, const TensorReshapingOp<const DSizes<typename internal::traits<OutputBackward>::Index, 4>, const TensorContractionOp<const array<IndexPair<typename internal::traits<Input>::Index>, 2>, const TensorReshapingOp<const DSizes<typename internal::traits<Input>::Index, 3>, const Input>, const TensorReshapingOp<const DSizes<typename internal::traits<OutputBackward>::Index, 4>, const TensorReshapingOp<const DSizes<typename internal::traits<OutputBackward>::Index, 4>, const TensorImagePatchOp<Dynamic, Dynamic, const OutputBackward> > > > > > >,
- const TensorShufflingOp<const array<typename internal::traits<OutputBackward>::Index, 4>, const TensorReverseOp<const array<bool, 4>, const TensorReshapingOp<const DSizes<typename internal::traits<OutputBackward>::Index, 4>, const TensorContractionOp<const array<IndexPair<typename internal::traits<Input>::Index>, 2>, const TensorReshapingOp<const DSizes<typename internal::traits<OutputBackward>::Index, 4>, const TensorReshapingOp<const DSizes<typename internal::traits<OutputBackward>::Index, 4>, const TensorImagePatchOp<Dynamic, Dynamic, const OutputBackward> > >, const TensorReshapingOp<const DSizes<typename internal::traits<Input>::Index, 3>, const Input> > > > > >::type
-SpatialConvolutionBackwardKernel(const Input& input, const OutputBackward& output_backward, typename internal::traits<Input>::Index kernelRows, typename internal::traits<Input>::Index kernelCols, const DenseIndex stride = 1, const DenseIndex in_stride = 1) {
-
- typedef typename internal::traits<Input>::Index TensorIndex;
- TensorRef<Tensor<typename internal::traits<Input>::Scalar, internal::traits<Input>::NumDimensions, internal::traits<Input>::Layout, TensorIndex> > in(input);
- TensorRef<Tensor<typename internal::traits<OutputBackward>::Scalar, internal::traits<OutputBackward>::NumDimensions, internal::traits<OutputBackward>::Layout, TensorIndex> > out(output_backward);
-
- EIGEN_STATIC_ASSERT(internal::traits<Input>::Layout == internal::traits<OutputBackward>::Layout, YOU_MADE_A_PROGRAMMING_MISTAKE);
-
- // stride and in_stride cannot both be larger than 1
- eigen_assert(!(stride > 1 && in_stride > 1));
-
- static const bool isColMajor = (internal::traits<Input>::Layout == ColMajor);
-
- static const int NumDims = internal::traits<Input>::NumDimensions;
- EIGEN_STATIC_ASSERT(internal::traits<Input>::NumDimensions == internal::traits<OutputBackward>::NumDimensions, YOU_MADE_A_PROGRAMMING_MISTAKE);
-
- const TensorIndex inputRows = isColMajor ? in.dimension(1) : in.dimension(NumDims - 2);
- const TensorIndex inputCols = isColMajor ? in.dimension(2) : in.dimension(NumDims - 3);
-
- const TensorIndex outputRows = isColMajor ? output_backward.dimension(1) : output_backward.dimension(NumDims - 2);
- const TensorIndex outputCols = isColMajor ? output_backward.dimension(2) : output_backward.dimension(NumDims - 3);
-
- // Number of filters to apply. This is the same as the output depth of the result
- const TensorIndex kernelFilters = isColMajor ? out.dimensions()[0] : out.dimensions()[NumDims - 1];
-
- // Number of channels. This is the same as the input depth.
- const TensorIndex kernelChannels = isColMajor ? in.dimensions()[0] : in.dimensions()[NumDims - 1];
-
- // This is the effective kernel size, taking into account the (in_stride - 1) zero-values
- // inserted between consecutive kernel elements in atrous convolution
- const TensorIndex kernelRowsEff = kernelRows + (kernelRows - 1) * (in_stride - 1);
- const TensorIndex kernelColsEff = kernelCols + (kernelCols - 1) * (in_stride - 1);
-
- // Computing the forward padding
- const TensorIndex forward_pad_top = ((outputRows - 1) * stride + kernelRowsEff - inputRows) / 2;
- const TensorIndex forward_pad_left = ((outputCols - 1) * stride + kernelColsEff - inputCols) / 2;
-
- // TODO: factor out the padding computation.
- const TensorIndex padding_top = kernelRowsEff - 1 - forward_pad_top;
- const TensorIndex padding_left = kernelColsEff - 1 - forward_pad_left;
- const TensorIndex padding_bottom = inputRows + kernelRowsEff - 1 - (outputRows - 1) * stride - 1 - padding_top;
- const TensorIndex padding_right = inputCols + kernelColsEff - 1 - (outputCols - 1) * stride - 1 - padding_left;
-
- eigen_assert(padding_top >= 0);
- eigen_assert(padding_left >= 0);
- eigen_assert(padding_bottom >= 0);
- eigen_assert(padding_right >= 0);
-
- // The output_backward has dimensions out_depth X out_rows X out_cols X OTHERS
- // When we extract the image patches from output_backward (with input as the
- // kernel), it will have dimensions
- // (out_depth) X (input_rows * input_cols) X (kernel_rows * kernel_cols) X OTHERS
- DSizes<TensorIndex, 4> pre_contract_dims;
- if (isColMajor) {
- pre_contract_dims[0] = kernelFilters;
- pre_contract_dims[1] = inputRows * inputCols;
- pre_contract_dims[2] = kernelRows * kernelCols;
- pre_contract_dims[3] = 1;
- for (int i = 3; i < NumDims; ++i) {
- pre_contract_dims[3] *= out.dimension(i);
- }
- } else {
- pre_contract_dims[3] = kernelFilters;
- pre_contract_dims[2] = inputRows * inputCols;
- pre_contract_dims[1] = kernelRows * kernelCols;
- pre_contract_dims[0] = 1;
- for (int i = 0; i < NumDims - 3; ++i) {
- pre_contract_dims[0] *= out.dimension(i);
- }
- }
-
- // The input has dimensions in_depth X (input_rows * input_cols) X OTHERS
- DSizes<TensorIndex, 3> input_dims;
- if (isColMajor) {
- input_dims[0] = kernelChannels;
- input_dims[1] = inputRows * inputCols;
- input_dims[2] = 1;
- for (int i = 3; i < NumDims; ++i) {
- input_dims[2] *= in.dimension(i);
- }
- eigen_assert(input_dims[2] == pre_contract_dims[3]);
- } else {
- input_dims[2] = kernelChannels;
- input_dims[1] = inputRows * inputCols;
- input_dims[0] = 1;
- for (int i = 0; i < NumDims - 3; ++i) {
- input_dims[0] *= in.dimension(i);
- }
- eigen_assert(input_dims[0] == pre_contract_dims[0]);
- }
-
- // We will contract along dimensions (1, 2) in in and (1, 3) in out, if
- // this is col-major.
- // For row-major, it's dimensions (0, 1) in in and (0, 2) in out.
- array<IndexPair<TensorIndex>, 2> contract_dims;
- if (isColMajor) {
- // col-major: in.contract(output.patches)
- contract_dims[0] = IndexPair<TensorIndex>(1, 1);
- contract_dims[1] = IndexPair<TensorIndex>(2, 3);
- } else {
- // row-major: output.patches.contract(in)
- contract_dims[0] = IndexPair<TensorIndex>(0, 0);
- contract_dims[1] = IndexPair<TensorIndex>(2, 1);
- }
-
- // After the contraction, the kernel will have dimension
- // in_depth X out_depth X kernel_rows X kernel_cols
- // We will need to shuffle the first two dimensions and reverse the latter
- // two dimensions.
- // The end shape is
- // out_depth X in_shape X kernel_rows X kernel_cols
-
- // This is the shape of the kernel *before* the shuffling.
- DSizes<TensorIndex, 4> kernel_dims;
- if (isColMajor) {
- kernel_dims[0] = kernelChannels;
- kernel_dims[1] = kernelFilters;
- kernel_dims[2] = kernelRows;
- kernel_dims[3] = kernelCols;
- } else {
- kernel_dims[0] = kernelCols;
- kernel_dims[1] = kernelRows;
- kernel_dims[2] = kernelFilters;
- kernel_dims[3] = kernelChannels;
- }
-
- array<TensorIndex, 4> kernel_shuffle;
- if (isColMajor) {
- kernel_shuffle[0] = 1;
- kernel_shuffle[1] = 0;
- kernel_shuffle[2] = 2;
- kernel_shuffle[3] = 3;
- } else {
- kernel_shuffle[0] = 0;
- kernel_shuffle[1] = 1;
- kernel_shuffle[2] = 3;
- kernel_shuffle[3] = 2;
- }
-
- array<bool, 4> kernel_reverse;
- if (isColMajor) {
- kernel_reverse[0] = false;
- kernel_reverse[1] = false;
- kernel_reverse[2] = true;
- kernel_reverse[3] = true;
- } else {
- kernel_reverse[0] = true;
- kernel_reverse[1] = true;
- kernel_reverse[2] = false;
- kernel_reverse[3] = false;
- }
-
- return choose(Cond<internal::traits<Input>::Layout == ColMajor>(),
- input.reshape(input_dims).contract(output_backward.extract_image_patches(inputRows, inputCols, in_stride, in_stride, 1, 1, stride, stride, padding_top, padding_bottom, padding_left, padding_right, 0).reshape(pre_contract_dims).reshape(pre_contract_dims), contract_dims).reshape(kernel_dims).reverse(kernel_reverse).shuffle(kernel_shuffle),
- output_backward.extract_image_patches(inputRows, inputCols, in_stride, in_stride, 1, 1, stride, stride, padding_top, padding_bottom, padding_left, padding_right, 0).reshape(pre_contract_dims).reshape(pre_contract_dims).contract(input.reshape(input_dims), contract_dims).reshape(kernel_dims).reverse(kernel_reverse).shuffle(kernel_shuffle));
-}
-
-} // end namespace Eigen
-
-#endif // EIGEN_CXX11_NEURAL_NETWORKS_BACKWARD_SPATIAL_CONVOLUTIONS_H
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/CuboidConvolution.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/CuboidConvolution.h
deleted file mode 100644
index dfb9dcedba..0000000000
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/CuboidConvolution.h
+++ /dev/null
@@ -1,179 +0,0 @@
-#ifndef EIGEN_CXX11_SRC_NEURAL_NETWORKS_CUBOID_CONVOLUTION_H
-#define EIGEN_CXX11_SRC_NEURAL_NETWORKS_CUBOID_CONVOLUTION_H
-
-#include "Patch3d.h"
-
-namespace Eigen {
-
-/** CuboidConvolution
- * \ingroup CXX11_NeuralNetworks_Module
- *
- * \brief Applies a 3D convolution over a multichannel input voxel block.
- *
- * The input parameter is expected to be a tensor with a rank of 4 or more (channels, depth, height, width, and optionally others).
- * The kernel parameter is expected to be a 5D tensor (filters, channels, kernel_depth, kernel_height, kernel_width).
- * The result can be assigned to a tensor of rank equal to the rank of the input. The dimensions of the result will be filters, depth, height, width (and others if applicable).
- *
- * The input and kernel have to be in the same layout, and both row-major and
- * col-major are supported. The shapes given above are for col-major layout.
- * For row-major, all dimensions should be reversed.
- *
- * It is possible to swap the order of the depth, width, and height dimensions provided that the same order is used in the input, the kernel, and the output.
- */
-template <typename Input, typename Kernel>
-EIGEN_ALWAYS_INLINE
-static const typename internal::conditional <
- internal::traits<Input>::Layout == ColMajor,
- TensorReshapingOp<
- const DSizes<typename internal::traits<Input>::Index,
- internal::traits<Input>::NumDimensions>,
- const TensorContractionOp<
- const array<IndexPair<typename internal::traits<Input>::Index>, 1>,
- const TensorReshapingOp<
- const DSizes<typename internal::traits<Input>::Index, 2>,
- const Kernel>,
- const TensorReshapingOp<
- const DSizes<typename internal::traits<Input>::Index, 2>,
- const TensorVolumePatchOp<Dynamic, Dynamic, Dynamic,
- const Input> > > >,
- TensorReshapingOp<
- const DSizes<typename internal::traits<Input>::Index,
- internal::traits<Input>::NumDimensions>,
- const TensorContractionOp<
- const array<IndexPair<typename internal::traits<Input>::Index>, 1>,
- const TensorReshapingOp<
- const DSizes<typename internal::traits<Input>::Index, 2>,
- const TensorVolumePatchOp<Dynamic, Dynamic, Dynamic,
- const Input> > ,
- const TensorReshapingOp<
- const DSizes<typename internal::traits<Input>::Index, 2>,
- const Kernel> > > >::type
-CuboidConvolution(const Input& input, const Kernel& kernel,
- const DenseIndex stridePlanes = 1,
- const DenseIndex strideRows = 1,
- const DenseIndex strideCols = 1,
- const PaddingType padding_type = PADDING_SAME) {
- typedef typename internal::traits<Input>::Index TensorIndex;
- TensorRef<Tensor<typename internal::traits<Input>::Scalar, internal::traits<Input>::NumDimensions, internal::traits<Input>::Layout, TensorIndex> > in(input);
- TensorRef<Tensor<typename internal::traits<Kernel>::Scalar, internal::traits<Kernel>::NumDimensions, internal::traits<Kernel>::Layout, TensorIndex> > kern(kernel);
-
- EIGEN_STATIC_ASSERT(internal::traits<Input>::Layout == internal::traits<Kernel>::Layout, YOU_MADE_A_PROGRAMMING_MISTAKE);
- static const bool isColMajor = (internal::traits<Input>::Layout == ColMajor);
- static const int NumDims = internal::traits<Input>::NumDimensions;
-
- // Number of filters to apply. This is the same as the output depth of the result.
- const TensorIndex kernelFilters = isColMajor ? kern.dimensions()[0] : kern.dimensions()[4];
- const TensorIndex kernelChannels = isColMajor ? kern.dimensions()[1] : kern.dimensions()[3];
-
- // Spatial size of the kernel.
- const TensorIndex kernelDepth = isColMajor ? kern.dimensions()[2] : kern.dimensions()[2];
- const TensorIndex kernelRows = isColMajor ? kern.dimensions()[3] : kern.dimensions()[1];
- const TensorIndex kernelCols = isColMajor ? kern.dimensions()[4] : kern.dimensions()[0];
-
- if (isColMajor) {
- eigen_assert(kernelChannels == in.dimension(0));
- } else {
- eigen_assert(kernelChannels == in.dimension(NumDims - 1));
- }
-
- const TensorIndex inputPlanes = isColMajor ? in.dimension(1) : in.dimension(NumDims - 2);
- const TensorIndex inputRows = isColMajor ? in.dimension(2) : in.dimension(NumDims - 3);
- const TensorIndex inputCols = isColMajor ? in.dimension(3) : in.dimension(NumDims - 4);
-
- const float stride_planes_f = static_cast<float>(stridePlanes);
- const float stride_rows_f = static_cast<float>(strideRows);
- const float stride_cols_f = static_cast<float>(strideCols);
- TensorIndex out_depth;
- TensorIndex out_height;
- TensorIndex out_width;
- switch (padding_type) {
- case PADDING_VALID:
- out_depth = ceil((inputPlanes - kernelDepth + 1.f) / stride_planes_f);
- out_height = ceil((inputRows - kernelRows + 1.f) / stride_rows_f);
- out_width = ceil((inputCols - kernelCols + 1.f) / stride_cols_f);
- break;
- case PADDING_SAME:
- out_depth = ceil(inputPlanes / stride_planes_f);
- out_height = ceil(inputRows / stride_rows_f);
- out_width = ceil(inputCols / stride_cols_f);
- break;
- default:
- eigen_assert(false && "unexpected padding");
- }
-
- DSizes<TensorIndex, 2> kernel_dims;
- if (isColMajor) {
- kernel_dims[0] = kernelFilters;
- kernel_dims[1] = kernelChannels * kernelDepth * kernelRows * kernelCols;
- } else {
- kernel_dims[0] = kernelChannels * kernelDepth * kernelRows * kernelCols;
- kernel_dims[1] = kernelFilters;
- }
-
- // Molds the output of the patch extraction result into a 2D tensor:
- // - the first dimension (dims[0]): the patch values to be multiplied with the kernels
- // - the second dimension (dims[1]): everything else
- DSizes<TensorIndex, 2> pre_contract_dims;
- if (isColMajor) {
- pre_contract_dims[0] = kernelChannels * kernelDepth * kernelRows * kernelCols;
- pre_contract_dims[1] = out_depth * out_height * out_width;
- for (int i = 4; i < NumDims; ++i) {
- pre_contract_dims[1] *= in.dimension(i);
- }
- } else {
- pre_contract_dims[1] = kernelChannels * kernelDepth * kernelRows * kernelCols;
- pre_contract_dims[0] = out_depth * out_height * out_width;
- for (int i = 0; i < NumDims - 4; ++i) {
- pre_contract_dims[0] *= in.dimension(i);
- }
- }
-
- array<IndexPair<TensorIndex>, 1> contract_dims;
- contract_dims[0] = IndexPair<TensorIndex>(1, 0);
-
- // Molds the output of the contraction into the shape expected by the user
- // (assuming ColMajor):
- // - 1st dim: kernel filters
- // - 2nd dim: output depth
- // - 3nd dim: output height
- // - 4rd dim: output width
- // - 5th dim and beyond: everything else including batch size
- DSizes<TensorIndex, NumDims> post_contract_dims;
- if (isColMajor) {
- post_contract_dims[0] = kernelFilters;
- post_contract_dims[1] = out_depth;
- post_contract_dims[2] = out_height;
- post_contract_dims[3] = out_width;
- for (int i = 4; i < NumDims; ++i) {
- post_contract_dims[i] = in.dimension(i);
- }
- } else {
- post_contract_dims[NumDims - 1] = kernelFilters;
- post_contract_dims[NumDims - 2] = out_depth;
- post_contract_dims[NumDims - 3] = out_height;
- post_contract_dims[NumDims - 4] = out_width;
- for (int i = 0; i < NumDims - 4; ++i) {
- post_contract_dims[i] = in.dimension(i);
- }
- }
-
- return choose(
- Cond<internal::traits<Input>::Layout == ColMajor>(),
- kernel.reshape(kernel_dims)
- .contract(input.extract_volume_patches(
- kernelDepth, kernelRows, kernelCols, stridePlanes,
- strideRows, strideCols, padding_type)
- .reshape(pre_contract_dims),
- contract_dims)
- .reshape(post_contract_dims),
- input.extract_volume_patches(kernelDepth, kernelRows, kernelCols,
- stridePlanes, strideRows, strideCols,
- padding_type)
- .reshape(pre_contract_dims)
- .contract(kernel.reshape(kernel_dims), contract_dims)
- .reshape(post_contract_dims));
-}
-
-} // end namespace Eigen
-
-#endif // EIGEN_CXX11_SRC_NEURAL_NETWORKS_CUBOID_CONVOLUTION_H
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Patch3d.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Patch3d.h
deleted file mode 100644
index 2864f83299..0000000000
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Patch3d.h
+++ /dev/null
@@ -1,240 +0,0 @@
-#ifndef EIGEN_CXX11_SRC_NEURAL_NETWORKS_PATCH3D_H
-#define EIGEN_CXX11_SRC_NEURAL_NETWORKS_PATCH3D_H
-
-#if not defined(__CUDACC__)
-#include <type_traits>
-#endif
-
-namespace Eigen {
-namespace internal {
-
-/** Extract3DPatches
- * \ingroup CXX11_NeuralNetworksModule
- *
- * \brief Extracts 3D patches from a multichannel input volume.
- *
- * The input parameter is expected to be a tensor with a rank of 4 or more
- * (channels, depth, height, width, optional others in col-major, and the
- * reverse order in row-major).
-
- * The return value will be a tensor of 3 more dimension than the input tensor.
- * In col-major, the first 4 dimensions of the result are: channels, patch_depth,
- * patch_height, patch_width. The next dimensions will identify the patch
- * position on the 3D grid of extracted patches: z, y, x. The remaining
- * dimensions, if any, will be the same as the 'other' dimensions of the input
- * tensor.
- */
-
-template <typename Input>
-EIGEN_ALWAYS_INLINE static const TensorStridingOp<
- const array<typename internal::traits<Input>::Index,
- internal::traits<Input>::NumDimensions + 3>,
- const TensorReshapingOp<
- const DSizes<typename internal::traits<Input>::Index,
- internal::traits<Input>::NumDimensions + 3>,
- const TensorPatchOp<
- const DSizes<typename internal::traits<Input>::Index,
- internal::traits<Input>::NumDimensions>,
- const TensorPaddingOp<
- const array<IndexPair<typename internal::traits<Input>::Index>,
- internal::traits<Input>::NumDimensions>,
- const Input> > > >
-Extract3DPatches(
- const Input& input, const DenseIndex patchPlanes,
- const DenseIndex patchRows, const DenseIndex patchCols,
- const DenseIndex stridePlanes, const DenseIndex strideRows,
- const DenseIndex strideCols,
- const DenseIndex paddingZTop, const DenseIndex paddingZBottom,
- const DenseIndex paddingTop, const DenseIndex paddingBottom,
- const DenseIndex paddingLeft, const DenseIndex paddingRight,
- const typename internal::traits<Input>::Scalar padding_value = 0) {
-
- typedef typename internal::traits<Input>::Index TensorIndex;
- TensorRef<Tensor<typename internal::traits<Input>::Scalar, internal::traits<Input>::NumDimensions, internal::traits<Input>::Layout, TensorIndex> > in(input);
-
- EIGEN_STATIC_ASSERT(internal::traits<Input>::NumDimensions >= 4, YOU_MADE_A_PROGRAMMING_MISTAKE);
-
- static const bool isColMajor = (internal::traits<Input>::Layout == ColMajor);
- static const int NumDims = internal::traits<Input>::NumDimensions;
- static const int ExtDims = NumDims + 3;
-
- // Tensor size after patch extraction. We add three dimensions to unpack the
- // linear patch index into a 3D grid over which stride() can work.
- DSizes<TensorIndex, ExtDims> pre_stride_dims;
-
- if (isColMajor) {
- pre_stride_dims[0] = in.dimension(0);
- pre_stride_dims[1] = patchPlanes;
- pre_stride_dims[2] = patchRows;
- pre_stride_dims[3] = patchCols;
- } else {
- pre_stride_dims[ExtDims - 1] = in.dimension(NumDims - 1);
- pre_stride_dims[ExtDims - 4] = patchCols;
- pre_stride_dims[ExtDims - 3] = patchRows;
- pre_stride_dims[ExtDims - 2] = patchPlanes;
- }
-
- const TensorIndex inputPlanes = isColMajor ? in.dimension(1) : in.dimension(NumDims - 2);
- const TensorIndex inputRows = isColMajor ? in.dimension(2) : in.dimension(NumDims - 3);
- const TensorIndex inputCols = isColMajor ? in.dimension(3) : in.dimension(NumDims - 4);
-
- array<IndexPair<TensorIndex>, NumDims> paddings;
- for (int i = 0; i < NumDims; ++i) {
- paddings[i] = IndexPair<TensorIndex>(0, 0);
- }
-
- paddings[isColMajor ? 1 : (NumDims - 2)] = IndexPair<TensorIndex>(paddingZTop, paddingZBottom);
- paddings[isColMajor ? 2 : (NumDims - 3)] = IndexPair<TensorIndex>(paddingTop, paddingBottom);
- paddings[isColMajor ? 3 : (NumDims - 4)] = IndexPair<TensorIndex>(paddingLeft, paddingRight);
-
- pre_stride_dims[isColMajor ? 4 : (ExtDims - 5)] = inputPlanes + paddingZBottom + paddingZTop - patchPlanes + 1;
- pre_stride_dims[isColMajor ? 5 : (ExtDims - 6)] = inputRows + paddingTop + paddingBottom - patchRows + 1;
- pre_stride_dims[isColMajor ? 6 : (ExtDims - 7)] = inputCols + paddingLeft + paddingRight - patchCols + 1;
-
- if (isColMajor) {
- for (int i = 7; i < NumDims + 3; ++i) {
- pre_stride_dims[i] = in.dimension(i - 3);
- }
- } else {
- for (int i = 0; i < NumDims - 4; ++i) {
- pre_stride_dims[i] = in.dimension(i);
- }
- }
-
- DSizes<TensorIndex, NumDims> patch_dims;
- if (isColMajor) {
- patch_dims[0] = in.dimension(0);
- patch_dims[1] = patchPlanes;
- patch_dims[2] = patchRows;
- patch_dims[3] = patchCols;
- for (int i = 4; i < NumDims; ++i) {
- patch_dims[i] = 1;
- }
- } else {
- patch_dims[NumDims - 1] = in.dimension(NumDims - 1);
- patch_dims[NumDims - 4] = patchCols;
- patch_dims[NumDims - 3] = patchRows;
- patch_dims[NumDims - 2] = patchPlanes;
- for (int i = 0; i < NumDims - 4; i++) {
- patch_dims[i] = 1;
- }
- }
-
- array<TensorIndex, NumDims + 3> strides;
- if (isColMajor) {
- // No striding within the patches.
- for (int i = 0; i < 4; ++i) {
- strides[i] = 1;
- }
- // Apply striding in the spatial patch grid dimensions only.
- strides[4] = stridePlanes;
- strides[5] = strideRows;
- strides[6] = strideCols;
- // No striding in the remaining dimensions (batches, ...).
- for (int i = 7; i < NumDims + 3; i++) {
- strides[i] = 1;
- }
- } else {
- // No striding within the patches.
- for (int i = 1; i <= 4; ++i) {
- strides[ExtDims - i] = 1;
- }
- // Apply striding in the spatial patch grid dimensions only.
- strides[ExtDims - 7] = strideCols;
- strides[ExtDims - 6] = strideRows;
- strides[ExtDims - 5] = stridePlanes;
- // No striding in the remaining dimensions (batches, ...).
- for (int i = 0; i < NumDims - 4; i++) {
- strides[i] = 1;
- }
- }
-
- // TODO(mjanusz): Consider getting rid of pad(), and stride() and extend
- // extract_patches to take additional parameters for padding/striding,
- // similarly to extract_image_patches.
- return input.pad(paddings, padding_value).extract_patches(patch_dims).reshape(pre_stride_dims).stride(strides);
-}
-
-
-template <typename Input>
-EIGEN_ALWAYS_INLINE static const TensorStridingOp<
- const array<typename internal::traits<Input>::Index,
- internal::traits<Input>::NumDimensions + 3>,
- const TensorReshapingOp<
- const DSizes<typename internal::traits<Input>::Index,
- internal::traits<Input>::NumDimensions + 3>,
- const TensorPatchOp<
- const DSizes<typename internal::traits<Input>::Index,
- internal::traits<Input>::NumDimensions>,
- const TensorPaddingOp<
- const array<IndexPair<typename internal::traits<Input>::Index>,
- internal::traits<Input>::NumDimensions>,
- const Input> > > >
-Extract3DPatches(
- const Input& input, const DenseIndex patchPlanes,
- const DenseIndex patchRows, const DenseIndex patchCols,
- const DenseIndex stridePlanes, const DenseIndex strideRows,
- const DenseIndex strideCols, const PaddingType padding_type,
- const typename internal::traits<Input>::Scalar padding_value = 0) {
- typedef typename internal::traits<Input>::Index TensorIndex;
- TensorRef<Tensor<typename internal::traits<Input>::Scalar, internal::traits<Input>::NumDimensions, internal::traits<Input>::Layout, TensorIndex> > in(input);
-
- EIGEN_STATIC_ASSERT(internal::traits<Input>::NumDimensions >= 4, YOU_MADE_A_PROGRAMMING_MISTAKE);
-
- static const bool isColMajor = (internal::traits<Input>::Layout == ColMajor);
- static const int NumDims = internal::traits<Input>::NumDimensions;
-
- const TensorIndex inputPlanes = isColMajor ? in.dimension(1) : in.dimension(NumDims - 2);
- const TensorIndex inputRows = isColMajor ? in.dimension(2) : in.dimension(NumDims - 3);
- const TensorIndex inputCols = isColMajor ? in.dimension(3) : in.dimension(NumDims - 4);
-
- switch (padding_type) {
- case PADDING_VALID:
- // No padding in any dimension.
- return Extract3DPatches(input, patchPlanes, patchRows, patchCols,
- stridePlanes, strideRows, strideCols,
- 0, 0, 0, 0, 0, 0, padding_value);
- case PADDING_SAME: {
- // The side of the tensor before striding should be just the expected
- // output times the stride.
- const TensorIndex size_z = ceil(inputPlanes / static_cast<float>(stridePlanes)) * stridePlanes;
- const TensorIndex size_y = ceil(inputRows / static_cast<float>(strideRows)) * strideRows;
- const TensorIndex size_x = ceil(inputCols / static_cast<float>(strideCols)) * strideCols;
-
- // The size of the patch space is going to be: padded_input_size - patch_size + 1.
- // This has to match the expected size before striding (pre_stride_dims).
- // The deltas below extend the input to the expected size.
- const TensorIndex dz = size_z + patchPlanes - 1 - inputPlanes;
- const TensorIndex dy = size_y + patchRows - 1 - inputRows;
- const TensorIndex dx = size_x + patchCols - 1 - inputCols;
-
- return Extract3DPatches(input, patchPlanes, patchRows, patchCols,
- stridePlanes, strideRows, strideCols,
- dz - dz / 2, dz / 2,
- dy - dy / 2, dy / 2,
- dx - dx / 2, dx / 2,
- padding_value);
- }
- default:
- eigen_assert(false && "unexpected padding");
- // unreachable code to avoid missing return warning.
- return Extract3DPatches(input, patchPlanes, patchRows, patchCols,
- stridePlanes, strideRows, strideCols,
- 0, 0, 0, 0, 0, 0, padding_value);
- }
-}
-
-// TODO(mjanusz): Switch this to a 'using' alias once CUDA supports C++11.
-template <typename Input>
-struct Extract3DPatchesType {
- typedef const TensorStridingOp< const array<typename internal::traits<Input>::Index, internal::traits<Input>::NumDimensions + 3>,
- const TensorReshapingOp< const DSizes<typename internal::traits<Input>::Index, internal::traits<Input>::NumDimensions + 3>,
- const TensorPatchOp< const DSizes<typename internal::traits<Input>::Index, internal::traits<Input>::NumDimensions>,
- const TensorPaddingOp< const array< IndexPair<typename internal::traits<Input>::Index>, internal::traits<Input>::NumDimensions>,
- const Input> > > > type;
-};
-
-} // end namespace internal
-} // end namespace Eigen
-
-#endif // EIGEN_CXX11_SRC_NEURAL_NETWORKS_PATCH3D_H
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Pooling.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Pooling.h
deleted file mode 100644
index 942b060ba7..0000000000
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Pooling.h
+++ /dev/null
@@ -1,433 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla
-// Public License v. 2.0. If a copy of the MPL was not distributed
-// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef EIGEN_CXX11_NEURAL_NETWORKS_POOLING_H
-#define EIGEN_CXX11_NEURAL_NETWORKS_POOLING_H
-
-#include "Patch3d.h"
-
-namespace Eigen {
-
-/** SpatialMaxPooling
- * \ingroup CXX11_NeuralNetworks_Module
- *
- * \brief Applies a max-pooling over a multichannel input image.
- *
- * The input parameter is expected to be a with a rank of 4 (channels, height, width, others in col-major, and the reverse of that in row-major).
- *
- * The result can be assigned to a tensor of rank equal to the rank of the input. The dimensions of the result will be channels, height, width, and others (in col-major, and the reverse of that if the input was row-major).
- *
- * The order of the width and height dimensions can be swapped if needed.
- *
-*/
-#if !defined(EIGEN_HAS_INDEX_LIST)
-template <typename Input>
-EIGEN_ALWAYS_INLINE
-static const TensorReshapingOp<const Eigen::DSizes<typename internal::traits<Input>::Index, internal::traits<Input>::NumDimensions>, const TensorReductionOp<internal::MaxReducer<typename internal::remove_const<typename internal::traits<Input>::Scalar>::type>, const Eigen::array<int, 2>, const TensorImagePatchOp<Dynamic, Dynamic, const Input> > >
-#else
-template <typename Input>
-EIGEN_ALWAYS_INLINE
-static const TensorReshapingOp<const Eigen::DSizes<typename internal::traits<Input>::Index, internal::traits<Input>::NumDimensions>, const TensorReductionOp<internal::MaxReducer<typename internal::remove_const<typename internal::traits<Input>::Scalar>::type>, typename internal::conditional<internal::traits<Input>::Layout == ColMajor, const Eigen::IndexList<Eigen::type2index<1>, Eigen::type2index<2> >, const Eigen::IndexList<Eigen::type2index<2>, Eigen::type2index<3> > >::type, const TensorImagePatchOp<Dynamic, Dynamic, const Input> > >
-#endif
-SpatialMaxPooling(const Input& input, DenseIndex patchRows, DenseIndex patchCols,
- DenseIndex strideRows, DenseIndex strideCols, const PaddingType padding_type,
- DenseIndex in_strideRows = 1, DenseIndex in_strideCols = 1)
-{
- EIGEN_STATIC_ASSERT(internal::traits<Input>::NumDimensions == 4, YOU_MADE_A_PROGRAMMING_MISTAKE);
-
- typedef typename internal::traits<Input>::Index TensorIndex;
- TensorRef<Tensor<typename internal::traits<Input>::Scalar, internal::traits<Input>::NumDimensions, internal::traits<Input>::Layout, TensorIndex> > in(input);
-
- const DenseIndex patchRowsEff = patchRows + (patchRows - 1) * (in_strideRows - 1);
- const DenseIndex patchColsEff = patchCols + (patchCols - 1) * (in_strideCols - 1);
-
- static const bool isColMajor = (internal::traits<Input>::Layout == ColMajor);
- static const int idxRows = isColMajor ? 1 : 2;
- static const int idxCols = isColMajor ? 2 : 1;
-
- // Molds the output of the reduction into the shape expected by the user.
- // (assuming col-major):
- // - 1st dim: channels
- // - 2nd dim: output height
- // - 3rd dim: output width
- // - 4th dim and beyond: everything else including batch size
- Eigen::DSizes<TensorIndex, internal::traits<Input>::NumDimensions> post_reduce_dims;
- post_reduce_dims[0] = in.dimension(0);
- if (padding_type == PADDING_VALID) {
- post_reduce_dims[idxRows] = numext::ceil((in.dimension(idxRows) - patchRowsEff + 1.f) / static_cast<float>(strideRows));
- post_reduce_dims[idxCols] = numext::ceil((in.dimension(idxCols) - patchColsEff + 1.f) / static_cast<float>(strideCols));
- } else {
- post_reduce_dims[idxRows] = numext::ceil(in.dimension(idxRows) / static_cast<float>(strideRows));
- post_reduce_dims[idxCols] = numext::ceil(in.dimension(idxCols) / static_cast<float>(strideCols));
- }
- post_reduce_dims[3] = in.dimension(3);
-
-#if !defined(EIGEN_HAS_INDEX_LIST)
- // nvcc doesn't support cxx11
- Eigen::array<int, 2> reduction_dims;
- if (isColMajor) {
- reduction_dims[0] = 1;
- reduction_dims[1] = 2;
- } else {
- reduction_dims[0] = 2;
- reduction_dims[1] = 3;
- }
-#else
- // Take advantage of cxx11 to give the compiler information it can use to
- // optimize the code.
- typename internal::conditional<internal::traits<Input>::Layout == ColMajor, const Eigen::IndexList<Eigen::type2index<1>, Eigen::type2index<2> >, const Eigen::IndexList<Eigen::type2index<2>, Eigen::type2index<3> > >::type reduction_dims;
-#endif
-
- return input.extract_image_patches(patchRows, patchCols, strideRows, strideCols, in_strideRows, in_strideCols, padding_type, -Eigen::NumTraits<typename internal::remove_const<typename internal::traits<Input>::Scalar>::type>::highest()).maximum(reduction_dims).reshape(post_reduce_dims);
-}
-
-/** CuboidMaxPooling
- * \ingroup CXX11_NeuralNetworks_Module
- *
- * \brief Applies a max-pooling over a multichannel input volume.
- *
- * The input parameter is expected to be a tensor with a rank of 5 (channels, depth, height, width, others in col-major, and the reverse of that in row-major).
- *
- * The result can be assigned to a tensor of rank equal to the rank of the input. The dimensions of the result will be channels, depth, height, width, and others (in col-major, and the reverse of that if the input was row-major).
- *
- * The order of the depth, width and height dimensions can be swapped if needed.
- *
-*/
-#if !defined(EIGEN_HAS_INDEX_LIST)
-template <typename Input>
-EIGEN_ALWAYS_INLINE static const TensorReshapingOp<
- const Eigen::DSizes<DenseIndex, internal::traits<Input>::NumDimensions>,
- const TensorReductionOp<
- internal::MaxReducer<float>, const Eigen::array<int, 1>,
- const TensorReshapingOp<
- const Eigen::DSizes<DenseIndex, 3>,
- const TensorVolumePatchOp<Dynamic, Dynamic, Dynamic, const Input> > > >
-#else
-template <typename Input>
-EIGEN_ALWAYS_INLINE static const TensorReshapingOp<
- const Eigen::DSizes<DenseIndex, internal::traits<Input>::NumDimensions>,
- const TensorReductionOp<
- internal::MaxReducer<float>,
- const Eigen::IndexList<Eigen::type2index<1> >,
- const TensorReshapingOp<
- const Eigen::DSizes<DenseIndex, 3>,
- const TensorVolumePatchOp<Dynamic, Dynamic, Dynamic, const Input> > > >
-#endif
-CuboidMaxPooling(const Input& input, DenseIndex patchPlanes,
- DenseIndex patchRows, DenseIndex patchCols,
- DenseIndex stridePlanes, DenseIndex strideRows,
- DenseIndex strideCols, const PaddingType padding_type) {
- EIGEN_STATIC_ASSERT(internal::traits<Input>::NumDimensions == 5, YOU_MADE_A_PROGRAMMING_MISTAKE);
- static const bool isColMajor = (internal::traits<Input>::Layout == ColMajor);
-
- typedef typename internal::traits<Input>::Index TensorIndex;
- TensorRef<Tensor<typename internal::traits<Input>::Scalar, internal::traits<Input>::NumDimensions, internal::traits<Input>::Layout, TensorIndex> > in(input);
-
- static const int idxPlanes = isColMajor ? 1 : 3;
- static const int idxRows = 2;
- static const int idxCols = isColMajor ? 3 : 1;
-
- // Molds the output of the reduction into the shape expected by the used
- // (assuming col-major):
- // - 1st dim: channels
- // - 2nd dim: output depth
- // - 3rd dim: output height
- // - 4th dim: output width
- // - 5th dim and beyond: everything else including batch size
- Eigen::DSizes<DenseIndex, internal::traits<Input>::NumDimensions> post_reduce_dims;
- post_reduce_dims[0] = in.dimension(0);
- if (padding_type == PADDING_VALID) {
- post_reduce_dims[idxPlanes] = numext::ceil((in.dimension(idxPlanes) - patchPlanes + 1.f) / static_cast<float>(stridePlanes));
- post_reduce_dims[idxRows] = numext::ceil((in.dimension(idxRows) - patchRows + 1.f) / static_cast<float>(strideRows));
- post_reduce_dims[idxCols] = numext::ceil((in.dimension(idxCols) - patchCols + 1.f) / static_cast<float>(strideCols));
- } else {
- post_reduce_dims[idxPlanes] = numext::ceil(in.dimension(idxPlanes) / static_cast<float>(stridePlanes));
- post_reduce_dims[idxRows] = numext::ceil(in.dimension(idxRows) / static_cast<float>(strideRows));
- post_reduce_dims[idxCols] = numext::ceil(in.dimension(idxCols) / static_cast<float>(strideCols));
- }
- post_reduce_dims[4] = in.dimension(4);
-
- Eigen::DSizes<DenseIndex, 3> pre_reduce_dims;
- pre_reduce_dims[1] = patchRows * patchCols * patchPlanes;
- if (isColMajor) {
- pre_reduce_dims[0] = post_reduce_dims[0];
- pre_reduce_dims[2] = post_reduce_dims[1] * post_reduce_dims[2] * post_reduce_dims[3] * post_reduce_dims[4];
- } else {
- pre_reduce_dims[0] = post_reduce_dims[0] * post_reduce_dims[1] * post_reduce_dims[2] * post_reduce_dims[3];
- pre_reduce_dims[2] = post_reduce_dims[4];
- }
-
-#if !defined(EIGEN_HAS_INDEX_LIST)
- // nvcc doesn't support cxx11
- Eigen::array<int, 1> reduction_dims;
- reduction_dims[0] = 1;
-#else
- // Take advantage of cxx11 to give the compiler information it can use to
- // optimize the code.
- Eigen::IndexList<Eigen::type2index<1> > reduction_dims;
-#endif
- return input.extract_volume_patches(patchPlanes, patchRows, patchCols,
- stridePlanes, strideRows, strideCols,
- padding_type, -Eigen::NumTraits<float>::highest())
- .reshape(pre_reduce_dims)
- .maximum(reduction_dims)
- .reshape(post_reduce_dims);
-}
-
-
-/** SpatialAvgPooling
- * \ingroup CXX11_NeuralNetworks_Module
- *
- * \brief Applies an average pooling over a multichannel input image.
- *
- * The input parameter is expected to be a tensor with a rank of 4 (channels, height, width, others in col-major, and the reverse of that in row-major).
- *
- * The result can be assigned to a tensor of rank equal to the rank of the input. The dimensions of the result will be channels, height, width, and others (in col-major, and the reverse of that if the input was row-major).
- *
- * The order of the width and height dimensions can be swapped if needed.
- *
-*/
-namespace internal {
-
-template <typename T> struct AvgPoolMeanReducer
-{
-#if (EIGEN_ARCH_i386 || EIGEN_ARCH_x86_64) && !defined(__CUDACC__)
- // We only support packet access for floats.
- static const bool PacketAccess = internal::is_same<T, float>::value;
-#else
- static const bool PacketAccess = false;
-#endif
- static const bool IsStateful = true;
-
- EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE AvgPoolMeanReducer() : scalarCount_(0) {
- typedef typename packet_traits<T>::type Packet;
- packetCount_ = pset1<Packet>(0.0);
- }
-
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T t, T* accum) {
- if (t != -Eigen::NumTraits<T>::highest()) {
- (*accum) = (*accum) + t;
- scalarCount_++;
- }
- }
-
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const {
- return static_cast<T>(0);
- }
-
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalize(const T accum) const {
- eigen_assert(scalarCount_ > 0);
- return accum / scalarCount_;
- }
-
-#if (EIGEN_ARCH_i386 || EIGEN_ARCH_x86_64) && !defined(__CUDACC__)
-#ifdef EIGEN_VECTORIZE_AVX
-#define pequal(a,b) _mm256_cmp_ps(a,b,_CMP_EQ_UQ)
-#define psel(a,b,false_mask) _mm256_blendv_ps(a,b,false_mask)
-#else
-#define pequal(a,b) _mm_cmpeq_ps(a,b)
-#define psel(a,b,false_mask) _mm_or_ps(_mm_andnot_ps(false_mask, a), _mm_and_ps(false_mask, b))
-#endif
-
- template <typename Packet>
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reducePacket(const Packet& p, Packet* accum) {
- reducePacketWithType(static_cast<T>(0), p, accum);
- }
-
- template <typename Packet>
- void reducePacketWithType(T, const Packet& p, Packet* accum) {
- Packet skip_mask = pequal(p, pset1<Packet>(-Eigen::NumTraits<T>::highest()));
- (*accum) = padd<Packet>(*accum, psel(p, pset1<Packet>(0), skip_mask));
- packetCount_ = padd<Packet>(packetCount_, psel(pset1<Packet>(1), pset1<Packet>(0), skip_mask));
- }
-
- template <typename Packet>
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet initializePacket() const {
- return pset1<Packet>(0);
- }
-
- template <typename Packet>
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet finalizePacket(const Packet& vaccum) const {
- return pdiv(vaccum, packetCount_);
- }
- template <typename Packet>
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalizeBoth(const T saccum, const Packet& vaccum) const {
- return (saccum + predux(vaccum)) / (scalarCount_ + predux(packetCount_));
- }
-#endif
-
- protected:
- typedef typename packet_traits<T>::type Packet;
- int scalarCount_;
- Packet packetCount_;
-};
-
-} // namespace internal
-
-#if !defined(EIGEN_HAS_INDEX_LIST)
-template <typename Input>
-EIGEN_ALWAYS_INLINE
-static const TensorReshapingOp<const Eigen::DSizes<typename internal::traits<Input>::Index, internal::traits<Input>::NumDimensions>, const TensorReductionOp<internal::AvgPoolMeanReducer<typename internal::remove_const<typename internal::traits<Input>::Scalar>::type>, const Eigen::array<int, 2>, const TensorImagePatchOp<Dynamic, Dynamic, const Input> > >
-#else
-template <typename Input>
-EIGEN_ALWAYS_INLINE
-static const TensorReshapingOp<const Eigen::DSizes<typename internal::traits<Input>::Index, internal::traits<Input>::NumDimensions>, const TensorReductionOp<internal::AvgPoolMeanReducer<typename internal::remove_const<typename internal::traits<Input>::Scalar>::type>, typename internal::conditional<internal::traits<Input>::Layout == ColMajor, const Eigen::IndexList<Eigen::type2index<1>, Eigen::type2index<2> >, const Eigen::IndexList<Eigen::type2index<2>, Eigen::type2index<3> > >::type, const TensorImagePatchOp<Dynamic, Dynamic, const Input> > >
-#endif
-SpatialAvgPooling(const Input& input, DenseIndex patchRows, DenseIndex patchCols,
- DenseIndex strideRows, DenseIndex strideCols, const PaddingType padding_type,
- DenseIndex in_strideRows = 1, DenseIndex in_strideCols = 1)
-{
- EIGEN_STATIC_ASSERT(internal::traits<Input>::NumDimensions == 4, YOU_MADE_A_PROGRAMMING_MISTAKE);
-
- typedef typename internal::traits<Input>::Index TensorIndex;
- TensorRef<Tensor<typename internal::traits<Input>::Scalar, internal::traits<Input>::NumDimensions, internal::traits<Input>::Layout, TensorIndex> > in(input);
-
- const DenseIndex patchRowsEff = patchRows + (patchRows - 1) * (in_strideRows - 1);
- const DenseIndex patchColsEff = patchCols + (patchCols - 1) * (in_strideCols - 1);
-
- static const bool isColMajor = (internal::traits<Input>::Layout == ColMajor);
- static const int idxRows = isColMajor ? 1 : 2;
- static const int idxCols = isColMajor ? 2 : 1;
-
- // Molds the output of the reduction into the shape expected by the user.
- // (assuming col-major):
- // - 1st dim: channels
- // - 2nd dim: output height
- // - 3rd dim: output width
- // - 4th dim and beyond: everything else including batch size
- Eigen::DSizes<TensorIndex, internal::traits<Input>::NumDimensions> post_reduce_dims;
- post_reduce_dims[0] = in.dimension(0);
- if (padding_type == PADDING_VALID) {
- post_reduce_dims[idxRows] = numext::ceil((in.dimension(idxRows) - patchRowsEff + 1.f) / static_cast<float>(strideRows));
- post_reduce_dims[idxCols] = numext::ceil((in.dimension(idxCols) - patchColsEff + 1.f) / static_cast<float>(strideCols));
- } else {
- post_reduce_dims[idxRows] = numext::ceil(in.dimension(idxRows) / static_cast<float>(strideRows));
- post_reduce_dims[idxCols] = numext::ceil(in.dimension(idxCols) / static_cast<float>(strideCols));
- }
- post_reduce_dims[3] = in.dimension(3);
-
- typedef typename internal::remove_const<typename internal::traits<Input>::Scalar>::type CoeffReturnType;
- internal::AvgPoolMeanReducer<CoeffReturnType> mean_with_nan;
-
-#if !defined(EIGEN_HAS_INDEX_LIST)
- // nvcc doesn't support cxx11
- Eigen::array<int, 2> reduction_dims;
- if (isColMajor) {
- reduction_dims[0] = 1;
- reduction_dims[1] = 2;
- } else {
- reduction_dims[0] = 2;
- reduction_dims[1] = 3;
- }
-#else
- // Take advantage of cxx11 to give the compiler information it can use to
- // optimize the code.
- typename internal::conditional<internal::traits<Input>::Layout == ColMajor, const Eigen::IndexList<Eigen::type2index<1>, Eigen::type2index<2> >, const Eigen::IndexList<Eigen::type2index<2>, Eigen::type2index<3> > >::type reduction_dims;
-#endif
- return input.extract_image_patches(patchRows, patchCols, strideRows, strideCols, in_strideRows, in_strideCols, padding_type, -Eigen::NumTraits<typename internal::remove_const<typename internal::traits<Input>::Scalar>::type>::highest()).reduce(reduction_dims, mean_with_nan).reshape(post_reduce_dims);
-}
-
-
-/** CuboidAvgPooling
- * \ingroup CXX11_NeuralNetworks_Module
- *
- * \brief Applies an average pooling over a multichannel input volume.
- *
- * The input parameter is expected to be a tensor with a rank of 5 (channels, depth, height, width, others, and the reverse of that in row-major).
- *
- * The result can be assigned to a tensor of rank equal to the rank of the input. The dimensions of the result will be channels, depth, width, and others (in col-major, and the reverse of that if the input was row-major).
- *
- * The order of the depth, width and height dimensions can be swapped if needed.
- *
-*/
-#if !defined(EIGEN_HAS_INDEX_LIST)
-template <typename Input>
-EIGEN_ALWAYS_INLINE static const TensorReshapingOp<
- const Eigen::DSizes<DenseIndex, internal::traits<Input>::NumDimensions>,
- const TensorReductionOp<
- internal::AvgPoolMeanReducer<float>, const Eigen::array<int, 1>,
- const TensorReshapingOp<
- const Eigen::DSizes<DenseIndex, 3>,
- const TensorVolumePatchOp<Dynamic, Dynamic, Dynamic, const Input> > > >
-#else
-template <typename Input>
-EIGEN_ALWAYS_INLINE static const TensorReshapingOp<
- const Eigen::DSizes<DenseIndex, internal::traits<Input>::NumDimensions>,
- const TensorReductionOp<
- internal::AvgPoolMeanReducer<float>,
- const Eigen::IndexList<Eigen::type2index<1> >,
- const TensorReshapingOp<
- const Eigen::DSizes<DenseIndex, 3>,
- const TensorVolumePatchOp<Dynamic, Dynamic, Dynamic, const Input> > > >
-#endif
-CuboidAvgPooling(const Input& input, DenseIndex patchPlanes,
- DenseIndex patchRows, DenseIndex patchCols,
- DenseIndex stridePlanes, DenseIndex strideRows,
- DenseIndex strideCols, const PaddingType padding_type) {
- EIGEN_STATIC_ASSERT(internal::traits<Input>::NumDimensions == 5, YOU_MADE_A_PROGRAMMING_MISTAKE);
- static const bool isColMajor = (internal::traits<Input>::Layout == ColMajor);
-
- typedef typename internal::traits<Input>::Index TensorIndex;
- TensorRef<Tensor<typename internal::traits<Input>::Scalar, internal::traits<Input>::NumDimensions, internal::traits<Input>::Layout, TensorIndex> > in(input);
-
- static const int idxPlanes = isColMajor ? 1 : 3;
- static const int idxRows = 2;
- static const int idxCols = isColMajor ? 3 : 1;
- // Molds the output of the reduction into the shape expected by the used
- // (assuming col-major):
- // - 1st dim: channels
- // - 2nd dim: outupt depth
- // - 3rd dim: output height
- // - 4th dim: output width
- // - 5th dim and beyond: everything else including batch size
- Eigen::DSizes<DenseIndex, internal::traits<Input>::NumDimensions> post_reduce_dims;
- post_reduce_dims[0] = in.dimension(0);
- if (padding_type == PADDING_VALID) {
- post_reduce_dims[idxPlanes] = numext::ceil((in.dimension(idxPlanes) - patchPlanes + 1.f) / static_cast<float>(stridePlanes));
- post_reduce_dims[idxRows] = numext::ceil((in.dimension(idxRows) - patchRows + 1.f) / static_cast<float>(strideRows));
- post_reduce_dims[idxCols] = numext::ceil((in.dimension(idxCols) - patchCols + 1.f) / static_cast<float>(strideCols));
- } else {
- post_reduce_dims[idxPlanes] = numext::ceil(in.dimension(idxPlanes) / static_cast<float>(stridePlanes));
- post_reduce_dims[idxRows] = numext::ceil(in.dimension(idxRows) / static_cast<float>(strideRows));
- post_reduce_dims[idxCols] = numext::ceil(in.dimension(idxCols) / static_cast<float>(strideCols));
- }
- post_reduce_dims[4] = in.dimension(4);
-
- Eigen::DSizes<DenseIndex, 3> pre_reduce_dims;
- pre_reduce_dims[1] = patchRows * patchCols * patchPlanes;
- if (isColMajor) {
- pre_reduce_dims[0] = post_reduce_dims[0];
- pre_reduce_dims[2] = post_reduce_dims[1] * post_reduce_dims[2] * post_reduce_dims[3] * post_reduce_dims[4];
- } else {
- pre_reduce_dims[0] = post_reduce_dims[0] * post_reduce_dims[1] * post_reduce_dims[2] * post_reduce_dims[3];
- pre_reduce_dims[2] = post_reduce_dims[4];
- }
-
- typedef typename internal::remove_const<typename internal::traits<Input>::Scalar>::type CoeffReturnType;
- internal::AvgPoolMeanReducer<CoeffReturnType> mean_with_nan;
-
-#if !defined(EIGEN_HAS_INDEX_LIST)
- // nvcc doesn't support cxx11
- Eigen::array<int, 1> reduction_dims;
- reduction_dims[0] = 1;
-#else
- // Take advantage of cxx11 to give the compiler information it can use to
- // optimize the code.
- Eigen::IndexList<Eigen::type2index<1> > reduction_dims;
-#endif
- return input.extract_volume_patches(patchPlanes, patchRows, patchCols,
- stridePlanes, strideRows, strideCols,
- padding_type, -Eigen::NumTraits<float>::highest())
- .reshape(pre_reduce_dims)
- .reduce(reduction_dims, mean_with_nan)
- .reshape(post_reduce_dims);
-}
-
-} // end namespace Eigen
-
-#endif // EIGEN_CXX11_NEURAL_NETWORKS_POOLING_H
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/SoftMax.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/SoftMax.h
deleted file mode 100644
index f0e21ab9c2..0000000000
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/SoftMax.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla
-// Public License v. 2.0. If a copy of the MPL was not distributed
-// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef EIGEN_CXX11_NEURAL_NETWORKS_SOFTMAX_H
-#define EIGEN_CXX11_NEURAL_NETWORKS_SOFTMAX_H
-
-namespace Eigen {
-
-/** SoftMax
- * \ingroup CXX11_NeuralNetworks_Module
- *
- * \brief Applies a softmax
- *
- * The input parameter is expected to be a col-major tensor with a rank of 2 (depth and other).
- *
- * The result can be assigned to a tensor of rank and dimensions equal to that of the input. The result will be laid out in col-major order.
- *
-*/
-
-namespace {
-class SoftmaxOp {
- public:
- EIGEN_ALWAYS_INLINE SoftmaxOp(const float beta) : beta_(beta) { }
-
- template <typename Input> EIGEN_ALWAYS_INLINE
- typename Input::Dimensions dimensions(const Input& input) const {
- return input.dimensions();
- }
-
- template <typename Input, typename Output, typename Device>
- void eval(const Input& input, Output& output, const Device& device) const
- {
-#if !defined(EIGEN_HAS_INDEX_LIST)
- // nvcc doesn't support cxx11
- Eigen::array<typename internal::traits<Input>::Index, 1> depth_dim;
- depth_dim[0] = 0;
- Eigen::array<typename internal::traits<Input>::Index, 2> bcast;
- bcast[0] = dimensions(input)[0];
- bcast[1] = 1;
- DSizes<typename internal::traits<Input>::Index, 2> dims2d;
- dims2d[0] = 1;
- dims2d[1] = dimensions(input)[1];
-#else
- // Take advantage of cxx11 to give the compiler information it can use to
- // optimize the code.
- Eigen::IndexList<Eigen::type2index<0>> depth_dim;
- Eigen::IndexList<int, Eigen::type2index<1>> bcast;
- bcast.set(0, dimensions(input)[0]);
- Eigen::IndexList<Eigen::type2index<1>, typename internal::traits<Input>::Index> dims2d;
- dims2d.set(1, dimensions(input)[1]);
-#endif
-
- output.device(device) = ((input - input.maximum(depth_dim).eval().reshape(dims2d).broadcast(bcast)) * beta_).exp();
- output.device(device) = output / (output.sum(depth_dim).eval().reshape(dims2d).broadcast(bcast));
- }
-
- private:
- const float beta_;
-};
-}
-
-
-template <typename Input>
-EIGEN_ALWAYS_INLINE
-static const TensorCustomUnaryOp<const SoftmaxOp, const Input>
-SoftMax(const Input& input, const float beta)
-{
- EIGEN_STATIC_ASSERT(internal::traits<Input>::Layout == ColMajor, YOU_MADE_A_PROGRAMMING_MISTAKE);
- EIGEN_STATIC_ASSERT(internal::traits<Input>::NumDimensions == 2, YOU_MADE_A_PROGRAMMING_MISTAKE);
-
- const SoftmaxOp op(beta);
- return input.customOp(op);
-}
-
-
-} // end namespace Eigen
-
-#endif // EIGEN_CXX11_NEURAL_NETWORKS_SOFTMAX_H
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/SpatialConvolutions.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/SpatialConvolutions.h
deleted file mode 100644
index 8e2ddca6b5..0000000000
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/SpatialConvolutions.h
+++ /dev/null
@@ -1,775 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla
-// Public License v. 2.0. If a copy of the MPL was not distributed
-// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef EIGEN_CXX11_NEURAL_NETWORKS_SPATIAL_CONVOLUTIONS_H
-#define EIGEN_CXX11_NEURAL_NETWORKS_SPATIAL_CONVOLUTIONS_H
-
-namespace Eigen {
-
-namespace internal {
-
-// These optimizations require vector instructions
-#ifdef EIGEN_VECTORIZE
-
-// TODO: Consolidate this part of the code with the image patch extraction code
-// since they are both very similar.
-template <typename NewDimension, DenseIndex Rows, DenseIndex Cols, typename ArgType, typename Device,
- typename Scalar_, typename Index,
- typename nocontract_t, typename contract_t,
- int Side, size_t packet_size,
- bool inner_dim_contiguous, bool inner_dim_reordered, int Alignment>
-class TensorContractionInputMapper<Scalar_, Index, Side, TensorEvaluator<const TensorReshapingOp<NewDimension, const TensorImagePatchOp<Rows, Cols, ArgType> >, Device>, nocontract_t, contract_t, packet_size, inner_dim_contiguous, inner_dim_reordered, Alignment>
-{
- public:
- typedef TensorContractionInputMapper<Scalar_, Index, Side, TensorEvaluator<const TensorReshapingOp<NewDimension, const TensorImagePatchOp<Rows, Cols, ArgType> >, Device>, nocontract_t, contract_t, packet_size, inner_dim_contiguous, inner_dim_reordered, Alignment> Self;
- typedef TensorContractionSubMapper<Scalar_, Index, Side, TensorEvaluator<const TensorReshapingOp<NewDimension, const TensorImagePatchOp<Rows, Cols, ArgType> >, Device>, nocontract_t, contract_t, packet_size, inner_dim_contiguous, inner_dim_reordered, Alignment> SubMapper;
- typedef SubMapper VectorMapper;
- typedef SubMapper LinearMapper;
- typedef Scalar_ Scalar;
- typedef typename packet_traits<Scalar>::type Packet;
-
- TensorContractionInputMapper(const TensorEvaluator<const TensorReshapingOp<NewDimension, const TensorImagePatchOp<Rows, Cols, ArgType> >, Device>& tensor,
- const nocontract_t&, const nocontract_t&,
- const contract_t&, const contract_t&)
- : m_impl(tensor.impl().impl())
- {
- Index patch_rows;
- Index patch_depth;
- if (internal::traits<ArgType>::Layout == ColMajor) {
- patch_depth = tensor.impl().dimensions()[0];
- patch_rows = tensor.impl().dimensions()[1];
- m_patch_cols = tensor.impl().dimensions()[2];
- m_num_patches = tensor.impl().dimensions()[3];
- } else {
- static const int NumDims = tensor.impl().dimensions().size();
- patch_depth = tensor.impl().dimensions()[NumDims - 1];
- patch_rows = tensor.impl().dimensions()[NumDims - 2];
- m_patch_cols = tensor.impl().dimensions()[NumDims - 3];
- m_num_patches = tensor.impl().dimensions()[NumDims - 4];
- }
- m_patch_row_inflate_strides = tensor.impl().rowInflateStride();
- m_patch_col_inflate_strides = tensor.impl().colInflateStride();
-
- m_colStride = patch_rows;
-
- m_outputRows = tensor.impl().outputRows();
- m_row_strides = tensor.impl().userRowStride();
- m_col_strides = tensor.impl().userColStride();
-
- m_in_row_strides = tensor.impl().userInRowStride();
- m_in_col_strides = tensor.impl().userInColStride();
-
- if (internal::traits<ArgType>::Layout == ColMajor) {
- m_inputRows = tensor.impl().impl().dimensions()[1];
- m_inputCols = tensor.impl().impl().dimensions()[2];
- } else {
- static const int NumDims = tensor.impl().impl().dimensions().size();
- m_inputRows = tensor.impl().impl().dimensions()[NumDims - 2];
- m_inputCols = tensor.impl().impl().dimensions()[NumDims - 3];
- }
-
- m_rowInputStride = patch_depth;
- m_colInputStride = patch_depth * m_inputRows;
- m_patchInputStride = patch_depth * m_inputRows * m_inputCols;
-
- m_rowPaddingTop = tensor.impl().rowPaddingTop();
- m_colPaddingLeft = tensor.impl().colPaddingLeft();
-
- m_fastInputRowStride = internal::TensorIntDivisor<Index>(m_patch_row_inflate_strides);
- m_fastInputColStride = internal::TensorIntDivisor<Index>(m_patch_col_inflate_strides);
- m_fastNumPatches = internal::TensorIntDivisor<Index>(m_num_patches);
- m_fastColStride = internal::TensorIntDivisor<Index>(m_colStride);
- m_fastOutputRows = internal::TensorIntDivisor<Index>(m_outputRows);
- m_fastDimZero = internal::TensorIntDivisor<Index>(patch_depth);
- }
-
- TensorContractionInputMapper(const TensorContractionInputMapper& base_mapper) :
- m_impl(base_mapper.m_impl) {
- m_patch_cols = base_mapper.m_patch_cols;
- m_num_patches = base_mapper.m_num_patches;
- m_patch_row_inflate_strides = base_mapper.m_patch_row_inflate_strides;
- m_patch_col_inflate_strides = base_mapper.m_patch_col_inflate_strides;
-
- m_colStride = base_mapper.m_colStride;
-
- m_rowInputStride = base_mapper.m_rowInputStride;
- m_colInputStride = base_mapper.m_colInputStride;
- m_patchInputStride = base_mapper.m_patchInputStride;
-
- m_inputRows = base_mapper.m_inputRows;
- m_inputCols = base_mapper.m_inputCols;
-
- m_outputRows = base_mapper.m_outputRows;
- m_row_strides = base_mapper.m_row_strides;
- m_col_strides = base_mapper.m_col_strides;
-
- m_in_row_strides = base_mapper.m_in_row_strides;
- m_in_col_strides = base_mapper.m_in_col_strides;
-
- m_rowPaddingTop = base_mapper.m_rowPaddingTop;
- m_colPaddingLeft = base_mapper.m_colPaddingLeft;
-
- m_fastInputRowStride = base_mapper.m_fastInputRowStride;
- m_fastInputColStride = base_mapper.m_fastInputColStride;
- m_fastNumPatches = base_mapper.m_fastNumPatches;
- m_fastColStride = base_mapper.m_fastColStride;
- m_fastOutputRows = base_mapper.m_fastOutputRows;
- m_fastDimZero = base_mapper.m_fastDimZero;
- }
-
- // If true, turns off some optimizations for loading packets since the image
- // patches are "non-standard" such as there are non-trivial strides or
- // inflations in the input.
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE bool nonStandardPatches() const {
- return m_in_row_strides != 1 || m_in_col_strides != 1 || m_patch_row_inflate_strides != 1 || m_patch_col_inflate_strides != 1;
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_STRONG_INLINE SubMapper getSubMapper(Index i, Index j) const {
- return SubMapper(*this, i, j);
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_STRONG_INLINE LinearMapper getLinearMapper(Index i, Index j) const {
- return LinearMapper(*this, i, j);
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Scalar operator()(Index row) const {
- Index rowIndex, colIndex, otherIndex;
- computeBaseIndices(0, rowIndex, colIndex, otherIndex);
- return loadCoeff(row, rowIndex, colIndex, otherIndex);
- }
-
- // Load the coefficient at the patchIndex location instead of the usual m_rowIndex,
- // m_colIndex, m_otherIndex. This is currently only used by the gpu code. EIGEN_DEVICE_FUNC
- EIGEN_DEVICE_FUNC
- EIGEN_STRONG_INLINE Scalar operator()(Index row, Index patchIndex) const {
- Index rowIndex, colIndex, otherIndex;
- computeBaseIndices(patchIndex, rowIndex, colIndex, otherIndex);
- return loadCoeff(row, rowIndex, colIndex, otherIndex);
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Packet loadPacket(Index row) const {
- Index rowIndex, colIndex, otherIndex;
- computeBaseIndices(0, rowIndex, colIndex, otherIndex);
- return loadPacket(row, rowIndex, colIndex, otherIndex);
- }
-
- // Load the packet at the patchIndex location instead of the usual m_rowIndex,
- // m_colIndex, m_otherIndex. This is currently only used by the gpu code.
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Packet loadPacket(Index row, Index patchIndex) const {
- Index rowIndex, colIndex, otherIndex;
- computeBaseIndices(patchIndex, rowIndex, colIndex, otherIndex);
- return loadPacket(row, rowIndex, colIndex, otherIndex);
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE const TensorEvaluator<ArgType, Device>& impl() const { return m_impl; }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Index patchDepth() const { return m_rowInputStride; }
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Index patchRows() const { return m_colStride; }
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Index patchCols() const { return m_patch_cols; }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Packet packetNoPadding(const Index depth, const Index baseIndex) const {
- const Index inputIndex = depth + baseIndex;
- return m_impl.template packet<Unaligned>(inputIndex);
- }
-
- private:
- friend class TensorContractionSubMapper<Scalar, Index, Side, TensorEvaluator<const TensorReshapingOp<NewDimension, const TensorImagePatchOp<Rows, Cols, ArgType> >, Device>, nocontract_t, contract_t, packet_size, inner_dim_contiguous, inner_dim_reordered, Alignment>;
-
- EIGEN_DEVICE_FUNC
- EIGEN_STRONG_INLINE Scalar loadCoeff(Index patchId, Index rowIndex, Index colIndex, Index otherIndex) const {
- // Find the offset of the element wrt the location of the first element.
- const Index patchOffset = patchId / m_fastDimZero;
-
- const Index colOffset = patchOffset / m_fastColStride;
- const Index inputCol = colIndex + colOffset * m_in_col_strides;
- const Index origInputCol = (m_patch_col_inflate_strides == 1) ? inputCol : ((inputCol >= 0) ? (inputCol / m_fastInputColStride) : 0);
- const Index rowOffset = patchOffset - colOffset * m_colStride;
- const Index inputRow = rowIndex + rowOffset * m_in_row_strides;
- const Index origInputRow = (m_patch_row_inflate_strides == 1) ? inputRow : ((inputRow >= 0) ? (inputRow / m_fastInputRowStride) : 0);
- if (origInputCol < 0 | origInputRow < 0 | origInputCol >= m_inputCols | origInputRow >= m_inputRows |
- (inputCol != origInputCol * m_patch_col_inflate_strides) | (inputRow != origInputRow * m_patch_row_inflate_strides)) {
- return Scalar(0);
- }
- const Index depth = patchId - patchOffset * patchDepth();
- const Index inputIndex = depth + origInputRow * m_rowInputStride + origInputCol * m_colInputStride + otherIndex;
- return m_impl.coeff(inputIndex);
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_STRONG_INLINE Scalar loadCoeffStandard(Index patchId, Index rowIndex, Index colIndex, Index otherIndex) const {
- eigen_assert(!nonStandardPatches());
-
- // Find the offset of the element wrt the location of the first element.
- const Index patchOffset = patchId / m_fastDimZero;
-
- const Index colOffset = patchOffset / m_fastColStride;
- const Index inputCol = colIndex + colOffset;
- const Index rowOffset = patchOffset - colOffset * m_colStride;
- const Index inputRow = rowIndex + rowOffset;
- if (inputCol < 0 || inputCol >= m_inputCols || inputRow < 0 || inputRow >= m_inputRows) {
- return Scalar(0);
- }
- const Index depth = patchId - patchOffset * patchDepth();
- const Index inputIndex = depth + inputRow * m_rowInputStride + inputCol * m_colInputStride + otherIndex;
- return m_impl.coeff(inputIndex);
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Packet loadPacket(Index patchId, Index rowIndex, Index colIndex, Index otherIndex) const {
- const Index packetSize = internal::unpacket_traits<Packet>::size;
- EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
- eigen_assert(patchId < patchDepth()*patchRows()*m_patch_cols);
-
- if (nonStandardPatches()) {
- return packetWithPossibleZero(patchId, rowIndex, colIndex, otherIndex);
- }
- return loadPacketStandard(patchId, rowIndex, colIndex, otherIndex);
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Packet loadPacketStandard(Index patchId, Index rowIndex, Index colIndex, Index otherIndex) const {
- const Index packetSize = internal::unpacket_traits<Packet>::size;
- EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
- eigen_assert(patchId < patchDepth()*patchRows()*m_patch_cols);
-
- eigen_assert(!nonStandardPatches());
-
- if ((patchDepth() % packetSize) == 0) {
- return loadPacketFast(patchId, rowIndex, colIndex, otherIndex);
- }
- else {
- const Index patchOffsets[2] = {patchId / m_fastDimZero, (patchId + packetSize - 1) / m_fastDimZero};
-
- const Index colOffsets[2] = {patchOffsets[0] / m_fastColStride, patchOffsets[1] / m_fastColStride};
-
- const Index inputCols[2] = {colIndex + colOffsets[0], colIndex + colOffsets[1]};
- if (inputCols[0] >= m_inputCols | inputCols[1] < 0) {
- // all zeros
- return internal::pset1<Packet>(Scalar(0));
- }
-
- if (inputCols[0] == inputCols[1]) {
- const Index rowOffsets[2] = {patchOffsets[0] - colOffsets[0]*m_colStride, patchOffsets[1] - colOffsets[1]*m_colStride};
- eigen_assert(rowOffsets[0] <= rowOffsets[1]);
- const Index inputRows[2] = {rowIndex + rowOffsets[0], rowIndex + rowOffsets[1]};
-
- if (inputRows[0] >= m_inputRows | inputRows[1] < 0) {
- // all zeros
- return internal::pset1<Packet>(Scalar(0));
- }
-
- if (inputRows[0] >= 0 & inputRows[1] < m_inputRows) {
- // no padding
- const Index depth = patchId - patchOffsets[0] * patchDepth();
- const Index inputIndex = depth + inputRows[0] * m_rowInputStride + inputCols[0] * m_colInputStride + otherIndex;
- return m_impl.template packet<Unaligned>(inputIndex);
- }
- }
- }
- return packetWithPossibleZero(patchId, rowIndex, colIndex, otherIndex);
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Packet loadPacketFast(Index patchId, Index rowIndex, Index colIndex, Index otherIndex) const {
- const Index packetSize = internal::unpacket_traits<Packet>::size;
- EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
- eigen_assert(patchId < patchDepth()*patchRows()*m_patch_cols);
-
- eigen_assert(!nonStandardPatches());
- eigen_assert((patchDepth() % packetSize) == 0);
- // Find the offset of the element wrt the location of the first element.
- const Index patchOffset = patchId / m_fastDimZero;
- eigen_assert((patchId + packetSize - 1) / m_fastDimZero == patchOffset);
-
- const Index colOffset = patchOffset / m_fastColStride;
- const Index inputCol = colIndex + colOffset;
- const Index rowOffset = patchOffset - colOffset*m_colStride;
- const Index inputRow = rowIndex + rowOffset;
- if (inputCol < 0 | inputRow < 0 | inputCol >= m_inputCols | inputRow >= m_inputRows) {
- // all zeros
- return internal::pset1<Packet>(Scalar(0));
- }
- // no padding
- const Index depth = patchId - patchOffset * patchDepth();
- const Index inputIndex = depth + inputRow * m_rowInputStride + inputCol * m_colInputStride + otherIndex;
- return m_impl.template packet<Unaligned>(inputIndex);
- }
-
- EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet packetWithPossibleZero(Index patchId, Index rowIndex, Index colIndex, Index otherIndex) const
- {
- const int packetSize = internal::unpacket_traits<Packet>::size;
- EIGEN_ALIGN_MAX typename internal::remove_const<Scalar>::type values[packetSize];
- for (int i = 0; i < packetSize; ++i) {
- values[i] = loadCoeff(patchId+i, rowIndex, colIndex, otherIndex);
- }
- Packet rslt = internal::pload<Packet>(values);
- return rslt;
- }
-
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void computeBaseIndices(Index patchIndex, Index& rowIndex, Index& colIndex, Index& otherIndex) const {
- const int NumInputDims = array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
- otherIndex = (NumInputDims == 3) ? 0 : patchIndex / m_fastNumPatches;
- const Index patch2DIndex = (NumInputDims == 3) ? patchIndex : (patchIndex - otherIndex * m_num_patches);
- otherIndex *= m_patchInputStride;
- colIndex = patch2DIndex / m_fastOutputRows;
- rowIndex = patch2DIndex - colIndex * m_outputRows;
- colIndex = colIndex * m_col_strides - m_colPaddingLeft;
- rowIndex = rowIndex * m_row_strides - m_rowPaddingTop;
- }
-
- Index m_patch_cols; // number of colums in the patch
- Index m_num_patches; // number of patches to extract.
- Index m_patch_row_inflate_strides; // the strides for row inflation in the image patch
- Index m_patch_col_inflate_strides; // the strides for col inflation in the image patch
- // Fast representation of inflation strides.
- internal::TensorIntDivisor<Index> m_fastInputRowStride;
- internal::TensorIntDivisor<Index> m_fastInputColStride;
-
- Index m_otherStride;
- Index m_colStride;
- internal::TensorIntDivisor<Index> m_fastNumPatches;
- internal::TensorIntDivisor<Index> m_fastColStride;
-
- Index m_rowInputStride; // row stride in the input tensor
- Index m_colInputStride; // col stride in the input tensor
- Index m_patchInputStride; // patch stride in the input tensor
-
- Index m_inputRows; // Number of rows in the input tensor
- Index m_inputCols; // Number of cols in the input tensor
-
- Index m_outputRows; // Number of patch rows
-
- Index m_row_strides; // User specified row stride
- Index m_col_strides; // User specified col stride
-
- Index m_in_row_strides; // User specified input row stride
- Index m_in_col_strides; // User specified input col stride
-
- Index m_rowPaddingTop; // Row padding
- Index m_colPaddingLeft; // Column padding
-
- internal::TensorIntDivisor<Index> m_fastOutputRows;
- internal::TensorIntDivisor<Index> m_fastDimZero;
-
- const TensorEvaluator<ArgType, Device> m_impl;
-};
-
-
-template <typename NewDimension, DenseIndex Rows, DenseIndex Cols, typename ArgType, typename Device,
- typename Scalar_, typename Index,
- typename nocontract_t, typename contract_t,
- int Side, size_t packet_size,
- bool inner_dim_contiguous, bool inner_dim_reordered, int Alignment>
-class TensorContractionSubMapper<Scalar_, Index, Side, TensorEvaluator<const TensorReshapingOp<NewDimension, const TensorImagePatchOp<Rows, Cols, ArgType> >, Device>, nocontract_t, contract_t, packet_size, inner_dim_contiguous, inner_dim_reordered, Alignment>
-{
- public:
- typedef Scalar_ Scalar;
- typedef typename packet_traits<Scalar>::type Packet;
- typedef typename packet_traits<Scalar>::half HalfPacket;
-
- typedef TensorContractionInputMapper<Scalar, Index, Side, TensorEvaluator<const TensorReshapingOp<NewDimension, const TensorImagePatchOp<Rows, Cols, ArgType> >, Device>, nocontract_t, contract_t, packet_size, inner_dim_contiguous, inner_dim_reordered, Alignment> ParentMapper;
- typedef TensorContractionSubMapper<Scalar, Index, Side, TensorEvaluator<const TensorReshapingOp<NewDimension, const TensorImagePatchOp<Rows, Cols, ArgType> >, Device>, nocontract_t, contract_t, packet_size, inner_dim_contiguous, inner_dim_reordered, Alignment> Self;
- typedef Self LinearMapper;
-
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorContractionSubMapper(const ParentMapper& base_mapper, Index vert_offset, Index horiz_offset)
- : m_base_mapper(base_mapper), m_depth_offset(vert_offset), m_col_offset(horiz_offset) {
- m_base_mapper.computeBaseIndices(m_col_offset, m_rowIndex, m_colIndex, m_otherIndex);
- }
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorContractionSubMapper(const Self& base_mapper, Index vert_offset, Index horiz_offset)
- : m_base_mapper(base_mapper.m_base_mapper), m_depth_offset(vert_offset+base_mapper.m_depth_offset), m_col_offset(horiz_offset+base_mapper.m_col_offset) {
- m_base_mapper.computeBaseIndices(m_col_offset, m_rowIndex, m_colIndex, m_otherIndex);
- }
- EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar operator()(Index i) const {
- return m_base_mapper.loadCoeff(i + m_depth_offset, m_rowIndex, m_colIndex, m_otherIndex);
- }
- EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar operator()(Index i, Index j) const {
- return m_base_mapper(i + m_depth_offset, j + m_col_offset);
- }
-
- EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet loadPacket(Index i) const {
- return m_base_mapper.loadPacket(i + m_depth_offset, m_rowIndex, m_colIndex, m_otherIndex);
- }
- EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet loadPacket(Index i, Index j) const {
- return m_base_mapper.template loadPacket(i + m_depth_offset, j + m_col_offset);
- }
-
- EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar loadCoeffStandard(Index i) const {
- return m_base_mapper.loadCoeffStandard(i + m_depth_offset, m_rowIndex, m_colIndex, m_otherIndex);
- }
-
- EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet loadPacketFast(Index i) const {
- return m_base_mapper.loadPacketFast(i + m_depth_offset, m_rowIndex, m_colIndex, m_otherIndex);
- }
- EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet loadPacketStandard(Index i) const {
- return m_base_mapper.loadPacketStandard(i + m_depth_offset, m_rowIndex, m_colIndex, m_otherIndex);
- }
- template <typename Packet>
- EIGEN_DEVICE_FUNC bool aligned(Index) const {
- return false;
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE bool nonStandardPatches() const {
- return m_base_mapper.nonStandardPatches();
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Index patchDepth() const { return m_base_mapper.m_rowInputStride; }
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Index patchRows() const { return m_base_mapper.m_colStride; }
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Index patchCols() const { return m_base_mapper.m_patch_cols; }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Packet packetNoPadding(const Index depth, const Index baseIndex) const {
- const Index inputIndex = depth + baseIndex;
- return m_base_mapper.m_impl.template packet<Unaligned>(inputIndex);
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE bool padRow(const Index row) const {
- const Index r = m_rowIndex + row;
- return r < 0 | r >= m_base_mapper.m_inputRows;
- }
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE bool padCol(const Index col) const {
- const Index c = m_colIndex + col;
- return c < 0 | c >= m_base_mapper.m_inputCols;
- }
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Index baseIndex(const Index row, const Index col) const {
- const Index r = m_rowIndex + row;
- const Index c = m_colIndex + col;
- return r * m_base_mapper.m_rowInputStride + c * m_base_mapper.m_colInputStride + m_otherIndex;
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Index rowOffset() const {
- const Index patchOffset = m_depth_offset / m_base_mapper.m_fastDimZero;
- const Index colOffset = patchOffset / m_base_mapper.m_fastColStride;
- return patchOffset-colOffset*m_base_mapper.m_colStride;
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Index colOffset() const {
- const Index patchOffset = m_depth_offset / m_base_mapper.m_fastDimZero;
- const Index colOffset = patchOffset / m_base_mapper.m_fastColStride;
- return colOffset;
- }
-
- EIGEN_DEVICE_FUNC
- EIGEN_ALWAYS_INLINE Index depthOffset() const {
- const Index patchOffset = m_depth_offset % m_base_mapper.patchDepth();
- return patchOffset;
- }
-
- EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE LinearMapper getLinearMapper(Index i, Index j) const {
- return LinearMapper(m_base_mapper, i + m_depth_offset, j + m_col_offset);
- }
-
- private:
- const ParentMapper& m_base_mapper; // that was a reference before
- Index m_depth_offset; // First row in the input matrix
- Index m_col_offset; // First col in the input matrix
-
- Index m_rowIndex; // precomputed row index corresponding to the col offset
- Index m_colIndex; // precomputed col index corresponding to the col offset
- Index m_otherIndex; // precomputed other index corresponding to the col offset
-
-};
-
-
-template <typename NewDimension, DenseIndex Rows, DenseIndex Cols, typename ArgType, typename Device,
- typename Scalar, typename Index,
- typename nocontract_t, typename contract_t,
- int Side, size_t packet_size,
- bool inner_dim_contiguous, bool inner_dim_reordered, int Alignment, int nr>
-struct gemm_pack_rhs<Scalar, Index, TensorContractionSubMapper<Scalar, Index, Side, TensorEvaluator<const TensorReshapingOp<NewDimension, const TensorImagePatchOp<Rows, Cols, ArgType> >, Device>, nocontract_t, contract_t, packet_size, inner_dim_contiguous, inner_dim_reordered, Alignment>, nr, ColMajor, false, false> {
-
- typedef TensorContractionSubMapper<Scalar, Index, Side, TensorEvaluator<const TensorReshapingOp<NewDimension, const TensorImagePatchOp<Rows, Cols, ArgType> >, Device>, nocontract_t, contract_t, packet_size, inner_dim_contiguous, inner_dim_reordered, Alignment> SubMapper;
- typedef SubMapper DataMapper;
-
- static inline Index ceil_div(Index a, Index b) {
- return (a + b - 1) / b;
- }
-
- EIGEN_DONT_INLINE void operator()(Scalar* block, const DataMapper& rhs, Index depth, Index cols, Index stride=0, Index offset=0) const {
- eigen_assert(stride == 0);
- eigen_assert(offset == 0);
-
- EIGEN_STATIC_ASSERT((nr == 4), YOU_MADE_A_PROGRAMMING_MISTAKE);
- typedef typename DataMapper::LinearMapper LinearMapper;
- typedef typename packet_traits<Scalar>::type Packet;
-
- const Index packet_cols4 = (cols/4) * 4;
- const Index peeled_k = (depth/packet_size) * packet_size;
- const bool non_standard_patches = rhs.nonStandardPatches();
-
- for(Index j2=0; j2<packet_cols4; j2+=4)
- {
- const SubMapper dm0 = rhs.getLinearMapper(0, j2 + 0);
- const SubMapper dm1 = rhs.getLinearMapper(0, j2 + 1);
- const SubMapper dm2 = rhs.getLinearMapper(0, j2 + 2);
- const SubMapper dm3 = rhs.getLinearMapper(0, j2 + 3);
-
- Index k=0;
- if((packet_size%4)==0 && !non_standard_patches)
- {
- const Index patch_depth = rhs.patchDepth();
- if ((patch_depth % packet_size) == 0) {
- const Index patch_cols = rhs.patchCols();
- const Index patch_rows = rhs.patchRows();
-
- const Index startCol = rhs.colOffset();
- const Index max_cols = std::min<Index>(ceil_div(peeled_k, patch_rows*patch_depth)+startCol, patch_cols);
-
- for (Index c = startCol; c < max_cols; ++c) {
- eigen_assert(k < peeled_k);
- const Index startRow = (c == startCol) ? rhs.rowOffset() : 0;
- const Index max_rows = std::min<Index>(ceil_div(peeled_k-c*patch_rows*patch_depth, patch_depth)+startRow, patch_rows);
-
- const bool pad_col0 = dm0.padCol(c);
- const bool pad_col1 = dm1.padCol(c);
- const bool pad_col2 = dm2.padCol(c);
- const bool pad_col3 = dm3.padCol(c);
- for (Index r = startRow; r < max_rows; ++r) {
- eigen_assert(k < peeled_k);
- const bool pad0 = pad_col0 || dm0.padRow(r);
- const bool pad1 = pad_col1 || dm1.padRow(r);
- const bool pad2 = pad_col2 || dm2.padRow(r);
- const bool pad3 = pad_col3 || dm3.padRow(r);
-
- const Index idx0 = dm0.baseIndex(r, c);
- const Index idx1 = dm1.baseIndex(r, c);
- const Index idx2 = dm2.baseIndex(r, c);
- const Index idx3 = dm3.baseIndex(r, c);
-
- const Index startDepth = ((c == startCol) && (r == startRow)) ? rhs.depthOffset() : 0;
- const Index max_depth = std::min<Index>(peeled_k-c*patch_rows*patch_depth-r*patch_depth+startDepth, patch_depth);
- eigen_assert(max_depth % packet_size == 0);
- for (Index d = startDepth; d < max_depth; d += packet_size) {
- eigen_assert(k < peeled_k);
- PacketBlock<Packet, 4> kernel;
- kernel.packet[0] = pad0 ? pset1<Packet>(0) : rhs.packetNoPadding(d, idx0);
- kernel.packet[1] = pad1 ? pset1<Packet>(0) : rhs.packetNoPadding(d, idx1);
- kernel.packet[2] = pad2 ? pset1<Packet>(0) : rhs.packetNoPadding(d, idx2);
- kernel.packet[3] = pad3 ? pset1<Packet>(0) : rhs.packetNoPadding(d, idx3);
- ptranspose(kernel);
- pstoreu(block+0*packet_size, kernel.packet[0]);
- pstoreu(block+1*packet_size, kernel.packet[1]);
- pstoreu(block+2*packet_size, kernel.packet[2]);
- pstoreu(block+3*packet_size, kernel.packet[3]);
- block+=4*packet_size;
- k += packet_size;
- }
- }
- }
-
- for(; k<peeled_k; k+=packet_size) {
- PacketBlock<Packet, 4> kernel;
- kernel.packet[0] = dm0.loadPacketFast(k);
- kernel.packet[1] = dm1.loadPacketFast(k);
- kernel.packet[2] = dm2.loadPacketFast(k);
- kernel.packet[3] = dm3.loadPacketFast(k);
- ptranspose(kernel);
- pstoreu(block+0*packet_size, kernel.packet[0]);
- pstoreu(block+1*packet_size, kernel.packet[1]);
- pstoreu(block+2*packet_size, kernel.packet[2]);
- pstoreu(block+3*packet_size, kernel.packet[3]);
- block+=4*packet_size;
- }
- }
- else {
- for(; k<peeled_k; k+=packet_size) {
- PacketBlock<Packet, 4> kernel;
- kernel.packet[0] = dm0.loadPacketStandard(k);
- kernel.packet[1] = dm1.loadPacketStandard(k);
- kernel.packet[2] = dm2.loadPacketStandard(k);
- kernel.packet[3] = dm3.loadPacketStandard(k);
- ptranspose(kernel);
- pstoreu(block+0*packet_size, kernel.packet[0]);
- pstoreu(block+1*packet_size, kernel.packet[1]);
- pstoreu(block+2*packet_size, kernel.packet[2]);
- pstoreu(block+3*packet_size, kernel.packet[3]);
- block+=4*packet_size;
- }
- }
- }
- if (!rhs.nonStandardPatches()) {
- for(; k<depth; k++)
- {
- block[0] = dm0.loadCoeffStandard(k);
- block[1] = dm1.loadCoeffStandard(k);
- block[2] = dm2.loadCoeffStandard(k);
- block[3] = dm3.loadCoeffStandard(k);
- block += 4;
- }
- }
- else {
- for(; k<depth; k++)
- {
- block[0] = dm0(k);
- block[1] = dm1(k);
- block[2] = dm2(k);
- block[3] = dm3(k);
- block += 4;
- }
- }
- }
-
- // copy the remaining columns one at a time (nr==1)
- for(Index j2=packet_cols4; j2<cols; ++j2)
- {
- const SubMapper dm0 = rhs.getLinearMapper(0, j2);
- for(Index k=0; k<depth; k++)
- {
- *block = dm0(k);
- block += 1;
- }
- }
- }
-};
-
-#endif // EIGEN_VECTORIZE
-} // end namespace internal
-
-
-/** SpatialConvolution
- * \ingroup CXX11_NeuralNetworks_Module
- *
- * \brief Applies a 2D convolution over a multichannel input image.
- *
- * The input parameter is expected to be a tensor with a rank of 3 or more (channels, height, width, and optionally others)
- * The kernel parameter is expected to be a 4D tensor (filters, channels, kernel_height, kernel_width)
- * The input and the kernel must both be in col-major layout. The result will also be in col-major layout.
- *
- * If in_stride > 1, then applies convolution with holes (aka atrous convolution), sampling every in_stride input pixels.
- *
- * The result can be assigned to a tensor of rank equal to the rank of the input. The dimensions of the result will be filters, height, width (and others if applicable).
- *
- * It is possible to swap the order of the width and height dimensions provided that the same order is used in the input, the kernel, and the output.
- *
- */
-template <typename Input, typename Kernel>
-EIGEN_ALWAYS_INLINE
-static const typename internal::conditional<
- internal::traits<Input>::Layout == ColMajor,
- TensorReshapingOp<const DSizes<typename internal::traits<Input>::Index, internal::traits<Input>::NumDimensions>, const TensorContractionOp<const array<IndexPair<typename internal::traits<Input>::Index>, 1>, const TensorReshapingOp<const DSizes<typename internal::traits<Input>::Index, 2>, const Kernel>, const TensorReshapingOp<const DSizes<typename internal::traits<Input>::Index, 2>, const TensorImagePatchOp<Dynamic, Dynamic, const Input> > > >,
- TensorReshapingOp<const DSizes<typename internal::traits<Input>::Index, internal::traits<Input>::NumDimensions>, const TensorContractionOp<const array<IndexPair<typename internal::traits<Input>::Index>, 1>, const TensorReshapingOp<const DSizes<typename internal::traits<Input>::Index, 2>, const TensorImagePatchOp<Dynamic, Dynamic, const Input> >, const TensorReshapingOp<const DSizes<typename internal::traits<Input>::Index, 2>, const Kernel> > > >::type
-SpatialConvolution(const Input& input, const Kernel& kernel, const DenseIndex stride = 1, const PaddingType padding_type = PADDING_SAME, const DenseIndex in_stride = 1) {
-
- typedef typename internal::traits<Input>::Index TensorIndex;
- TensorRef<Tensor<typename internal::traits<Input>::Scalar, internal::traits<Input>::NumDimensions, internal::traits<Input>::Layout, TensorIndex> > in(input);
- TensorRef<Tensor<typename internal::traits<Kernel>::Scalar, internal::traits<Kernel>::NumDimensions, internal::traits<Kernel>::Layout, TensorIndex> > kern(kernel);
-
- EIGEN_STATIC_ASSERT(internal::traits<Input>::Layout == internal::traits<Kernel>::Layout, YOU_MADE_A_PROGRAMMING_MISTAKE);
- static const bool isColMajor = (internal::traits<Input>::Layout == ColMajor);
-
- static const int NumDims = internal::traits<Input>::NumDimensions;
-
- // Number of filters to apply. This is the same as the output depth of the result
- const TensorIndex kernelFilters = isColMajor ? kern.dimensions()[0] : kern.dimensions()[3];
- // Number of channels. This is the same as the input depth.
- const TensorIndex kernelChannels = isColMajor ? kern.dimensions()[1] : kern.dimensions()[2];
- const TensorIndex kernelRows = isColMajor ? kern.dimensions()[2] : kern.dimensions()[1];
- const TensorIndex kernelCols = isColMajor ? kern.dimensions()[3] : kern.dimensions()[0];
-
- const DenseIndex kernelRowsEff = kernelRows + (kernelRows - 1) * (in_stride - 1);
- const DenseIndex kernelColsEff = kernelCols + (kernelCols - 1) * (in_stride - 1);
-
- array<IndexPair<TensorIndex>, 1> contract_dims;
- contract_dims[0] = IndexPair<TensorIndex>(1, 0);
-
- const TensorIndex InputRows = isColMajor ? in.dimension(1) : in.dimension(NumDims - 2);
- const TensorIndex InputCols = isColMajor ? in.dimension(2) : in.dimension(NumDims - 3);
-
- TensorIndex out_height;
- TensorIndex out_width;
- switch (padding_type) {
- case PADDING_VALID:
- out_height = numext::ceil((InputRows - kernelRowsEff + 1.f) / static_cast<float>(stride));
- out_width = numext::ceil((InputCols - kernelColsEff + 1.f) / static_cast<float>(stride));
- break;
- case PADDING_SAME:
- out_height = numext::ceil(InputRows / static_cast<float>(stride));
- out_width = numext::ceil(InputCols / static_cast<float>(stride));
- break;
- default:
- eigen_assert(false && "unexpected padding");
- }
-
- // Molds the output of the patch extraction code into a 2d tensor:
- // - the first dimension (dims[0]): the patch values to be multiplied with the kernels
- // - the second dimension (dims[1]): everything else
- DSizes<TensorIndex, 2> pre_contract_dims;
- if (isColMajor) {
- pre_contract_dims[0] = kernelChannels * kernelRows * kernelCols;
- pre_contract_dims[1] = out_height * out_width;
- for (int i = 3; i < NumDims; ++i) {
- pre_contract_dims[1] *= in.dimension(i);
- }
- } else {
- pre_contract_dims[1] = kernelChannels * kernelRows * kernelCols;
- pre_contract_dims[0] = out_height * out_width;
- for (int i = 0; i < NumDims - 3; ++i) {
- pre_contract_dims[0] *= in.dimension(i);
- }
- }
-
- // Molds the output of the contraction into the shape expected by the used
- // (assuming this is ColMajor):
- // - 1st dim: kernel filters
- // - 2nd dim: output height
- // - 3rd dim: output width
- // - 4th dim and beyond: everything else including batch size
- DSizes<TensorIndex, NumDims> post_contract_dims;
- if (isColMajor) {
- post_contract_dims[0] = kernelFilters;
- post_contract_dims[1] = out_height;
- post_contract_dims[2] = out_width;
- for (int i = 3; i < NumDims; ++i) {
- post_contract_dims[i] = in.dimension(i);
- }
- } else {
- post_contract_dims[NumDims - 1] = kernelFilters;
- post_contract_dims[NumDims - 2] = out_height;
- post_contract_dims[NumDims - 3] = out_width;
- for (int i = 0; i < NumDims - 3; ++i) {
- post_contract_dims[i] = in.dimension(i);
- }
- }
-
- DSizes<TensorIndex, 2> kernel_dims;
- if (isColMajor) {
- kernel_dims[0] = kernelFilters;
- kernel_dims[1] = kernelChannels * kernelRows * kernelCols;
- } else {
- kernel_dims[0] = kernelChannels * kernelRows * kernelCols;
- kernel_dims[1] = kernelFilters;
- }
- // TODO(yangke): choose() is defined in TensorContraction.h -- consider
- // moving it to somewhere more "common".
- return choose(Cond<internal::traits<Input>::Layout == ColMajor>(),
- kernel.reshape(kernel_dims).contract(input.extract_image_patches(kernelRows, kernelCols, stride, stride, in_stride, in_stride, padding_type).reshape(pre_contract_dims), contract_dims).reshape(post_contract_dims),
- input.extract_image_patches(kernelRows, kernelCols, stride, stride, in_stride, in_stride, padding_type).reshape(pre_contract_dims).contract(kernel.reshape(kernel_dims), contract_dims).reshape(post_contract_dims));
-}
-
-} // end namespace Eigen
-
-#endif // EIGEN_CXX11_NEURAL_NETWORKS_SPATIAL_CONVOLUTIONS_H
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/TensorConvolutionByFFT.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/TensorConvolutionByFFT.h
deleted file mode 100644
index 0e72173536..0000000000
--- a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/TensorConvolutionByFFT.h
+++ /dev/null
@@ -1,289 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
-// Copyright (C) 2015 Jianwei Cui <thucjw@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla
-// Public License v. 2.0. If a copy of the MPL was not distributed
-// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#ifndef EIGEN_CXX11_TENSOR_TENSOR_CONVOLUTIONBYFFT_H
-#define EIGEN_CXX11_TENSOR_TENSOR_CONVOLUTIONBYFFT_H
-
-namespace Eigen {
-
-/** \class TensorConvolutionByFFT
- * \ingroup CXX11_Tensor_Module
- *
- * \brief Tensor convolution class.
- *
- *
- */
-namespace internal {
-
-
-template<typename Dimensions, typename InputXprType, typename KernelXprType>
-struct traits<TensorConvolutionByFFTOp<Dimensions, InputXprType, KernelXprType> >
-{
- // Type promotion to handle the case where the types of the lhs and the rhs are different.
- typedef typename promote_storage_type<typename InputXprType::Scalar,
- typename KernelXprType::Scalar>::ret Scalar;
- typedef typename packet_traits<Scalar>::type Packet;
- typedef typename promote_storage_type<typename traits<InputXprType>::StorageKind,
- typename traits<KernelXprType>::StorageKind>::ret StorageKind;
- typedef typename promote_index_type<typename traits<InputXprType>::Index,
- typename traits<KernelXprType>::Index>::type Index;
- typedef typename InputXprType::Nested LhsNested;
- typedef typename KernelXprType::Nested RhsNested;
- typedef typename remove_reference<LhsNested>::type _LhsNested;
- typedef typename remove_reference<RhsNested>::type _RhsNested;
- static const int NumDimensions = traits<InputXprType>::NumDimensions;
- static const int Layout = traits<InputXprType>::Layout;
-
- enum {
- Flags = 0,
- };
-};
-
-template<typename Dimensions, typename InputXprType, typename KernelXprType>
-struct eval<TensorConvolutionByFFTOp<Dimensions, InputXprType, KernelXprType>, Eigen::Dense>
-{
- typedef const TensorConvolutionByFFTOp<Dimensions, InputXprType, KernelXprType>& type;
-};
-
-template<typename Dimensions, typename InputXprType, typename KernelXprType>
-struct nested<TensorConvolutionByFFTOp<Dimensions, InputXprType, KernelXprType>, 1, typename eval<TensorConvolutionByFFTOp<Dimensions, InputXprType, KernelXprType> >::type>
-{
- typedef TensorConvolutionByFFTOp<Dimensions, InputXprType, KernelXprType> type;
-};
-
-} // end namespace internal
-
-
-
-template<typename Indices, typename InputXprType, typename KernelXprType>
-class TensorConvolutionByFFTOp : public TensorBase<TensorConvolutionByFFTOp<Indices, InputXprType, KernelXprType> >
-{
- public:
- typedef typename Eigen::internal::traits<TensorConvolutionByFFTOp>::Scalar Scalar;
- typedef typename Eigen::internal::traits<TensorConvolutionByFFTOp>::Packet Packet;
- typedef typename Eigen::NumTraits<Scalar>::Real RealScalar;
- typedef typename internal::promote_storage_type<typename InputXprType::CoeffReturnType,
- typename KernelXprType::CoeffReturnType>::ret CoeffReturnType;
- typedef typename internal::promote_storage_type<typename InputXprType::PacketReturnType,
- typename KernelXprType::PacketReturnType>::ret PacketReturnType;
- typedef typename Eigen::internal::nested<TensorConvolutionByFFTOp>::type Nested;
- typedef typename Eigen::internal::traits<TensorConvolutionByFFTOp>::StorageKind StorageKind;
- typedef typename Eigen::internal::traits<TensorConvolutionByFFTOp>::Index Index;
-
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorConvolutionByFFTOp(const InputXprType& input, const KernelXprType& kernel, const Indices& dims)
- : m_input_xpr(input), m_kernel_xpr(kernel), m_indices(dims) {}
-
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
- const Indices& indices() const { return m_indices; }
-
- /** \returns the nested expressions */
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
- const typename internal::remove_all<typename InputXprType::Nested>::type&
- inputExpression() const { return m_input_xpr; }
-
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
- const typename internal::remove_all<typename KernelXprType::Nested>::type&
- kernelExpression() const { return m_kernel_xpr; }
-
- protected:
- typename InputXprType::Nested m_input_xpr;
- typename KernelXprType::Nested m_kernel_xpr;
- const Indices m_indices;
-};
-
-
-template<typename Indices, typename InputArgType, typename KernelArgType, typename Device>
-struct TensorEvaluator<const TensorConvolutionByFFTOp<Indices, InputArgType, KernelArgType>, Device>
-{
- typedef TensorConvolutionByFFTOp<Indices, InputArgType, KernelArgType> XprType;
-
- typedef typename XprType::Scalar Scalar;
- typedef typename XprType::CoeffReturnType CoeffReturnType;
- typedef typename XprType::PacketReturnType PacketReturnType;
-
- typedef typename Eigen::NumTraits<Scalar>::Real RealScalar;
-
- static const int NumDims = internal::array_size<typename TensorEvaluator<InputArgType, Device>::Dimensions>::value;
- static const int NumKernelDims = internal::array_size<Indices>::value;
- typedef typename XprType::Index Index;
- typedef DSizes<Index, NumDims> Dimensions;
-
- enum {
- IsAligned = TensorEvaluator<InputArgType, Device>::IsAligned &
- TensorEvaluator<KernelArgType, Device>::IsAligned,
- PacketAccess = false,
- BlockAccess = false,
- Layout = TensorEvaluator<InputArgType, Device>::Layout,
- CoordAccess = false, // to be implemented
- };
-
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(const XprType& op, const Device& device)
- : m_inputImpl(op.inputExpression(), device), m_kernelImpl(op.kernelExpression(), device), m_kernelArg(op.kernelExpression()), m_kernel(NULL), m_local_kernel(false), m_device(device)
- {
- EIGEN_STATIC_ASSERT((static_cast<int>(TensorEvaluator<InputArgType, Device>::Layout) == static_cast<int>(TensorEvaluator<KernelArgType, Device>::Layout)), YOU_MADE_A_PROGRAMMING_MISTAKE);
-
- const typename TensorEvaluator<InputArgType, Device>::Dimensions& input_dims = m_inputImpl.dimensions();
- const typename TensorEvaluator<KernelArgType, Device>::Dimensions& kernel_dims = m_kernelImpl.dimensions();
-
- if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
- m_inputStride[0] = 1;
- for (int i = 1; i < NumDims; ++i) {
- m_inputStride[i] = m_inputStride[i - 1] * input_dims[i - 1];
- }
- } else {
- m_inputStride[NumDims - 1] = 1;
- for (int i = NumDims - 2; i >= 0; --i) {
- m_inputStride[i] = m_inputStride[i + 1] * input_dims[i + 1];
- }
- }
-
- m_dimensions = m_inputImpl.dimensions();
- if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
- for (int i = 0; i < NumKernelDims; ++i) {
- const Index index = op.indices()[i];
- const Index input_dim = input_dims[index];
- const Index kernel_dim = kernel_dims[i];
- const Index result_dim = input_dim - kernel_dim + 1;
- m_dimensions[index] = result_dim;
- if (i > 0) {
- m_kernelStride[i] = m_kernelStride[i - 1] * kernel_dims[i - 1];
- } else {
- m_kernelStride[0] = 1;
- }
- m_indexStride[i] = m_inputStride[index];
- }
-
- m_outputStride[0] = 1;
- for (int i = 1; i < NumDims; ++i) {
- m_outputStride[i] = m_outputStride[i - 1] * m_dimensions[i - 1];
- }
- } else {
- for (int i = NumKernelDims - 1; i >= 0; --i) {
- const Index index = op.indices()[i];
- const Index input_dim = input_dims[index];
- const Index kernel_dim = kernel_dims[i];
- const Index result_dim = input_dim - kernel_dim + 1;
- m_dimensions[index] = result_dim;
- if (i < NumKernelDims - 1) {
- m_kernelStride[i] = m_kernelStride[i + 1] * kernel_dims[i + 1];
- } else {
- m_kernelStride[NumKernelDims - 1] = 1;
- }
- m_indexStride[i] = m_inputStride[index];
- }
-
- m_outputStride[NumDims - 1] = 1;
- for (int i = NumDims - 2; i >= 0; --i) {
- m_outputStride[i] = m_outputStride[i + 1] * m_dimensions[i + 1];
- }
- }
- }
-
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_dimensions; }
-
-
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(Scalar* data) {
- m_inputImpl.evalSubExprsIfNeeded(NULL);
- m_kernelImpl.evalSubExprsIfNeeded(NULL);
-
- typedef typename internal::traits<InputArgType>::Index TensorIndex;
-
- Tensor<Scalar, NumDims, Layout, TensorIndex> input(m_inputImpl.dimensions());
- for (int i = 0; i < m_inputImpl.dimensions().TotalSize(); ++i) {
- input.data()[i] = m_inputImpl.coeff(i);
- }
-
- Tensor<Scalar, NumDims, Layout, TensorIndex> kernel(m_kernelImpl.dimensions());
- for (int i = 0; i < m_kernelImpl.dimensions().TotalSize(); ++i) {
- kernel.data()[i] = m_kernelImpl.coeff(i);
- }
-
- array<std::pair<ptrdiff_t, ptrdiff_t>, NumDims> paddings;
- for (int i = 0; i < NumDims; ++i) {
- paddings[i] = std::make_pair(0, m_inputImpl.dimensions()[i] - m_kernelImpl.dimensions()[i]);
- }
-
- Eigen::array<bool, NumKernelDims> reverse;
- for (int i = 0; i < NumKernelDims; ++i) {
- reverse[i] = true;
- }
-
- Eigen::array<bool, NumDims> fft;
- for (int i = 0; i < NumDims; ++i) {
- fft[i] = i;
- }
-
- Eigen::DSizes<TensorIndex, NumDims> slice_offsets;
- for (int i = 0; i < NumDims; ++i) {
- slice_offsets[i] = m_kernelImpl.dimensions()[i] - 1;
- }
-
- Eigen::DSizes<TensorIndex, NumDims> slice_extents;
- for (int i = 0; i < NumDims; ++i) {
- slice_extents[i] = m_inputImpl.dimensions()[i] - m_kernelImpl.dimensions()[i] + 1;
- }
-
- Tensor<Scalar, NumDims, Layout, TensorIndex> kernel_variant = kernel.reverse(reverse).pad(paddings);
- Tensor<std::complex<Scalar>, NumDims, Layout, TensorIndex> kernel_fft = kernel_variant.template fft<Eigen::BothParts, FFT_FORWARD>(fft);
- //Tensor<std::complex<Scalar>, NumDims, Layout|IndexType> kernel_fft = kernel.reverse(reverse).pad(paddings).template fft<2>(fft);
- Tensor<std::complex<Scalar>, NumDims, Layout, TensorIndex> input_fft = input.template fft<Eigen::BothParts, FFT_FORWARD>(fft);
- Tensor<std::complex<Scalar>, NumDims, Layout, TensorIndex> prod = (input_fft * kernel_fft).template fft<Eigen::BothParts, FFT_REVERSE>(fft);
- Tensor<std::complex<Scalar>, NumDims, Layout, TensorIndex> tensor_result = prod.slice(slice_offsets, slice_extents);
-
- for (int i = 0; i < tensor_result.size(); ++i) {
- data[i] = std::real(tensor_result.data()[i]);
- }
- return false;
- }
-
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup() {
- m_inputImpl.cleanup();
- if (m_local_kernel) {
- m_device.deallocate((void*)m_kernel);
- m_local_kernel = false;
- }
- m_kernel = NULL;
- }
-
- void evalTo(typename XprType::Scalar* buffer) {
- evalSubExprsIfNeeded(NULL);
- for (int i = 0; i < dimensions().TotalSize(); ++i) {
- buffer[i] += coeff(i);
- }
- cleanup();
- }
-
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
- {
- CoeffReturnType result = CoeffReturnType(0);
- return result;
- }
-
- EIGEN_DEVICE_FUNC Scalar* data() const { return NULL; }
-
- private:
- array<Index, NumDims> m_inputStride;
- array<Index, NumDims> m_outputStride;
-
- array<Index, NumKernelDims> m_indexStride;
- array<Index, NumKernelDims> m_kernelStride;
- TensorEvaluator<InputArgType, Device> m_inputImpl;
- TensorEvaluator<KernelArgType, Device> m_kernelImpl;
- Dimensions m_dimensions;
-
- KernelArgType m_kernelArg;
- const Scalar* m_kernel;
- bool m_local_kernel;
- const Device& m_device;
-};
-
-} // end namespace Eigen
-
-#endif // EIGEN_CXX11_TENSOR_TENSOR_CONVOLUTIONBYFFT_H
diff --git a/third_party/eigen_fix_cuda_compilation.patch b/third_party/eigen_fix_cuda_compilation.patch
deleted file mode 100644
index b921a7c31d..0000000000
--- a/third_party/eigen_fix_cuda_compilation.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-diff --git a/Eigen/src/Core/ProductEvaluators.h b/Eigen/src/Core/ProductEvaluators.h
---- a/Eigen/src/Core/ProductEvaluators.h
-+++ b/Eigen/src/Core/ProductEvaluators.h
-@@ -137,7 +137,7 @@ struct Assignment<DstXprType, Product<Lh
- typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct)>::type>
- {
- typedef Product<Lhs,Rhs,Options> SrcXprType;
-- static EIGEN_STRONG_INLINE
-+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
- void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op<Scalar,Scalar> &)
- {
- Index dstRows = src.rows();
-@@ -390,7 +390,7 @@ struct generic_product_impl<Lhs,Rhs,Dens
- typedef typename Product<Lhs,Rhs>::Scalar Scalar;
-
- template<typename Dst>
-- static EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
-+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
- {
- // Same as: dst.noalias() = lhs.lazyProduct(rhs);
- // but easier on the compiler side
-@@ -398,14 +398,14 @@ struct generic_product_impl<Lhs,Rhs,Dens
- }
-
- template<typename Dst>
-- static EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
-+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
- {
- // dst.noalias() += lhs.lazyProduct(rhs);
- call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::add_assign_op<typename Dst::Scalar,Scalar>());
- }
-
- template<typename Dst>
-- static EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
-+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
- {
- // dst.noalias() -= lhs.lazyProduct(rhs);
- call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::sub_assign_op<typename Dst::Scalar,Scalar>());
diff --git a/third_party/examples/eager/spinn/README.md b/third_party/examples/eager/spinn/README.md
index 7f477d1920..e2fd8009a0 100644
--- a/third_party/examples/eager/spinn/README.md
+++ b/third_party/examples/eager/spinn/README.md
@@ -22,7 +22,7 @@ Other eager execution examples can be found under [tensorflow/contrib/eager/pyth
- [`data.py`](../../../../tensorflow/contrib/eager/python/examples/spinn/data.py): Pipeline for loading and preprocessing the
[SNLI](https://nlp.stanford.edu/projects/snli/) data and
[GloVe](https://nlp.stanford.edu/projects/glove/) word embedding, written
- using the [`tf.data`](https://www.tensorflow.org/programmers_guide/datasets)
+ using the [`tf.data`](https://www.tensorflow.org/guide/datasets)
API.
- [`spinn.py`](./spinn.py): Model definition and training routines.
This example illustrates how one might perform the following actions with
@@ -70,7 +70,7 @@ Other eager execution examples can be found under [tensorflow/contrib/eager/pyth
- After training, you may use the model to perform inference on input data in
the SNLI data format. The premise and hypotheses sentences are specified with
the command-line flags `--inference_premise` and `--inference_hypothesis`,
- respecitvely. Each sentence should include the words, as well as parentheses
+ respectively. Each sentence should include the words, as well as parentheses
representing a binary parsing of the sentence. The words and parentheses
should all be separated by spaces. For instance,
diff --git a/third_party/examples/eager/spinn/spinn.py b/third_party/examples/eager/spinn/spinn.py
index 8a1c7db2ea..de63ebe9e6 100644
--- a/third_party/examples/eager/spinn/spinn.py
+++ b/third_party/examples/eager/spinn/spinn.py
@@ -51,6 +51,9 @@ import tensorflow.contrib.eager as tfe
from tensorflow.contrib.eager.python.examples.spinn import data
+layers = tf.keras.layers
+
+
def _bundle(lstm_iter):
"""Concatenate a list of Tensors along 1st axis and split result into two.
@@ -78,17 +81,16 @@ def _unbundle(state):
return tf.split(tf.concat(state, 1), state[0].shape[0], axis=0)
-class Reducer(tfe.Network):
+# pylint: disable=not-callable
+class Reducer(tf.keras.Model):
"""A module that applies reduce operation on left and right vectors."""
def __init__(self, size, tracker_size=None):
super(Reducer, self).__init__()
- self.left = self.track_layer(tf.layers.Dense(5 * size, activation=None))
- self.right = self.track_layer(
- tf.layers.Dense(5 * size, activation=None, use_bias=False))
+ self.left = layers.Dense(5 * size, activation=None)
+ self.right = layers.Dense(5 * size, activation=None, use_bias=False)
if tracker_size is not None:
- self.track = self.track_layer(
- tf.layers.Dense(5 * size, activation=None, use_bias=False))
+ self.track = layers.Dense(5 * size, activation=None, use_bias=False)
else:
self.track = None
@@ -123,7 +125,7 @@ class Reducer(tfe.Network):
return h, c
-class Tracker(tfe.Network):
+class Tracker(tf.keras.Model):
"""A module that tracks the history of the sentence with an LSTM."""
def __init__(self, tracker_size, predict):
@@ -134,10 +136,10 @@ class Tracker(tfe.Network):
predict: (`bool`) Whether prediction mode is enabled.
"""
super(Tracker, self).__init__()
- self._rnn = self.track_layer(tf.nn.rnn_cell.LSTMCell(tracker_size))
+ self._rnn = tf.nn.rnn_cell.LSTMCell(tracker_size)
self._state_size = tracker_size
if predict:
- self._transition = self.track_layer(tf.layers.Dense(4))
+ self._transition = layers.Dense(4)
else:
self._transition = None
@@ -182,7 +184,7 @@ class Tracker(tfe.Network):
return unbundled, None
-class SPINN(tfe.Network):
+class SPINN(tf.keras.Model):
"""Stack-augmented Parser-Interpreter Neural Network.
See https://arxiv.org/abs/1603.06021 for more details.
@@ -204,9 +206,9 @@ class SPINN(tfe.Network):
"""
super(SPINN, self).__init__()
self.config = config
- self.reducer = self.track_layer(Reducer(config.d_hidden, config.d_tracker))
+ self.reducer = Reducer(config.d_hidden, config.d_tracker)
if config.d_tracker is not None:
- self.tracker = self.track_layer(Tracker(config.d_tracker, config.predict))
+ self.tracker = Tracker(config.d_tracker, config.predict)
else:
self.tracker = None
@@ -248,7 +250,7 @@ class SPINN(tfe.Network):
trans = transitions[i]
if self.tracker:
# Invoke tracker to obtain the current tracker states for the sentences.
- tracker_states, trans_hypothesis = self.tracker(buffers, stacks)
+ tracker_states, trans_hypothesis = self.tracker(buffers, stacks=stacks)
if trans_hypothesis:
trans = tf.argmax(trans_hypothesis, axis=-1)
else:
@@ -273,7 +275,27 @@ class SPINN(tfe.Network):
return _bundle([stack.pop() for stack in stacks])[0]
-class SNLIClassifier(tfe.Network):
+class Perceptron(tf.keras.Model):
+ """One layer of the SNLIClassifier multi-layer perceptron."""
+
+ def __init__(self, dimension, dropout_rate, previous_layer):
+ """Configure the Perceptron."""
+ super(Perceptron, self).__init__()
+ self.dense = tf.keras.layers.Dense(dimension, activation=tf.nn.elu)
+ self.batchnorm = layers.BatchNormalization()
+ self.dropout = layers.Dropout(rate=dropout_rate)
+ self.previous_layer = previous_layer
+
+ def call(self, x, training):
+ """Run previous Perceptron layers, then this one."""
+ x = self.previous_layer(x, training=training)
+ x = self.dense(x)
+ x = self.batchnorm(x, training=training)
+ x = self.dropout(x, training=training)
+ return x
+
+
+class SNLIClassifier(tf.keras.Model):
"""SNLI Classifier Model.
A model aimed at solving the SNLI (Standford Natural Language Inference)
@@ -304,29 +326,24 @@ class SNLIClassifier(tfe.Network):
self.config = config
self.embed = tf.constant(embed)
- self.projection = self.track_layer(tf.layers.Dense(config.d_proj))
- self.embed_bn = self.track_layer(tf.layers.BatchNormalization())
- self.embed_dropout = self.track_layer(
- tf.layers.Dropout(rate=config.embed_dropout))
- self.encoder = self.track_layer(SPINN(config))
-
- self.feature_bn = self.track_layer(tf.layers.BatchNormalization())
- self.feature_dropout = self.track_layer(
- tf.layers.Dropout(rate=config.mlp_dropout))
-
- self.mlp_dense = []
- self.mlp_bn = []
- self.mlp_dropout = []
- for _ in xrange(config.n_mlp_layers):
- self.mlp_dense.append(self.track_layer(tf.layers.Dense(config.d_mlp)))
- self.mlp_bn.append(
- self.track_layer(tf.layers.BatchNormalization()))
- self.mlp_dropout.append(
- self.track_layer(tf.layers.Dropout(rate=config.mlp_dropout)))
- self.mlp_output = self.track_layer(tf.layers.Dense(
+ self.projection = layers.Dense(config.d_proj)
+ self.embed_bn = layers.BatchNormalization()
+ self.embed_dropout = layers.Dropout(rate=config.embed_dropout)
+ self.encoder = SPINN(config)
+
+ self.feature_bn = layers.BatchNormalization()
+ self.feature_dropout = layers.Dropout(rate=config.mlp_dropout)
+
+ current_mlp = lambda result, training: result
+ for _ in range(config.n_mlp_layers):
+ current_mlp = Perceptron(dimension=config.d_mlp,
+ dropout_rate=config.mlp_dropout,
+ previous_layer=current_mlp)
+ self.mlp = current_mlp
+ self.mlp_output = layers.Dense(
config.d_out,
kernel_initializer=tf.random_uniform_initializer(minval=-5e-3,
- maxval=5e-3)))
+ maxval=5e-3))
def call(self,
premise,
@@ -383,15 +400,12 @@ class SNLIClassifier(tfe.Network):
self.feature_bn(logits, training=training), training=training)
# Apply the multi-layer perceptron on the logits.
- for dense, bn, dropout in zip(
- self.mlp_dense, self.mlp_bn, self.mlp_dropout):
- logits = tf.nn.elu(dense(logits))
- logits = dropout(bn(logits, training=training), training=training)
+ logits = self.mlp(logits, training=training)
logits = self.mlp_output(logits)
return logits
-class SNLIClassifierTrainer(object):
+class SNLIClassifierTrainer(tfe.Checkpointable):
"""A class that coordinates the training of an SNLIClassifier."""
def __init__(self, snli_classifier, lr):
@@ -405,7 +419,7 @@ class SNLIClassifierTrainer(object):
# Create a custom learning rate Variable for the RMSProp optimizer, because
# the learning rate needs to be manually decayed later (see
# decay_learning_rate()).
- self._learning_rate = tfe.Variable(lr, name="learning_rate")
+ self._learning_rate = tf.Variable(lr, name="learning_rate")
self._optimizer = tf.train.RMSPropOptimizer(self._learning_rate,
epsilon=1e-6)
@@ -448,7 +462,7 @@ class SNLIClassifierTrainer(object):
2. logits as a dense `Tensor` of shape (batch_size, d_out), where d_out is
the output dimension size of the SNLIClassifier.
"""
- with tfe.GradientTape() as tape:
+ with tf.GradientTape() as tape:
tape.watch(self._model.variables)
logits = self._model(premise,
premise_transition,
@@ -609,29 +623,27 @@ def train_or_infer_spinn(embed,
with tf.device(device), \
summary_writer.as_default(), \
tf.contrib.summary.always_record_summaries():
- with tfe.restore_variables_on_create(
- tf.train.latest_checkpoint(config.logdir)):
- model = SNLIClassifier(config, embed)
- global_step = tf.train.get_or_create_global_step()
- trainer = SNLIClassifierTrainer(model, config.lr)
+ model = SNLIClassifier(config, embed)
+ global_step = tf.train.get_or_create_global_step()
+ trainer = SNLIClassifierTrainer(model, config.lr)
+ checkpoint = tf.train.Checkpoint(trainer=trainer, global_step=global_step)
+ checkpoint.restore(tf.train.latest_checkpoint(config.logdir))
if inference_sentence_pair:
# Inference mode.
- with tfe.restore_variables_on_create(
- tf.train.latest_checkpoint(config.logdir)):
- prem, prem_trans = inference_sentence_pair[0]
- hypo, hypo_trans = inference_sentence_pair[1]
- hypo_trans = inference_sentence_pair[1][1]
- inference_logits = model( # pylint: disable=not-callable
- tf.constant(prem), tf.constant(prem_trans),
- tf.constant(hypo), tf.constant(hypo_trans), training=False)
- inference_logits = inference_logits[0][1:]
- max_index = tf.argmax(inference_logits)
- print("\nInference logits:")
- for i, (label, logit) in enumerate(
- zip(data.POSSIBLE_LABELS, inference_logits)):
- winner_tag = " (winner)" if max_index == i else ""
- print(" {0:<16}{1:.6f}{2}".format(label + ":", logit, winner_tag))
+ prem, prem_trans = inference_sentence_pair[0]
+ hypo, hypo_trans = inference_sentence_pair[1]
+ hypo_trans = inference_sentence_pair[1][1]
+ inference_logits = model(
+ tf.constant(prem), tf.constant(prem_trans),
+ tf.constant(hypo), tf.constant(hypo_trans), training=False)
+ inference_logits = inference_logits[0][1:]
+ max_index = tf.argmax(inference_logits)
+ print("\nInference logits:")
+ for i, (label, logit) in enumerate(
+ zip(data.POSSIBLE_LABELS, inference_logits)):
+ winner_tag = " (winner)" if max_index == i else ""
+ print(" {0:<16}{1:.6f}{2}".format(label + ":", logit, winner_tag))
return inference_logits
train_len = train_data.num_batches(config.batch_size)
@@ -650,20 +662,15 @@ def train_or_infer_spinn(embed,
# remain on CPU. Same in _evaluate_on_dataset().
iterations += 1
- with tfe.restore_variables_on_create(
- tf.train.latest_checkpoint(config.logdir)):
- batch_train_loss, batch_train_logits = trainer.train_batch(
- label, prem, prem_trans, hypo, hypo_trans)
+ batch_train_loss, batch_train_logits = trainer.train_batch(
+ label, prem, prem_trans, hypo, hypo_trans)
batch_size = tf.shape(label)[0]
mean_loss(batch_train_loss.numpy(),
weights=batch_size.gpu() if use_gpu else batch_size)
accuracy(tf.argmax(batch_train_logits, axis=1), label)
if iterations % config.save_every == 0:
- all_variables = trainer.variables + [global_step]
- saver = tfe.Saver(all_variables)
- saver.save(os.path.join(config.logdir, "ckpt"),
- global_step=global_step)
+ checkpoint.save(os.path.join(config.logdir, "ckpt"))
if iterations % config.dev_every == 0:
dev_loss, dev_frac_correct = _evaluate_on_dataset(
diff --git a/third_party/farmhash.BUILD b/third_party/farmhash.BUILD
index a51e1511c1..4b8464684a 100644
--- a/third_party/farmhash.BUILD
+++ b/third_party/farmhash.BUILD
@@ -3,13 +3,6 @@ licenses(["notice"]) # MIT
exports_files(["COPYING"])
config_setting(
- name = "windows_msvc",
- values = {
- "cpu": "x64_windows_msvc",
- },
-)
-
-config_setting(
name = "windows",
values = {
"cpu": "x64_windows",
@@ -23,7 +16,6 @@ cc_library(
# Disable __builtin_expect support on Windows
copts = select({
":windows": ["/DFARMHASH_OPTIONAL_BUILTIN_EXPECT"],
- ":windows_msvc": ["/DFARMHASH_OPTIONAL_BUILTIN_EXPECT"],
"//conditions:default": [],
}),
includes = ["src/."],
diff --git a/third_party/fft2d/fft2d.BUILD b/third_party/fft2d/fft2d.BUILD
index 3dbd36aec0..74dd3112fc 100644
--- a/third_party/fft2d/fft2d.BUILD
+++ b/third_party/fft2d/fft2d.BUILD
@@ -14,6 +14,11 @@ FFT2D_SRCS = [
"fft/fftsg.c",
]
+config_setting(
+ name = "windows",
+ values = {"cpu": "x64_windows"},
+)
+
# This is the main 2D FFT library. The 2D FFTs in this library call
# 1D FFTs. In addition, fast DCTs are provided for the special case
# of 8x8 and 16x16. This code in this library is referred to as
@@ -21,7 +26,10 @@ FFT2D_SRCS = [
cc_library(
name = "fft2d",
srcs = FFT2D_SRCS,
- linkopts = ["-lm"],
+ linkopts = select({
+ ":windows": [],
+ "//conditions:default": ["-lm"],
+ }),
)
objc_library(
diff --git a/third_party/flatbuffers/BUILD b/third_party/flatbuffers/BUILD
index fbdf19f205..82bab3ffd9 100644
--- a/third_party/flatbuffers/BUILD
+++ b/third_party/flatbuffers/BUILD
@@ -1,15 +1 @@
-package(default_visibility = ["//visibility:public"])
-
-licenses(["notice"]) # Apache 2.0
-
-filegroup(
- name = "all_files",
- srcs = glob(
- ["**/*"],
- exclude = [
- "**/METADATA",
- "**/OWNERS",
- ],
- ),
- visibility = ["//tensorflow:__subpackages__"],
-)
+# This empty BUILD file is required to make Bazel treat this directory as a package.
diff --git a/third_party/flatbuffers/flatbuffers.BUILD b/third_party/flatbuffers/BUILD.bazel
index 824c97be60..934c0d9650 100644
--- a/third_party/flatbuffers/flatbuffers.BUILD
+++ b/third_party/flatbuffers/BUILD.bazel
@@ -12,12 +12,17 @@ config_setting(
visibility = ["//visibility:public"],
)
-FLATBUFFERS_COPTS = [
- "-fexceptions",
-] + select({
- "@bazel_tools//src:windows": [],
- "@bazel_tools//src:windows_msvc": [],
- "//conditions:default": ["-Wno-implicit-fallthrough"],
+config_setting(
+ name = "windows",
+ values = {"cpu": "x64_windows"},
+)
+
+FLATBUFFERS_COPTS = select({
+ ":windows": [],
+ "//conditions:default": [
+ "-Wno-implicit-fallthrough",
+ "-fexceptions",
+ ],
})
# Public flatc library to compile flatbuffer files at runtime.
@@ -98,6 +103,8 @@ cc_binary(
"grpc/src/compiler/cpp_generator.h",
"grpc/src/compiler/go_generator.cc",
"grpc/src/compiler/go_generator.h",
+ "grpc/src/compiler/java_generator.cc",
+ "grpc/src/compiler/java_generator.h",
"grpc/src/compiler/schema_interface.h",
"src/flatc_main.cpp",
"src/idl_gen_cpp.cpp",
@@ -119,6 +126,7 @@ cc_binary(
":freebsd": [
"-lm",
],
+ ":windows": [],
"//conditions:default": [
"-lm",
"-ldl",
@@ -134,6 +142,7 @@ filegroup(
srcs = [
"include/flatbuffers/base.h",
"include/flatbuffers/flatbuffers.h",
+ "include/flatbuffers/minireflect.h",
"include/flatbuffers/stl_emulation.h",
"include/flatbuffers/util.h",
],
diff --git a/third_party/flatbuffers/BUILD.system b/third_party/flatbuffers/BUILD.system
new file mode 100644
index 0000000000..14fceada82
--- /dev/null
+++ b/third_party/flatbuffers/BUILD.system
@@ -0,0 +1,38 @@
+licenses(["notice"]) # Apache 2.0
+
+filegroup(
+ name = "LICENSE.txt",
+ visibility = ["//visibility:public"],
+)
+
+# Public flatc library to compile flatbuffer files at runtime.
+cc_library(
+ name = "flatbuffers",
+ linkopts = ["-lflatbuffers"],
+ visibility = ["//visibility:public"],
+)
+
+# Public flatc compiler library.
+cc_library(
+ name = "flatc_library",
+ linkopts = ["-lflatbuffers"],
+ visibility = ["//visibility:public"],
+)
+
+genrule(
+ name = "lnflatc",
+ outs = ["flatc.bin"],
+ cmd = "ln -s $$(which flatc) $@",
+)
+
+# Public flatc compiler.
+sh_binary(
+ name = "flatc",
+ srcs = ["flatc.bin"],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "runtime_cc",
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/flatbuffers/build_defs.bzl b/third_party/flatbuffers/build_defs.bzl
index ae8d7feebe..235b44f7cf 100644
--- a/third_party/flatbuffers/build_defs.bzl
+++ b/third_party/flatbuffers/build_defs.bzl
@@ -1,5 +1,4 @@
-# Description:
-# BUILD rules for generating flatbuffer files.
+"""BUILD rules for generating flatbuffer files."""
flatc_path = "@flatbuffers//:flatc"
@@ -8,66 +7,50 @@ DEFAULT_FLATC_ARGS = [
"--gen-object-api",
]
-def flatbuffer_library_public(name,
- srcs,
- outs,
- language_flag,
- out_prefix="",
- includes=[],
- include_paths=[],
- flatc_args=DEFAULT_FLATC_ARGS,
- reflection_name="",
- reflection_visiblity=None,
- output_to_bindir=False):
- '''Generates code files for reading/writing the given flatbuffers in the requested language using the public compiler.
-
- Args:
- name: Rule name.
- srcs: Source .fbs files. Sent in order to the compiler.
- outs: Output files from flatc.
- language_flag: Target language flag. One of [-c, -j, -js].
- out_prefix: Prepend this path to the front of all generated files except on
- single source targets. Usually is a directory name.
- includes: Optional, list of filegroups of schemas that the srcs depend on.
- include_paths: Optional, list of paths the includes files can be found in.
- flatc_args: Optional, list of additional arguments to pass to flatc.
- reflection_name: Optional, if set this will generate the flatbuffer
- reflection binaries for the schemas.
- reflection_visiblity: The visibility of the generated reflection Fileset.
- output_to_bindir: Passed to genrule for output to bin directory.
- Outs:
- filegroup(name): all generated source files.
- Fileset([reflection_name]): (Optional) all generated reflection binaries.
- '''
- include_paths_cmd = ["-I %s" % (s) for s in include_paths]
- # '$(@D)' when given a single source target will give the appropriate
- # directory. Appending 'out_prefix' is only necessary when given a build
- # target with multiple sources.
- output_directory = (
- ("-o $(@D)/%s" % (out_prefix)) if len(srcs) > 1 else ("-o $(@D)"))
- genrule_cmd = " ".join([
- "for f in $(SRCS); do",
- "$(location %s)" % (flatc_path),
- " ".join(flatc_args),
- " ".join(include_paths_cmd),
- language_flag,
- output_directory,
- "$$f;",
- "done",
- ])
- native.genrule(
- name=name,
- srcs=srcs,
- outs=outs,
- output_to_bindir=output_to_bindir,
- tools=includes + [flatc_path,],
- cmd=genrule_cmd,
- message="Generating flatbuffer files for %s:" % (name),)
- if reflection_name:
- reflection_genrule_cmd = " ".join([
+def flatbuffer_library_public(
+ name,
+ srcs,
+ outs,
+ language_flag,
+ out_prefix = "",
+ includes = [],
+ include_paths = [],
+ flatc_args = DEFAULT_FLATC_ARGS,
+ reflection_name = "",
+ reflection_visiblity = None,
+ output_to_bindir = False):
+ """Generates code files for reading/writing the given flatbuffers in the requested language using the public compiler.
+
+ Outs:
+ filegroup(name): all generated source files.
+ Fileset([reflection_name]): (Optional) all generated reflection binaries.
+
+ Args:
+ name: Rule name.
+ srcs: Source .fbs files. Sent in order to the compiler.
+ outs: Output files from flatc.
+ language_flag: Target language flag. One of [-c, -j, -js].
+ out_prefix: Prepend this path to the front of all generated files except on
+ single source targets. Usually is a directory name.
+ includes: Optional, list of filegroups of schemas that the srcs depend on.
+ include_paths: Optional, list of paths the includes files can be found in.
+ flatc_args: Optional, list of additional arguments to pass to flatc.
+ reflection_name: Optional, if set this will generate the flatbuffer
+ reflection binaries for the schemas.
+ reflection_visiblity: The visibility of the generated reflection Fileset.
+ output_to_bindir: Passed to genrule for output to bin directory.
+ """
+ include_paths_cmd = ["-I %s" % (s) for s in include_paths]
+
+ # '$(@D)' when given a single source target will give the appropriate
+ # directory. Appending 'out_prefix' is only necessary when given a build
+ # target with multiple sources.
+ output_directory = (
+ ("-o $(@D)/%s" % (out_prefix)) if len(srcs) > 1 else ("-o $(@D)")
+ )
+ genrule_cmd = " ".join([
"for f in $(SRCS); do",
"$(location %s)" % (flatc_path),
- "-b --schema",
" ".join(flatc_args),
" ".join(include_paths_cmd),
language_flag,
@@ -75,122 +58,160 @@ def flatbuffer_library_public(name,
"$$f;",
"done",
])
- reflection_outs = [
- (out_prefix + "%s.bfbs") % (s.replace(".fbs", "").split("/")[-1]) for s in srcs
- ]
native.genrule(
- name= "%s_srcs" % reflection_name,
- srcs=srcs,
- outs=reflection_outs,
- output_to_bindir=output_to_bindir,
- tools=includes + [flatc_path,],
- cmd=reflection_genrule_cmd,
- message="Generating flatbuffer reflection binary for %s:" % (name),)
- native.Fileset(
- name=reflection_name,
- out="%s_out" % reflection_name,
- entries=[
- native.FilesetEntry(files=reflection_outs),
- ],
- visibility=reflection_visiblity
+ name = name,
+ srcs = srcs,
+ outs = outs,
+ output_to_bindir = output_to_bindir,
+ tools = includes + [flatc_path],
+ cmd = genrule_cmd,
+ message = "Generating flatbuffer files for %s:" % (name),
)
+ if reflection_name:
+ reflection_genrule_cmd = " ".join([
+ "for f in $(SRCS); do",
+ "$(location %s)" % (flatc_path),
+ "-b --schema",
+ " ".join(flatc_args),
+ " ".join(include_paths_cmd),
+ language_flag,
+ output_directory,
+ "$$f;",
+ "done",
+ ])
+ reflection_outs = [
+ (out_prefix + "%s.bfbs") % (s.replace(".fbs", "").split("/")[-1])
+ for s in srcs
+ ]
+ native.genrule(
+ name = "%s_srcs" % reflection_name,
+ srcs = srcs,
+ outs = reflection_outs,
+ output_to_bindir = output_to_bindir,
+ tools = includes + [flatc_path],
+ cmd = reflection_genrule_cmd,
+ message = "Generating flatbuffer reflection binary for %s:" % (name),
+ )
+ # TODO(b/114456773): Make bazel rules proper and supported by flatbuffer
+ # Have to comment this since FilesetEntry is not supported in bazel
+ # skylark.
+ # native.Fileset(
+ # name = reflection_name,
+ # out = "%s_out" % reflection_name,
+ # entries = [
+ # native.FilesetEntry(files = reflection_outs),
+ # ],
+ # visibility = reflection_visiblity,
+ # )
+
+def flatbuffer_cc_library(
+ name,
+ srcs,
+ srcs_filegroup_name = "",
+ out_prefix = "",
+ includes = [],
+ include_paths = [],
+ flatc_args = DEFAULT_FLATC_ARGS,
+ visibility = None,
+ srcs_filegroup_visibility = None,
+ gen_reflections = False):
+ '''A cc_library with the generated reader/writers for the given flatbuffer definitions.
+
+ Outs:
+ filegroup([name]_srcs): all generated .h files.
+ filegroup(srcs_filegroup_name if specified, or [name]_includes if not):
+ Other flatbuffer_cc_library's can pass this in for their `includes`
+ parameter, if they depend on the schemas in this library.
+ Fileset([name]_reflection): (Optional) all generated reflection binaries.
+ cc_library([name]): library with sources and flatbuffers deps.
+
+ Remarks:
+ ** Because the genrule used to call flatc does not have any trivial way of
+ computing the output list of files transitively generated by includes and
+ --gen-includes (the default) being defined for flatc, the --gen-includes
+ flag will not work as expected. The way around this is to add a dependency
+ to the flatbuffer_cc_library defined alongside the flatc included Fileset.
+ For example you might define:
+
+ flatbuffer_cc_library(
+ name = "my_fbs",
+ srcs = [ "schemas/foo.fbs" ],
+ includes = [ "//third_party/bazz:bazz_fbs_includes" ],
+ )
+ In which foo.fbs includes a few files from the Fileset defined at
+ //third_party/bazz:bazz_fbs_includes. When compiling the library that
+ includes foo_generated.h, and therefore has my_fbs as a dependency, it
+ will fail to find any of the bazz *_generated.h files unless you also
+ add bazz's flatbuffer_cc_library to your own dependency list, e.g.:
-def flatbuffer_cc_library(name, srcs, srcs_filegroup_name="",
- out_prefix="", includes=[], include_paths=[],
- flatc_args=DEFAULT_FLATC_ARGS,
- visibility=None, srcs_filegroup_visibility=None,
- gen_reflections=False):
- '''A cc_library with the generated reader/writers for the given flatbuffer definitions.
-
- Args:
- name: Rule name.
- srcs: Source .fbs files. Sent in order to the compiler.
- srcs_filegroup_name: Name of the output filegroup that holds srcs. Pass this
- filegroup into the `includes` parameter of any other
- flatbuffer_cc_library that depends on this one's schemas.
- out_prefix: Prepend this path to the front of all generated files. Usually
- is a directory name.
- includes: Optional, list of filegroups of schemas that the srcs depend on.
- ** SEE REMARKS BELOW **
- include_paths: Optional, list of paths the includes files can be found in.
- flatc_args: Optional list of additional arguments to pass to flatc
- (e.g. --gen-mutable).
- visibility: The visibility of the generated cc_library. By default, use the
- default visibility of the project.
- srcs_filegroup_visibility: The visibility of the generated srcs filegroup.
- By default, use the value of the visibility parameter above.
- gen_reflections: Optional, if true this will generate the flatbuffer
- reflection binaries for the schemas.
- Outs:
- filegroup([name]_srcs): all generated .h files.
- filegroup(srcs_filegroup_name if specified, or [name]_includes if not):
- Other flatbuffer_cc_library's can pass this in for their `includes`
- parameter, if they depend on the schemas in this library.
- Fileset([name]_reflection): (Optional) all generated reflection binaries.
- cc_library([name]): library with sources and flatbuffers deps.
-
- Remarks:
- ** Because the genrule used to call flatc does not have any trivial way of
- computing the output list of files transitively generated by includes and
- --gen-includes (the default) being defined for flatc, the --gen-includes
- flag will not work as expected. The way around this is to add a dependency
- to the flatbuffer_cc_library defined alongside the flatc included Fileset.
- For example you might define:
-
- flatbuffer_cc_library(
- name = "my_fbs",
- srcs = [ "schemas/foo.fbs" ],
- includes = [ "//third_party/bazz:bazz_fbs_includes" ],
- )
-
- In which foo.fbs includes a few files from the Fileset defined at
- //third_party/bazz:bazz_fbs_includes. When compiling the library that
- includes foo_generated.h, and therefore has my_fbs as a dependency, it
- will fail to find any of the bazz *_generated.h files unless you also
- add bazz's flatbuffer_cc_library to your own dependency list, e.g.:
-
- cc_library(
- name = "my_lib",
- deps = [
- ":my_fbs",
- "//third_party/bazz:bazz_fbs"
- ],
- )
-
- Happy dependent Flatbuffering!
- '''
- output_headers = [
- (out_prefix + "%s_generated.h") % (s.replace(".fbs", "").split("/")[-1]) for s in srcs
- ]
- reflection_name = "%s_reflection" % name if gen_reflections else ""
-
- flatbuffer_library_public(name="%s_srcs" % (name),
- srcs=srcs,
- outs=output_headers,
- language_flag="-c",
- out_prefix=out_prefix,
- includes=includes,
- include_paths=include_paths,
- flatc_args=flatc_args,
- reflection_name=reflection_name,
- reflection_visiblity=visibility,)
- native.cc_library(name=name,
- hdrs=output_headers,
- srcs=output_headers,
- features=[
- "-parse_headers",
- ],
- deps=[
- "@flatbuffers//:runtime_cc",
- ],
- includes=["."],
- linkstatic=1,
- visibility=visibility)
-
- # A filegroup for the `srcs`. That is, all the schema files for this
- # Flatbuffer set.
- native.filegroup(
- name = srcs_filegroup_name if srcs_filegroup_name else "%s_includes" % (name),
- srcs = srcs,
- visibility=srcs_filegroup_visibility if srcs_filegroup_visibility != None else visibility)
+ cc_library(
+ name = "my_lib",
+ deps = [
+ ":my_fbs",
+ "//third_party/bazz:bazz_fbs"
+ ],
+ )
+
+ Happy dependent Flatbuffering!
+
+ Args:
+ name: Rule name.
+ srcs: Source .fbs files. Sent in order to the compiler.
+ srcs_filegroup_name: Name of the output filegroup that holds srcs. Pass this
+ filegroup into the `includes` parameter of any other
+ flatbuffer_cc_library that depends on this one's schemas.
+ out_prefix: Prepend this path to the front of all generated files. Usually
+ is a directory name.
+ includes: Optional, list of filegroups of schemas that the srcs depend on.
+ ** SEE REMARKS BELOW **
+ include_paths: Optional, list of paths the includes files can be found in.
+ flatc_args: Optional list of additional arguments to pass to flatc
+ (e.g. --gen-mutable).
+ visibility: The visibility of the generated cc_library. By default, use the
+ default visibility of the project.
+ srcs_filegroup_visibility: The visibility of the generated srcs filegroup.
+ By default, use the value of the visibility parameter above.
+ gen_reflections: Optional, if true this will generate the flatbuffer
+ reflection binaries for the schemas.
+ '''
+ output_headers = [
+ (out_prefix + "%s_generated.h") % (s.replace(".fbs", "").split("/")[-1])
+ for s in srcs
+ ]
+ reflection_name = "%s_reflection" % name if gen_reflections else ""
+
+ flatbuffer_library_public(
+ name = "%s_srcs" % (name),
+ srcs = srcs,
+ outs = output_headers,
+ language_flag = "-c",
+ out_prefix = out_prefix,
+ includes = includes,
+ include_paths = include_paths,
+ flatc_args = flatc_args,
+ reflection_name = reflection_name,
+ reflection_visiblity = visibility,
+ )
+ native.cc_library(
+ name = name,
+ hdrs = output_headers,
+ srcs = output_headers,
+ features = [
+ "-parse_headers",
+ ],
+ deps = [
+ "@flatbuffers//:runtime_cc",
+ ],
+ includes = ["."],
+ linkstatic = 1,
+ visibility = visibility,
+ )
+
+ # A filegroup for the `srcs`. That is, all the schema files for this
+ # Flatbuffer set.
+ native.filegroup(
+ name = srcs_filegroup_name if srcs_filegroup_name else "%s_includes" % (name),
+ srcs = srcs,
+ visibility = srcs_filegroup_visibility if srcs_filegroup_visibility != None else visibility,
+ )
diff --git a/third_party/flatbuffers/workspace.bzl b/third_party/flatbuffers/workspace.bzl
new file mode 100644
index 0000000000..3aeef96a72
--- /dev/null
+++ b/third_party/flatbuffers/workspace.bzl
@@ -0,0 +1,19 @@
+"""Loads the Flatbuffers library, used by TF Lite."""
+
+load("//third_party:repo.bzl", "third_party_http_archive")
+
+def repo():
+ third_party_http_archive(
+ name = "flatbuffers",
+ strip_prefix = "flatbuffers-1.9.0",
+ sha256 = "5ca5491e4260cacae30f1a5786d109230db3f3a6e5a0eb45d0d0608293d247e3",
+ urls = [
+ "https://mirror.bazel.build/github.com/google/flatbuffers/archive/v1.9.0.tar.gz",
+ "https://github.com/google/flatbuffers/archive/v1.9.0.tar.gz",
+ ],
+ build_file = "//third_party/flatbuffers:BUILD.bazel",
+ system_build_file = "//third_party/flatbuffers:BUILD.system",
+ link_files = {
+ "//third_party/flatbuffers:build_defs.bzl": "build_defs.bzl",
+ },
+ )
diff --git a/third_party/gif.BUILD b/third_party/gif.BUILD
index 78fbd6c0e0..cbe730fe10 100644
--- a/third_party/gif.BUILD
+++ b/third_party/gif.BUILD
@@ -21,7 +21,6 @@ cc_library(
],
hdrs = ["lib/gif_lib.h"],
defines = select({
- #"@org_tensorflow//tensorflow:android": [
":android": [
"S_IREAD=S_IRUSR",
"S_IWRITE=S_IWUSR",
@@ -33,7 +32,6 @@ cc_library(
visibility = ["//visibility:public"],
deps = select({
":windows": [":windows_polyfill"],
- ":windows_msvc": [":windows_polyfill"],
"//conditions:default": [],
}),
)
@@ -51,13 +49,6 @@ genrule(
)
config_setting(
- name = "windows_msvc",
- values = {
- "cpu": "x64_windows_msvc",
- },
-)
-
-config_setting(
name = "windows",
values = {
"cpu": "x64_windows",
diff --git a/third_party/googleapis.BUILD b/third_party/googleapis.BUILD
new file mode 100644
index 0000000000..95e999af18
--- /dev/null
+++ b/third_party/googleapis.BUILD
@@ -0,0 +1,45 @@
+# Copyright 2018 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+package(default_visibility = ["//visibility:public"])
+licenses(["notice"]) # Apache 2.0
+exports_files(["LICENSE"])
+
+load("@protobuf_archive//:protobuf.bzl", "cc_proto_library")
+
+cc_proto_library(
+ name = "bigtable_protos",
+ srcs = [
+ "google/bigtable/admin/v2/bigtable_instance_admin.proto",
+ "google/bigtable/admin/v2/bigtable_table_admin.proto",
+ "google/bigtable/admin/v2/common.proto",
+ "google/bigtable/admin/v2/instance.proto",
+ "google/bigtable/admin/v2/table.proto",
+ "google/bigtable/v2/bigtable.proto",
+ "google/bigtable/v2/data.proto",
+ "google/iam/v1/iam_policy.proto",
+ "google/iam/v1/policy.proto",
+ "google/longrunning/operations.proto",
+ "google/rpc/status.proto",
+ "google/rpc/error_details.proto",
+ "google/api/annotations.proto",
+ "google/api/auth.proto",
+ "google/api/http.proto",
+ ],
+ include = ".",
+ protoc = "@protobuf_archive//:protoc",
+ default_runtime = "@protobuf_archive//:protobuf",
+ deps = ["@protobuf_archive//:cc_wkt_protos"],
+ use_grpc_plugin = True,
+)
diff --git a/third_party/gpus/crosstool/BUILD.tpl b/third_party/gpus/crosstool/BUILD.tpl
index 98cb326572..f638756d23 100644
--- a/third_party/gpus/crosstool/BUILD.tpl
+++ b/third_party/gpus/crosstool/BUILD.tpl
@@ -7,6 +7,7 @@ cc_toolchain_suite(
toolchains = {
"local|compiler": ":cc-compiler-local",
"darwin|compiler": ":cc-compiler-darwin",
+ "x64_windows|msvc-cl": ":cc-compiler-windows",
},
)
@@ -42,6 +43,20 @@ cc_toolchain(
supports_param_files = 0,
)
+cc_toolchain(
+ name = "cc-compiler-windows",
+ all_files = "%{win_linker_files}",
+ compiler_files = ":empty",
+ cpu = "x64_windows",
+ dwp_files = ":empty",
+ dynamic_runtime_libs = [":empty"],
+ linker_files = "%{win_linker_files}",
+ objcopy_files = ":empty",
+ static_runtime_libs = [":empty"],
+ strip_files = ":empty",
+ supports_param_files = 1,
+)
+
filegroup(
name = "empty",
srcs = [],
@@ -51,3 +66,8 @@ filegroup(
name = "crosstool_wrapper_driver_is_not_gcc",
srcs = ["clang/bin/crosstool_wrapper_driver_is_not_gcc"],
)
+
+filegroup(
+ name = "windows_msvc_wrapper_files",
+ srcs = glob(["windows/msvc_*"]),
+)
diff --git a/third_party/gpus/crosstool/CROSSTOOL.tpl b/third_party/gpus/crosstool/CROSSTOOL.tpl
new file mode 100644
index 0000000000..3189cf8e31
--- /dev/null
+++ b/third_party/gpus/crosstool/CROSSTOOL.tpl
@@ -0,0 +1,1408 @@
+major_version: "local"
+minor_version: ""
+default_target_cpu: "same_as_host"
+
+default_toolchain {
+ cpu: "k8"
+ toolchain_identifier: "local_linux"
+}
+default_toolchain {
+ cpu: "piii"
+ toolchain_identifier: "local_linux"
+}
+default_toolchain {
+ cpu: "arm"
+ toolchain_identifier: "local_linux"
+}
+default_toolchain {
+ cpu: "darwin"
+ toolchain_identifier: "local_darwin"
+}
+default_toolchain {
+ cpu: "ppc"
+ toolchain_identifier: "local_linux"
+}
+default_toolchain {
+ cpu: "x64_windows"
+ toolchain_identifier: "local_windows"
+}
+
+toolchain {
+ abi_version: "local"
+ abi_libc_version: "local"
+ compiler: "compiler"
+ host_system_name: "local"
+ needsPic: true
+ target_libc: "local"
+ target_cpu: "local"
+ target_system_name: "local"
+ toolchain_identifier: "local_linux"
+
+ feature {
+ name: "c++11"
+ flag_set {
+ action: "c++-compile"
+ flag_group {
+ flag: "-std=c++11"
+ }
+ }
+ }
+
+ feature {
+ name: "stdlib"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "-lstdc++"
+ }
+ }
+ }
+
+ feature {
+ name: "determinism"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # Make C++ compilation deterministic. Use linkstamping instead of these
+ # compiler symbols.
+ flag: "-Wno-builtin-macro-redefined"
+ flag: "-D__DATE__=\"redacted\""
+ flag: "-D__TIMESTAMP__=\"redacted\""
+ flag: "-D__TIME__=\"redacted\""
+ }
+ }
+ }
+
+ feature {
+ name: "alwayslink"
+ flag_set {
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "c++-link-executable"
+ flag_group {
+ flag: "-Wl,-no-as-needed"
+ }
+ }
+ }
+
+ # This feature will be enabled for builds that support pic by bazel.
+ feature {
+ name: "pic"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ expand_if_all_available: "pic"
+ flag: "-fPIC"
+ }
+ flag_group {
+ expand_if_none_available: "pic"
+ flag: "-fPIE"
+ }
+ }
+ }
+
+ # Security hardening on by default.
+ feature {
+ name: "hardening"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
+ # We need to undef it before redefining it as some distributions now
+ # have it enabled by default.
+ flag: "-U_FORTIFY_SOURCE"
+ flag: "-D_FORTIFY_SOURCE=1"
+ flag: "-fstack-protector"
+ }
+ }
+ flag_set {
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "-Wl,-z,relro,-z,now"
+ }
+ }
+ flag_set {
+ action: "c++-link-executable"
+ flag_group {
+ flag: "-pie"
+ flag: "-Wl,-z,relro,-z,now"
+ }
+ }
+ }
+
+ feature {
+ name: "warnings"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # All warnings are enabled. Maybe enable -Werror as well?
+ flag: "-Wall"
+ %{host_compiler_warnings}
+ }
+ }
+ }
+
+ # Keep stack frames for debugging, even in opt mode.
+ feature {
+ name: "frame-pointer"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-fno-omit-frame-pointer"
+ }
+ }
+ }
+
+ feature {
+ name: "build-id"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ # Stamp the binary with a unique identifier.
+ flag: "-Wl,--build-id=md5"
+ flag: "-Wl,--hash-style=gnu"
+ }
+ }
+ }
+
+ feature {
+ name: "no-canonical-prefixes"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag:"-no-canonical-prefixes"
+ }
+ }
+ }
+
+ feature {
+ name: "disable-assertions"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-DNDEBUG"
+ }
+ }
+ }
+
+ feature {
+ name: "linker-bin-path"
+
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ %{linker_bin_path_flag}
+ }
+ }
+ }
+
+ feature {
+ name: "common"
+ implies: "stdlib"
+ implies: "c++11"
+ implies: "determinism"
+ implies: "alwayslink"
+ implies: "hardening"
+ implies: "warnings"
+ implies: "frame-pointer"
+ implies: "build-id"
+ implies: "no-canonical-prefixes"
+ implies: "linker-bin-path"
+ }
+
+ feature {
+ name: "opt"
+ implies: "common"
+ implies: "disable-assertions"
+
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # No debug symbols.
+ # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt
+ # or even generally? However, that can't happen here, as it requires
+ # special handling in Bazel.
+ flag: "-g0"
+
+ # Conservative choice for -O
+ # -O3 can increase binary size and even slow down the resulting binaries.
+ # Profile first and / or use FDO if you need better performance than this.
+ flag: "-O2"
+
+ # Removal of unused code and data at link time (can this increase binary size in some cases?).
+ flag: "-ffunction-sections"
+ flag: "-fdata-sections"
+ }
+ }
+ flag_set {
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "c++-link-executable"
+ flag_group {
+ flag: "-Wl,--gc-sections"
+ }
+ }
+ }
+
+ feature {
+ name: "fastbuild"
+ implies: "common"
+ }
+
+ feature {
+ name: "dbg"
+ implies: "common"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-g"
+ }
+ }
+ }
+
+ # Set clang as a C/C++ compiler.
+ tool_path { name: "gcc" path: "%{host_compiler_path}" }
+
+ # Use the default system toolchain for everything else.
+ tool_path { name: "ar" path: "/usr/bin/ar" }
+ tool_path { name: "compat-ld" path: "/usr/bin/ld" }
+ tool_path { name: "cpp" path: "/usr/bin/cpp" }
+ tool_path { name: "dwp" path: "/usr/bin/dwp" }
+ tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ tool_path { name: "ld" path: "/usr/bin/ld" }
+ tool_path { name: "nm" path: "/usr/bin/nm" }
+ tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
+ tool_path { name: "objdump" path: "/usr/bin/objdump" }
+ tool_path { name: "strip" path: "/usr/bin/strip" }
+
+ # Enabled dynamic linking.
+ linking_mode_flags { mode: DYNAMIC }
+
+%{host_compiler_includes}
+}
+
+toolchain {
+ abi_version: "local"
+ abi_libc_version: "local"
+ compiler: "compiler"
+ host_system_name: "local"
+ needsPic: true
+ target_libc: "macosx"
+ target_cpu: "darwin"
+ target_system_name: "local"
+ toolchain_identifier: "local_darwin"
+ feature {
+ name: "c++11"
+ flag_set {
+ action: "c++-compile"
+ flag_group {
+ flag: "-std=c++11"
+ }
+ }
+ }
+
+ feature {
+ name: "stdlib"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "-lc++"
+ }
+ }
+ }
+
+ feature {
+ name: "determinism"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # Make C++ compilation deterministic. Use linkstamping instead of these
+ # compiler symbols.
+ flag: "-Wno-builtin-macro-redefined"
+ flag: "-D__DATE__=\"redacted\""
+ flag: "-D__TIMESTAMP__=\"redacted\""
+ flag: "-D__TIME__=\"redacted\""
+ }
+ }
+ }
+
+ # This feature will be enabled for builds that support pic by bazel.
+ feature {
+ name: "pic"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ expand_if_all_available: "pic"
+ flag: "-fPIC"
+ }
+ flag_group {
+ expand_if_none_available: "pic"
+ flag: "-fPIE"
+ }
+ }
+ }
+
+ # Security hardening on by default.
+ feature {
+ name: "hardening"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
+ # We need to undef it before redefining it as some distributions now
+ # have it enabled by default.
+ flag: "-U_FORTIFY_SOURCE"
+ flag: "-D_FORTIFY_SOURCE=1"
+ flag: "-fstack-protector"
+ }
+ }
+ flag_set {
+ action: "c++-link-executable"
+ flag_group {
+ flag: "-pie"
+ }
+ }
+ }
+
+ feature {
+ name: "warnings"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # All warnings are enabled. Maybe enable -Werror as well?
+ flag: "-Wall"
+ %{host_compiler_warnings}
+ }
+ }
+ }
+
+ # Keep stack frames for debugging, even in opt mode.
+ feature {
+ name: "frame-pointer"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-fno-omit-frame-pointer"
+ }
+ }
+ }
+
+ feature {
+ name: "no-canonical-prefixes"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag:"-no-canonical-prefixes"
+ }
+ }
+ }
+
+ feature {
+ name: "disable-assertions"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-DNDEBUG"
+ }
+ }
+ }
+
+ feature {
+ name: "linker-bin-path"
+
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ %{linker_bin_path_flag}
+ }
+ }
+ }
+
+ feature {
+ name: "undefined-dynamic"
+ flag_set {
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "c++-link-executable"
+ flag_group {
+ flag: "-undefined"
+ flag: "dynamic_lookup"
+ }
+ }
+ }
+
+ feature {
+ name: "common"
+ implies: "stdlib"
+ implies: "c++11"
+ implies: "determinism"
+ implies: "hardening"
+ implies: "warnings"
+ implies: "frame-pointer"
+ implies: "no-canonical-prefixes"
+ implies: "linker-bin-path"
+ implies: "undefined-dynamic"
+ }
+
+ feature {
+ name: "opt"
+ implies: "common"
+ implies: "disable-assertions"
+
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # No debug symbols.
+ # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt
+ # or even generally? However, that can't happen here, as it requires
+ # special handling in Bazel.
+ flag: "-g0"
+
+ # Conservative choice for -O
+ # -O3 can increase binary size and even slow down the resulting binaries.
+ # Profile first and / or use FDO if you need better performance than this.
+ flag: "-O2"
+
+ # Removal of unused code and data at link time (can this increase binary size in some cases?).
+ flag: "-ffunction-sections"
+ flag: "-fdata-sections"
+ }
+ }
+ }
+
+ feature {
+ name: "fastbuild"
+ implies: "common"
+ }
+
+ feature {
+ name: "dbg"
+ implies: "common"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-g"
+ }
+ }
+ }
+
+ # Set clang as a C/C++ compiler.
+ tool_path { name: "gcc" path: "%{host_compiler_path}" }
+
+ # Use the default system toolchain for everything else.
+ tool_path { name: "ar" path: "/usr/bin/libtool" }
+ tool_path { name: "compat-ld" path: "/usr/bin/ld" }
+ tool_path { name: "cpp" path: "/usr/bin/cpp" }
+ tool_path { name: "dwp" path: "/usr/bin/dwp" }
+ tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ tool_path { name: "ld" path: "/usr/bin/ld" }
+ tool_path { name: "nm" path: "/usr/bin/nm" }
+ tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
+ tool_path { name: "objdump" path: "/usr/bin/objdump" }
+ tool_path { name: "strip" path: "/usr/bin/strip" }
+
+ # Enabled dynamic linking.
+ linking_mode_flags { mode: DYNAMIC }
+
+%{host_compiler_includes}
+}
+
+toolchain {
+ toolchain_identifier: "local_windows"
+ host_system_name: "local"
+ target_system_name: "local"
+
+ abi_version: "local"
+ abi_libc_version: "local"
+ target_cpu: "x64_windows"
+ compiler: "msvc-cl"
+ target_libc: "msvcrt"
+
+%{cxx_builtin_include_directory}
+
+ tool_path {
+ name: "ar"
+ path: "%{msvc_lib_path}"
+ }
+ tool_path {
+ name: "ml"
+ path: "%{msvc_ml_path}"
+ }
+ tool_path {
+ name: "cpp"
+ path: "%{msvc_cl_path}"
+ }
+ tool_path {
+ name: "gcc"
+ path: "%{msvc_cl_path}"
+ }
+ tool_path {
+ name: "gcov"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ tool_path {
+ name: "ld"
+ path: "%{msvc_link_path}"
+ }
+ tool_path {
+ name: "nm"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ tool_path {
+ name: "objcopy"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ tool_path {
+ name: "objdump"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ tool_path {
+ name: "strip"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ supports_interface_shared_objects: true
+
+ # TODO(pcloudy): Review those flags below, they should be defined by cl.exe
+ compiler_flag: "/DCOMPILER_MSVC"
+
+ # Don't define min/max macros in windows.h.
+ compiler_flag: "/DNOMINMAX"
+
+ # Platform defines.
+ compiler_flag: "/D_WIN32_WINNT=0x0600"
+ # Turn off warning messages.
+ compiler_flag: "/D_CRT_SECURE_NO_DEPRECATE"
+ compiler_flag: "/D_CRT_SECURE_NO_WARNINGS"
+ compiler_flag: "/D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS"
+
+ # Useful options to have on for compilation.
+ # Increase the capacity of object files to 2^32 sections.
+ compiler_flag: "/bigobj"
+ # Allocate 500MB for precomputed headers.
+ compiler_flag: "/Zm500"
+ # Use unsigned char by default.
+ compiler_flag: "/J"
+ # Use function level linking.
+ compiler_flag: "/Gy"
+ # Use string pooling.
+ compiler_flag: "/GF"
+ # Catch C++ exceptions only and tell the compiler to assume that functions declared
+ # as extern "C" never throw a C++ exception.
+ compiler_flag: "/EHsc"
+
+ # Globally disabled warnings.
+ # Don't warn about elements of array being be default initialized.
+ compiler_flag: "/wd4351"
+ # Don't warn about no matching delete found.
+ compiler_flag: "/wd4291"
+ # Don't warn about diamond inheritance patterns.
+ compiler_flag: "/wd4250"
+ # Don't warn about insecure functions (e.g. non _s functions).
+ compiler_flag: "/wd4996"
+
+ linker_flag: "/MACHINE:X64"
+
+ feature {
+ name: "no_legacy_features"
+ }
+
+ # Suppress startup banner.
+ feature {
+ name: "nologo"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-module-compile"
+ action: "c++-module-codegen"
+ action: "c++-header-parsing"
+ action: "assemble"
+ action: "preprocess-assemble"
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "c++-link-static-library"
+ flag_group {
+ flag: "/nologo"
+ }
+ }
+ }
+
+ feature {
+ name: 'has_configured_linker_path'
+ }
+
+ # This feature indicates strip is not supported, building stripped binary will just result a copy of orignial binary
+ feature {
+ name: 'no_stripping'
+ }
+
+ # This feature indicates this is a toolchain targeting Windows.
+ feature {
+ name: 'targets_windows'
+ implies: 'copy_dynamic_libraries_to_binary'
+ enabled: true
+ }
+
+ feature {
+ name: 'copy_dynamic_libraries_to_binary'
+ }
+
+ action_config {
+ config_name: 'assemble'
+ action_name: 'assemble'
+ tool {
+ tool_path: '%{msvc_ml_path}'
+ }
+ implies: 'compiler_input_flags'
+ implies: 'compiler_output_flags'
+ implies: 'nologo'
+ implies: 'msvc_env'
+ implies: 'sysroot'
+ }
+
+ action_config {
+ config_name: 'preprocess-assemble'
+ action_name: 'preprocess-assemble'
+ tool {
+ tool_path: '%{msvc_ml_path}'
+ }
+ implies: 'compiler_input_flags'
+ implies: 'compiler_output_flags'
+ implies: 'nologo'
+ implies: 'msvc_env'
+ implies: 'sysroot'
+ }
+
+ action_config {
+ config_name: 'c-compile'
+ action_name: 'c-compile'
+ tool {
+ tool_path: '%{msvc_cl_path}'
+ }
+ implies: 'compiler_input_flags'
+ implies: 'compiler_output_flags'
+ implies: 'legacy_compile_flags'
+ implies: 'nologo'
+ implies: 'msvc_env'
+ implies: 'parse_showincludes'
+ implies: 'user_compile_flags'
+ implies: 'sysroot'
+ implies: 'unfiltered_compile_flags'
+ }
+
+ action_config {
+ config_name: 'c++-compile'
+ action_name: 'c++-compile'
+ tool {
+ tool_path: '%{msvc_cl_path}'
+ }
+ implies: 'compiler_input_flags'
+ implies: 'compiler_output_flags'
+ implies: 'legacy_compile_flags'
+ implies: 'nologo'
+ implies: 'msvc_env'
+ implies: 'parse_showincludes'
+ implies: 'user_compile_flags'
+ implies: 'sysroot'
+ implies: 'unfiltered_compile_flags'
+ }
+
+ action_config {
+ config_name: 'c++-link-executable'
+ action_name: 'c++-link-executable'
+ tool {
+ tool_path: '%{msvc_link_path}'
+ }
+ implies: 'nologo'
+ implies: 'linkstamps'
+ implies: 'output_execpath_flags'
+ implies: 'input_param_flags'
+ implies: 'user_link_flags'
+ implies: 'legacy_link_flags'
+ implies: 'linker_subsystem_flag'
+ implies: 'linker_param_file'
+ implies: 'msvc_env'
+ implies: 'no_stripping'
+ }
+
+ action_config {
+ config_name: 'c++-link-dynamic-library'
+ action_name: 'c++-link-dynamic-library'
+ tool {
+ tool_path: '%{msvc_link_path}'
+ }
+ implies: 'nologo'
+ implies: 'shared_flag'
+ implies: 'linkstamps'
+ implies: 'output_execpath_flags'
+ implies: 'input_param_flags'
+ implies: 'user_link_flags'
+ implies: 'legacy_link_flags'
+ implies: 'linker_subsystem_flag'
+ implies: 'linker_param_file'
+ implies: 'msvc_env'
+ implies: 'no_stripping'
+ implies: 'has_configured_linker_path'
+ implies: 'def_file'
+ }
+
+ action_config {
+ config_name: 'c++-link-nodeps-dynamic-library'
+ action_name: 'c++-link-nodeps-dynamic-library'
+ tool {
+ tool_path: '%{msvc_link_path}'
+ }
+ implies: 'nologo'
+ implies: 'shared_flag'
+ implies: 'linkstamps'
+ implies: 'output_execpath_flags'
+ implies: 'input_param_flags'
+ implies: 'user_link_flags'
+ implies: 'legacy_link_flags'
+ implies: 'linker_subsystem_flag'
+ implies: 'linker_param_file'
+ implies: 'msvc_env'
+ implies: 'no_stripping'
+ implies: 'has_configured_linker_path'
+ implies: 'def_file'
+ }
+
+ action_config {
+ config_name: 'c++-link-static-library'
+ action_name: 'c++-link-static-library'
+ tool {
+ tool_path: '%{msvc_lib_path}'
+ }
+ implies: 'nologo'
+ implies: 'archiver_flags'
+ implies: 'input_param_flags'
+ implies: 'linker_param_file'
+ implies: 'msvc_env'
+ }
+
+ # TODO(b/65151735): Remove legacy_compile_flags feature when legacy fields are
+ # not used in this crosstool
+ feature {
+ name: 'legacy_compile_flags'
+ flag_set {
+ expand_if_all_available: 'legacy_compile_flags'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ iterate_over: 'legacy_compile_flags'
+ flag: '%{legacy_compile_flags}'
+ }
+ }
+ }
+
+ feature {
+ name: "msvc_env"
+ env_set {
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-module-compile"
+ action: "c++-module-codegen"
+ action: "c++-header-parsing"
+ action: "assemble"
+ action: "preprocess-assemble"
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "c++-link-static-library"
+ env_entry {
+ key: "PATH"
+ value: "%{msvc_env_path}"
+ }
+ env_entry {
+ key: "INCLUDE"
+ value: "%{msvc_env_include}"
+ }
+ env_entry {
+ key: "LIB"
+ value: "%{msvc_env_lib}"
+ }
+ env_entry {
+ key: "TMP"
+ value: "%{msvc_env_tmp}"
+ }
+ env_entry {
+ key: "TEMP"
+ value: "%{msvc_env_tmp}"
+ }
+ }
+ }
+
+ feature {
+ name: 'include_paths'
+ flag_set {
+ action: "assemble"
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ flag_group {
+ iterate_over: 'quote_include_paths'
+ flag: '/I%{quote_include_paths}'
+ }
+ flag_group {
+ iterate_over: 'include_paths'
+ flag: '/I%{include_paths}'
+ }
+ flag_group {
+ iterate_over: 'system_include_paths'
+ flag: '/I%{system_include_paths}'
+ }
+ }
+ }
+
+ feature {
+ name: "preprocessor_defines"
+ flag_set {
+ action: "assemble"
+ action: "preprocess-assemble"
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-header-parsing"
+ action: "c++-module-compile"
+ flag_group {
+ flag: "/D%{preprocessor_defines}"
+ iterate_over: "preprocessor_defines"
+ }
+ }
+ }
+
+ # Tell Bazel to parse the output of /showIncludes
+ feature {
+ name: 'parse_showincludes'
+ flag_set {
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-module-compile'
+ action: 'c++-header-parsing'
+ flag_group {
+ flag: "/showIncludes"
+ }
+ }
+ }
+
+
+ feature {
+ name: 'generate_pdb_file'
+ requires: {
+ feature: 'dbg'
+ }
+ requires: {
+ feature: 'fastbuild'
+ }
+ }
+
+ feature {
+ name: 'shared_flag'
+ flag_set {
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: '/DLL'
+ }
+ }
+ }
+
+ feature {
+ name: 'linkstamps'
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ expand_if_all_available: 'linkstamp_paths'
+ flag_group {
+ iterate_over: 'linkstamp_paths'
+ flag: '%{linkstamp_paths}'
+ }
+ }
+ }
+
+ feature {
+ name: 'output_execpath_flags'
+ flag_set {
+ expand_if_all_available: 'output_execpath'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: '/OUT:%{output_execpath}'
+ }
+ }
+ }
+
+ feature {
+ name: 'archiver_flags'
+ flag_set {
+ expand_if_all_available: 'output_execpath'
+ action: 'c++-link-static-library'
+ flag_group {
+ flag: '/OUT:%{output_execpath}'
+ }
+ }
+ }
+
+ feature {
+ name: 'input_param_flags'
+ flag_set {
+ expand_if_all_available: 'interface_library_output_path'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/IMPLIB:%{interface_library_output_path}"
+ }
+ }
+ flag_set {
+ expand_if_all_available: 'libopts'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ iterate_over: 'libopts'
+ flag: '%{libopts}'
+ }
+ }
+ flag_set {
+ expand_if_all_available: 'libraries_to_link'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ action: 'c++-link-static-library'
+ flag_group {
+ iterate_over: 'libraries_to_link'
+ flag_group {
+ expand_if_equal: {
+ variable: 'libraries_to_link.type'
+ value: 'object_file_group'
+ }
+ iterate_over: 'libraries_to_link.object_files'
+ flag_group {
+ flag: '%{libraries_to_link.object_files}'
+ }
+ }
+ flag_group {
+ expand_if_equal: {
+ variable: 'libraries_to_link.type'
+ value: 'object_file'
+ }
+ flag_group {
+ flag: '%{libraries_to_link.name}'
+ }
+ }
+ flag_group {
+ expand_if_equal: {
+ variable: 'libraries_to_link.type'
+ value: 'interface_library'
+ }
+ flag_group {
+ flag: '%{libraries_to_link.name}'
+ }
+ }
+ flag_group {
+ expand_if_equal: {
+ variable: 'libraries_to_link.type'
+ value: 'static_library'
+ }
+ flag_group {
+ expand_if_false: 'libraries_to_link.is_whole_archive'
+ flag: '%{libraries_to_link.name}'
+ }
+ flag_group {
+ expand_if_true: 'libraries_to_link.is_whole_archive'
+ flag: '/WHOLEARCHIVE:%{libraries_to_link.name}'
+ }
+ }
+ }
+ }
+ }
+
+ # Since this feature is declared earlier in the CROSSTOOL than
+ # "user_link_flags", this feature will be applied prior to it anwyhere they
+ # are both implied. And since "user_link_flags" contains the linkopts from
+ # the build rule, this allows the user to override the /SUBSYSTEM in the BUILD
+ # file.
+ feature {
+ name: 'linker_subsystem_flag'
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: '/SUBSYSTEM:CONSOLE'
+ }
+ }
+ }
+
+ # The "user_link_flags" contains user-defined linkopts (from build rules)
+ # so it should be defined after features that declare user-overridable flags.
+ # For example the "linker_subsystem_flag" defines a default "/SUBSYSTEM" flag
+ # but we want to let the user override it, therefore "link_flag_subsystem" is
+ # defined earlier in the CROSSTOOL file than "user_link_flags".
+ feature {
+ name: 'user_link_flags'
+ flag_set {
+ expand_if_all_available: 'user_link_flags'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ iterate_over: 'user_link_flags'
+ flag: '%{user_link_flags}'
+ }
+ }
+ }
+ feature {
+ name: 'legacy_link_flags'
+ flag_set {
+ expand_if_all_available: 'legacy_link_flags'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ iterate_over: 'legacy_link_flags'
+ flag: '%{legacy_link_flags}'
+ }
+ }
+ }
+
+ feature {
+ name: 'linker_param_file'
+ flag_set {
+ expand_if_all_available: 'linker_param_file'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ action: 'c++-link-static-library'
+ flag_group {
+ flag: '@%{linker_param_file}'
+ }
+ }
+ }
+
+ feature {
+ name: 'static_link_msvcrt'
+ }
+
+ feature {
+ name: 'static_link_msvcrt_no_debug'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/MT"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEFAULTLIB:libcmt.lib"
+ }
+ }
+ requires: { feature: 'fastbuild'}
+ requires: { feature: 'opt'}
+ }
+
+ feature {
+ name: 'dynamic_link_msvcrt_no_debug'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/MD"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEFAULTLIB:msvcrt.lib"
+ }
+ }
+ requires: { feature: 'fastbuild'}
+ requires: { feature: 'opt'}
+ }
+
+ feature {
+ name: 'static_link_msvcrt_debug'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/MTd"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEFAULTLIB:libcmtd.lib"
+ }
+ }
+ requires: { feature: 'dbg'}
+ }
+
+ feature {
+ name: 'dynamic_link_msvcrt_debug'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/MDd"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEFAULTLIB:msvcrtd.lib"
+ }
+ }
+ requires: { feature: 'dbg'}
+ }
+
+ feature {
+ name: 'dbg'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/Od"
+ flag: "/Z7"
+ flag: "/DDEBUG"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEBUG:FULL"
+ flag: "/INCREMENTAL:NO"
+ }
+ }
+ implies: 'generate_pdb_file'
+ }
+
+ feature {
+ name: 'fastbuild'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/Od"
+ flag: "/Z7"
+ flag: "/DDEBUG"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEBUG:FASTLINK"
+ flag: "/INCREMENTAL:NO"
+ }
+ }
+ implies: 'generate_pdb_file'
+ }
+
+ feature {
+ name: 'opt'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/O2"
+ flag: "/DNDEBUG"
+ }
+ }
+ }
+
+ feature {
+ name: 'user_compile_flags'
+ flag_set {
+ expand_if_all_available: 'user_compile_flags'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ iterate_over: 'user_compile_flags'
+ flag: '%{user_compile_flags}'
+ }
+ }
+ }
+
+ feature {
+ name: 'sysroot'
+ flag_set {
+ expand_if_all_available: 'sysroot'
+ action: 'assemble'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ iterate_over: 'sysroot'
+ flag: '--sysroot=%{sysroot}'
+ }
+ }
+ }
+
+ feature {
+ name: 'unfiltered_compile_flags'
+ flag_set {
+ expand_if_all_available: 'unfiltered_compile_flags'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ iterate_over: 'unfiltered_compile_flags'
+ flag: '%{unfiltered_compile_flags}'
+ }
+ }
+ }
+
+ feature {
+ name: 'compiler_output_flags'
+ flag_set {
+ action: 'assemble'
+ flag_group {
+ expand_if_all_available: 'output_file'
+ expand_if_none_available: 'output_assembly_file'
+ expand_if_none_available: 'output_preprocess_file'
+ flag: '/Fo%{output_file}'
+ flag: '/Zi'
+ }
+ }
+ flag_set {
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ expand_if_all_available: 'output_file'
+ expand_if_none_available: 'output_assembly_file'
+ expand_if_none_available: 'output_preprocess_file'
+ flag: '/Fo%{output_file}'
+ }
+ flag_group {
+ expand_if_all_available: 'output_file'
+ expand_if_all_available: 'output_assembly_file'
+ flag: '/Fa%{output_file}'
+ }
+ flag_group {
+ expand_if_all_available: 'output_file'
+ expand_if_all_available: 'output_preprocess_file'
+ flag: '/P'
+ flag: '/Fi%{output_file}'
+ }
+ }
+ }
+
+ feature {
+ name: 'compiler_input_flags'
+ flag_set {
+ action: 'assemble'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ expand_if_all_available: 'source_file'
+ flag: '/c'
+ flag: '%{source_file}'
+ }
+ }
+ }
+
+ feature {
+ name : 'def_file',
+ flag_set {
+ expand_if_all_available: 'def_file_path'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEF:%{def_file_path}"
+ # We can specify a different DLL name in DEF file, /ignore:4070 suppresses
+ # the warning message about DLL name doesn't match the default one.
+ # See https://msdn.microsoft.com/en-us/library/sfkk2fz7.aspx
+ flag: "/ignore:4070"
+ }
+ }
+ }
+
+ feature {
+ name: 'windows_export_all_symbols'
+ }
+
+ feature {
+ name: 'no_windows_export_all_symbols'
+ }
+
+ linking_mode_flags { mode: DYNAMIC }
+}
diff --git a/third_party/gpus/crosstool/CROSSTOOL_clang.tpl b/third_party/gpus/crosstool/CROSSTOOL_clang.tpl
deleted file mode 100644
index 2f09473ee2..0000000000
--- a/third_party/gpus/crosstool/CROSSTOOL_clang.tpl
+++ /dev/null
@@ -1,299 +0,0 @@
-major_version: "local"
-minor_version: ""
-default_target_cpu: "same_as_host"
-
-default_toolchain {
- cpu: "k8"
- toolchain_identifier: "local_linux"
-}
-default_toolchain {
- cpu: "piii"
- toolchain_identifier: "local_linux"
-}
-default_toolchain {
- cpu: "arm"
- toolchain_identifier: "local_linux"
-}
-default_toolchain {
- cpu: "darwin"
- toolchain_identifier: "local_darwin"
-}
-default_toolchain {
- cpu: "ppc"
- toolchain_identifier: "local_linux"
-}
-
-toolchain {
- abi_version: "local"
- abi_libc_version: "local"
- compiler: "compiler"
- host_system_name: "local"
- needsPic: true
- target_libc: "local"
- target_cpu: "local"
- target_system_name: "local"
- toolchain_identifier: "local_linux"
-
- feature {
- name: "c++11"
- flag_set {
- action: "c++-compile"
- flag_group {
- flag: "-std=c++11"
- }
- }
- }
-
- feature {
- name: "stdlib"
- flag_set {
- action: "c++-link-executable"
- action: "c++-link-dynamic-library"
- action: "c++-link-nodeps-dynamic-library"
- flag_group {
- flag: "-lstdc++"
- }
- }
- }
-
- feature {
- name: "determinism"
- flag_set {
- action: "c-compile"
- action: "c++-compile"
- flag_group {
- # Make C++ compilation deterministic. Use linkstamping instead of these
- # compiler symbols.
- flag: "-Wno-builtin-macro-redefined"
- flag: "-D__DATE__=\"redacted\""
- flag: "-D__TIMESTAMP__=\"redacted\""
- flag: "-D__TIME__=\"redacted\""
- }
- }
- }
-
- feature {
- name: "alwayslink"
- flag_set {
- action: "c++-link-dynamic-library"
- action: "c++-link-nodeps-dynamic-library"
- action: "c++-link-executable"
- flag_group {
- flag: "-Wl,-no-as-needed"
- }
- }
- }
-
- # This feature will be enabled for builds that support pic by bazel.
- feature {
- name: "pic"
- flag_set {
- action: "c-compile"
- action: "c++-compile"
- flag_group {
- expand_if_all_available: "pic"
- flag: "-fPIC"
- }
- flag_group {
- expand_if_none_available: "pic"
- flag: "-fPIE"
- }
- }
- }
-
- # Security hardening on by default.
- feature {
- name: "hardening"
- flag_set {
- action: "c-compile"
- action: "c++-compile"
- flag_group {
- # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
- # We need to undef it before redefining it as some distributions now
- # have it enabled by default.
- flag: "-U_FORTIFY_SOURCE"
- flag: "-D_FORTIFY_SOURCE=1"
- flag: "-fstack-protector"
- }
- }
- flag_set {
- action: "c++-link-dynamic-library"
- action: "c++-link-nodeps-dynamic-library"
- flag_group {
- flag: "-Wl,-z,relro,-z,now"
- }
- }
- flag_set {
- action: "c++-link-executable"
- flag_group {
- flag: "-pie"
- flag: "-Wl,-z,relro,-z,now"
- }
- }
- }
-
- feature {
- name: "warnings"
- flag_set {
- action: "c-compile"
- action: "c++-compile"
- flag_group {
- # All warnings are enabled. Maybe enable -Werror as well?
- flag: "-Wall"
- # Some parts of the codebase set -Werror and hit this warning, so
- # switch it off for now.
- flag: "-Wno-invalid-partial-specialization"
- }
- }
- }
-
- # Keep stack frames for debugging, even in opt mode.
- feature {
- name: "frame-pointer"
- flag_set {
- action: "c-compile"
- action: "c++-compile"
- flag_group {
- flag: "-fno-omit-frame-pointer"
- }
- }
- }
-
- feature {
- name: "build-id"
- flag_set {
- action: "c++-link-executable"
- action: "c++-link-dynamic-library"
- action: "c++-link-nodeps-dynamic-library"
- flag_group {
- # Stamp the binary with a unique identifier.
- flag: "-Wl,--build-id=md5"
- flag: "-Wl,--hash-style=gnu"
- }
- }
- }
-
- feature {
- name: "no-canonical-prefixes"
- flag_set {
- action: "c-compile"
- action: "c++-compile"
- action: "c++-link-executable"
- action: "c++-link-dynamic-library"
- action: "c++-link-nodeps-dynamic-library"
- flag_group {
- flag:"-no-canonical-prefixes"
- }
- }
- }
-
- feature {
- name: "disable-assertions"
- flag_set {
- action: "c-compile"
- action: "c++-compile"
- flag_group {
- flag: "-DNDEBUG"
- }
- }
- }
-
- feature {
- name: "linker-bin-path"
-
- flag_set {
- action: "c++-link-executable"
- action: "c++-link-dynamic-library"
- action: "c++-link-nodeps-dynamic-library"
- flag_group {
- flag: "-B/usr/bin/"
- }
- }
- }
-
- feature {
- name: "common"
- implies: "stdlib"
- implies: "c++11"
- implies: "determinism"
- implies: "alwayslink"
- implies: "hardening"
- implies: "warnings"
- implies: "frame-pointer"
- implies: "build-id"
- implies: "no-canonical-prefixes"
- implies: "linker-bin-path"
- }
-
- feature {
- name: "opt"
- implies: "common"
- implies: "disable-assertions"
-
- flag_set {
- action: "c-compile"
- action: "c++-compile"
- flag_group {
- # No debug symbols.
- # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt
- # or even generally? However, that can't happen here, as it requires
- # special handling in Bazel.
- flag: "-g0"
-
- # Conservative choice for -O
- # -O3 can increase binary size and even slow down the resulting binaries.
- # Profile first and / or use FDO if you need better performance than this.
- flag: "-O2"
-
- # Removal of unused code and data at link time (can this increase binary size in some cases?).
- flag: "-ffunction-sections"
- flag: "-fdata-sections"
- }
- }
- flag_set {
- action: "c++-link-dynamic-library"
- action: "c++-link-nodeps-dynamic-library"
- action: "c++-link-executable"
- flag_group {
- flag: "-Wl,--gc-sections"
- }
- }
- }
-
- feature {
- name: "fastbuild"
- implies: "common"
- }
-
- feature {
- name: "dbg"
- implies: "common"
- flag_set {
- action: "c-compile"
- action: "c++-compile"
- flag_group {
- flag: "-g"
- }
- }
- }
-
- # Set clang as a C/C++ compiler.
- tool_path { name: "gcc" path: "%{clang_path}" }
-
- # Use the default system toolchain for everything else.
- tool_path { name: "ar" path: "/usr/bin/ar" }
- tool_path { name: "compat-ld" path: "/usr/bin/ld" }
- tool_path { name: "cpp" path: "/usr/bin/cpp" }
- tool_path { name: "dwp" path: "/usr/bin/dwp" }
- tool_path { name: "gcov" path: "/usr/bin/gcov" }
- tool_path { name: "ld" path: "/usr/bin/ld" }
- tool_path { name: "nm" path: "/usr/bin/nm" }
- tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
- tool_path { name: "objdump" path: "/usr/bin/objdump" }
- tool_path { name: "strip" path: "/usr/bin/strip" }
-
- # Enabled dynamic linking.
- linking_mode_flags { mode: DYNAMIC }
-
-%{host_compiler_includes}
-}
diff --git a/third_party/gpus/crosstool/CROSSTOOL_nvcc.tpl b/third_party/gpus/crosstool/CROSSTOOL_nvcc.tpl
deleted file mode 100644
index 05290d647e..0000000000
--- a/third_party/gpus/crosstool/CROSSTOOL_nvcc.tpl
+++ /dev/null
@@ -1,249 +0,0 @@
-major_version: "local"
-minor_version: ""
-default_target_cpu: "same_as_host"
-
-default_toolchain {
- cpu: "k8"
- toolchain_identifier: "local_linux"
-}
-default_toolchain {
- cpu: "piii"
- toolchain_identifier: "local_linux"
-}
-default_toolchain {
- cpu: "arm"
- toolchain_identifier: "local_linux"
-}
-default_toolchain {
- cpu: "darwin"
- toolchain_identifier: "local_darwin"
-}
-default_toolchain {
- cpu: "ppc"
- toolchain_identifier: "local_linux"
-}
-
-toolchain {
- abi_version: "local"
- abi_libc_version: "local"
- builtin_sysroot: ""
- compiler: "compiler"
- host_system_name: "local"
- needsPic: true
- supports_gold_linker: false
- supports_incremental_linker: false
- supports_fission: false
- supports_interface_shared_objects: false
- supports_normalizing_ar: false
- supports_start_end_lib: false
- supports_thin_archives: false
- target_libc: "local"
- target_cpu: "local"
- target_system_name: "local"
- toolchain_identifier: "local_linux"
-
- tool_path { name: "ar" path: "/usr/bin/ar" }
- tool_path { name: "compat-ld" path: "/usr/bin/ld" }
- tool_path { name: "cpp" path: "/usr/bin/cpp" }
- tool_path { name: "dwp" path: "/usr/bin/dwp" }
- # As part of the TensorFlow release, we place some cuda-related compilation
- # files in @local_config_cuda//crosstool/clang/bin, and this relative
- # path, combined with the rest of our Bazel configuration causes our
- # compilation to use those files.
- tool_path { name: "gcc" path: "clang/bin/crosstool_wrapper_driver_is_not_gcc" }
- # Use "-std=c++11" for nvcc. For consistency, force both the host compiler
- # and the device compiler to use "-std=c++11".
- cxx_flag: "-std=c++11"
- linker_flag: "-Wl,-no-as-needed"
- linker_flag: "-lstdc++"
- linker_flag: "-B/usr/bin/"
-
-%{host_compiler_includes}
- tool_path { name: "gcov" path: "/usr/bin/gcov" }
-
- # C(++) compiles invoke the compiler (as that is the one knowing where
- # to find libraries), but we provide LD so other rules can invoke the linker.
- tool_path { name: "ld" path: "/usr/bin/ld" }
-
- tool_path { name: "nm" path: "/usr/bin/nm" }
- tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
- objcopy_embed_flag: "-I"
- objcopy_embed_flag: "binary"
- tool_path { name: "objdump" path: "/usr/bin/objdump" }
- tool_path { name: "strip" path: "/usr/bin/strip" }
-
- # Anticipated future default.
- unfiltered_cxx_flag: "-no-canonical-prefixes"
-
- # Make C++ compilation deterministic. Use linkstamping instead of these
- # compiler symbols.
- unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
- unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
-
- # Security hardening on by default.
- # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
- # We need to undef it before redefining it as some distributions now have
- # it enabled by default.
- compiler_flag: "-U_FORTIFY_SOURCE"
- compiler_flag: "-D_FORTIFY_SOURCE=1"
- compiler_flag: "-fstack-protector"
- compiler_flag: "-fPIE"
- linker_flag: "-pie"
- linker_flag: "-Wl,-z,relro,-z,now"
-
- # Enable coloring even if there's no attached terminal. Bazel removes the
- # escape sequences if --nocolor is specified. This isn't supported by gcc
- # on Ubuntu 14.04.
- # compiler_flag: "-fcolor-diagnostics"
-
- # All warnings are enabled. Maybe enable -Werror as well?
- compiler_flag: "-Wall"
- # Enable a few more warnings that aren't part of -Wall.
- compiler_flag: "-Wunused-but-set-parameter"
- # But disable some that are problematic.
- compiler_flag: "-Wno-free-nonheap-object" # has false positives
-
- # Keep stack frames for debugging, even in opt mode.
- compiler_flag: "-fno-omit-frame-pointer"
-
- # Anticipated future default.
- linker_flag: "-no-canonical-prefixes"
- unfiltered_cxx_flag: "-fno-canonical-system-headers"
- # Have gcc return the exit code from ld.
- linker_flag: "-pass-exit-codes"
- # Stamp the binary with a unique identifier.
- linker_flag: "-Wl,--build-id=md5"
- linker_flag: "-Wl,--hash-style=gnu"
- # Gold linker only? Can we enable this by default?
- # linker_flag: "-Wl,--warn-execstack"
- # linker_flag: "-Wl,--detect-odr-violations"
-
- # Include directory for cuda headers.
-%{cuda_include_path}
-
- compilation_mode_flags {
- mode: DBG
- # Enable debug symbols.
- compiler_flag: "-g"
- }
- compilation_mode_flags {
- mode: OPT
-
- # No debug symbols.
- # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or
- # even generally? However, that can't happen here, as it requires special
- # handling in Bazel.
- compiler_flag: "-g0"
-
- # Conservative choice for -O
- # -O3 can increase binary size and even slow down the resulting binaries.
- # Profile first and / or use FDO if you need better performance than this.
- compiler_flag: "-O2"
-
- # Disable assertions
- compiler_flag: "-DNDEBUG"
-
- # Removal of unused code and data at link time (can this increase binary size in some cases?).
- compiler_flag: "-ffunction-sections"
- compiler_flag: "-fdata-sections"
- linker_flag: "-Wl,--gc-sections"
- }
- linking_mode_flags { mode: DYNAMIC }
-}
-
-toolchain {
- abi_version: "local"
- abi_libc_version: "local"
- builtin_sysroot: ""
- compiler: "compiler"
- host_system_name: "local"
- needsPic: true
- target_libc: "macosx"
- target_cpu: "darwin"
- target_system_name: "local"
- toolchain_identifier: "local_darwin"
-
- tool_path { name: "ar" path: "/usr/bin/libtool" }
- tool_path { name: "compat-ld" path: "/usr/bin/ld" }
- tool_path { name: "cpp" path: "/usr/bin/cpp" }
- tool_path { name: "dwp" path: "/usr/bin/dwp" }
- tool_path { name: "gcc" path: "clang/bin/crosstool_wrapper_driver_is_not_gcc" }
- cxx_flag: "-std=c++11"
- ar_flag: "-static"
- ar_flag: "-s"
- ar_flag: "-o"
- linker_flag: "-lc++"
- linker_flag: "-undefined"
- linker_flag: "dynamic_lookup"
- # TODO(ulfjack): This is wrong on so many levels. Figure out a way to auto-detect the proper
- # setting from the local compiler, and also how to make incremental builds correct.
- cxx_builtin_include_directory: "/"
- tool_path { name: "gcov" path: "/usr/bin/gcov" }
- tool_path { name: "ld" path: "/usr/bin/ld" }
- tool_path { name: "nm" path: "/usr/bin/nm" }
- tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
- objcopy_embed_flag: "-I"
- objcopy_embed_flag: "binary"
- tool_path { name: "objdump" path: "/usr/bin/objdump" }
- tool_path { name: "strip" path: "/usr/bin/strip" }
-
- # Anticipated future default.
- unfiltered_cxx_flag: "-no-canonical-prefixes"
- # Make C++ compilation deterministic. Use linkstamping instead of these
- # compiler symbols.
- unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
- unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
-
- # Security hardening on by default.
- # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
- compiler_flag: "-D_FORTIFY_SOURCE=1"
- compiler_flag: "-fstack-protector"
-
- # Enable coloring even if there's no attached terminal. Bazel removes the
- # escape sequences if --nocolor is specified.
- compiler_flag: "-fcolor-diagnostics"
-
- # All warnings are enabled. Maybe enable -Werror as well?
- compiler_flag: "-Wall"
- # Enable a few more warnings that aren't part of -Wall.
- compiler_flag: "-Wthread-safety"
- compiler_flag: "-Wself-assign"
-
- # Keep stack frames for debugging, even in opt mode.
- compiler_flag: "-fno-omit-frame-pointer"
-
- # Anticipated future default.
- linker_flag: "-no-canonical-prefixes"
-
- # Include directory for cuda headers.
-%{cuda_include_path}
-
- compilation_mode_flags {
- mode: DBG
- # Enable debug symbols.
- compiler_flag: "-g"
- }
- compilation_mode_flags {
- mode: OPT
- # No debug symbols.
- # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or even generally?
- # However, that can't happen here, as it requires special handling in Bazel.
- compiler_flag: "-g0"
-
- # Conservative choice for -O
- # -O3 can increase binary size and even slow down the resulting binaries.
- # Profile first and / or use FDO if you need better performance than this.
- compiler_flag: "-O2"
-
- # Disable assertions
- compiler_flag: "-DNDEBUG"
-
- # Removal of unused code and data at link time (can this increase binary size in some cases?).
- compiler_flag: "-ffunction-sections"
- compiler_flag: "-fdata-sections"
- }
-}
diff --git a/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl b/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl
index 2558f46fd5..f4f4d0ee96 100755
--- a/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl
+++ b/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl
@@ -175,6 +175,11 @@ def InvokeNvcc(argv, log=False):
# any other reliable way to just get the list of source files to be compiled.
src_files = GetOptionValue(argv, 'c')
+ # Pass -w through from host to nvcc, but don't do anything fancier with
+ # warnings-related flags, since they're not necessarily the same across
+ # compilers.
+ warning_options = ' -w' if '-w' in argv else ''
+
if len(src_files) == 0:
return 1
if len(out_file) != 1:
@@ -205,6 +210,7 @@ def InvokeNvcc(argv, log=False):
nvccopts += defines
nvccopts += std_options
nvccopts += m_options
+ nvccopts += warning_options
if depfiles:
# Generate the dependency file
diff --git a/third_party/gpus/crosstool/windows/msvc_wrapper_for_nvcc.bat.tpl b/third_party/gpus/crosstool/windows/msvc_wrapper_for_nvcc.bat.tpl
new file mode 100644
index 0000000000..8f8fb3e423
--- /dev/null
+++ b/third_party/gpus/crosstool/windows/msvc_wrapper_for_nvcc.bat.tpl
@@ -0,0 +1,20 @@
+:: Copyright 2015 The TensorFlow Authors. All Rights Reserved.
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+:: http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+:: =============================================================================
+
+:: Invoke msvc_wrapper_for_nvcc.py, which is located in the same directory.
+@echo OFF
+set arg0=%~0
+for %%F in ("%arg0%") do set DRIVER_BIN=%%~dpF
+"%{python_binary}" -B "%DRIVER_BIN%\msvc_wrapper_for_nvcc.py" %*
diff --git a/third_party/gpus/crosstool/windows/msvc_wrapper_for_nvcc.py.tpl b/third_party/gpus/crosstool/windows/msvc_wrapper_for_nvcc.py.tpl
new file mode 100644
index 0000000000..1a09756813
--- /dev/null
+++ b/third_party/gpus/crosstool/windows/msvc_wrapper_for_nvcc.py.tpl
@@ -0,0 +1,192 @@
+#!/usr/bin/env python
+# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ==============================================================================
+
+"""Crosstool wrapper for compiling CUDA programs with nvcc on Windows.
+
+DESCRIPTION:
+ This script is the Windows version of //third_party/gpus/crosstool/crosstool_wrapper_is_not_gcc
+"""
+
+from __future__ import print_function
+
+from argparse import ArgumentParser
+import os
+import subprocess
+import re
+import sys
+import pipes
+
+# Template values set by cuda_autoconf.
+CPU_COMPILER = ('%{cpu_compiler}')
+GCC_HOST_COMPILER_PATH = ('%{gcc_host_compiler_path}')
+
+NVCC_PATH = '%{nvcc_path}'
+NVCC_VERSION = '%{cuda_version}'
+NVCC_TEMP_DIR = "%{nvcc_tmp_dir}"
+supported_cuda_compute_capabilities = [ %{cuda_compute_capabilities} ]
+
+def Log(s):
+ print('gpus/crosstool: {0}'.format(s))
+
+
+def GetOptionValue(argv, option):
+ """Extract the list of values for option from options.
+
+ Args:
+ option: The option whose value to extract, without the leading '/'.
+
+ Returns:
+ 1. A list of values, either directly following the option,
+ (eg., /opt val1 val2) or values collected from multiple occurrences of
+ the option (eg., /opt val1 /opt val2).
+ 2. The leftover options.
+ """
+
+ parser = ArgumentParser(prefix_chars='/')
+ parser.add_argument('/' + option, nargs='*', action='append')
+ args, leftover = parser.parse_known_args(argv)
+ if args and vars(args)[option]:
+ return (sum(vars(args)[option], []), leftover)
+ return ([], leftover)
+
+def _update_options(nvcc_options):
+ if NVCC_VERSION in ("7.0",):
+ return nvcc_options
+
+ update_options = { "relaxed-constexpr" : "expt-relaxed-constexpr" }
+ return [ update_options[opt] if opt in update_options else opt
+ for opt in nvcc_options ]
+
+def GetNvccOptions(argv):
+ """Collect the -nvcc_options values from argv.
+
+ Args:
+ argv: A list of strings, possibly the argv passed to main().
+
+ Returns:
+ 1. The string that can be passed directly to nvcc.
+ 2. The leftover options.
+ """
+
+ parser = ArgumentParser()
+ parser.add_argument('-nvcc_options', nargs='*', action='append')
+
+ args, leftover = parser.parse_known_args(argv)
+
+ if args.nvcc_options:
+ options = _update_options(sum(args.nvcc_options, []))
+ return (['--' + a for a in options], leftover)
+ return ([], leftover)
+
+
+def InvokeNvcc(argv, log=False):
+ """Call nvcc with arguments assembled from argv.
+
+ Args:
+ argv: A list of strings, possibly the argv passed to main().
+ log: True if logging is requested.
+
+ Returns:
+ The return value of calling os.system('nvcc ' + args)
+ """
+
+ src_files = [f for f in argv if
+ re.search('\.cpp$|\.cc$|\.c$|\.cxx$|\.C$', f)]
+ if len(src_files) == 0:
+ raise Error('No source files found for cuda compilation.')
+
+ out_file = [ f for f in argv if f.startswith('/Fo') ]
+ if len(out_file) != 1:
+ raise Error('Please sepecify exactly one output file for cuda compilation.')
+ out = ['-o', out_file[0][len('/Fo'):]]
+
+ nvcc_compiler_options, argv = GetNvccOptions(argv)
+
+ opt_option, argv = GetOptionValue(argv, 'O')
+ opt = ['-g', '-G']
+ if (len(opt_option) > 0 and opt_option[0] != 'd'):
+ opt = ['-O2']
+
+ include_options, argv = GetOptionValue(argv, 'I')
+ includes = ["-I " + include for include in include_options]
+
+ defines, argv = GetOptionValue(argv, 'D')
+ defines = ['-D' + define for define in defines]
+
+ undefines, argv = GetOptionValue(argv, 'U')
+ undefines = ['-U' + define for define in undefines]
+
+ # The rest of the unrecongized options should be passed to host compiler
+ host_compiler_options = [option for option in argv if option not in (src_files + out_file)]
+
+ m_options = ["-m64"]
+
+ nvccopts = ['-D_FORCE_INLINES']
+ for capability in supported_cuda_compute_capabilities:
+ capability = capability.replace('.', '')
+ nvccopts += [r'-gencode=arch=compute_%s,"code=sm_%s,compute_%s"' % (
+ capability, capability, capability)]
+ nvccopts += nvcc_compiler_options
+ nvccopts += undefines
+ nvccopts += defines
+ nvccopts += m_options
+ nvccopts += ['--compiler-options="' + " ".join(host_compiler_options) + '"']
+ nvccopts += ['-x', 'cu'] + opt + includes + out + ['-c'] + src_files
+ # If we don't specify --keep-dir, nvcc will generate intermediate files under TEMP
+ # Put them under NVCC_TEMP_DIR instead, then Bazel can ignore files under NVCC_TEMP_DIR during dependency check
+ # http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#options-for-guiding-compiler-driver
+ # Different actions are sharing NVCC_TEMP_DIR, so we cannot remove it if the directory already exists.
+ if os.path.isfile(NVCC_TEMP_DIR):
+ os.remove(NVCC_TEMP_DIR)
+ if not os.path.exists(NVCC_TEMP_DIR):
+ os.makedirs(NVCC_TEMP_DIR)
+ nvccopts += ['--keep', '--keep-dir', NVCC_TEMP_DIR]
+ cmd = [NVCC_PATH] + nvccopts
+ if log:
+ Log(cmd)
+ proc = subprocess.Popen(cmd,
+ stdout=sys.stdout,
+ stderr=sys.stderr,
+ env=os.environ.copy(),
+ shell=True)
+ proc.wait()
+ return proc.returncode
+
+def main():
+ parser = ArgumentParser()
+ parser.add_argument('-x', nargs=1)
+ parser.add_argument('--cuda_log', action='store_true')
+ args, leftover = parser.parse_known_args(sys.argv[1:])
+
+ if args.x and args.x[0] == 'cuda':
+ if args.cuda_log: Log('-x cuda')
+ leftover = [pipes.quote(s) for s in leftover]
+ if args.cuda_log: Log('using nvcc')
+ return InvokeNvcc(leftover, log=args.cuda_log)
+
+ # Strip our flags before passing through to the CPU compiler for files which
+ # are not -x cuda. We can't just pass 'leftover' because it also strips -x.
+ # We not only want to pass -x to the CPU compiler, but also keep it in its
+ # relative location in the argv list (the compiler is actually sensitive to
+ # this).
+ cpu_compiler_flags = [flag for flag in sys.argv[1:]
+ if not flag.startswith(('--cuda_log'))
+ and not flag.startswith(('-nvcc_options'))]
+
+ return subprocess.call([CPU_COMPILER] + cpu_compiler_flags)
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/third_party/gpus/cuda/BUILD.tpl b/third_party/gpus/cuda/BUILD.tpl
index 2a37c65bc7..f6b497f813 100644
--- a/third_party/gpus/cuda/BUILD.tpl
+++ b/third_party/gpus/cuda/BUILD.tpl
@@ -128,6 +128,15 @@ cc_library(
)
cc_library(
+ name = "cudnn_header",
+ includes = [
+ ".",
+ "cuda/include",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
name = "cufft",
srcs = ["cuda/lib/%{cufft_lib}"],
data = ["cuda/lib/%{cufft_lib}"],
diff --git a/third_party/gpus/cuda/BUILD.windows.tpl b/third_party/gpus/cuda/BUILD.windows.tpl
new file mode 100644
index 0000000000..325d18b9cb
--- /dev/null
+++ b/third_party/gpus/cuda/BUILD.windows.tpl
@@ -0,0 +1,164 @@
+licenses(["restricted"]) # MPL2, portions GPL v3, LGPL v3, BSD-like
+
+package(default_visibility = ["//visibility:public"])
+
+config_setting(
+ name = "using_nvcc",
+ values = {
+ "define": "using_cuda_nvcc=true",
+ },
+)
+
+config_setting(
+ name = "using_clang",
+ values = {
+ "define": "using_cuda_clang=true",
+ },
+)
+
+# Equivalent to using_clang && -c opt.
+config_setting(
+ name = "using_clang_opt",
+ values = {
+ "define": "using_cuda_clang=true",
+ "compilation_mode": "opt",
+ },
+)
+
+config_setting(
+ name = "darwin",
+ values = {"cpu": "darwin"},
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "freebsd",
+ values = {"cpu": "freebsd"},
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cuda_headers",
+ hdrs = [
+ "cuda/cuda_config.h",
+ %{cuda_headers}
+ ],
+ includes = [
+ ".",
+ "cuda/include",
+ "cuda/include/crt",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_import(
+ name = "cudart_static",
+ # /WHOLEARCHIVE:cudart_static.lib will cause a
+ # "Internal error during CImplib::EmitThunk" error.
+ # Treat this library as interface library to avoid being whole archived when
+ # linking a DLL that depends on this.
+ # TODO(pcloudy): Remove this rule after b/111278841 is resolved.
+ interface_library = "cuda/lib/%{cudart_static_lib}",
+ system_provided = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_import(
+ name = "cuda_driver",
+ interface_library = "cuda/lib/%{cuda_driver_lib}",
+ system_provided = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_import(
+ name = "cudart",
+ interface_library = "cuda/lib/%{cudart_lib}",
+ system_provided = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_import(
+ name = "cublas",
+ interface_library = "cuda/lib/%{cublas_lib}",
+ system_provided = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_import(
+ name = "cusolver",
+ interface_library = "cuda/lib/%{cusolver_lib}",
+ system_provided = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_import(
+ name = "cudnn",
+ interface_library = "cuda/lib/%{cudnn_lib}",
+ system_provided = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cudnn_header",
+ includes = [
+ ".",
+ "cuda/include",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_import(
+ name = "cufft",
+ interface_library = "cuda/lib/%{cufft_lib}",
+ system_provided = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_import(
+ name = "curand",
+ interface_library = "cuda/lib/%{curand_lib}",
+ system_provided = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cuda",
+ visibility = ["//visibility:public"],
+ deps = [
+ ":cublas",
+ ":cuda_headers",
+ ":cudart",
+ ":cudnn",
+ ":cufft",
+ ":curand",
+ ],
+)
+
+cc_library(
+ name = "cupti_headers",
+ hdrs = [
+ "cuda/cuda_config.h",
+ ":cuda-extras",
+ ],
+ includes = [
+ ".",
+ "cuda/",
+ "cuda/extras/CUPTI/include/",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_import(
+ name = "cupti_dsos",
+ interface_library = "cuda/lib/%{cupti_lib}",
+ system_provided = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "libdevice_root",
+ data = [":cuda-nvvm"],
+ visibility = ["//visibility:public"],
+)
+
+%{cuda_include_genrules}
diff --git a/third_party/gpus/cuda/remote.BUILD.tpl b/third_party/gpus/cuda/remote.BUILD.tpl
index f774def5e6..100c7bb7c4 100644
--- a/third_party/gpus/cuda/remote.BUILD.tpl
+++ b/third_party/gpus/cuda/remote.BUILD.tpl
@@ -75,6 +75,11 @@ alias(
)
alias(
+ name = "cudnn_header",
+ actual = "%{remote_cuda_repo}/cuda:cudnn_header",
+)
+
+alias(
name = "cufft",
actual = "%{remote_cuda_repo}/cuda:cufft",
)
diff --git a/third_party/gpus/cuda_configure.bzl b/third_party/gpus/cuda_configure.bzl
index 6c9c128db6..5648b1525a 100644
--- a/third_party/gpus/cuda_configure.bzl
+++ b/third_party/gpus/cuda_configure.bzl
@@ -20,6 +20,7 @@
`/usr/local/cuda`.
* `TF_CUDA_COMPUTE_CAPABILITIES`: The CUDA compute capabilities. Default is
`3.5,5.2`.
+ * `PYTHON_BIN_PATH`: The python binary path
"""
_GCC_HOST_COMPILER_PATH = "GCC_HOST_COMPILER_PATH"
@@ -31,6 +32,7 @@ _CUDNN_INSTALL_PATH = "CUDNN_INSTALL_PATH"
_TF_CUDA_COMPUTE_CAPABILITIES = "TF_CUDA_COMPUTE_CAPABILITIES"
_TF_CUDA_CONFIG_REPO = "TF_CUDA_CONFIG_REPO"
_TF_DOWNLOAD_CLANG = "TF_DOWNLOAD_CLANG"
+_PYTHON_BIN_PATH = "PYTHON_BIN_PATH"
_DEFAULT_CUDA_VERSION = ""
_DEFAULT_CUDNN_VERSION = ""
@@ -44,12 +46,12 @@ _DEFAULT_CUDA_COMPUTE_CAPABILITIES = ["3.5", "5.2"]
# will be used. For example, when looking for the cudart libraries, the first
# attempt will be lib64/cudart inside the CUDA toolkit.
CUDA_LIB_PATHS = [
- "lib64/",
- "lib64/stubs/",
- "lib/x86_64-linux-gnu/",
- "lib/x64/",
- "lib/",
- "",
+ "lib64/",
+ "lib64/stubs/",
+ "lib/x86_64-linux-gnu/",
+ "lib/x64/",
+ "lib/",
+ "",
]
# Lookup paths for cupti.h, relative to the CUDA toolkit directory.
@@ -57,8 +59,9 @@ CUDA_LIB_PATHS = [
# On most systems, the cupti library is not installed in the same directory as
# the other CUDA libraries but rather in a special extras/CUPTI directory.
CUPTI_HEADER_PATHS = [
- "extras/CUPTI/include/",
- "include/cuda/CUPTI/",
+ "extras/CUPTI/include/",
+ "include/cuda/CUPTI/",
+ "include/",
]
# Lookup paths for the cupti library, relative to the
@@ -66,25 +69,25 @@ CUPTI_HEADER_PATHS = [
# On most systems, the cupti library is not installed in the same directory as
# the other CUDA libraries but rather in a special extras/CUPTI directory.
CUPTI_LIB_PATHS = [
- "extras/CUPTI/lib64/",
- "lib/x86_64-linux-gnu",
- "lib64/",
- "extras/CUPTI/libx64/",
- "extras/CUPTI/lib/",
- "lib/",
+ "extras/CUPTI/lib64/",
+ "lib/x86_64-linux-gnu/",
+ "lib64/",
+ "extras/CUPTI/libx64/",
+ "extras/CUPTI/lib/",
+ "lib/",
]
# Lookup paths for CUDA headers (cuda.h) relative to the CUDA toolkit directory.
CUDA_INCLUDE_PATHS = [
- "include/",
- "include/cuda/"
+ "include/",
+ "include/cuda/",
]
# Lookup paths for cudnn.h relative to the CUDNN install directory.
CUDNN_INCLUDE_PATHS = [
- "",
- "include/",
- "include/cuda/",
+ "",
+ "include/",
+ "include/cuda/",
]
# Lookup paths for NVVM libdevice relative to the CUDA directory toolkit.
@@ -92,686 +95,842 @@ CUDNN_INCLUDE_PATHS = [
# libdevice implements mathematical functions for GPU kernels, and is provided
# in NVVM bitcode (a subset of LLVM bitcode).
NVVM_LIBDEVICE_PATHS = [
- "nvvm/libdevice/",
- "share/cuda/",
+ "nvvm/libdevice/",
+ "share/cuda/",
+ "lib/nvidia-cuda-toolkit/libdevice/",
]
-load(":download_clang.bzl", "download_clang")
+# Files used to detect the NVVM libdevice path.
+NVVM_LIBDEVICE_FILES = [
+ # CUDA 9.0 has a single file.
+ "libdevice.10.bc",
+
+ # CUDA 8.0 has separate files for compute versions 2.0, 3.0, 3.5 and 5.0.
+ # Probing for one of them is sufficient.
+ "libdevice.compute_20.10.bc",
+]
+
+load("//third_party/clang_toolchain:download_clang.bzl", "download_clang")
+load(
+ "@bazel_tools//tools/cpp:lib_cc_configure.bzl",
+ "escape_string",
+ "get_env_var",
+)
+load(
+ "@bazel_tools//tools/cpp:windows_cc_configure.bzl",
+ "find_msvc_tool",
+ "find_vc_path",
+ "setup_vc_env_vars",
+)
+
+def _get_python_bin(repository_ctx):
+ """Gets the python bin path."""
+ python_bin = repository_ctx.os.environ.get(_PYTHON_BIN_PATH)
+ if python_bin != None:
+ return python_bin
+ python_bin_name = "python.exe" if _is_windows(repository_ctx) else "python"
+ python_bin_path = repository_ctx.which(python_bin_name)
+ if python_bin_path != None:
+ return str(python_bin_path)
+ auto_configure_fail("Cannot find python in PATH, please make sure " +
+ "python is installed and add its directory in PATH, or --define " +
+ "%s='/something/else'.\nPATH=%s" % (
+ _PYTHON_BIN_PATH,
+ repository_ctx.os.environ.get("PATH", ""),
+ ))
+
+def _get_nvcc_tmp_dir_for_windows(repository_ctx):
+ """Return the tmp directory for nvcc to generate intermediate source files."""
+ escaped_tmp_dir = escape_string(
+ get_env_var(repository_ctx, "TMP", "C:\\Windows\\Temp").replace("\\", "\\\\"),
+ )
+ return escaped_tmp_dir + "\\\\nvcc_inter_files_tmp_dir"
+
+def _get_msvc_compiler(repository_ctx):
+ vc_path = find_vc_path(repository_ctx)
+ return find_msvc_tool(repository_ctx, vc_path, "cl.exe").replace("\\", "/")
+
+def _get_win_cuda_defines(repository_ctx):
+ """Return CROSSTOOL defines for Windows"""
+
+ # If we are not on Windows, return empty vaules for Windows specific fields.
+ # This ensures the CROSSTOOL file parser is happy.
+ if not _is_windows(repository_ctx):
+ return {
+ "%{msvc_env_tmp}": "",
+ "%{msvc_env_path}": "",
+ "%{msvc_env_include}": "",
+ "%{msvc_env_lib}": "",
+ "%{msvc_cl_path}": "",
+ "%{msvc_ml_path}": "",
+ "%{msvc_link_path}": "",
+ "%{msvc_lib_path}": "",
+ "%{cxx_builtin_include_directory}": "",
+ }
+
+ vc_path = find_vc_path(repository_ctx)
+ if not vc_path:
+ auto_configure_fail("Visual C++ build tools not found on your machine." +
+ "Please check your installation following https://docs.bazel.build/versions/master/windows.html#using")
+ return {}
+
+ env = setup_vc_env_vars(repository_ctx, vc_path)
+ escaped_paths = escape_string(env["PATH"])
+ escaped_include_paths = escape_string(env["INCLUDE"])
+ escaped_lib_paths = escape_string(env["LIB"])
+ escaped_tmp_dir = escape_string(
+ get_env_var(repository_ctx, "TMP", "C:\\Windows\\Temp").replace("\\", "\\\\"),
+ )
+
+ msvc_cl_path = "windows/msvc_wrapper_for_nvcc.bat"
+ msvc_ml_path = find_msvc_tool(repository_ctx, vc_path, "ml64.exe").replace("\\", "/")
+ msvc_link_path = find_msvc_tool(repository_ctx, vc_path, "link.exe").replace("\\", "/")
+ msvc_lib_path = find_msvc_tool(repository_ctx, vc_path, "lib.exe").replace("\\", "/")
+
+ # nvcc will generate some temporary source files under %{nvcc_tmp_dir}
+ # The generated files are guranteed to have unique name, so they can share the same tmp directory
+ escaped_cxx_include_directories = ["cxx_builtin_include_directory: \"%s\"" % _get_nvcc_tmp_dir_for_windows(repository_ctx)]
+ for path in escaped_include_paths.split(";"):
+ if path:
+ escaped_cxx_include_directories.append("cxx_builtin_include_directory: \"%s\"" % path)
+
+ return {
+ "%{msvc_env_tmp}": escaped_tmp_dir,
+ "%{msvc_env_path}": escaped_paths,
+ "%{msvc_env_include}": escaped_include_paths,
+ "%{msvc_env_lib}": escaped_lib_paths,
+ "%{msvc_cl_path}": msvc_cl_path,
+ "%{msvc_ml_path}": msvc_ml_path,
+ "%{msvc_link_path}": msvc_link_path,
+ "%{msvc_lib_path}": msvc_lib_path,
+ "%{cxx_builtin_include_directory}": "\n".join(escaped_cxx_include_directories),
+ }
# TODO(dzc): Once these functions have been factored out of Bazel's
# cc_configure.bzl, load them from @bazel_tools instead.
# BEGIN cc_configure common functions.
def find_cc(repository_ctx):
- """Find the C++ compiler."""
- # On Windows, we use Bazel's MSVC CROSSTOOL for GPU build
- # Return a dummy value for GCC detection here to avoid error
- if _is_windows(repository_ctx):
- return "/use/--config=win-cuda --cpu=x64_windows_msvc/instead"
-
- if _use_cuda_clang(repository_ctx):
- target_cc_name = "clang"
- cc_path_envvar = _CLANG_CUDA_COMPILER_PATH
- if _flag_enabled(repository_ctx, _TF_DOWNLOAD_CLANG):
- return "extra_tools/bin/clang"
- else:
- target_cc_name = "gcc"
- cc_path_envvar = _GCC_HOST_COMPILER_PATH
- cc_name = target_cc_name
-
- if cc_path_envvar in repository_ctx.os.environ:
- cc_name_from_env = repository_ctx.os.environ[cc_path_envvar].strip()
- if cc_name_from_env:
- cc_name = cc_name_from_env
- if cc_name.startswith("/"):
- # Absolute path, maybe we should make this supported by our which function.
- return cc_name
- cc = repository_ctx.which(cc_name)
- if cc == None:
- fail(("Cannot find {}, either correct your path or set the {}" +
- " environment variable").format(target_cc_name, cc_path_envvar))
- return cc
-
+ """Find the C++ compiler."""
+ if _is_windows(repository_ctx):
+ return _get_msvc_compiler(repository_ctx)
+
+ if _use_cuda_clang(repository_ctx):
+ target_cc_name = "clang"
+ cc_path_envvar = _CLANG_CUDA_COMPILER_PATH
+ if _flag_enabled(repository_ctx, _TF_DOWNLOAD_CLANG):
+ return "extra_tools/bin/clang"
+ else:
+ target_cc_name = "gcc"
+ cc_path_envvar = _GCC_HOST_COMPILER_PATH
+ cc_name = target_cc_name
+
+ if cc_path_envvar in repository_ctx.os.environ:
+ cc_name_from_env = repository_ctx.os.environ[cc_path_envvar].strip()
+ if cc_name_from_env:
+ cc_name = cc_name_from_env
+ if cc_name.startswith("/"):
+ # Absolute path, maybe we should make this supported by our which function.
+ return cc_name
+ cc = repository_ctx.which(cc_name)
+ if cc == None:
+ fail(("Cannot find {}, either correct your path or set the {}" +
+ " environment variable").format(target_cc_name, cc_path_envvar))
+ return cc
_INC_DIR_MARKER_BEGIN = "#include <...>"
-
# OSX add " (framework directory)" at the end of line, strip it.
_OSX_FRAMEWORK_SUFFIX = " (framework directory)"
-_OSX_FRAMEWORK_SUFFIX_LEN = len(_OSX_FRAMEWORK_SUFFIX)
-def _cxx_inc_convert(path):
- """Convert path returned by cc -E xc++ in a complete path."""
- path = path.strip()
- if path.endswith(_OSX_FRAMEWORK_SUFFIX):
- path = path[:-_OSX_FRAMEWORK_SUFFIX_LEN].strip()
- return path
+_OSX_FRAMEWORK_SUFFIX_LEN = len(_OSX_FRAMEWORK_SUFFIX)
+def _cxx_inc_convert(path):
+ """Convert path returned by cc -E xc++ in a complete path."""
+ path = path.strip()
+ if path.endswith(_OSX_FRAMEWORK_SUFFIX):
+ path = path[:-_OSX_FRAMEWORK_SUFFIX_LEN].strip()
+ return path
def _normalize_include_path(repository_ctx, path):
- """Normalizes include paths before writing them to the crosstool.
-
- If path points inside the 'crosstool' folder of the repository, a relative
- path is returned.
- If path points outside the 'crosstool' folder, an absolute path is returned.
- """
- path = str(repository_ctx.path(path))
- crosstool_folder = str(repository_ctx.path(".").get_child('crosstool'))
+ """Normalizes include paths before writing them to the crosstool.
- if path.startswith(crosstool_folder):
- # We drop the path to "$REPO/crosstool" and a trailing path separator.
- return path[len(crosstool_folder)+1:]
- return path
+ If path points inside the 'crosstool' folder of the repository, a relative
+ path is returned.
+ If path points outside the 'crosstool' folder, an absolute path is returned.
+ """
+ path = str(repository_ctx.path(path))
+ crosstool_folder = str(repository_ctx.path(".").get_child("crosstool"))
+ if path.startswith(crosstool_folder):
+ # We drop the path to "$REPO/crosstool" and a trailing path separator.
+ return path[len(crosstool_folder) + 1:]
+ return path
def _get_cxx_inc_directories_impl(repository_ctx, cc, lang_is_cpp):
- """Compute the list of default C or C++ include directories."""
- if lang_is_cpp:
- lang = "c++"
- else:
- lang = "c"
- result = repository_ctx.execute([cc, "-E", "-x" + lang, "-", "-v"])
- index1 = result.stderr.find(_INC_DIR_MARKER_BEGIN)
- if index1 == -1:
- return []
- index1 = result.stderr.find("\n", index1)
- if index1 == -1:
- return []
- index2 = result.stderr.rfind("\n ")
- if index2 == -1 or index2 < index1:
- return []
- index2 = result.stderr.find("\n", index2 + 1)
- if index2 == -1:
- inc_dirs = result.stderr[index1 + 1:]
- else:
- inc_dirs = result.stderr[index1 + 1:index2].strip()
-
- return [
- _normalize_include_path(repository_ctx, _cxx_inc_convert(p))
- for p in inc_dirs.split("\n")
- ]
+ """Compute the list of default C or C++ include directories."""
+ if lang_is_cpp:
+ lang = "c++"
+ else:
+ lang = "c"
+ result = repository_ctx.execute([cc, "-E", "-x" + lang, "-", "-v"])
+ index1 = result.stderr.find(_INC_DIR_MARKER_BEGIN)
+ if index1 == -1:
+ return []
+ index1 = result.stderr.find("\n", index1)
+ if index1 == -1:
+ return []
+ index2 = result.stderr.rfind("\n ")
+ if index2 == -1 or index2 < index1:
+ return []
+ index2 = result.stderr.find("\n", index2 + 1)
+ if index2 == -1:
+ inc_dirs = result.stderr[index1 + 1:]
+ else:
+ inc_dirs = result.stderr[index1 + 1:index2].strip()
+ return [
+ _normalize_include_path(repository_ctx, _cxx_inc_convert(p))
+ for p in inc_dirs.split("\n")
+ ]
def get_cxx_inc_directories(repository_ctx, cc):
- """Compute the list of default C and C++ include directories."""
- # For some reason `clang -xc` sometimes returns include paths that are
- # different from the ones from `clang -xc++`. (Symlink and a dir)
- # So we run the compiler with both `-xc` and `-xc++` and merge resulting lists
- includes_cpp = _get_cxx_inc_directories_impl(repository_ctx, cc, True)
- includes_c = _get_cxx_inc_directories_impl(repository_ctx, cc, False)
+ """Compute the list of default C and C++ include directories."""
- includes_cpp_set = depset(includes_cpp)
- return includes_cpp + [inc for inc in includes_c
- if inc not in includes_cpp_set]
+ # For some reason `clang -xc` sometimes returns include paths that are
+ # different from the ones from `clang -xc++`. (Symlink and a dir)
+ # So we run the compiler with both `-xc` and `-xc++` and merge resulting lists
+ includes_cpp = _get_cxx_inc_directories_impl(repository_ctx, cc, True)
+ includes_c = _get_cxx_inc_directories_impl(repository_ctx, cc, False)
+ includes_cpp_set = depset(includes_cpp)
+ return includes_cpp + [
+ inc
+ for inc in includes_c
+ if inc not in includes_cpp_set
+ ]
def auto_configure_fail(msg):
- """Output failure message when cuda configuration fails."""
- red = "\033[0;31m"
- no_color = "\033[0m"
- fail("\n%sCuda Configuration Error:%s %s\n" % (red, no_color, msg))
-# END cc_configure common functions (see TODO above).
+ """Output failure message when cuda configuration fails."""
+ red = "\033[0;31m"
+ no_color = "\033[0m"
+ fail("\n%sCuda Configuration Error:%s %s\n" % (red, no_color, msg))
+# END cc_configure common functions (see TODO above).
def _host_compiler_includes(repository_ctx, cc):
- """Generates the cxx_builtin_include_directory entries for gcc inc dirs.
-
- Args:
- repository_ctx: The repository context.
- cc: The path to the gcc host compiler.
-
- Returns:
- A string containing the cxx_builtin_include_directory for each of the gcc
- host compiler include directories, which can be added to the CROSSTOOL
- file.
- """
- inc_dirs = get_cxx_inc_directories(repository_ctx, cc)
- inc_entries = []
- for inc_dir in inc_dirs:
- inc_entries.append(" cxx_builtin_include_directory: \"%s\"" % inc_dir)
- return "\n".join(inc_entries)
+ """Generates the cxx_builtin_include_directory entries for gcc inc dirs.
+
+ Args:
+ repository_ctx: The repository context.
+ cc: The path to the gcc host compiler.
+
+ Returns:
+ A string containing the cxx_builtin_include_directory for each of the gcc
+ host compiler include directories, which can be added to the CROSSTOOL
+ file.
+ """
+ inc_dirs = get_cxx_inc_directories(repository_ctx, cc)
+ inc_entries = []
+ for inc_dir in inc_dirs:
+ inc_entries.append(" cxx_builtin_include_directory: \"%s\"" % inc_dir)
+ return "\n".join(inc_entries)
def _cuda_include_path(repository_ctx, cuda_config):
- """Generates the cxx_builtin_include_directory entries for cuda inc dirs.
-
- Args:
- repository_ctx: The repository context.
- cc: The path to the gcc host compiler.
-
- Returns:
- A string containing the cxx_builtin_include_directory for each of the gcc
- host compiler include directories, which can be added to the CROSSTOOL
- file.
- """
- nvcc_path = repository_ctx.path("%s/bin/nvcc%s" %
- (cuda_config.cuda_toolkit_path,
- ".exe" if cuda_config.cpu_value == "Windows" else ""))
- result = repository_ctx.execute([nvcc_path, '-v',
- '/dev/null', '-o', '/dev/null'])
- target_dir = ""
- for one_line in result.stderr.splitlines():
- if one_line.startswith('#$ _TARGET_DIR_='):
- target_dir = (cuda_config.cuda_toolkit_path + '/' +
- one_line.replace('#$ _TARGET_DIR_=', '') + "/include")
- inc_entries = []
- if target_dir != "":
- inc_entries.append(" cxx_builtin_include_directory: \"%s\"" % target_dir)
- default_include = cuda_config.cuda_toolkit_path + '/include'
- inc_entries.append(" cxx_builtin_include_directory: \"%s\"" %
- default_include)
- return "\n".join(inc_entries)
-
+ """Generates the cxx_builtin_include_directory entries for cuda inc dirs.
+
+ Args:
+ repository_ctx: The repository context.
+ cc: The path to the gcc host compiler.
+
+ Returns:
+ A string containing the cxx_builtin_include_directory for each of the gcc
+ host compiler include directories, which can be added to the CROSSTOOL
+ file.
+ """
+ nvcc_path = repository_ctx.path("%s/bin/nvcc%s" %
+ (
+ cuda_config.cuda_toolkit_path,
+ ".exe" if cuda_config.cpu_value == "Windows" else "",
+ ))
+ result = repository_ctx.execute([
+ nvcc_path,
+ "-v",
+ "/dev/null",
+ "-o",
+ "/dev/null",
+ ])
+ target_dir = ""
+ for one_line in result.stderr.splitlines():
+ if one_line.startswith("#$ _TARGET_DIR_="):
+ target_dir = (cuda_config.cuda_toolkit_path + "/" +
+ one_line.replace("#$ _TARGET_DIR_=", "") + "/include")
+ inc_entries = []
+ if target_dir != "":
+ inc_entries.append(" cxx_builtin_include_directory: \"%s\"" % target_dir)
+ default_include = cuda_config.cuda_toolkit_path + "/include"
+ inc_entries.append(" cxx_builtin_include_directory: \"%s\"" %
+ default_include)
+ return "\n".join(inc_entries)
def _enable_cuda(repository_ctx):
- if "TF_NEED_CUDA" in repository_ctx.os.environ:
- enable_cuda = repository_ctx.os.environ["TF_NEED_CUDA"].strip()
- return enable_cuda == "1"
- return False
-
+ if "TF_NEED_CUDA" in repository_ctx.os.environ:
+ enable_cuda = repository_ctx.os.environ["TF_NEED_CUDA"].strip()
+ return enable_cuda == "1"
+ return False
def _cuda_toolkit_path(repository_ctx):
- """Finds the cuda toolkit directory.
-
- Args:
- repository_ctx: The repository context.
+ """Finds the cuda toolkit directory.
- Returns:
- A speculative real path of the cuda toolkit install directory.
- """
- cuda_toolkit_path = _DEFAULT_CUDA_TOOLKIT_PATH
- if _CUDA_TOOLKIT_PATH in repository_ctx.os.environ:
- cuda_toolkit_path = repository_ctx.os.environ[_CUDA_TOOLKIT_PATH].strip()
- if not repository_ctx.path(cuda_toolkit_path).exists:
- auto_configure_fail("Cannot find cuda toolkit path.")
- return str(repository_ctx.path(cuda_toolkit_path).realpath)
+ Args:
+ repository_ctx: The repository context.
+ Returns:
+ A speculative real path of the cuda toolkit install directory.
+ """
+ cuda_toolkit_path = _DEFAULT_CUDA_TOOLKIT_PATH
+ if _CUDA_TOOLKIT_PATH in repository_ctx.os.environ:
+ cuda_toolkit_path = repository_ctx.os.environ[_CUDA_TOOLKIT_PATH].strip()
+ if not repository_ctx.path(cuda_toolkit_path).exists:
+ auto_configure_fail("Cannot find cuda toolkit path.")
+ return str(repository_ctx.path(cuda_toolkit_path).realpath)
def _cudnn_install_basedir(repository_ctx):
- """Finds the cudnn install directory."""
- cudnn_install_path = _DEFAULT_CUDNN_INSTALL_PATH
- if _CUDNN_INSTALL_PATH in repository_ctx.os.environ:
- cudnn_install_path = repository_ctx.os.environ[_CUDNN_INSTALL_PATH].strip()
- if not repository_ctx.path(cudnn_install_path).exists:
- auto_configure_fail("Cannot find cudnn install path.")
- return cudnn_install_path
-
+ """Finds the cudnn install directory."""
+ cudnn_install_path = _DEFAULT_CUDNN_INSTALL_PATH
+ if _CUDNN_INSTALL_PATH in repository_ctx.os.environ:
+ cudnn_install_path = repository_ctx.os.environ[_CUDNN_INSTALL_PATH].strip()
+ if not repository_ctx.path(cudnn_install_path).exists:
+ auto_configure_fail("Cannot find cudnn install path.")
+ return cudnn_install_path
def matches_version(environ_version, detected_version):
- """Checks whether the user-specified version matches the detected version.
-
- This function performs a weak matching so that if the user specifies only the
- major or major and minor versions, the versions are still considered matching
- if the version parts match. To illustrate:
-
- environ_version detected_version result
- -----------------------------------------
- 5.1.3 5.1.3 True
- 5.1 5.1.3 True
- 5 5.1 True
- 5.1.3 5.1 False
- 5.2.3 5.1.3 False
-
- Args:
- environ_version: The version specified by the user via environment
- variables.
- detected_version: The version autodetected from the CUDA installation on
- the system.
-
- Returns: True if user-specified version matches detected version and False
- otherwise.
- """
- environ_version_parts = environ_version.split(".")
- detected_version_parts = detected_version.split(".")
- if len(detected_version_parts) < len(environ_version_parts):
- return False
- for i, part in enumerate(detected_version_parts):
- if i >= len(environ_version_parts):
- break
- if part != environ_version_parts[i]:
- return False
- return True
-
+ """Checks whether the user-specified version matches the detected version.
+
+ This function performs a weak matching so that if the user specifies only the
+ major or major and minor versions, the versions are still considered matching
+ if the version parts match. To illustrate:
+
+ environ_version detected_version result
+ -----------------------------------------
+ 5.1.3 5.1.3 True
+ 5.1 5.1.3 True
+ 5 5.1 True
+ 5.1.3 5.1 False
+ 5.2.3 5.1.3 False
+
+ Args:
+ environ_version: The version specified by the user via environment
+ variables.
+ detected_version: The version autodetected from the CUDA installation on
+ the system.
+
+ Returns: True if user-specified version matches detected version and False
+ otherwise.
+ """
+ environ_version_parts = environ_version.split(".")
+ detected_version_parts = detected_version.split(".")
+ if len(detected_version_parts) < len(environ_version_parts):
+ return False
+ for i, part in enumerate(detected_version_parts):
+ if i >= len(environ_version_parts):
+ break
+ if part != environ_version_parts[i]:
+ return False
+ return True
_NVCC_VERSION_PREFIX = "Cuda compilation tools, release "
-
def _cuda_version(repository_ctx, cuda_toolkit_path, cpu_value):
- """Detects the version of CUDA installed on the system.
-
- Args:
- repository_ctx: The repository context.
- cuda_toolkit_path: The CUDA install directory.
-
- Returns:
- String containing the version of CUDA.
- """
- # Run nvcc --version and find the line containing the CUDA version.
- nvcc_path = repository_ctx.path("%s/bin/nvcc%s" %
- (cuda_toolkit_path,
- ".exe" if cpu_value == "Windows" else ""))
- if not nvcc_path.exists:
- auto_configure_fail("Cannot find nvcc at %s" % str(nvcc_path))
- result = repository_ctx.execute([str(nvcc_path), '--version'])
- if result.stderr:
- auto_configure_fail("Error running nvcc --version: %s" % result.stderr)
- lines = result.stdout.splitlines()
- version_line = lines[len(lines) - 1]
- if version_line.find(_NVCC_VERSION_PREFIX) == -1:
- auto_configure_fail(
- "Could not parse CUDA version from nvcc --version. Got: %s" %
- result.stdout)
-
- # Parse the CUDA version from the line containing the CUDA version.
- prefix_removed = version_line.replace(_NVCC_VERSION_PREFIX, '')
- parts = prefix_removed.split(",")
- if len(parts) != 2 or len(parts[0]) < 2:
- auto_configure_fail(
- "Could not parse CUDA version from nvcc --version. Got: %s" %
- result.stdout)
- full_version = parts[1].strip()
- if full_version.startswith('V'):
- full_version = full_version[1:]
-
- # Check whether TF_CUDA_VERSION was set by the user and fail if it does not
- # match the detected version.
- environ_version = ""
- if _TF_CUDA_VERSION in repository_ctx.os.environ:
- environ_version = repository_ctx.os.environ[_TF_CUDA_VERSION].strip()
- if environ_version and not matches_version(environ_version, full_version):
- auto_configure_fail(
- ("CUDA version detected from nvcc (%s) does not match " +
- "TF_CUDA_VERSION (%s)") % (full_version, environ_version))
-
- # We only use the version consisting of the major and minor version numbers.
- version_parts = full_version.split('.')
- if len(version_parts) < 2:
- auto_configure_fail("CUDA version detected from nvcc (%s) is incomplete.")
- if cpu_value == "Windows":
- version = "64_%s%s" % (version_parts[0], version_parts[1])
- else:
- version = "%s.%s" % (version_parts[0], version_parts[1])
- return version
+ """Detects the version of CUDA installed on the system.
+
+ Args:
+ repository_ctx: The repository context.
+ cuda_toolkit_path: The CUDA install directory.
+
+ Returns:
+ String containing the version of CUDA.
+ """
+
+ # Run nvcc --version and find the line containing the CUDA version.
+ nvcc_path = repository_ctx.path("%s/bin/nvcc%s" %
+ (
+ cuda_toolkit_path,
+ ".exe" if cpu_value == "Windows" else "",
+ ))
+ if not nvcc_path.exists:
+ auto_configure_fail("Cannot find nvcc at %s" % str(nvcc_path))
+ result = repository_ctx.execute([str(nvcc_path), "--version"])
+ if result.stderr:
+ auto_configure_fail("Error running nvcc --version: %s" % result.stderr)
+ lines = result.stdout.splitlines()
+ version_line = lines[len(lines) - 1]
+ if version_line.find(_NVCC_VERSION_PREFIX) == -1:
+ auto_configure_fail(
+ "Could not parse CUDA version from nvcc --version. Got: %s" %
+ result.stdout,
+ )
+ # Parse the CUDA version from the line containing the CUDA version.
+ prefix_removed = version_line.replace(_NVCC_VERSION_PREFIX, "")
+ parts = prefix_removed.split(",")
+ if len(parts) != 2 or len(parts[0]) < 2:
+ auto_configure_fail(
+ "Could not parse CUDA version from nvcc --version. Got: %s" %
+ result.stdout,
+ )
+ full_version = parts[1].strip()
+ if full_version.startswith("V"):
+ full_version = full_version[1:]
+
+ # Check whether TF_CUDA_VERSION was set by the user and fail if it does not
+ # match the detected version.
+ environ_version = ""
+ if _TF_CUDA_VERSION in repository_ctx.os.environ:
+ environ_version = repository_ctx.os.environ[_TF_CUDA_VERSION].strip()
+ if environ_version and not matches_version(environ_version, full_version):
+ auto_configure_fail(
+ ("CUDA version detected from nvcc (%s) does not match " +
+ "TF_CUDA_VERSION (%s)") % (full_version, environ_version),
+ )
+
+ # We only use the version consisting of the major and minor version numbers.
+ version_parts = full_version.split(".")
+ if len(version_parts) < 2:
+ auto_configure_fail("CUDA version detected from nvcc (%s) is incomplete.")
+ if cpu_value == "Windows":
+ version = "64_%s%s" % (version_parts[0], version_parts[1])
+ else:
+ version = "%s.%s" % (version_parts[0], version_parts[1])
+ return version
_DEFINE_CUDNN_MAJOR = "#define CUDNN_MAJOR"
_DEFINE_CUDNN_MINOR = "#define CUDNN_MINOR"
_DEFINE_CUDNN_PATCHLEVEL = "#define CUDNN_PATCHLEVEL"
-
def find_cuda_define(repository_ctx, header_dir, header_file, define):
- """Returns the value of a #define in a header file.
-
- Greps through a header file and returns the value of the specified #define.
- If the #define is not found, then raise an error.
-
- Args:
- repository_ctx: The repository context.
- header_dir: The directory containing the header file.
- header_file: The header file name.
- define: The #define to search for.
-
- Returns:
- The value of the #define found in the header.
- """
- # Confirm location of the header and grep for the line defining the macro.
- h_path = repository_ctx.path("%s/%s" % (header_dir, header_file))
- if not h_path.exists:
- auto_configure_fail("Cannot find %s at %s" % (header_file, str(h_path)))
- result = repository_ctx.execute(
- # Grep one more lines as some #defines are splitted into two lines.
- ["grep", "--color=never", "-A1", "-E", define, str(h_path)])
- if result.stderr:
- auto_configure_fail("Error reading %s: %s" % (str(h_path), result.stderr))
-
- # Parse the version from the line defining the macro.
- if result.stdout.find(define) == -1:
- auto_configure_fail("Cannot find line containing '%s' in %s" %
- (define, h_path))
- # Split results to lines
- lines = result.stdout.split('\n')
- num_lines = len(lines)
- for l in range(num_lines):
- line = lines[l]
- if define in line: # Find the line with define
- version = line
- if l != num_lines-1 and line[-1] == '\\': # Add next line, if multiline
- version = version[:-1] + lines[l+1]
- break
- # Remove any comments
- version = version.split("//")[0]
- # Remove define name
- version = version.replace(define, "").strip()
- # Remove the code after the version number.
- version_end = version.find(" ")
- if version_end != -1:
- if version_end == 0:
- auto_configure_fail(
- "Cannot extract the version from line containing '%s' in %s" %
- (define, str(h_path)))
- version = version[:version_end].strip()
- return version
-
+ """Returns the value of a #define in a header file.
+
+ Greps through a header file and returns the value of the specified #define.
+ If the #define is not found, then raise an error.
+
+ Args:
+ repository_ctx: The repository context.
+ header_dir: The directory containing the header file.
+ header_file: The header file name.
+ define: The #define to search for.
+
+ Returns:
+ The value of the #define found in the header.
+ """
+
+ # Confirm location of the header and grep for the line defining the macro.
+ h_path = repository_ctx.path("%s/%s" % (header_dir, header_file))
+ if not h_path.exists:
+ auto_configure_fail("Cannot find %s at %s" % (header_file, str(h_path)))
+ result = repository_ctx.execute(
+ # Grep one more lines as some #defines are splitted into two lines.
+ ["grep", "--color=never", "-A1", "-E", define, str(h_path)],
+ )
+ if result.stderr:
+ auto_configure_fail("Error reading %s: %s" % (str(h_path), result.stderr))
+
+ # Parse the version from the line defining the macro.
+ if result.stdout.find(define) == -1:
+ auto_configure_fail("Cannot find line containing '%s' in %s" %
+ (define, h_path))
+
+ # Split results to lines
+ lines = result.stdout.split("\n")
+ num_lines = len(lines)
+ for l in range(num_lines):
+ line = lines[l]
+ if define in line: # Find the line with define
+ version = line
+ if l != num_lines - 1 and line[-1] == "\\": # Add next line, if multiline
+ version = version[:-1] + lines[l + 1]
+ break
+
+ # Remove any comments
+ version = version.split("//")[0]
+
+ # Remove define name
+ version = version.replace(define, "").strip()
+
+ # Remove the code after the version number.
+ version_end = version.find(" ")
+ if version_end != -1:
+ if version_end == 0:
+ auto_configure_fail(
+ "Cannot extract the version from line containing '%s' in %s" %
+ (define, str(h_path)),
+ )
+ version = version[:version_end].strip()
+ return version
def _cudnn_version(repository_ctx, cudnn_install_basedir, cpu_value):
- """Detects the version of cuDNN installed on the system.
-
- Args:
- repository_ctx: The repository context.
- cpu_value: The name of the host operating system.
- cudnn_install_basedir: The cuDNN install directory.
-
- Returns:
- A string containing the version of cuDNN.
- """
- cudnn_header_dir = _find_cudnn_header_dir(repository_ctx,
- cudnn_install_basedir)
- major_version = find_cuda_define(
- repository_ctx, cudnn_header_dir, "cudnn.h", _DEFINE_CUDNN_MAJOR)
- minor_version = find_cuda_define(
- repository_ctx, cudnn_header_dir, "cudnn.h", _DEFINE_CUDNN_MINOR)
- patch_version = find_cuda_define(
- repository_ctx, cudnn_header_dir, "cudnn.h", _DEFINE_CUDNN_PATCHLEVEL)
- full_version = "%s.%s.%s" % (major_version, minor_version, patch_version)
-
- # Check whether TF_CUDNN_VERSION was set by the user and fail if it does not
- # match the detected version.
- environ_version = ""
- if _TF_CUDNN_VERSION in repository_ctx.os.environ:
- environ_version = repository_ctx.os.environ[_TF_CUDNN_VERSION].strip()
- if environ_version and not matches_version(environ_version, full_version):
- cudnn_h_path = repository_ctx.path("%s/include/cudnn.h" %
- cudnn_install_basedir)
- auto_configure_fail(
- ("cuDNN version detected from %s (%s) does not match " +
- "TF_CUDNN_VERSION (%s)") %
- (str(cudnn_h_path), full_version, environ_version))
-
- # We only use the major version since we use the libcudnn libraries that are
- # only versioned with the major version (e.g. libcudnn.so.5).
- version = major_version
- if cpu_value == "Windows":
- version = "64_" + version
- return version
+ """Detects the version of cuDNN installed on the system.
+ Args:
+ repository_ctx: The repository context.
+ cpu_value: The name of the host operating system.
+ cudnn_install_basedir: The cuDNN install directory.
+
+ Returns:
+ A string containing the version of cuDNN.
+ """
+ cudnn_header_dir = _find_cudnn_header_dir(
+ repository_ctx,
+ cudnn_install_basedir,
+ )
+ major_version = find_cuda_define(
+ repository_ctx,
+ cudnn_header_dir,
+ "cudnn.h",
+ _DEFINE_CUDNN_MAJOR,
+ )
+ minor_version = find_cuda_define(
+ repository_ctx,
+ cudnn_header_dir,
+ "cudnn.h",
+ _DEFINE_CUDNN_MINOR,
+ )
+ patch_version = find_cuda_define(
+ repository_ctx,
+ cudnn_header_dir,
+ "cudnn.h",
+ _DEFINE_CUDNN_PATCHLEVEL,
+ )
+ full_version = "%s.%s.%s" % (major_version, minor_version, patch_version)
+
+ # Check whether TF_CUDNN_VERSION was set by the user and fail if it does not
+ # match the detected version.
+ environ_version = ""
+ if _TF_CUDNN_VERSION in repository_ctx.os.environ:
+ environ_version = repository_ctx.os.environ[_TF_CUDNN_VERSION].strip()
+ if environ_version and not matches_version(environ_version, full_version):
+ cudnn_h_path = repository_ctx.path("%s/include/cudnn.h" %
+ cudnn_install_basedir)
+ auto_configure_fail(
+ ("cuDNN version detected from %s (%s) does not match " +
+ "TF_CUDNN_VERSION (%s)") %
+ (str(cudnn_h_path), full_version, environ_version),
+ )
-def _compute_capabilities(repository_ctx):
- """Returns a list of strings representing cuda compute capabilities."""
- if _TF_CUDA_COMPUTE_CAPABILITIES not in repository_ctx.os.environ:
- return _DEFAULT_CUDA_COMPUTE_CAPABILITIES
- capabilities_str = repository_ctx.os.environ[_TF_CUDA_COMPUTE_CAPABILITIES]
- capabilities = capabilities_str.split(",")
- for capability in capabilities:
- # Workaround for Skylark's lack of support for regex. This check should
- # be equivalent to checking:
- # if re.match("[0-9]+.[0-9]+", capability) == None:
- parts = capability.split(".")
- if len(parts) != 2 or not parts[0].isdigit() or not parts[1].isdigit():
- auto_configure_fail("Invalid compute capability: %s" % capability)
- return capabilities
+ # We only use the major version since we use the libcudnn libraries that are
+ # only versioned with the major version (e.g. libcudnn.so.5).
+ version = major_version
+ if cpu_value == "Windows":
+ version = "64_" + version
+ return version
+def _compute_capabilities(repository_ctx):
+ """Returns a list of strings representing cuda compute capabilities."""
+ if _TF_CUDA_COMPUTE_CAPABILITIES not in repository_ctx.os.environ:
+ return _DEFAULT_CUDA_COMPUTE_CAPABILITIES
+ capabilities_str = repository_ctx.os.environ[_TF_CUDA_COMPUTE_CAPABILITIES]
+ capabilities = capabilities_str.split(",")
+ for capability in capabilities:
+ # Workaround for Skylark's lack of support for regex. This check should
+ # be equivalent to checking:
+ # if re.match("[0-9]+.[0-9]+", capability) == None:
+ parts = capability.split(".")
+ if len(parts) != 2 or not parts[0].isdigit() or not parts[1].isdigit():
+ auto_configure_fail("Invalid compute capability: %s" % capability)
+ return capabilities
def get_cpu_value(repository_ctx):
- """Returns the name of the host operating system.
+ """Returns the name of the host operating system.
+
+ Args:
+ repository_ctx: The repository context.
+
+ Returns:
+ A string containing the name of the host operating system.
+ """
+ os_name = repository_ctx.os.name.lower()
+ if os_name.startswith("mac os"):
+ return "Darwin"
+ if os_name.find("windows") != -1:
+ return "Windows"
+ result = repository_ctx.execute(["uname", "-s"])
+ return result.stdout.strip()
- Args:
- repository_ctx: The repository context.
-
- Returns:
- A string containing the name of the host operating system.
- """
- os_name = repository_ctx.os.name.lower()
- if os_name.startswith("mac os"):
- return "Darwin"
- if os_name.find("windows") != -1:
- return "Windows"
- result = repository_ctx.execute(["uname", "-s"])
- return result.stdout.strip()
+def _is_windows(repository_ctx):
+ """Returns true if the host operating system is windows."""
+ return get_cpu_value(repository_ctx) == "Windows"
+def _lib_name(lib, cpu_value, version = "", static = False):
+ """Constructs the platform-specific name of a library.
-def _is_windows(repository_ctx):
- """Returns true if the host operating system is windows."""
- return get_cpu_value(repository_ctx) == "Windows"
-
-def _lib_name(lib, cpu_value, version="", static=False):
- """Constructs the platform-specific name of a library.
-
- Args:
- lib: The name of the library, such as "cudart"
- cpu_value: The name of the host operating system.
- version: The version of the library.
- static: True the library is static or False if it is a shared object.
-
- Returns:
- The platform-specific name of the library.
- """
- if cpu_value in ("Linux", "FreeBSD"):
- if static:
- return "lib%s.a" % lib
- else:
- if version:
- version = ".%s" % version
- return "lib%s.so%s" % (lib, version)
- elif cpu_value == "Windows":
- return "%s.lib" % lib
- elif cpu_value == "Darwin":
- if static:
- return "lib%s.a" % lib
+ Args:
+ lib: The name of the library, such as "cudart"
+ cpu_value: The name of the host operating system.
+ version: The version of the library.
+ static: True the library is static or False if it is a shared object.
+
+ Returns:
+ The platform-specific name of the library.
+ """
+ if cpu_value in ("Linux", "FreeBSD"):
+ if static:
+ return "lib%s.a" % lib
+ else:
+ if version:
+ version = ".%s" % version
+ return "lib%s.so%s" % (lib, version)
+ elif cpu_value == "Windows":
+ return "%s.lib" % lib
+ elif cpu_value == "Darwin":
+ if static:
+ return "lib%s.a" % lib
+ elif version:
+ version = ".%s" % version
+ return "lib%s%s.dylib" % (lib, version)
else:
- if version:
- version = ".%s" % version
- return "lib%s%s.dylib" % (lib, version)
- else:
- auto_configure_fail("Invalid cpu_value: %s" % cpu_value)
-
-
-def _find_cuda_lib(lib, repository_ctx, cpu_value, basedir, version="",
- static=False):
- """Finds the given CUDA or cuDNN library on the system.
-
- Args:
- lib: The name of the library, such as "cudart"
- repository_ctx: The repository context.
- cpu_value: The name of the host operating system.
- basedir: The install directory of CUDA or cuDNN.
- version: The version of the library.
- static: True if static library, False if shared object.
-
- Returns:
- Returns a struct with the following fields:
- file_name: The basename of the library found on the system.
- path: The full path to the library.
- """
- file_name = _lib_name(lib, cpu_value, version, static)
- for relative_path in CUDA_LIB_PATHS:
- path = repository_ctx.path("%s/%s%s" % (basedir, relative_path, file_name))
- if path.exists:
- return struct(file_name=file_name, path=str(path.realpath))
- auto_configure_fail("Cannot find cuda library %s" % file_name)
-
+ auto_configure_fail("Invalid cpu_value: %s" % cpu_value)
+
+def _find_cuda_lib(
+ lib,
+ repository_ctx,
+ cpu_value,
+ basedir,
+ version = "",
+ static = False):
+ """Finds the given CUDA or cuDNN library on the system.
+
+ Args:
+ lib: The name of the library, such as "cudart"
+ repository_ctx: The repository context.
+ cpu_value: The name of the host operating system.
+ basedir: The install directory of CUDA or cuDNN.
+ version: The version of the library.
+ static: True if static library, False if shared object.
+
+ Returns:
+ Returns a struct with the following fields:
+ file_name: The basename of the library found on the system.
+ path: The full path to the library.
+ """
+ file_name = _lib_name(lib, cpu_value, version, static)
+ for relative_path in CUDA_LIB_PATHS:
+ path = repository_ctx.path("%s/%s%s" % (basedir, relative_path, file_name))
+ if path.exists:
+ return struct(file_name = file_name, path = str(path.realpath))
+ auto_configure_fail("Cannot find cuda library %s" % file_name)
def _find_cupti_header_dir(repository_ctx, cuda_config):
- """Returns the path to the directory containing cupti.h
-
- On most systems, the cupti library is not installed in the same directory as
- the other CUDA libraries but rather in a special extras/CUPTI directory.
+ """Returns the path to the directory containing cupti.h
- Args:
- repository_ctx: The repository context.
- cuda_config: The CUDA config as returned by _get_cuda_config
+ On most systems, the cupti library is not installed in the same directory as
+ the other CUDA libraries but rather in a special extras/CUPTI directory.
- Returns:
- The path of the directory containing the cupti header.
- """
- cuda_toolkit_path = cuda_config.cuda_toolkit_path
- for relative_path in CUPTI_HEADER_PATHS:
- if repository_ctx.path("%s/%scupti.h" % (cuda_toolkit_path, relative_path)).exists:
- return ("%s/%s" % (cuda_toolkit_path, relative_path))[:-1]
- auto_configure_fail("Cannot find cupti.h under %s" % cuda_toolkit_path)
+ Args:
+ repository_ctx: The repository context.
+ cuda_config: The CUDA config as returned by _get_cuda_config
+ Returns:
+ The path of the directory containing the cupti header.
+ """
+ cuda_toolkit_path = cuda_config.cuda_toolkit_path
+ for relative_path in CUPTI_HEADER_PATHS:
+ if repository_ctx.path("%s/%scupti.h" % (cuda_toolkit_path, relative_path)).exists:
+ return ("%s/%s" % (cuda_toolkit_path, relative_path))[:-1]
+ auto_configure_fail("Cannot find cupti.h under %s" % ", ".join([cuda_toolkit_path + "/" + s for s in CUPTI_HEADER_PATHS]))
def _find_cupti_lib(repository_ctx, cuda_config):
- """Finds the cupti library on the system.
-
- On most systems, the cupti library is not installed in the same directory as
- the other CUDA libraries but rather in a special extras/CUPTI directory.
-
- Args:
- repository_ctx: The repository context.
- cuda_config: The cuda configuration as returned by _get_cuda_config.
-
- Returns:
- Returns a struct with the following fields:
- file_name: The basename of the library found on the system.
- path: The full path to the library.
- """
- file_name = _lib_name("cupti", cuda_config.cpu_value,
- cuda_config.cuda_version)
- cuda_toolkit_path = cuda_config.cuda_toolkit_path
- for relative_path in CUPTI_LIB_PATHS:
- path = repository_ctx.path(
- "%s/%s%s" % (cuda_toolkit_path, relative_path, file_name))
- if path.exists:
- return struct(file_name=file_name, path=str(path.realpath))
-
- auto_configure_fail("Cannot find cupti library %s" % file_name)
+ """Finds the cupti library on the system.
+
+ On most systems, the cupti library is not installed in the same directory as
+ the other CUDA libraries but rather in a special extras/CUPTI directory.
+
+ Args:
+ repository_ctx: The repository context.
+ cuda_config: The cuda configuration as returned by _get_cuda_config.
+
+ Returns:
+ Returns a struct with the following fields:
+ file_name: The basename of the library found on the system.
+ path: The full path to the library.
+ """
+ file_name = _lib_name(
+ "cupti",
+ cuda_config.cpu_value,
+ cuda_config.cuda_version,
+ )
+ cuda_toolkit_path = cuda_config.cuda_toolkit_path
+ for relative_path in CUPTI_LIB_PATHS:
+ path = repository_ctx.path(
+ "%s/%s%s" % (cuda_toolkit_path, relative_path, file_name),
+ )
+ if path.exists:
+ return struct(file_name = file_name, path = str(path.realpath))
-def _find_libs(repository_ctx, cuda_config):
- """Returns the CUDA and cuDNN libraries on the system.
-
- Args:
- repository_ctx: The repository context.
- cuda_config: The CUDA config as returned by _get_cuda_config
-
- Returns:
- Map of library names to structs of filename and path.
- """
- cpu_value = cuda_config.cpu_value
- return {
- "cuda": _find_cuda_lib("cuda", repository_ctx, cpu_value, cuda_config.cuda_toolkit_path),
- "cudart": _find_cuda_lib(
- "cudart", repository_ctx, cpu_value, cuda_config.cuda_toolkit_path,
- cuda_config.cuda_version),
- "cudart_static": _find_cuda_lib(
- "cudart_static", repository_ctx, cpu_value,
- cuda_config.cuda_toolkit_path, cuda_config.cuda_version, static=True),
- "cublas": _find_cuda_lib(
- "cublas", repository_ctx, cpu_value, cuda_config.cuda_toolkit_path,
- cuda_config.cuda_version),
- "cusolver": _find_cuda_lib(
- "cusolver", repository_ctx, cpu_value, cuda_config.cuda_toolkit_path,
- cuda_config.cuda_version),
- "curand": _find_cuda_lib(
- "curand", repository_ctx, cpu_value, cuda_config.cuda_toolkit_path,
- cuda_config.cuda_version),
- "cufft": _find_cuda_lib(
- "cufft", repository_ctx, cpu_value, cuda_config.cuda_toolkit_path,
- cuda_config.cuda_version),
- "cudnn": _find_cuda_lib(
- "cudnn", repository_ctx, cpu_value, cuda_config.cudnn_install_basedir,
- cuda_config.cudnn_version),
- "cupti": _find_cupti_lib(repository_ctx, cuda_config)
- }
+ auto_configure_fail("Cannot find cupti library %s" % file_name)
+def _find_libs(repository_ctx, cuda_config):
+ """Returns the CUDA and cuDNN libraries on the system.
+
+ Args:
+ repository_ctx: The repository context.
+ cuda_config: The CUDA config as returned by _get_cuda_config
+
+ Returns:
+ Map of library names to structs of filename and path.
+ """
+ cpu_value = cuda_config.cpu_value
+ return {
+ "cuda": _find_cuda_lib("cuda", repository_ctx, cpu_value, cuda_config.cuda_toolkit_path),
+ "cudart": _find_cuda_lib(
+ "cudart",
+ repository_ctx,
+ cpu_value,
+ cuda_config.cuda_toolkit_path,
+ cuda_config.cuda_version,
+ ),
+ "cudart_static": _find_cuda_lib(
+ "cudart_static",
+ repository_ctx,
+ cpu_value,
+ cuda_config.cuda_toolkit_path,
+ cuda_config.cuda_version,
+ static = True,
+ ),
+ "cublas": _find_cuda_lib(
+ "cublas",
+ repository_ctx,
+ cpu_value,
+ cuda_config.cuda_toolkit_path,
+ cuda_config.cuda_version,
+ ),
+ "cusolver": _find_cuda_lib(
+ "cusolver",
+ repository_ctx,
+ cpu_value,
+ cuda_config.cuda_toolkit_path,
+ cuda_config.cuda_version,
+ ),
+ "curand": _find_cuda_lib(
+ "curand",
+ repository_ctx,
+ cpu_value,
+ cuda_config.cuda_toolkit_path,
+ cuda_config.cuda_version,
+ ),
+ "cufft": _find_cuda_lib(
+ "cufft",
+ repository_ctx,
+ cpu_value,
+ cuda_config.cuda_toolkit_path,
+ cuda_config.cuda_version,
+ ),
+ "cudnn": _find_cuda_lib(
+ "cudnn",
+ repository_ctx,
+ cpu_value,
+ cuda_config.cudnn_install_basedir,
+ cuda_config.cudnn_version,
+ ),
+ "cupti": _find_cupti_lib(repository_ctx, cuda_config),
+ }
def _find_cuda_include_path(repository_ctx, cuda_config):
- """Returns the path to the directory containing cuda.h
-
- Args:
- repository_ctx: The repository context.
- cuda_config: The CUDA config as returned by _get_cuda_config
+ """Returns the path to the directory containing cuda.h
- Returns:
- The path of the directory containing the CUDA headers.
- """
- cuda_toolkit_path = cuda_config.cuda_toolkit_path
- for relative_path in CUDA_INCLUDE_PATHS:
- if repository_ctx.path("%s/%scuda.h" % (cuda_toolkit_path, relative_path)).exists:
- return ("%s/%s" % (cuda_toolkit_path, relative_path))[:-1]
- auto_configure_fail("Cannot find cuda.h under %s" % cuda_toolkit_path)
+ Args:
+ repository_ctx: The repository context.
+ cuda_config: The CUDA config as returned by _get_cuda_config
+ Returns:
+ The path of the directory containing the CUDA headers.
+ """
+ cuda_toolkit_path = cuda_config.cuda_toolkit_path
+ for relative_path in CUDA_INCLUDE_PATHS:
+ if repository_ctx.path("%s/%scuda.h" % (cuda_toolkit_path, relative_path)).exists:
+ return ("%s/%s" % (cuda_toolkit_path, relative_path))[:-1]
+ auto_configure_fail("Cannot find cuda.h under %s" % cuda_toolkit_path)
def _find_cudnn_header_dir(repository_ctx, cudnn_install_basedir):
- """Returns the path to the directory containing cudnn.h
-
- Args:
- repository_ctx: The repository context.
- cudnn_install_basedir: The cudnn install directory as returned by
- _cudnn_install_basedir.
-
- Returns:
- The path of the directory containing the cudnn header.
- """
- for relative_path in CUDA_INCLUDE_PATHS:
- if repository_ctx.path("%s/%scudnn.h" % (cudnn_install_basedir, relative_path)).exists:
- return ("%s/%s" % (cudnn_install_basedir, relative_path))[:-1]
- if repository_ctx.path("/usr/include/cudnn.h").exists:
- return "/usr/include"
- auto_configure_fail("Cannot find cudnn.h under %s" % cudnn_install_basedir)
-
+ """Returns the path to the directory containing cudnn.h
+
+ Args:
+ repository_ctx: The repository context.
+ cudnn_install_basedir: The cudnn install directory as returned by
+ _cudnn_install_basedir.
+
+ Returns:
+ The path of the directory containing the cudnn header.
+ """
+ for relative_path in CUDA_INCLUDE_PATHS:
+ if repository_ctx.path("%s/%scudnn.h" % (cudnn_install_basedir, relative_path)).exists:
+ return ("%s/%s" % (cudnn_install_basedir, relative_path))[:-1]
+ if repository_ctx.path("/usr/include/cudnn.h").exists:
+ return "/usr/include"
+ auto_configure_fail("Cannot find cudnn.h under %s" % cudnn_install_basedir)
def _find_nvvm_libdevice_dir(repository_ctx, cuda_config):
- """Returns the path to the directory containing libdevice in bitcode format.
-
- Args:
- repository_ctx: The repository context.
- cuda_config: The CUDA config as returned by _get_cuda_config
-
- Returns:
- The path of the directory containing the CUDA headers.
- """
- cuda_toolkit_path = cuda_config.cuda_toolkit_path
- for relative_path in NVVM_LIBDEVICE_PATHS:
- if repository_ctx.path("%s/%slibdevice.10.bc" % (cuda_toolkit_path, relative_path)).exists:
- return ("%s/%s" % (cuda_toolkit_path, relative_path))[:-1]
- auto_configure_fail("Cannot find libdevice.10.bc under %s" % cuda_toolkit_path)
-
+ """Returns the path to the directory containing libdevice in bitcode format.
+
+ Args:
+ repository_ctx: The repository context.
+ cuda_config: The CUDA config as returned by _get_cuda_config
+
+ Returns:
+ The path of the directory containing the CUDA headers.
+ """
+ cuda_toolkit_path = cuda_config.cuda_toolkit_path
+ for libdevice_file in NVVM_LIBDEVICE_FILES:
+ for relative_path in NVVM_LIBDEVICE_PATHS:
+ if repository_ctx.path("%s/%s%s" % (cuda_toolkit_path, relative_path, libdevice_file)).exists:
+ return ("%s/%s" % (cuda_toolkit_path, relative_path))[:-1]
+ auto_configure_fail("Cannot find libdevice*.bc files under %s" % cuda_toolkit_path)
def _cudart_static_linkopt(cpu_value):
- """Returns additional platform-specific linkopts for cudart."""
- return "" if cpu_value == "Darwin" else "\"-lrt\","
+ """Returns additional platform-specific linkopts for cudart."""
+ return "" if cpu_value == "Darwin" else "\"-lrt\","
def _get_cuda_config(repository_ctx):
- """Detects and returns information about the CUDA installation on the system.
-
- Args:
- repository_ctx: The repository context.
-
- Returns:
- A struct containing the following fields:
- cuda_toolkit_path: The CUDA toolkit installation directory.
- cudnn_install_basedir: The cuDNN installation directory.
- cuda_version: The version of CUDA on the system.
- cudnn_version: The version of cuDNN on the system.
- compute_capabilities: A list of the system's CUDA compute capabilities.
- cpu_value: The name of the host operating system.
- """
- cpu_value = get_cpu_value(repository_ctx)
- cuda_toolkit_path = _cuda_toolkit_path(repository_ctx)
- cuda_version = _cuda_version(repository_ctx, cuda_toolkit_path, cpu_value)
- cudnn_install_basedir = _cudnn_install_basedir(repository_ctx)
- cudnn_version = _cudnn_version(repository_ctx, cudnn_install_basedir, cpu_value)
- return struct(
- cuda_toolkit_path = cuda_toolkit_path,
- cudnn_install_basedir = cudnn_install_basedir,
- cuda_version = cuda_version,
- cudnn_version = cudnn_version,
- compute_capabilities = _compute_capabilities(repository_ctx),
- cpu_value = cpu_value)
-
-
-def _tpl(repository_ctx, tpl, substitutions={}, out=None):
- if not out:
- out = tpl.replace(":", "/")
- repository_ctx.template(
- out,
- Label("//third_party/gpus/%s.tpl" % tpl),
- substitutions)
-
+ """Detects and returns information about the CUDA installation on the system.
+
+ Args:
+ repository_ctx: The repository context.
+
+ Returns:
+ A struct containing the following fields:
+ cuda_toolkit_path: The CUDA toolkit installation directory.
+ cudnn_install_basedir: The cuDNN installation directory.
+ cuda_version: The version of CUDA on the system.
+ cudnn_version: The version of cuDNN on the system.
+ compute_capabilities: A list of the system's CUDA compute capabilities.
+ cpu_value: The name of the host operating system.
+ """
+ cpu_value = get_cpu_value(repository_ctx)
+ cuda_toolkit_path = _cuda_toolkit_path(repository_ctx)
+ cuda_version = _cuda_version(repository_ctx, cuda_toolkit_path, cpu_value)
+ cudnn_install_basedir = _cudnn_install_basedir(repository_ctx)
+ cudnn_version = _cudnn_version(repository_ctx, cudnn_install_basedir, cpu_value)
+ return struct(
+ cuda_toolkit_path = cuda_toolkit_path,
+ cudnn_install_basedir = cudnn_install_basedir,
+ cuda_version = cuda_version,
+ cudnn_version = cudnn_version,
+ compute_capabilities = _compute_capabilities(repository_ctx),
+ cpu_value = cpu_value,
+ )
+
+def _tpl(repository_ctx, tpl, substitutions = {}, out = None):
+ if not out:
+ out = tpl.replace(":", "/")
+ repository_ctx.template(
+ out,
+ Label("//third_party/gpus/%s.tpl" % tpl),
+ substitutions,
+ )
def _file(repository_ctx, label):
- repository_ctx.template(
- label.replace(":", "/"),
- Label("//third_party/gpus/%s.tpl" % label),
- {})
-
+ repository_ctx.template(
+ label.replace(":", "/"),
+ Label("//third_party/gpus/%s.tpl" % label),
+ {},
+ )
_DUMMY_CROSSTOOL_BZL_FILE = """
def error_gpu_disabled():
@@ -792,355 +951,511 @@ def error_gpu_disabled():
)
"""
-
_DUMMY_CROSSTOOL_BUILD_FILE = """
load("//crosstool:error_gpu_disabled.bzl", "error_gpu_disabled")
error_gpu_disabled()
"""
-
def _create_dummy_repository(repository_ctx):
- cpu_value = get_cpu_value(repository_ctx)
-
- # Set up BUILD file for cuda/.
- _tpl(repository_ctx, "cuda:build_defs.bzl",
- {
- "%{cuda_is_configured}": "False",
- "%{cuda_extra_copts}": "[]",
- })
- _tpl(repository_ctx, "cuda:BUILD",
- {
- "%{cuda_driver_lib}": _lib_name("cuda", cpu_value),
- "%{cudart_static_lib}": _lib_name("cudart_static", cpu_value,
- static=True),
- "%{cudart_static_linkopt}": _cudart_static_linkopt(cpu_value),
- "%{cudart_lib}": _lib_name("cudart", cpu_value),
- "%{cublas_lib}": _lib_name("cublas", cpu_value),
- "%{cusolver_lib}": _lib_name("cusolver", cpu_value),
- "%{cudnn_lib}": _lib_name("cudnn", cpu_value),
- "%{cufft_lib}": _lib_name("cufft", cpu_value),
- "%{curand_lib}": _lib_name("curand", cpu_value),
- "%{cupti_lib}": _lib_name("cupti", cpu_value),
- "%{cuda_include_genrules}": '',
- "%{cuda_headers}": '',
- })
-
- # Create dummy files for the CUDA toolkit since they are still required by
- # tensorflow/core/platform/default/build_config:cuda.
- repository_ctx.file("cuda/cuda/include/cuda.h", "")
- repository_ctx.file("cuda/cuda/include/cublas.h", "")
- repository_ctx.file("cuda/cuda/include/cudnn.h", "")
- repository_ctx.file("cuda/cuda/extras/CUPTI/include/cupti.h", "")
- repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cuda", cpu_value))
- repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cudart", cpu_value))
- repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cudart_static", cpu_value))
- repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cublas", cpu_value))
- repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cusolver", cpu_value))
- repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cudnn", cpu_value))
- repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("curand", cpu_value))
- repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cufft", cpu_value))
- repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cupti", cpu_value))
-
- # Set up cuda_config.h, which is used by
- # tensorflow/stream_executor/dso_loader.cc.
- _tpl(repository_ctx, "cuda:cuda_config.h",
- {
- "%{cuda_version}": _DEFAULT_CUDA_VERSION,
- "%{cudnn_version}": _DEFAULT_CUDNN_VERSION,
- "%{cuda_compute_capabilities}": ",".join([
- "CudaVersion(\"%s\")" % c
- for c in _DEFAULT_CUDA_COMPUTE_CAPABILITIES]),
- "%{cuda_toolkit_path}": _DEFAULT_CUDA_TOOLKIT_PATH,
- }, "cuda/cuda/cuda_config.h")
-
- # If cuda_configure is not configured to build with GPU support, and the user
- # attempts to build with --config=cuda, add a dummy build rule to intercept
- # this and fail with an actionable error message.
- repository_ctx.file("crosstool/error_gpu_disabled.bzl",
- _DUMMY_CROSSTOOL_BZL_FILE)
- repository_ctx.file("crosstool/BUILD", _DUMMY_CROSSTOOL_BUILD_FILE)
-
-
-def _execute(repository_ctx, cmdline, error_msg=None, error_details=None,
- empty_stdout_fine=False):
- """Executes an arbitrary shell command.
-
- Args:
- repository_ctx: the repository_ctx object
- cmdline: list of strings, the command to execute
- error_msg: string, a summary of the error if the command fails
- error_details: string, details about the error or steps to fix it
- empty_stdout_fine: bool, if True, an empty stdout result is fine, otherwise
- it's an error
- Return:
- the result of repository_ctx.execute(cmdline)
- """
- result = repository_ctx.execute(cmdline)
- if result.stderr or not (empty_stdout_fine or result.stdout):
- auto_configure_fail(
- "\n".join([
- error_msg.strip() if error_msg else "Repository command failed",
- result.stderr.strip(),
- error_details if error_details else ""]))
- return result
-
+ cpu_value = get_cpu_value(repository_ctx)
+
+ # Set up BUILD file for cuda/.
+ _tpl(
+ repository_ctx,
+ "cuda:build_defs.bzl",
+ {
+ "%{cuda_is_configured}": "False",
+ "%{cuda_extra_copts}": "[]",
+ },
+ )
+ _tpl(
+ repository_ctx,
+ "cuda:BUILD",
+ {
+ "%{cuda_driver_lib}": _lib_name("cuda", cpu_value),
+ "%{cudart_static_lib}": _lib_name(
+ "cudart_static",
+ cpu_value,
+ static = True,
+ ),
+ "%{cudart_static_linkopt}": _cudart_static_linkopt(cpu_value),
+ "%{cudart_lib}": _lib_name("cudart", cpu_value),
+ "%{cublas_lib}": _lib_name("cublas", cpu_value),
+ "%{cusolver_lib}": _lib_name("cusolver", cpu_value),
+ "%{cudnn_lib}": _lib_name("cudnn", cpu_value),
+ "%{cufft_lib}": _lib_name("cufft", cpu_value),
+ "%{curand_lib}": _lib_name("curand", cpu_value),
+ "%{cupti_lib}": _lib_name("cupti", cpu_value),
+ "%{cuda_include_genrules}": "",
+ "%{cuda_headers}": "",
+ },
+ )
+
+ # Create dummy files for the CUDA toolkit since they are still required by
+ # tensorflow/core/platform/default/build_config:cuda.
+ repository_ctx.file("cuda/cuda/include/cuda.h", "")
+ repository_ctx.file("cuda/cuda/include/cublas.h", "")
+ repository_ctx.file("cuda/cuda/include/cudnn.h", "")
+ repository_ctx.file("cuda/cuda/extras/CUPTI/include/cupti.h", "")
+ repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cuda", cpu_value))
+ repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cudart", cpu_value))
+ repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cudart_static", cpu_value))
+ repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cublas", cpu_value))
+ repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cusolver", cpu_value))
+ repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cudnn", cpu_value))
+ repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("curand", cpu_value))
+ repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cufft", cpu_value))
+ repository_ctx.file("cuda/cuda/lib/%s" % _lib_name("cupti", cpu_value))
+
+ # Set up cuda_config.h, which is used by
+ # tensorflow/stream_executor/dso_loader.cc.
+ _tpl(
+ repository_ctx,
+ "cuda:cuda_config.h",
+ {
+ "%{cuda_version}": _DEFAULT_CUDA_VERSION,
+ "%{cudnn_version}": _DEFAULT_CUDNN_VERSION,
+ "%{cuda_compute_capabilities}": ",".join([
+ "CudaVersion(\"%s\")" % c
+ for c in _DEFAULT_CUDA_COMPUTE_CAPABILITIES
+ ]),
+ "%{cuda_toolkit_path}": _DEFAULT_CUDA_TOOLKIT_PATH,
+ },
+ "cuda/cuda/cuda_config.h",
+ )
+
+ # If cuda_configure is not configured to build with GPU support, and the user
+ # attempts to build with --config=cuda, add a dummy build rule to intercept
+ # this and fail with an actionable error message.
+ repository_ctx.file(
+ "crosstool/error_gpu_disabled.bzl",
+ _DUMMY_CROSSTOOL_BZL_FILE,
+ )
+ repository_ctx.file("crosstool/BUILD", _DUMMY_CROSSTOOL_BUILD_FILE)
+
+def _execute(
+ repository_ctx,
+ cmdline,
+ error_msg = None,
+ error_details = None,
+ empty_stdout_fine = False):
+ """Executes an arbitrary shell command.
+
+ Args:
+ repository_ctx: the repository_ctx object
+ cmdline: list of strings, the command to execute
+ error_msg: string, a summary of the error if the command fails
+ error_details: string, details about the error or steps to fix it
+ empty_stdout_fine: bool, if True, an empty stdout result is fine, otherwise
+ it's an error
+ Return:
+ the result of repository_ctx.execute(cmdline)
+ """
+ result = repository_ctx.execute(cmdline)
+ if result.stderr or not (empty_stdout_fine or result.stdout):
+ auto_configure_fail(
+ "\n".join([
+ error_msg.strip() if error_msg else "Repository command failed",
+ result.stderr.strip(),
+ error_details if error_details else "",
+ ]),
+ )
+ return result
def _norm_path(path):
- """Returns a path with '/' and remove the trailing slash."""
- path = path.replace("\\", "/")
- if path[-1] == "/":
- path = path[:-1]
- return path
-
-
-def symlink_genrule_for_dir(repository_ctx, src_dir, dest_dir, genrule_name,
- src_files = [], dest_files = []):
- """Returns a genrule to symlink(or copy if on Windows) a set of files.
-
- If src_dir is passed, files will be read from the given directory; otherwise
- we assume files are in src_files and dest_files
- """
- if src_dir != None:
- src_dir = _norm_path(src_dir)
- dest_dir = _norm_path(dest_dir)
- files = '\n'.join(sorted(_read_dir(repository_ctx, src_dir).splitlines()))
- # Create a list with the src_dir stripped to use for outputs.
- dest_files = files.replace(src_dir, '').splitlines()
- src_files = files.splitlines()
- command = []
- if not _is_windows(repository_ctx):
- # We clear folders that might have been generated previously to avoid
- # undesired inclusions
- command.append('if [ -d "$(@D)/extras" ]; then rm $(@D)/extras -drf; fi')
- command.append('if [ -d "$(@D)/include" ]; then rm $(@D)/include -drf; fi')
- command.append('if [ -d "$(@D)/lib" ]; then rm $(@D)/lib -drf; fi')
- command.append('if [ -d "$(@D)/nvvm" ]; then rm $(@D)/nvvm -drf; fi')
- outs = []
- for i in range(len(dest_files)):
- if dest_files[i] != "":
- # If we have only one file to link we do not want to use the dest_dir, as
- # $(@D) will include the full path to the file.
- dest = '$(@D)/' + dest_dir + dest_files[i] if len(dest_files) != 1 else '$(@D)/' + dest_files[i]
- # On Windows, symlink is not supported, so we just copy all the files.
- cmd = 'cp -f' if _is_windows(repository_ctx) else 'ln -s'
- command.append(cmd + ' "%s" "%s"' % (src_files[i] , dest))
- outs.append(' "' + dest_dir + dest_files[i] + '",')
- genrule = _genrule(src_dir, genrule_name, " && ".join(command),
- "\n".join(outs))
- return genrule
-
+ """Returns a path with '/' and remove the trailing slash."""
+ path = path.replace("\\", "/")
+ if path[-1] == "/":
+ path = path[:-1]
+ return path
+
+def symlink_genrule_for_dir(
+ repository_ctx,
+ src_dir,
+ dest_dir,
+ genrule_name,
+ src_files = [],
+ dest_files = []):
+ """Returns a genrule to symlink(or copy if on Windows) a set of files.
+
+ If src_dir is passed, files will be read from the given directory; otherwise
+ we assume files are in src_files and dest_files
+ """
+ if src_dir != None:
+ src_dir = _norm_path(src_dir)
+ dest_dir = _norm_path(dest_dir)
+ files = "\n".join(sorted(_read_dir(repository_ctx, src_dir).splitlines()))
+
+ # Create a list with the src_dir stripped to use for outputs.
+ dest_files = files.replace(src_dir, "").splitlines()
+ src_files = files.splitlines()
+ command = []
+ if not _is_windows(repository_ctx):
+ # We clear folders that might have been generated previously to avoid
+ # undesired inclusions
+ command.append('if [ -d "$(@D)/extras" ]; then rm $(@D)/extras -drf; fi')
+ command.append('if [ -d "$(@D)/include" ]; then rm $(@D)/include -drf; fi')
+ command.append('if [ -d "$(@D)/lib" ]; then rm $(@D)/lib -drf; fi')
+ command.append('if [ -d "$(@D)/nvvm" ]; then rm $(@D)/nvvm -drf; fi')
+ outs = []
+ for i in range(len(dest_files)):
+ if dest_files[i] != "":
+ # If we have only one file to link we do not want to use the dest_dir, as
+ # $(@D) will include the full path to the file.
+ dest = "$(@D)/" + dest_dir + dest_files[i] if len(dest_files) != 1 else "$(@D)/" + dest_files[i]
+
+ # On Windows, symlink is not supported, so we just copy all the files.
+ cmd = "cp -f" if _is_windows(repository_ctx) else "ln -s"
+ command.append(cmd + ' "%s" "%s"' % (src_files[i], dest))
+ outs.append(' "' + dest_dir + dest_files[i] + '",')
+ genrule = _genrule(
+ src_dir,
+ genrule_name,
+ " && ".join(command),
+ "\n".join(outs),
+ )
+ return genrule
def _genrule(src_dir, genrule_name, command, outs):
- """Returns a string with a genrule.
-
- Genrule executes the given command and produces the given outputs.
- """
- return (
- 'genrule(\n' +
- ' name = "' +
- genrule_name + '",\n' +
- ' outs = [\n' +
- outs +
- '\n ],\n' +
- ' cmd = """\n' +
- command +
- '\n """,\n' +
- ')\n'
- )
-
+ """Returns a string with a genrule.
+
+ Genrule executes the given command and produces the given outputs.
+ """
+ return (
+ "genrule(\n" +
+ ' name = "' +
+ genrule_name + '",\n' +
+ " outs = [\n" +
+ outs +
+ "\n ],\n" +
+ ' cmd = """\n' +
+ command +
+ '\n """,\n' +
+ ")\n"
+ )
def _read_dir(repository_ctx, src_dir):
- """Returns a string with all files in a directory.
-
- Finds all files inside a directory, traversing subfolders and following
- symlinks. The returned string contains the full path of all files
- separated by line breaks.
- """
- if _is_windows(repository_ctx):
- src_dir = src_dir.replace("/", "\\")
- find_result = _execute(
- repository_ctx, ["cmd.exe", "/c", "dir", src_dir, "/b", "/s", "/a-d"],
- empty_stdout_fine=True)
- # src_files will be used in genrule.outs where the paths must
- # use forward slashes.
- result = find_result.stdout.replace("\\", "/")
- else:
- find_result = _execute(
- repository_ctx, ["find", src_dir, "-follow", "-type", "f"],
- empty_stdout_fine=True)
- result = find_result.stdout
- return result
+ """Returns a string with all files in a directory.
+
+ Finds all files inside a directory, traversing subfolders and following
+ symlinks. The returned string contains the full path of all files
+ separated by line breaks.
+ """
+ if _is_windows(repository_ctx):
+ src_dir = src_dir.replace("/", "\\")
+ find_result = _execute(
+ repository_ctx,
+ ["cmd.exe", "/c", "dir", src_dir, "/b", "/s", "/a-d"],
+ empty_stdout_fine = True,
+ )
+
+ # src_files will be used in genrule.outs where the paths must
+ # use forward slashes.
+ result = find_result.stdout.replace("\\", "/")
+ else:
+ find_result = _execute(
+ repository_ctx,
+ ["find", src_dir, "-follow", "-type", "f"],
+ empty_stdout_fine = True,
+ )
+ result = find_result.stdout
+ return result
def _flag_enabled(repository_ctx, flag_name):
- if flag_name in repository_ctx.os.environ:
- value = repository_ctx.os.environ[flag_name].strip()
- return value == "1"
- return False
+ if flag_name in repository_ctx.os.environ:
+ value = repository_ctx.os.environ[flag_name].strip()
+ return value == "1"
+ return False
def _use_cuda_clang(repository_ctx):
- return _flag_enabled(repository_ctx, "TF_CUDA_CLANG")
+ return _flag_enabled(repository_ctx, "TF_CUDA_CLANG")
def _compute_cuda_extra_copts(repository_ctx, compute_capabilities):
- if _use_cuda_clang(repository_ctx):
- capability_flags = ["--cuda-gpu-arch=sm_" +
- cap.replace(".", "") for cap in compute_capabilities]
- else:
- # Capabilities are handled in the "crosstool_wrapper_driver_is_not_gcc" for nvcc
- capability_flags = []
- return str(capability_flags)
+ if _use_cuda_clang(repository_ctx):
+ capability_flags = ["--cuda-gpu-arch=sm_" +
+ cap.replace(".", "") for cap in compute_capabilities]
+ else:
+ # Capabilities are handled in the "crosstool_wrapper_driver_is_not_gcc" for nvcc
+ capability_flags = []
+ return str(capability_flags)
def _create_local_cuda_repository(repository_ctx):
- """Creates the repository containing files set up to build with CUDA."""
- cuda_config = _get_cuda_config(repository_ctx)
-
- cuda_include_path = _find_cuda_include_path(repository_ctx, cuda_config)
- cudnn_header_dir = _find_cudnn_header_dir(repository_ctx,
- cuda_config.cudnn_install_basedir)
- cupti_header_dir = _find_cupti_header_dir(repository_ctx, cuda_config)
- nvvm_libdevice_dir = _find_nvvm_libdevice_dir(repository_ctx, cuda_config)
-
- # Set up symbolic links for the cuda toolkit by creating genrules to do
- # symlinking. We create one genrule for each directory we want to track under
- # cuda_toolkit_path
- cuda_toolkit_path = cuda_config.cuda_toolkit_path
- genrules = [symlink_genrule_for_dir(repository_ctx,
- cuda_include_path, "cuda/include", "cuda-include")]
- genrules.append(symlink_genrule_for_dir(repository_ctx,
- nvvm_libdevice_dir, "cuda/nvvm/libdevice", "cuda-nvvm"))
- genrules.append(symlink_genrule_for_dir(repository_ctx,
- cupti_header_dir, "cuda/extras/CUPTI/include", "cuda-extras"))
-
- cuda_libs = _find_libs(repository_ctx, cuda_config)
- cuda_lib_src = []
- cuda_lib_dest = []
- for lib in cuda_libs.values():
- cuda_lib_src.append(lib.path)
- cuda_lib_dest.append("cuda/lib/" + lib.file_name)
- genrules.append(symlink_genrule_for_dir(repository_ctx, None, "", "cuda-lib",
- cuda_lib_src, cuda_lib_dest))
-
- # Set up the symbolic links for cudnn if cndnn was not installed to
- # CUDA_TOOLKIT_PATH.
- included_files = _read_dir(repository_ctx, cuda_include_path).replace(
- cuda_include_path, '').splitlines()
- if '/cudnn.h' not in included_files:
- genrules.append(symlink_genrule_for_dir(repository_ctx, None,
- "cuda/include/", "cudnn-include", [cudnn_header_dir + "/cudnn.h"],
- ["cudnn.h"]))
- else:
- genrules.append(
- 'filegroup(\n' +
+ """Creates the repository containing files set up to build with CUDA."""
+ cuda_config = _get_cuda_config(repository_ctx)
+
+ cuda_include_path = _find_cuda_include_path(repository_ctx, cuda_config)
+ cudnn_header_dir = _find_cudnn_header_dir(
+ repository_ctx,
+ cuda_config.cudnn_install_basedir,
+ )
+ cupti_header_dir = _find_cupti_header_dir(repository_ctx, cuda_config)
+ nvvm_libdevice_dir = _find_nvvm_libdevice_dir(repository_ctx, cuda_config)
+
+ # Set up symbolic links for the cuda toolkit by creating genrules to do
+ # symlinking. We create one genrule for each directory we want to track under
+ # cuda_toolkit_path
+ cuda_toolkit_path = cuda_config.cuda_toolkit_path
+ genrules = [symlink_genrule_for_dir(
+ repository_ctx,
+ cuda_include_path,
+ "cuda/include",
+ "cuda-include",
+ )]
+ genrules.append(symlink_genrule_for_dir(
+ repository_ctx,
+ nvvm_libdevice_dir,
+ "cuda/nvvm/libdevice",
+ "cuda-nvvm",
+ ))
+ genrules.append(symlink_genrule_for_dir(
+ repository_ctx,
+ cupti_header_dir,
+ "cuda/extras/CUPTI/include",
+ "cuda-extras",
+ ))
+
+ cuda_libs = _find_libs(repository_ctx, cuda_config)
+ cuda_lib_src = []
+ cuda_lib_dest = []
+ for lib in cuda_libs.values():
+ cuda_lib_src.append(lib.path)
+ cuda_lib_dest.append("cuda/lib/" + lib.file_name)
+ genrules.append(symlink_genrule_for_dir(
+ repository_ctx,
+ None,
+ "",
+ "cuda-lib",
+ cuda_lib_src,
+ cuda_lib_dest,
+ ))
+
+ # Set up the symbolic links for cudnn if cndnn was not installed to
+ # CUDA_TOOLKIT_PATH.
+ included_files = _read_dir(repository_ctx, cuda_include_path).replace(
+ cuda_include_path,
+ "",
+ ).splitlines()
+ if "/cudnn.h" not in included_files:
+ genrules.append(symlink_genrule_for_dir(
+ repository_ctx,
+ None,
+ "cuda/include/",
+ "cudnn-include",
+ [cudnn_header_dir + "/cudnn.h"],
+ ["cudnn.h"],
+ ))
+ else:
+ genrules.append(
+ "filegroup(\n" +
' name = "cudnn-include",\n' +
- ' srcs = [],\n' +
- ')\n'
+ " srcs = [],\n" +
+ ")\n",
)
- # Set up BUILD file for cuda/
- _tpl(repository_ctx, "cuda:build_defs.bzl",
- {
- "%{cuda_is_configured}": "True",
- "%{cuda_extra_copts}": _compute_cuda_extra_copts(
- repository_ctx, cuda_config.compute_capabilities),
- })
- _tpl(repository_ctx, "cuda:BUILD",
- {
- "%{cuda_driver_lib}": cuda_libs["cuda"].file_name,
- "%{cudart_static_lib}": cuda_libs["cudart_static"].file_name,
- "%{cudart_static_linkopt}": _cudart_static_linkopt(
- cuda_config.cpu_value),
- "%{cudart_lib}": cuda_libs["cudart"].file_name,
- "%{cublas_lib}": cuda_libs["cublas"].file_name,
- "%{cusolver_lib}": cuda_libs["cusolver"].file_name,
- "%{cudnn_lib}": cuda_libs["cudnn"].file_name,
- "%{cufft_lib}": cuda_libs["cufft"].file_name,
- "%{curand_lib}": cuda_libs["curand"].file_name,
- "%{cupti_lib}": cuda_libs["cupti"].file_name,
- "%{cuda_include_genrules}": "\n".join(genrules),
- "%{cuda_headers}": ('":cuda-include",\n' +
- ' ":cudnn-include",')
- })
-
- is_cuda_clang = _use_cuda_clang(repository_ctx)
-
- should_download_clang = is_cuda_clang and _flag_enabled(
- repository_ctx, _TF_DOWNLOAD_CLANG)
- if should_download_clang:
- download_clang(repository_ctx, "crosstool/extra_tools")
-
- # Set up crosstool/
- cc = find_cc(repository_ctx)
- cc_fullpath = cc if not should_download_clang else "crosstool/" + cc
-
- host_compiler_includes = _host_compiler_includes(repository_ctx, cc_fullpath)
- cuda_defines = {
- "%{cuda_include_path}": _cuda_include_path(repository_ctx,
- cuda_config),
- "%{host_compiler_includes}": host_compiler_includes,
- }
- if is_cuda_clang:
- cuda_defines["%{clang_path}"] = cc
- _tpl(repository_ctx, "crosstool:BUILD", {"%{linker_files}": ":empty"})
- _tpl(repository_ctx, "crosstool:CROSSTOOL_clang", cuda_defines, out="crosstool/CROSSTOOL")
- repository_ctx.file("crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc", "")
- else:
- nvcc_path = str(repository_ctx.path("%s/bin/nvcc%s" %
- (cuda_config.cuda_toolkit_path,
- ".exe" if cuda_config.cpu_value == "Windows" else "")))
- _tpl(repository_ctx, "crosstool:BUILD",
- {"%{linker_files}": ":crosstool_wrapper_driver_is_not_gcc"})
- _tpl(repository_ctx, "crosstool:CROSSTOOL_nvcc", cuda_defines, out="crosstool/CROSSTOOL")
- _tpl(repository_ctx,
- "crosstool:clang/bin/crosstool_wrapper_driver_is_not_gcc",
- {
- "%{cpu_compiler}": str(cc),
- "%{cuda_version}": cuda_config.cuda_version,
- "%{nvcc_path}": nvcc_path,
- "%{gcc_host_compiler_path}": str(cc),
- "%{cuda_compute_capabilities}": ", ".join(
- ["\"%s\"" % c for c in cuda_config.compute_capabilities]),
- })
-
- # Set up cuda_config.h, which is used by
- # tensorflow/stream_executor/dso_loader.cc.
- _tpl(repository_ctx, "cuda:cuda_config.h",
- {
- "%{cuda_version}": cuda_config.cuda_version,
- "%{cudnn_version}": cuda_config.cudnn_version,
- "%{cuda_compute_capabilities}": ",".join(
- ["CudaVersion(\"%s\")" % c
- for c in cuda_config.compute_capabilities]),
- "%{cuda_toolkit_path}": cuda_config.cuda_toolkit_path,
- }, "cuda/cuda/cuda_config.h")
+ # Set up BUILD file for cuda/
+ _tpl(
+ repository_ctx,
+ "cuda:build_defs.bzl",
+ {
+ "%{cuda_is_configured}": "True",
+ "%{cuda_extra_copts}": _compute_cuda_extra_copts(
+ repository_ctx,
+ cuda_config.compute_capabilities,
+ ),
+ },
+ )
+ _tpl(
+ repository_ctx,
+ "cuda:BUILD.windows" if _is_windows(repository_ctx) else "cuda:BUILD",
+ {
+ "%{cuda_driver_lib}": cuda_libs["cuda"].file_name,
+ "%{cudart_static_lib}": cuda_libs["cudart_static"].file_name,
+ "%{cudart_static_linkopt}": _cudart_static_linkopt(
+ cuda_config.cpu_value,
+ ),
+ "%{cudart_lib}": cuda_libs["cudart"].file_name,
+ "%{cublas_lib}": cuda_libs["cublas"].file_name,
+ "%{cusolver_lib}": cuda_libs["cusolver"].file_name,
+ "%{cudnn_lib}": cuda_libs["cudnn"].file_name,
+ "%{cufft_lib}": cuda_libs["cufft"].file_name,
+ "%{curand_lib}": cuda_libs["curand"].file_name,
+ "%{cupti_lib}": cuda_libs["cupti"].file_name,
+ "%{cuda_include_genrules}": "\n".join(genrules),
+ "%{cuda_headers}": ('":cuda-include",\n' +
+ ' ":cudnn-include",'),
+ },
+ "cuda/BUILD",
+ )
+
+ is_cuda_clang = _use_cuda_clang(repository_ctx)
+
+ should_download_clang = is_cuda_clang and _flag_enabled(
+ repository_ctx,
+ _TF_DOWNLOAD_CLANG,
+ )
+ if should_download_clang:
+ download_clang(repository_ctx, "crosstool/extra_tools")
+
+ # Set up crosstool/
+ cc = find_cc(repository_ctx)
+ cc_fullpath = cc if not should_download_clang else "crosstool/" + cc
+
+ host_compiler_includes = _host_compiler_includes(repository_ctx, cc_fullpath)
+ cuda_defines = {}
+ # Bazel sets '-B/usr/bin' flag to workaround build errors on RHEL (see
+ # https://github.com/bazelbuild/bazel/issues/760).
+ # However, this stops our custom clang toolchain from picking the provided
+ # LLD linker, so we're only adding '-B/usr/bin' when using non-downloaded
+ # toolchain.
+ # TODO: when bazel stops adding '-B/usr/bin' by default, remove this
+ # flag from the CROSSTOOL completely (see
+ # https://github.com/bazelbuild/bazel/issues/5634)
+ if should_download_clang:
+ cuda_defines["%{linker_bin_path_flag}"] = ""
+ else:
+ cuda_defines["%{linker_bin_path_flag}"] = 'flag: "-B/usr/bin"'
+
+ if is_cuda_clang:
+ cuda_defines["%{host_compiler_path}"] = str(cc)
+ cuda_defines["%{host_compiler_warnings}"] = """
+ # Some parts of the codebase set -Werror and hit this warning, so
+ # switch it off for now.
+ flag: "-Wno-invalid-partial-specialization"
+ """
+ cuda_defines["%{host_compiler_includes}"] = host_compiler_includes
+ _tpl(repository_ctx, "crosstool:BUILD", {"%{linker_files}": ":empty", "%{win_linker_files}": ":empty"})
+ repository_ctx.file("crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc", "")
+ repository_ctx.file("crosstool/windows/msvc_wrapper_for_nvcc.py", "")
+ repository_ctx.file("crosstool/windows/msvc_wrapper_for_nvcc.bat", "")
+ else:
+ cuda_defines["%{host_compiler_path}"] = "clang/bin/crosstool_wrapper_driver_is_not_gcc"
+ cuda_defines["%{host_compiler_warnings}"] = ""
+
+ # TODO(klimek): We currently need to inject "/" as builtin directory path
+ # to disable bazel's dependency checks.
+ # The problem is that:
+ # - the python rules symlink the python headers into the bazel root
+ # - the rules use 'includes' in the BUILD file to redirect includes of the
+ # python headers through those paths
+ # - bazel currently uses -isystem for include paths specified via 'includes'
+ # - gcc follows symlinks when resolving files via -isystem paths, and puts
+ # the resolved paths into the .d file, which makes the dependency check
+ # fail for bazel
+ # There are multiple possible ways to solve this:
+ # 1. make bazel not use -isystem for paths specified via 'includes'
+ # 2. cp the headers instead of symlinking them
+ #
+ # Once this is fixed, the right builtin directory path is:
+ # (host_compiler_includes +
+ # "\n cxx_builtin_include_directory: \"%s\"" % cuda_include_path)
+ # The cuda directory needs to be passed, as there is currently no rule
+ # providing the cuda headers in the same way the python headers are
+ # provided.
+ cuda_defines["%{host_compiler_includes}"] = "\n cxx_builtin_include_directory: \"/\""
+ nvcc_path = str(repository_ctx.path("%s/bin/nvcc%s" %
+ (
+ cuda_config.cuda_toolkit_path,
+ ".exe" if _is_windows(repository_ctx) else "",
+ )))
+ _tpl(
+ repository_ctx,
+ "crosstool:BUILD",
+ {
+ "%{linker_files}": ":crosstool_wrapper_driver_is_not_gcc",
+ "%{win_linker_files}": ":windows_msvc_wrapper_files",
+ },
+ )
+ wrapper_defines = {
+ "%{cpu_compiler}": str(cc),
+ "%{cuda_version}": cuda_config.cuda_version,
+ "%{nvcc_path}": nvcc_path,
+ "%{gcc_host_compiler_path}": str(cc),
+ "%{cuda_compute_capabilities}": ", ".join(
+ ["\"%s\"" % c for c in cuda_config.compute_capabilities],
+ ),
+ "%{nvcc_tmp_dir}": _get_nvcc_tmp_dir_for_windows(repository_ctx),
+ }
+ _tpl(
+ repository_ctx,
+ "crosstool:clang/bin/crosstool_wrapper_driver_is_not_gcc",
+ wrapper_defines,
+ )
+ _tpl(
+ repository_ctx,
+ "crosstool:windows/msvc_wrapper_for_nvcc.py",
+ wrapper_defines,
+ )
+ _tpl(
+ repository_ctx,
+ "crosstool:windows/msvc_wrapper_for_nvcc.bat",
+ {
+ "%{python_binary}": _get_python_bin(repository_ctx),
+ },
+ )
+
+ _tpl(
+ repository_ctx,
+ "crosstool:CROSSTOOL",
+ cuda_defines + _get_win_cuda_defines(repository_ctx),
+ out = "crosstool/CROSSTOOL",
+ )
+
+ # Set up cuda_config.h, which is used by
+ # tensorflow/stream_executor/dso_loader.cc.
+ _tpl(
+ repository_ctx,
+ "cuda:cuda_config.h",
+ {
+ "%{cuda_version}": cuda_config.cuda_version,
+ "%{cudnn_version}": cuda_config.cudnn_version,
+ "%{cuda_compute_capabilities}": ",".join(
+ [
+ "CudaVersion(\"%s\")" % c
+ for c in cuda_config.compute_capabilities
+ ],
+ ),
+ "%{cuda_toolkit_path}": cuda_config.cuda_toolkit_path,
+ },
+ "cuda/cuda/cuda_config.h",
+ )
def _create_remote_cuda_repository(repository_ctx, remote_config_repo):
- """Creates pointers to a remotely configured repo set up to build with CUDA."""
- _tpl(repository_ctx, "cuda:build_defs.bzl",
- {
- "%{cuda_is_configured}": "True",
- "%{cuda_extra_copts}": _compute_cuda_extra_copts(
- repository_ctx, _compute_capabilities(repository_ctx)),
-
- })
- _tpl(repository_ctx, "cuda:remote.BUILD",
- {
- "%{remote_cuda_repo}": remote_config_repo,
- }, "cuda/BUILD")
- _tpl(repository_ctx, "crosstool:remote.BUILD", {
- "%{remote_cuda_repo}": remote_config_repo,
- }, "crosstool/BUILD")
+ """Creates pointers to a remotely configured repo set up to build with CUDA."""
+ _tpl(
+ repository_ctx,
+ "cuda:build_defs.bzl",
+ {
+ "%{cuda_is_configured}": "True",
+ "%{cuda_extra_copts}": _compute_cuda_extra_copts(
+ repository_ctx,
+ _compute_capabilities(repository_ctx),
+ ),
+ },
+ )
+ _tpl(
+ repository_ctx,
+ "cuda:remote.BUILD",
+ {
+ "%{remote_cuda_repo}": remote_config_repo,
+ },
+ "cuda/BUILD",
+ )
+ _tpl(repository_ctx, "crosstool:remote.BUILD", {
+ "%{remote_cuda_repo}": remote_config_repo,
+ }, "crosstool/BUILD")
def _cuda_autoconf_impl(repository_ctx):
- """Implementation of the cuda_autoconf repository rule."""
- if not _enable_cuda(repository_ctx):
- _create_dummy_repository(repository_ctx)
- else:
- if _TF_CUDA_CONFIG_REPO in repository_ctx.os.environ:
- _create_remote_cuda_repository(repository_ctx,
- repository_ctx.os.environ[_TF_CUDA_CONFIG_REPO])
+ """Implementation of the cuda_autoconf repository rule."""
+ if not _enable_cuda(repository_ctx):
+ _create_dummy_repository(repository_ctx)
+ elif _TF_CUDA_CONFIG_REPO in repository_ctx.os.environ:
+ _create_remote_cuda_repository(
+ repository_ctx,
+ repository_ctx.os.environ[_TF_CUDA_CONFIG_REPO],
+ )
else:
- _create_local_cuda_repository(repository_ctx)
-
+ _create_local_cuda_repository(repository_ctx)
cuda_configure = repository_rule(
implementation = _cuda_autoconf_impl,
@@ -1157,6 +1472,7 @@ cuda_configure = repository_rule(
_TF_CUDA_COMPUTE_CAPABILITIES,
_TF_CUDA_CONFIG_REPO,
"NVVMIR_LIBRARY_DIR",
+ _PYTHON_BIN_PATH,
],
)
diff --git a/third_party/gpus/download_clang.bzl b/third_party/gpus/download_clang.bzl
deleted file mode 100644
index 54d383d7d7..0000000000
--- a/third_party/gpus/download_clang.bzl
+++ /dev/null
@@ -1,54 +0,0 @@
-""" Helpers to download a recent clang release."""
-
-def _get_platform_folder(os_name):
- os_name = os_name.lower()
- if os_name.startswith('windows'):
- return 'Win'
- if os_name.startswith('mac os'):
- return 'Mac'
- if not os_name.startswith('linux'):
- fail('Unknown platform')
- return 'Linux_x64'
-
-def _download_chromium_clang(repo_ctx, platform_folder, package_version, sha256,
- out_folder):
- cds_url = 'https://commondatastorage.googleapis.com/chromium-browser-clang'
- cds_file = 'clang-%s.tgz' % package_version
- cds_full_url = '{0}/{1}/{2}'.format(cds_url, platform_folder, cds_file)
- repo_ctx.download_and_extract(cds_full_url, output=out_folder, sha256=sha256)
-
-def download_clang(repo_ctx, out_folder):
- """ Download a fresh clang release and put it into out_folder.
-
- Clang itself will be located in 'out_folder/bin/clang'.
- We currently download one of the latest releases of clang by the
- Chromium project (see
- https://chromium.googlesource.com/chromium/src/+/master/docs/clang.md).
-
- Args:
- repo_ctx: An instance of repository_context object.
- out_folder: A folder to extract the compiler into.
- """
- # TODO(ibiryukov): we currently download and extract some extra tools in the
- # clang release (e.g., sanitizers). We should probably remove the ones
- # we don't need and document the ones we want provide in addition to clang.
-
- # Latest CLANG_REVISION and CLANG_SUB_REVISION of the Chromiums's release
- # can be found in https://chromium.googlesource.com/chromium/src/tools/clang/+/master/scripts/update.py
- CLANG_REVISION = '321529'
- CLANG_SUB_REVISION = 2
-
- package_version = '%s-%s' % (CLANG_REVISION, CLANG_SUB_REVISION)
-
- checksums = {
- 'Linux_x64':
- '76d4eb1ad011e3127c4a9de9b9f5d4ac624b5a9395c4d7395c9e0a487b13daf6',
- 'Mac':
- '4b2a7a65ac1ee892b318c723eec8771f514bb306f346aa8216bb0006f19d87b7',
- 'Win':
- 'eba51bb8f84af41a85903113666bd21c22709010c39c4cb19dc20cf1ed14581b',
- }
-
- platform_folder = _get_platform_folder(repo_ctx.os.name)
- _download_chromium_clang(repo_ctx, platform_folder, package_version,
- checksums[platform_folder], out_folder)
diff --git a/third_party/hadoop/BUILD b/third_party/hadoop/BUILD
index 9e98154400..c3c5e428be 100644
--- a/third_party/hadoop/BUILD
+++ b/third_party/hadoop/BUILD
@@ -4,18 +4,6 @@ licenses(["notice"]) # Apache 2.0
exports_files(["LICENSE.txt"])
-filegroup(
- name = "all_files",
- srcs = glob(
- ["**/*"],
- exclude = [
- "**/METADATA",
- "**/OWNERS",
- ],
- ),
- visibility = ["//tensorflow:__subpackages__"],
-)
-
cc_library(
name = "hdfs",
hdrs = ["hdfs.h"],
diff --git a/third_party/hadoop/hdfs.h b/third_party/hadoop/hdfs.h
index a664f3b50c..30c277a450 100644
--- a/third_party/hadoop/hdfs.h
+++ b/third_party/hadoop/hdfs.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef LIBHDFS_HDFS_H
-#define LIBHDFS_HDFS_H
+#ifndef TENSORFLOW_THIRD_PARTY_HADOOP_HDFS_H_
+#define TENSORFLOW_THIRD_PARTY_HADOOP_HDFS_H_
#include <errno.h> /* for EINTERNAL, etc. */
#include <fcntl.h> /* for O_RDONLY, O_WRONLY */
@@ -904,7 +904,7 @@ void hadoopRzBufferFree(hdfsFile file, struct hadoopRzBuffer *buffer);
#endif
#undef LIBHDFS_EXTERNAL
-#endif /*LIBHDFS_HDFS_H*/
+#endif // TENSORFLOW_THIRD_PARTY_HADOOP_HDFS_H_
/**
* vim: ts=4: sw=4: et
diff --git a/third_party/highwayhash.BUILD b/third_party/highwayhash.BUILD
index 1b8e40765e..08cb84ea2c 100644
--- a/third_party/highwayhash.BUILD
+++ b/third_party/highwayhash.BUILD
@@ -10,6 +10,7 @@ cc_library(
srcs = ["highwayhash/sip_hash.cc"],
hdrs = [
"highwayhash/sip_hash.h",
+ "highwayhash/endianess.h",
"highwayhash/state_helpers.h",
],
visibility = ["//visibility:public"],
diff --git a/third_party/jpeg/jpeg.BUILD b/third_party/jpeg/jpeg.BUILD
index 87a23925c4..1b9b9bf2f5 100644
--- a/third_party/jpeg/jpeg.BUILD
+++ b/third_party/jpeg/jpeg.BUILD
@@ -11,8 +11,8 @@ libjpegturbo_nocopts = "-[W]error"
WIN_COPTS = [
"/Ox",
- "/w14711", # function 'function' selected for inline expansion
- "/w14710", # 'function' : function not inlined
+ "-DWITH_SIMD",
+ "-wd4996",
]
libjpegturbo_copts = select({
@@ -22,7 +22,6 @@ libjpegturbo_copts = select({
"-w",
],
":windows": WIN_COPTS,
- ":windows_msvc": WIN_COPTS,
"//conditions:default": [
"-O3",
"-w",
@@ -128,6 +127,7 @@ cc_library(
":armeabi-v7a": [":simd_armv7a"],
":arm64-v8a": [":simd_armv8a"],
":linux_ppc64le": [":simd_altivec"],
+ ":windows": [":simd_win_x86_64"],
"//conditions:default": [":simd_none"],
}),
)
@@ -145,27 +145,27 @@ cc_library(
"jpeglib.h",
"jsimd.h",
"jsimddct.h",
- "simd/jccolor-altivec.c",
- "simd/jcgray-altivec.c",
- "simd/jcsample.h",
- "simd/jcsample-altivec.c",
- "simd/jdcolor-altivec.c",
- "simd/jdmerge-altivec.c",
- "simd/jdsample-altivec.c",
- "simd/jfdctfst-altivec.c",
- "simd/jfdctint-altivec.c",
- "simd/jidctfst-altivec.c",
- "simd/jidctint-altivec.c",
- "simd/jquanti-altivec.c",
"simd/jsimd.h",
- "simd/jsimd_altivec.h",
- "simd/jsimd_powerpc.c",
+ "simd/powerpc/jccolor-altivec.c",
+ "simd/powerpc/jcgray-altivec.c",
+ "simd/powerpc/jcsample-altivec.c",
+ "simd/powerpc/jdcolor-altivec.c",
+ "simd/powerpc/jdmerge-altivec.c",
+ "simd/powerpc/jdsample-altivec.c",
+ "simd/powerpc/jfdctfst-altivec.c",
+ "simd/powerpc/jfdctint-altivec.c",
+ "simd/powerpc/jidctfst-altivec.c",
+ "simd/powerpc/jidctint-altivec.c",
+ "simd/powerpc/jquanti-altivec.c",
+ "simd/powerpc/jsimd.c",
],
hdrs = [
- "simd/jccolext-altivec.c", # should have been named .inc
- "simd/jcgryext-altivec.c", # should have been named .inc
- "simd/jdcolext-altivec.c", # should have been named .inc
- "simd/jdmrgext-altivec.c", # should have been named .inc
+ "simd/powerpc/jccolext-altivec.c",
+ "simd/powerpc/jcgryext-altivec.c",
+ "simd/powerpc/jdcolext-altivec.c",
+ "simd/powerpc/jdmrgext-altivec.c",
+ "simd/powerpc/jcsample.h",
+ "simd/powerpc/jsimd_altivec.h",
],
copts = libjpegturbo_copts,
nocopts = libjpegturbo_nocopts,
@@ -176,6 +176,7 @@ cc_library(
srcs = [
"jchuff.h",
"jconfig.h",
+ "jconfigint.h",
"jdct.h",
"jerror.h",
"jinclude.h",
@@ -184,24 +185,35 @@ cc_library(
"jpeglib.h",
"jsimd.h",
"jsimddct.h",
- "simd/jccolor-sse2-64.o",
- "simd/jcgray-sse2-64.o",
- "simd/jchuff-sse2-64.o",
- "simd/jcsample-sse2-64.o",
- "simd/jdcolor-sse2-64.o",
- "simd/jdmerge-sse2-64.o",
- "simd/jdsample-sse2-64.o",
- "simd/jfdctflt-sse-64.o",
- "simd/jfdctfst-sse2-64.o",
- "simd/jfdctint-sse2-64.o",
- "simd/jidctflt-sse2-64.o",
- "simd/jidctfst-sse2-64.o",
- "simd/jidctint-sse2-64.o",
- "simd/jidctred-sse2-64.o",
- "simd/jquantf-sse2-64.o",
- "simd/jquanti-sse2-64.o",
"simd/jsimd.h",
- "simd/jsimd_x86_64.c",
+ "simd/x86_64/jsimd.c",
+ "simd/x86_64/jccolor-avx2.o",
+ "simd/x86_64/jccolor-sse2.o",
+ "simd/x86_64/jcgray-avx2.o",
+ "simd/x86_64/jcgray-sse2.o",
+ "simd/x86_64/jchuff-sse2.o",
+ "simd/x86_64/jcphuff-sse2.o",
+ "simd/x86_64/jcsample-avx2.o",
+ "simd/x86_64/jcsample-sse2.o",
+ "simd/x86_64/jdcolor-avx2.o",
+ "simd/x86_64/jdcolor-sse2.o",
+ "simd/x86_64/jdmerge-avx2.o",
+ "simd/x86_64/jdmerge-sse2.o",
+ "simd/x86_64/jdsample-avx2.o",
+ "simd/x86_64/jdsample-sse2.o",
+ "simd/x86_64/jfdctflt-sse.o",
+ "simd/x86_64/jfdctfst-sse2.o",
+ "simd/x86_64/jfdctint-avx2.o",
+ "simd/x86_64/jfdctint-sse2.o",
+ "simd/x86_64/jidctflt-sse2.o",
+ "simd/x86_64/jidctfst-sse2.o",
+ "simd/x86_64/jidctint-avx2.o",
+ "simd/x86_64/jidctint-sse2.o",
+ "simd/x86_64/jidctred-sse2.o",
+ "simd/x86_64/jquantf-sse2.o",
+ "simd/x86_64/jquanti-avx2.o",
+ "simd/x86_64/jquanti-sse2.o",
+ "simd/x86_64/jsimdcpu.o",
],
copts = libjpegturbo_copts,
linkstatic = 1,
@@ -211,57 +223,88 @@ cc_library(
genrule(
name = "simd_x86_64_assemblage23",
srcs = [
- "simd/jccolext-sse2-64.asm",
- "simd/jccolor-sse2-64.asm",
- "simd/jcgray-sse2-64.asm",
- "simd/jcgryext-sse2-64.asm",
- "simd/jchuff-sse2-64.asm",
- "simd/jcolsamp.inc",
- "simd/jcsample-sse2-64.asm",
- "simd/jdcolext-sse2-64.asm",
- "simd/jdcolor-sse2-64.asm",
- "simd/jdct.inc",
- "simd/jdmerge-sse2-64.asm",
- "simd/jdmrgext-sse2-64.asm",
- "simd/jdsample-sse2-64.asm",
- "simd/jfdctflt-sse-64.asm",
- "simd/jfdctfst-sse2-64.asm",
- "simd/jfdctint-sse2-64.asm",
- "simd/jidctflt-sse2-64.asm",
- "simd/jidctfst-sse2-64.asm",
- "simd/jidctint-sse2-64.asm",
- "simd/jidctred-sse2-64.asm",
- "simd/jpeg_nbits_table.inc",
- "simd/jquantf-sse2-64.asm",
- "simd/jquanti-sse2-64.asm",
- "simd/jsimdcfg.inc",
- "simd/jsimdext.inc",
+ "jconfig.h",
+ "jconfigint.h",
+ "simd/x86_64/jccolext-avx2.asm",
+ "simd/x86_64/jccolext-sse2.asm",
+ "simd/x86_64/jccolor-avx2.asm",
+ "simd/x86_64/jccolor-sse2.asm",
+ "simd/x86_64/jcgray-avx2.asm",
+ "simd/x86_64/jcgray-sse2.asm",
+ "simd/x86_64/jcgryext-avx2.asm",
+ "simd/x86_64/jcgryext-sse2.asm",
+ "simd/x86_64/jchuff-sse2.asm",
+ "simd/x86_64/jcphuff-sse2.asm",
+ "simd/x86_64/jcsample-avx2.asm",
+ "simd/x86_64/jcsample-sse2.asm",
+ "simd/x86_64/jdcolext-avx2.asm",
+ "simd/x86_64/jdcolext-sse2.asm",
+ "simd/x86_64/jdcolor-avx2.asm",
+ "simd/x86_64/jdcolor-sse2.asm",
+ "simd/x86_64/jdmerge-avx2.asm",
+ "simd/x86_64/jdmerge-sse2.asm",
+ "simd/x86_64/jdmrgext-avx2.asm",
+ "simd/x86_64/jdmrgext-sse2.asm",
+ "simd/x86_64/jdsample-avx2.asm",
+ "simd/x86_64/jdsample-sse2.asm",
+ "simd/x86_64/jfdctflt-sse.asm",
+ "simd/x86_64/jfdctfst-sse2.asm",
+ "simd/x86_64/jfdctint-avx2.asm",
+ "simd/x86_64/jfdctint-sse2.asm",
+ "simd/x86_64/jidctflt-sse2.asm",
+ "simd/x86_64/jidctfst-sse2.asm",
+ "simd/x86_64/jidctint-avx2.asm",
+ "simd/x86_64/jidctint-sse2.asm",
+ "simd/x86_64/jidctred-sse2.asm",
+ "simd/x86_64/jquantf-sse2.asm",
+ "simd/x86_64/jquanti-avx2.asm",
+ "simd/x86_64/jquanti-sse2.asm",
+ "simd/x86_64/jsimdcpu.asm",
+ "simd/nasm/jcolsamp.inc",
+ "simd/nasm/jdct.inc",
+ "simd/nasm/jpeg_nbits_table.inc",
+ "simd/nasm/jsimdcfg.inc",
+ "simd/nasm/jsimdcfg.inc.h",
+ "simd/nasm/jsimdext.inc",
],
outs = [
- "simd/jccolor-sse2-64.o",
- "simd/jcgray-sse2-64.o",
- "simd/jchuff-sse2-64.o",
- "simd/jcsample-sse2-64.o",
- "simd/jdcolor-sse2-64.o",
- "simd/jdmerge-sse2-64.o",
- "simd/jdsample-sse2-64.o",
- "simd/jfdctflt-sse-64.o",
- "simd/jfdctfst-sse2-64.o",
- "simd/jfdctint-sse2-64.o",
- "simd/jidctflt-sse2-64.o",
- "simd/jidctfst-sse2-64.o",
- "simd/jidctint-sse2-64.o",
- "simd/jidctred-sse2-64.o",
- "simd/jquantf-sse2-64.o",
- "simd/jquanti-sse2-64.o",
+ "simd/x86_64/jccolor-avx2.o",
+ "simd/x86_64/jccolor-sse2.o",
+ "simd/x86_64/jcgray-avx2.o",
+ "simd/x86_64/jcgray-sse2.o",
+ "simd/x86_64/jchuff-sse2.o",
+ "simd/x86_64/jcphuff-sse2.o",
+ "simd/x86_64/jcsample-avx2.o",
+ "simd/x86_64/jcsample-sse2.o",
+ "simd/x86_64/jdcolor-avx2.o",
+ "simd/x86_64/jdcolor-sse2.o",
+ "simd/x86_64/jdmerge-avx2.o",
+ "simd/x86_64/jdmerge-sse2.o",
+ "simd/x86_64/jdsample-avx2.o",
+ "simd/x86_64/jdsample-sse2.o",
+ "simd/x86_64/jfdctflt-sse.o",
+ "simd/x86_64/jfdctfst-sse2.o",
+ "simd/x86_64/jfdctint-avx2.o",
+ "simd/x86_64/jfdctint-sse2.o",
+ "simd/x86_64/jidctflt-sse2.o",
+ "simd/x86_64/jidctfst-sse2.o",
+ "simd/x86_64/jidctint-avx2.o",
+ "simd/x86_64/jidctint-sse2.o",
+ "simd/x86_64/jidctred-sse2.o",
+ "simd/x86_64/jquantf-sse2.o",
+ "simd/x86_64/jquanti-avx2.o",
+ "simd/x86_64/jquanti-sse2.o",
+ "simd/x86_64/jsimdcpu.o",
],
cmd = "for out in $(OUTS); do\n" +
" $(location @nasm//:nasm) -f elf64" +
- " -DELF -DPIC -DRGBX_FILLER_0XFF -D__x86_64__ -DARCH_X86_64" +
- " -I $$(dirname $(location simd/jdct.inc))/" +
- " -I $$(dirname $(location simd/jsimdcfg.inc))/" +
+ " -DELF -DPIC -D__x86_64__" +
+ " -I $$(dirname $(location jconfig.h))/" +
+ " -I $$(dirname $(location jconfigint.h))/" +
+ " -I $$(dirname $(location simd/nasm/jsimdcfg.inc.h))/" +
+ " -I $$(dirname $(location simd/x86_64/jccolext-sse2.asm))/" +
" -o $$out" +
- " $$(dirname $(location simd/jdct.inc))/$$(basename $${out%.o}.asm)\n" +
+ " $$(dirname $(location simd/x86_64/jccolext-sse2.asm))/$$(basename $${out%.o}.asm)\n" +
"done",
tools = ["@nasm"],
)
@@ -272,14 +315,16 @@ cc_library(
"jchuff.h",
"jconfig.h",
"jdct.h",
+ "jerror.h",
"jinclude.h",
"jmorecfg.h",
+ "jpegint.h",
"jpeglib.h",
"jsimd.h",
"jsimddct.h",
"simd/jsimd.h",
- "simd/jsimd_arm.c",
- "simd/jsimd_arm_neon.S",
+ "simd/arm/jsimd.c",
+ "simd/arm/jsimd_neon.S",
],
copts = libjpegturbo_copts,
nocopts = libjpegturbo_nocopts,
@@ -291,20 +336,156 @@ cc_library(
"jchuff.h",
"jconfig.h",
"jdct.h",
+ "jerror.h",
"jinclude.h",
"jmorecfg.h",
+ "jpegint.h",
"jpeglib.h",
"jsimd.h",
"jsimddct.h",
"simd/jsimd.h",
- "simd/jsimd_arm64.c",
- "simd/jsimd_arm64_neon.S",
+ "simd/arm64/jsimd.c",
+ "simd/arm64/jsimd_neon.S",
],
copts = libjpegturbo_copts,
nocopts = libjpegturbo_nocopts,
)
cc_library(
+ name = "simd_win_x86_64",
+ srcs = [
+ "jchuff.h",
+ "jconfig.h",
+ "jconfigint.h",
+ "jdct.h",
+ "jerror.h",
+ "jinclude.h",
+ "jmorecfg.h",
+ "jpegint.h",
+ "jpeglib.h",
+ "jsimd.h",
+ "jsimddct.h",
+ "simd/jsimd.h",
+ "simd/x86_64/jsimd.c",
+ "simd/x86_64/jccolor-avx2.obj",
+ "simd/x86_64/jccolor-sse2.obj",
+ "simd/x86_64/jcgray-avx2.obj",
+ "simd/x86_64/jcgray-sse2.obj",
+ "simd/x86_64/jchuff-sse2.obj",
+ "simd/x86_64/jcphuff-sse2.obj",
+ "simd/x86_64/jcsample-avx2.obj",
+ "simd/x86_64/jcsample-sse2.obj",
+ "simd/x86_64/jdcolor-avx2.obj",
+ "simd/x86_64/jdcolor-sse2.obj",
+ "simd/x86_64/jdmerge-avx2.obj",
+ "simd/x86_64/jdmerge-sse2.obj",
+ "simd/x86_64/jdsample-avx2.obj",
+ "simd/x86_64/jdsample-sse2.obj",
+ "simd/x86_64/jfdctflt-sse.obj",
+ "simd/x86_64/jfdctfst-sse2.obj",
+ "simd/x86_64/jfdctint-avx2.obj",
+ "simd/x86_64/jfdctint-sse2.obj",
+ "simd/x86_64/jidctflt-sse2.obj",
+ "simd/x86_64/jidctfst-sse2.obj",
+ "simd/x86_64/jidctint-avx2.obj",
+ "simd/x86_64/jidctint-sse2.obj",
+ "simd/x86_64/jidctred-sse2.obj",
+ "simd/x86_64/jquantf-sse2.obj",
+ "simd/x86_64/jquanti-avx2.obj",
+ "simd/x86_64/jquanti-sse2.obj",
+ "simd/x86_64/jsimdcpu.obj",
+ ],
+ copts = libjpegturbo_copts,
+)
+
+genrule(
+ name = "simd_win_x86_64_assemble",
+ srcs = [
+ "jconfig.h",
+ "jconfigint.h",
+ "simd/x86_64/jccolext-avx2.asm",
+ "simd/x86_64/jccolext-sse2.asm",
+ "simd/x86_64/jccolor-avx2.asm",
+ "simd/x86_64/jccolor-sse2.asm",
+ "simd/x86_64/jcgray-avx2.asm",
+ "simd/x86_64/jcgray-sse2.asm",
+ "simd/x86_64/jcgryext-avx2.asm",
+ "simd/x86_64/jcgryext-sse2.asm",
+ "simd/x86_64/jchuff-sse2.asm",
+ "simd/x86_64/jcphuff-sse2.asm",
+ "simd/x86_64/jcsample-avx2.asm",
+ "simd/x86_64/jcsample-sse2.asm",
+ "simd/x86_64/jdcolext-avx2.asm",
+ "simd/x86_64/jdcolext-sse2.asm",
+ "simd/x86_64/jdcolor-avx2.asm",
+ "simd/x86_64/jdcolor-sse2.asm",
+ "simd/x86_64/jdmerge-avx2.asm",
+ "simd/x86_64/jdmerge-sse2.asm",
+ "simd/x86_64/jdmrgext-avx2.asm",
+ "simd/x86_64/jdmrgext-sse2.asm",
+ "simd/x86_64/jdsample-avx2.asm",
+ "simd/x86_64/jdsample-sse2.asm",
+ "simd/x86_64/jfdctflt-sse.asm",
+ "simd/x86_64/jfdctfst-sse2.asm",
+ "simd/x86_64/jfdctint-avx2.asm",
+ "simd/x86_64/jfdctint-sse2.asm",
+ "simd/x86_64/jidctflt-sse2.asm",
+ "simd/x86_64/jidctfst-sse2.asm",
+ "simd/x86_64/jidctint-avx2.asm",
+ "simd/x86_64/jidctint-sse2.asm",
+ "simd/x86_64/jidctred-sse2.asm",
+ "simd/x86_64/jquantf-sse2.asm",
+ "simd/x86_64/jquanti-avx2.asm",
+ "simd/x86_64/jquanti-sse2.asm",
+ "simd/x86_64/jsimdcpu.asm",
+ "simd/nasm/jcolsamp.inc",
+ "simd/nasm/jdct.inc",
+ "simd/nasm/jpeg_nbits_table.inc",
+ "simd/nasm/jsimdcfg.inc",
+ "simd/nasm/jsimdcfg.inc.h",
+ "simd/nasm/jsimdext.inc",
+ ],
+ outs = [
+ "simd/x86_64/jccolor-avx2.obj",
+ "simd/x86_64/jccolor-sse2.obj",
+ "simd/x86_64/jcgray-avx2.obj",
+ "simd/x86_64/jcgray-sse2.obj",
+ "simd/x86_64/jchuff-sse2.obj",
+ "simd/x86_64/jcphuff-sse2.obj",
+ "simd/x86_64/jcsample-avx2.obj",
+ "simd/x86_64/jcsample-sse2.obj",
+ "simd/x86_64/jdcolor-avx2.obj",
+ "simd/x86_64/jdcolor-sse2.obj",
+ "simd/x86_64/jdmerge-avx2.obj",
+ "simd/x86_64/jdmerge-sse2.obj",
+ "simd/x86_64/jdsample-avx2.obj",
+ "simd/x86_64/jdsample-sse2.obj",
+ "simd/x86_64/jfdctflt-sse.obj",
+ "simd/x86_64/jfdctfst-sse2.obj",
+ "simd/x86_64/jfdctint-avx2.obj",
+ "simd/x86_64/jfdctint-sse2.obj",
+ "simd/x86_64/jidctflt-sse2.obj",
+ "simd/x86_64/jidctfst-sse2.obj",
+ "simd/x86_64/jidctint-avx2.obj",
+ "simd/x86_64/jidctint-sse2.obj",
+ "simd/x86_64/jidctred-sse2.obj",
+ "simd/x86_64/jquantf-sse2.obj",
+ "simd/x86_64/jquanti-avx2.obj",
+ "simd/x86_64/jquanti-sse2.obj",
+ "simd/x86_64/jsimdcpu.obj",
+ ],
+ cmd = "for out in $(OUTS); do\n" +
+ " $(location @nasm//:nasm) -fwin64 -DWIN64 -D__x86_64__" +
+ " -I $$(dirname $(location simd/x86_64/jccolext-sse2.asm))/" +
+ " -I $$(dirname $(location simd/nasm/jdct.inc))/" +
+ " -I $$(dirname $(location simd/nasm/jdct.inc))/../../win/" +
+ " -o $$out" +
+ " $$(dirname $(location simd/x86_64/jccolext-sse2.asm))/$$(basename $${out%.obj}.asm)\n" +
+ "done",
+ tools = ["@nasm"],
+)
+
+cc_library(
name = "simd_none",
srcs = [
"jchuff.h",
@@ -329,50 +510,44 @@ template_rule(
out = "jconfig_win.h",
substitutions = {
"@JPEG_LIB_VERSION@": "62",
- "@VERSION@": "1.5.1",
- "@LIBJPEG_TURBO_VERSION_NUMBER@": "1005001",
- "cmakedefine": "define",
+ "@VERSION@": "2.0.0",
+ "@LIBJPEG_TURBO_VERSION_NUMBER@": "2000000",
"@BITS_IN_JSAMPLE@": "8",
- },
-)
-
-template_rule(
- name = "jconfigint_win",
- src = "win/jconfigint.h.in",
- out = "jconfigint_win.h",
- substitutions = {
- "@VERSION@": "1.5.1",
- "@BUILD@": "20161115",
- "@CMAKE_PROJECT_NAME@": "libjpeg-turbo",
+ "#cmakedefine C_ARITH_CODING_SUPPORTED": "#define C_ARITH_CODING_SUPPORTED",
+ "#cmakedefine D_ARITH_CODING_SUPPORTED": "#define D_ARITH_CODING_SUPPORTED",
+ "#cmakedefine MEM_SRCDST_SUPPORTED": "#define MEM_SRCDST_SUPPORTED",
+ "#cmakedefine WITH_SIMD": "",
},
)
JCONFIG_NOWIN_COMMON_SUBSTITUTIONS = {
- "LIBJPEG_TURBO_VERSION 0": "LIBJPEG_TURBO_VERSION 1.5.1",
- "LIBJPEG_TURBO_VERSION_NUMBER 0": "LIBJPEG_TURBO_VERSION_NUMBER 1005001",
- "#undef C_ARITH_CODING_SUPPORTED": "#define C_ARITH_CODING_SUPPORTED 1",
- "#undef D_ARITH_CODING_SUPPORTED": "#define D_ARITH_CODING_SUPPORTED 1",
- "#undef HAVE_LOCALE_H": "#define HAVE_LOCALE_H 1",
- "#undef HAVE_STDDEF_H": "#define HAVE_STDDEF_H 1",
- "#undef HAVE_STDLIB_H": "#define HAVE_STDLIB_H 1",
- "#undef HAVE_UNSIGNED_CHAR": "#define HAVE_UNSIGNED_CHAR 1",
- "#undef HAVE_UNSIGNED_SHORT": "#define HAVE_UNSIGNED_SHORT 1",
- "#undef INCOMPLETE_TYPES_BROKEN": "",
- "#undef MEM_SRCDST_SUPPORTED": "#define MEM_SRCDST_SUPPORTED 1",
- "#undef NEED_BSD_STRINGS": "",
- "#undef NEED_SYS_TYPES_H": "#define NEED_SYS_TYPES_H 1",
- "#undef __CHAR_UNSIGNED__": "",
+ "@JPEG_LIB_VERSION@": "62",
+ "@VERSION@": "2.0.0",
+ "@LIBJPEG_TURBO_VERSION_NUMBER@": "2000000",
+ "#cmakedefine C_ARITH_CODING_SUPPORTED": "#define C_ARITH_CODING_SUPPORTED",
+ "#cmakedefine D_ARITH_CODING_SUPPORTED": "#define D_ARITH_CODING_SUPPORTED",
+ "#cmakedefine MEM_SRCDST_SUPPORTED": "#define MEM_SRCDST_SUPPORTED",
+ "@BITS_IN_JSAMPLE@": "8",
+ "#cmakedefine HAVE_LOCALE_H": "#define HAVE_LOCALE_H 1",
+ "#cmakedefine HAVE_STDDEF_H": "#define HAVE_STDDEF_H 1",
+ "#cmakedefine HAVE_STDLIB_H": "#define HAVE_STDLIB_H 1",
+ "#cmakedefine NEED_SYS_TYPES_H": "#define NEED_SYS_TYPES_H",
+ "#cmakedefine NEED_BSD_STRINGS": "",
+ "#cmakedefine HAVE_UNSIGNED_CHAR": "#define HAVE_UNSIGNED_CHAR 1",
+ "#cmakedefine HAVE_UNSIGNED_SHORT": "#define HAVE_UNSIGNED_SHORT 1",
+ "#cmakedefine INCOMPLETE_TYPES_BROKEN": "",
+ "#cmakedefine RIGHT_SHIFT_IS_UNSIGNED": "",
+ "#cmakedefine __CHAR_UNSIGNED__": "",
"#undef const": "",
"#undef size_t": "",
- "#undef RIGHT_SHIFT_IS_UNSIGNED": "",
}
JCONFIG_NOWIN_SIMD_SUBSTITUTIONS = {
- "#undef WITH_SIMD": "#define WITH_SIMD 1",
+ "#cmakedefine WITH_SIMD": "#define WITH_SIMD",
}
JCONFIG_NOWIN_NOSIMD_SUBSTITUTIONS = {
- "#undef WITH_SIMD": "",
+ "#cmakedefine WITH_SIMD": "",
}
JCONFIG_NOWIN_SIMD_SUBSTITUTIONS.update(JCONFIG_NOWIN_COMMON_SUBSTITUTIONS)
@@ -393,22 +568,55 @@ template_rule(
substitutions = JCONFIG_NOWIN_SIMD_SUBSTITUTIONS,
)
+JCONFIGINT_COMMON_SUBSTITUTIONS = {
+ "@BUILD@": "20180831",
+ "@VERSION@": "2.0.0",
+ "@CMAKE_PROJECT_NAME@": "libjpeg-turbo",
+ "#undef inline": "",
+ "#cmakedefine HAVE_INTRIN_H": "",
+}
+
+JCONFIGINT_NOWIN_SUBSTITUTIONS = {
+ "#cmakedefine HAVE_BUILTIN_CTZL": "#define HAVE_BUILTIN_CTZL",
+ "@INLINE@": "inline __attribute__((always_inline))",
+ "#define SIZEOF_SIZE_T @SIZE_T@": "#if (__WORDSIZE==64 && !defined(__native_client__))\n" +
+ "#define SIZEOF_SIZE_T 8\n" +
+ "#else\n" +
+ "#define SIZEOF_SIZE_T 4\n" +
+ "#endif\n",
+}
+
+JCONFIGINT_WIN_SUBSTITUTIONS = {
+ "#cmakedefine HAVE_BUILTIN_CTZL": "",
+ "#define INLINE @INLINE@": "#if defined(__GNUC__)\n" +
+ "#define INLINE inline __attribute__((always_inline))\n" +
+ "#elif defined(_MSC_VER)\n" +
+ "#define INLINE __forceinline\n" +
+ "#else\n" +
+ "#define INLINE\n" +
+ "#endif\n",
+ "#define SIZEOF_SIZE_T @SIZE_T@": "#if (__WORDSIZE==64)\n" +
+ "#define SIZEOF_SIZE_T 8\n" +
+ "#else\n" +
+ "#define SIZEOF_SIZE_T 4\n" +
+ "#endif\n",
+}
+
+JCONFIGINT_NOWIN_SUBSTITUTIONS.update(JCONFIGINT_COMMON_SUBSTITUTIONS)
+JCONFIGINT_WIN_SUBSTITUTIONS.update(JCONFIGINT_COMMON_SUBSTITUTIONS)
+
template_rule(
name = "jconfigint_nowin",
src = "jconfigint.h.in",
out = "jconfigint_nowin.h",
- substitutions = {
- "#undef BUILD": "#define BUILD \"20161115\"",
- "#undef inline": "",
- "#undef INLINE": "#define INLINE inline __attribute__((always_inline))",
- "#undef PACKAGE_NAME": "#define PACKAGE_NAME \"libjpeg-turbo\"",
- "#undef VERSION": "#define VERSION \"1.5.1\"",
- "#undef SIZEOF_SIZE_T": "#if (__WORDSIZE==64 && !defined(__native_client__))\n" +
- "#define SIZEOF_SIZE_T 8\n" +
- "#else\n" +
- "#define SIZEOF_SIZE_T 4\n" +
- "#endif\n",
- },
+ substitutions = JCONFIGINT_NOWIN_SUBSTITUTIONS,
+)
+
+template_rule(
+ name = "jconfigint_win",
+ src = "jconfigint.h.in",
+ out = "jconfigint_win.h",
+ substitutions = JCONFIGINT_WIN_SUBSTITUTIONS,
)
genrule(
@@ -421,7 +629,6 @@ genrule(
outs = ["jconfig.h"],
cmd = select({
":windows": "cp $(location jconfig_win.h) $@",
- ":windows_msvc": "cp $(location jconfig_win.h) $@",
":k8": "cp $(location jconfig_nowin_simd.h) $@",
":armeabi-v7a": "cp $(location jconfig_nowin_simd.h) $@",
":arm64-v8a": "cp $(location jconfig_nowin_simd.h) $@",
@@ -439,7 +646,6 @@ genrule(
outs = ["jconfigint.h"],
cmd = select({
":windows": "cp $(location jconfigint_win.h) $@",
- ":windows_msvc": "cp $(location jconfigint_win.h) $@",
"//conditions:default": "cp $(location jconfigint_nowin.h) $@",
}),
)
@@ -526,12 +732,12 @@ config_setting(
config_setting(
name = "armeabi-v7a",
- values = {"android_cpu": "armeabi-v7a"},
+ values = {"cpu": "armeabi-v7a"},
)
config_setting(
name = "arm64-v8a",
- values = {"android_cpu": "arm64-v8a"},
+ values = {"cpu": "arm64-v8a"},
)
config_setting(
@@ -540,11 +746,6 @@ config_setting(
)
config_setting(
- name = "windows_msvc",
- values = {"cpu": "x64_windows_msvc"},
-)
-
-config_setting(
name = "linux_ppc64le",
values = {"cpu": "ppc"},
)
diff --git a/third_party/jsoncpp.BUILD b/third_party/jsoncpp.BUILD
index 65f98410b2..cf3cba0555 100644
--- a/third_party/jsoncpp.BUILD
+++ b/third_party/jsoncpp.BUILD
@@ -6,7 +6,6 @@ cc_library(
name = "jsoncpp",
srcs = [
"include/json/assertions.h",
- "src/lib_json/json_batchallocator.h",
"src/lib_json/json_reader.cpp",
"src/lib_json/json_tool.h",
"src/lib_json/json_value.cpp",
@@ -20,9 +19,13 @@ cc_library(
"include/json/json.h",
"include/json/reader.h",
"include/json/value.h",
+ "include/json/version.h",
"include/json/writer.h",
],
- copts = ["-DJSON_USE_EXCEPTION=0"],
+ copts = [
+ "-DJSON_USE_EXCEPTION=0",
+ "-DJSON_HAS_INT64",
+ ],
includes = ["include"],
visibility = ["//visibility:public"],
deps = [":private"],
diff --git a/third_party/kafka/BUILD b/third_party/kafka/BUILD
index a839ca717e..11ec50069a 100644
--- a/third_party/kafka/BUILD
+++ b/third_party/kafka/BUILD
@@ -15,6 +15,7 @@ cc_library(
"src-cpp/KafkaConsumerImpl.cpp",
"src-cpp/MessageImpl.cpp",
"src-cpp/MetadataImpl.cpp",
+ "src-cpp/ProducerImpl.cpp",
"src-cpp/QueueImpl.cpp",
"src-cpp/RdKafka.cpp",
"src-cpp/TopicImpl.cpp",
@@ -47,8 +48,13 @@ cc_library(
"src/rdinterval.h",
"src/rdkafka.c",
"src/rdkafka.h",
+ "src/rdkafka_admin.c",
+ "src/rdkafka_admin.h",
"src/rdkafka_assignor.c",
"src/rdkafka_assignor.h",
+ "src/rdkafka_aux.c",
+ "src/rdkafka_aux.h",
+ "src/rdkafka_background.c",
"src/rdkafka_broker.c",
"src/rdkafka_broker.h",
"src/rdkafka_buf.c",
@@ -57,9 +63,12 @@ cc_library(
"src/rdkafka_cgrp.h",
"src/rdkafka_conf.c",
"src/rdkafka_conf.h",
+ "src/rdkafka_confval.h",
"src/rdkafka_event.h",
"src/rdkafka_feature.c",
"src/rdkafka_feature.h",
+ "src/rdkafka_header.c",
+ "src/rdkafka_header.h",
"src/rdkafka_int.h",
"src/rdkafka_interceptor.c",
"src/rdkafka_interceptor.h",
@@ -93,7 +102,6 @@ cc_library(
"src/rdkafka_sasl_int.h",
"src/rdkafka_sasl_plain.c",
"src/rdkafka_subscription.c",
- "src/rdkafka_subscription.h",
"src/rdkafka_timer.c",
"src/rdkafka_timer.h",
"src/rdkafka_topic.c",
@@ -105,6 +113,8 @@ cc_library(
"src/rdlist.h",
"src/rdlog.c",
"src/rdlog.h",
+ "src/rdmurmur2.c",
+ "src/rdmurmur2.h",
"src/rdports.c",
"src/rdports.h",
"src/rdposix.h",
@@ -127,7 +137,15 @@ cc_library(
"src/tinycthread.h",
"src/xxhash.c",
"src/xxhash.h",
- ],
+ ] + select({
+ "@org_tensorflow//tensorflow:windows": [
+ "src/rdkafka_sasl_win32.c",
+ "src/rdwin32.h",
+ "src/regexp.c",
+ "src/regexp.h",
+ ],
+ "//conditions:default": [],
+ }),
hdrs = [
"config.h",
"src-cpp/rdkafkacpp.h",
@@ -135,15 +153,25 @@ cc_library(
"src/lz4.c",
"src/snappy_compat.h",
],
- copts = [
- "-Iexternal/kafka/src",
- "-Iexternal/kafka/src-cpp",
- ],
- defines = [
- ],
- linkopts = [
- "-lpthread",
+ copts = select({
+ "@org_tensorflow//tensorflow:windows": [
+ "-DWIN32_LEAN_AND_MEAN",
+ "-DWITHOUT_WIN32_CONFIG",
+ "-DWITH_ZLIB=1",
+ "-DWITH_SSL=1",
+ "-DWITH_SNAPPY=1",
+ ],
+ "//conditions:default": [],
+ }),
+ defines = ["LIBRDKAFKA_STATICLIB"],
+ includes = [
+ "src",
+ "src-cpp",
],
+ linkopts = select({
+ "@org_tensorflow//tensorflow:windows": ["-defaultlib:crypt32.lib"],
+ "//conditions:default": ["-lpthread"],
+ }),
visibility = ["//visibility:public"],
deps = [
"@boringssl//:ssl",
diff --git a/third_party/libxsmm.BUILD b/third_party/libxsmm.BUILD
index 4124f2db63..ee49d281ab 100644
--- a/third_party/libxsmm.BUILD
+++ b/third_party/libxsmm.BUILD
@@ -3,7 +3,7 @@
licenses(["notice"]) # BSD 3-clause
-exports_files(["LICENSE"])
+exports_files(["LICENSE.md"])
# Arguments to ./scripts/libxsmm_interface.py, see that file for detailed description.
# precision: SP & DP
@@ -38,8 +38,8 @@ genrule(
":libxsmm_interface",
],
visibility = [
- "//tensorflow/core/kernels:__pkg__",
"//third_party/eigen3:__pkg__",
+ "//tensorflow/core/kernels:__pkg__",
],
)
diff --git a/third_party/llvm/llvm.BUILD b/third_party/llvm/llvm.autogenerated.BUILD
index 28293a3659..776935739a 100644
--- a/third_party/llvm/llvm.BUILD
+++ b/third_party/llvm/llvm.autogenerated.BUILD
@@ -8,10 +8,14 @@ exports_files(["LICENSE.TXT"])
load(
"@org_tensorflow//third_party/llvm:llvm.bzl",
- "gentbl",
- "expand_cmake_vars",
- "llvm_target_cmake_vars",
"cmake_var_string",
+ "expand_cmake_vars",
+ "gentbl",
+ "llvm_all_cmake_vars",
+ "llvm_copts",
+ "llvm_defines",
+ "llvm_linkopts",
+ "llvm_support_platform_specific_srcs_glob",
)
load(
"@org_tensorflow//third_party:common.bzl",
@@ -24,9 +28,7 @@ llvm_host_triple = "x86_64-unknown-linux_gnu"
llvm_targets = [
"AArch64",
- # Uncomment to enable the AMDGPU backend.
- # TODO(phawkins): use a configure-time test.
- # "AMDGPU",
+ "AMDGPU",
"ARM",
"NVPTX",
"PowerPC",
@@ -39,154 +41,25 @@ llvm_target_asm_printers = llvm_targets
llvm_target_disassemblers = llvm_targets
-# TODO(phawkins): the set of CMake variables was hardcoded for expediency.
-# However, we should really detect many of these via configure-time tests.
-
-# The set of CMake variables common to all targets.
-cmake_vars = {
- # Headers
- "HAVE_DIRENT_H": 1,
- "HAVE_DLFCN_H": 1,
- "HAVE_ERRNO_H": 1,
- "HAVE_EXECINFO_H": 1,
- "HAVE_FCNTL_H": 1,
- "HAVE_INTTYPES_H": 1,
- "HAVE_PTHREAD_H": 1,
- "HAVE_SIGNAL_H": 1,
- "HAVE_STDINT_H": 1,
- "HAVE_SYS_IOCTL_H": 1,
- "HAVE_SYS_MMAN_H": 1,
- "HAVE_SYS_PARAM_H": 1,
- "HAVE_SYS_RESOURCE_H": 1,
- "HAVE_SYS_STAT_H": 1,
- "HAVE_SYS_TIME_H": 1,
- "HAVE_SYS_TYPES_H": 1,
- "HAVE_TERMIOS_H": 1,
- "HAVE_UNISTD_H": 1,
- "HAVE_ZLIB_H": 1,
-
- # Features
- "HAVE_BACKTRACE": 1,
- "BACKTRACE_HEADER": "execinfo.h",
- "HAVE_DLOPEN": 1,
- "HAVE_FUTIMES": 1,
- "HAVE_GETCWD": 1,
- "HAVE_GETPAGESIZE": 1,
- "HAVE_GETRLIMIT": 1,
- "HAVE_GETRUSAGE": 1,
- "HAVE_GETTIMEOFDAY": 1,
- "HAVE_INT64_T": 1,
- "HAVE_ISATTY": 1,
- "HAVE_LIBEDIT": 1,
- "HAVE_LIBPTHREAD": 1,
- "HAVE_LIBZ": 1,
- "HAVE_MKDTEMP": 1,
- "HAVE_MKSTEMP": 1,
- "HAVE_MKTEMP": 1,
- "HAVE_PREAD": 1,
- "HAVE_PTHREAD_GETSPECIFIC": 1,
- "HAVE_PTHREAD_MUTEX_LOCK": 1,
- "HAVE_PTHREAD_RWLOCK_INIT": 1,
- "HAVE_REALPATH": 1,
- "HAVE_SBRK": 1,
- "HAVE_SETENV": 1,
- "HAVE_SETRLIMIT": 1,
- "HAVE_SIGALTSTACK": 1,
- "HAVE_STRERROR": 1,
- "HAVE_STRERROR_R": 1,
- "HAVE_STRTOLL": 1,
- "HAVE_SYSCONF": 1,
- "HAVE_UINT64_T": 1,
- "HAVE__UNWIND_BACKTRACE": 1,
-
- # LLVM features
- "ENABLE_BACKTRACES": 1,
- "LLVM_BINDIR": "/dev/null",
- "LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING": 0,
- "LLVM_ENABLE_ABI_BREAKING_CHECKS": 0,
- "LLVM_ENABLE_THREADS": 1,
- "LLVM_ENABLE_ZLIB": 1,
- "LLVM_HAS_ATOMICS": 1,
- "LLVM_INCLUDEDIR": "/dev/null",
- "LLVM_INFODIR": "/dev/null",
- "LLVM_MANDIR": "/dev/null",
- "LLVM_NATIVE_TARGET": 1,
- "LLVM_NATIVE_TARGETINFO": 1,
- "LLVM_NATIVE_TARGETMC": 1,
- "LLVM_NATIVE_ASMPRINTER": 1,
- "LLVM_NATIVE_ASMPARSER": 1,
- "LLVM_NATIVE_DISASSEMBLER": 1,
- "LLVM_ON_UNIX": 1,
- "LLVM_PREFIX": "/dev/null",
- "LLVM_VERSION_MAJOR": 0,
- "LLVM_VERSION_MINOR": 0,
- "LLVM_VERSION_PATCH": 0,
- "LTDL_SHLIB_EXT": ".so",
- "PACKAGE_NAME": "llvm",
- "PACKAGE_STRING": "llvm tensorflow-trunk",
- "PACKAGE_VERSION": "tensorflow-trunk",
- "RETSIGTYPE": "void",
-}
-
-# CMake variables specific to the Linux platform
-linux_cmake_vars = {
- "HAVE_MALLOC_H": 1,
- "HAVE_LINK_H": 1,
- "HAVE_MALLINFO": 1,
- "HAVE_FUTIMENS": 1,
-}
-
-# CMake variables specific to the Darwin (Mac OS X) platform.
-darwin_cmake_vars = {
- "HAVE_MALLOC_MALLOC_H": 1,
-}
-
-# Select a set of CMake variables based on the platform.
-# TODO(phawkins): use a better method to select the right host triple, rather
-# than hardcoding x86_64.
-all_cmake_vars = select({
- "@org_tensorflow//tensorflow:darwin": cmake_var_string(
- cmake_vars + llvm_target_cmake_vars("X86", "x86_64-apple-darwin") +
- darwin_cmake_vars,
- ),
- "@org_tensorflow//tensorflow:linux_ppc64le": cmake_var_string(
- cmake_vars +
- llvm_target_cmake_vars("PowerPC", "powerpc64le-unknown-linux_gnu") +
- linux_cmake_vars,
- ),
- "//conditions:default": cmake_var_string(
- cmake_vars +
- llvm_target_cmake_vars("X86", "x86_64-unknown-linux_gnu") +
- linux_cmake_vars,
- ),
-})
-
# Performs CMake variable substitutions on configuration header files.
expand_cmake_vars(
- name = "datatypes_gen",
- src = "include/llvm/Support/DataTypes.h.cmake",
- cmake_vars = all_cmake_vars,
- dst = "include/llvm/Support/DataTypes.h",
-)
-
-expand_cmake_vars(
name = "config_gen",
src = "include/llvm/Config/config.h.cmake",
- cmake_vars = all_cmake_vars,
+ cmake_vars = llvm_all_cmake_vars,
dst = "include/llvm/Config/config.h",
)
expand_cmake_vars(
name = "llvm_config_gen",
src = "include/llvm/Config/llvm-config.h.cmake",
- cmake_vars = all_cmake_vars,
+ cmake_vars = llvm_all_cmake_vars,
dst = "include/llvm/Config/llvm-config.h",
)
expand_cmake_vars(
name = "abi_breaking_gen",
src = "include/llvm/Config/abi-breaking.h.cmake",
- cmake_vars = all_cmake_vars,
+ cmake_vars = llvm_all_cmake_vars,
dst = "include/llvm/Config/abi-breaking.h",
)
@@ -236,25 +109,25 @@ template_rule(
)
# A common library that all LLVM targets depend on.
+# TODO(b/113996071): We need to glob all potentially #included files and stage
+# them here because LLVM's build files are not strict headers clean, and remote
+# build execution requires all inputs to be depended upon.
cc_library(
name = "config",
- hdrs = [
+ hdrs = glob([
+ "**/*.h",
+ "**/*.def",
+ "**/*.inc.cpp",
+ ]) + [
"include/llvm/Config/AsmParsers.def",
"include/llvm/Config/AsmPrinters.def",
"include/llvm/Config/Disassemblers.def",
"include/llvm/Config/Targets.def",
- "include/llvm/Config/abi-breaking.h",
"include/llvm/Config/config.h",
"include/llvm/Config/llvm-config.h",
+ "include/llvm/Config/abi-breaking.h",
],
- defines = [
- "LLVM_ENABLE_STATS",
- "__STDC_LIMIT_MACROS",
- "__STDC_CONSTANT_MACROS",
- "__STDC_FORMAT_MACROS",
- "_DEBUG",
- "LLVM_BUILD_GLOBAL_ISEL",
- ],
+ defines = llvm_defines,
includes = ["include"],
)
@@ -270,19 +143,8 @@ genrule(
# Rules that apply the LLVM tblgen tool.
gentbl(
- name = "intrinsics_gen",
- tbl_outs = [("-gen-intrinsic", "include/llvm/IR/Intrinsics.gen")],
- tblgen = ":llvm-tblgen",
- td_file = "include/llvm/IR/Intrinsics.td",
- td_srcs = glob([
- "include/llvm/CodeGen/*.td",
- "include/llvm/IR/Intrinsics*.td",
- ]),
-)
-
-gentbl(
name = "attributes_gen",
- tbl_outs = [("-gen-attrs", "include/llvm/IR/Attributes.gen")],
+ tbl_outs = [("-gen-attrs", "include/llvm/IR/Attributes.inc")],
tblgen = ":llvm-tblgen",
td_file = "include/llvm/IR/Attributes.td",
td_srcs = ["include/llvm/IR/Attributes.td"],
@@ -299,20 +161,51 @@ gentbl(
],
)
+gentbl(
+ name = "instcombine_transforms_gen",
+ tbl_outs = [(
+ "-gen-searchable-tables",
+ "lib/Transforms/InstCombine/InstCombineTables.inc",
+ )],
+ tblgen = ":llvm-tblgen",
+ td_file = "lib/Transforms/InstCombine/InstCombineTables.td",
+ td_srcs = glob([
+ "include/llvm/CodeGen/*.td",
+ "include/llvm/IR/Intrinsics*.td",
+ ]) + ["include/llvm/TableGen/SearchableTable.td"],
+)
+
+gentbl(
+ name = "intrinsic_enums_gen",
+ tbl_outs = [("-gen-intrinsic-enums", "include/llvm/IR/IntrinsicEnums.inc")],
+ tblgen = ":llvm-tblgen",
+ td_file = "include/llvm/IR/Intrinsics.td",
+ td_srcs = glob([
+ "include/llvm/CodeGen/*.td",
+ "include/llvm/IR/Intrinsics*.td",
+ ]),
+)
+
+gentbl(
+ name = "intrinsics_impl_gen",
+ tbl_outs = [("-gen-intrinsic-impl", "include/llvm/IR/IntrinsicImpl.inc")],
+ tblgen = ":llvm-tblgen",
+ td_file = "include/llvm/IR/Intrinsics.td",
+ td_srcs = glob([
+ "include/llvm/CodeGen/*.td",
+ "include/llvm/IR/Intrinsics*.td",
+ ]),
+)
+
# Binary targets used by Tensorflow.
cc_binary(
name = "llvm-tblgen",
srcs = glob([
"utils/TableGen/*.cpp",
"utils/TableGen/*.h",
- ]) + [
- "lib/Target/X86/Disassembler/X86DisassemblerDecoderCommon.h",
- ],
- linkopts = [
- "-lm",
- "-ldl",
- "-lpthread",
- ],
+ ]),
+ copts = llvm_copts,
+ linkopts = llvm_linkopts,
stamp = 0,
deps = [
":config",
@@ -328,11 +221,8 @@ cc_binary(
"utils/FileCheck/*.cpp",
"utils/FileCheck/*.h",
]),
- linkopts = [
- "-ldl",
- "-lm",
- "-lpthread",
- ],
+ copts = llvm_copts,
+ linkopts = llvm_linkopts,
stamp = 0,
deps = [":support"],
)
@@ -371,13 +261,31 @@ llvm_target_list = [
("-gen-dag-isel", "lib/Target/AMDGPU/AMDGPUGenDAGISel.inc"),
("-gen-callingconv", "lib/Target/AMDGPU/AMDGPUGenCallingConv.inc"),
("-gen-subtarget", "lib/Target/AMDGPU/AMDGPUGenSubtargetInfo.inc"),
- ("-gen-tgt-intrinsic", "lib/Target/AMDGPU/AMDGPUGenIntrinsics.inc"),
+ ("-gen-tgt-intrinsic-impl", "lib/Target/AMDGPU/AMDGPUGenIntrinsicImpl.inc"),
+ ("-gen-tgt-intrinsic-enums", "lib/Target/AMDGPU/AMDGPUGenIntrinsicEnums.inc"),
("-gen-emitter", "lib/Target/AMDGPU/AMDGPUGenMCCodeEmitter.inc"),
("-gen-dfa-packetizer", "lib/Target/AMDGPU/AMDGPUGenDFAPacketizer.inc"),
("-gen-asm-writer", "lib/Target/AMDGPU/AMDGPUGenAsmWriter.inc"),
("-gen-asm-matcher", "lib/Target/AMDGPU/AMDGPUGenAsmMatcher.inc"),
("-gen-disassembler", "lib/Target/AMDGPU/AMDGPUGenDisassemblerTables.inc"),
("-gen-pseudo-lowering", "lib/Target/AMDGPU/AMDGPUGenMCPseudoLowering.inc"),
+ ("-gen-searchable-tables", "lib/Target/AMDGPU/AMDGPUGenSearchableTables.inc"),
+ ("-gen-global-isel", "lib/Target/AMDGPU/AMDGPUGenGlobalISel.inc"),
+ ],
+ },
+ {
+ "name": "AMDGPU",
+ "lower_name": "amdgpu_r600",
+ "short_name": "R600",
+ "tbl_outs": [
+ ("-gen-asm-writer", "lib/Target/AMDGPU/R600GenAsmWriter.inc"),
+ ("-gen-callingconv", "lib/Target/AMDGPU/R600GenCallingConv.inc"),
+ ("-gen-dag-isel", "lib/Target/AMDGPU/R600GenDAGISel.inc"),
+ ("-gen-dfa-packetizer", "lib/Target/AMDGPU/R600GenDFAPacketizer.inc"),
+ ("-gen-instr-info", "lib/Target/AMDGPU/R600GenInstrInfo.inc"),
+ ("-gen-emitter", "lib/Target/AMDGPU/R600GenMCCodeEmitter.inc"),
+ ("-gen-register-info", "lib/Target/AMDGPU/R600GenRegisterInfo.inc"),
+ ("-gen-subtarget", "lib/Target/AMDGPU/R600GenSubtargetInfo.inc"),
],
},
{
@@ -503,7 +411,7 @@ cc_library(
"include/llvm/Target/AArch64/AsmParser/*.inc",
"lib/Target/AArch64/AsmParser/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AArch64"],
deps = [
":aarch64_desc",
":aarch64_info",
@@ -528,7 +436,7 @@ cc_library(
"include/llvm/Target/AArch64/InstPrinter/*.inc",
"lib/Target/AArch64/InstPrinter/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AArch64"],
deps = [
":aarch64_target_gen",
":aarch64_utils",
@@ -551,7 +459,7 @@ cc_library(
"include/llvm/Target/AArch64/*.inc",
"lib/Target/AArch64/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AArch64"],
deps = [
":aarch64_asm_printer",
":aarch64_desc",
@@ -584,14 +492,15 @@ cc_library(
"include/llvm/Target/AArch64/MCTargetDesc/*.inc",
"lib/Target/AArch64/MCTargetDesc/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AArch64"],
deps = [
":aarch64_asm_printer",
":aarch64_info",
":aarch64_target_gen",
":attributes_gen",
":config",
- ":intrinsics_gen",
+ ":intrinsic_enums_gen",
+ ":intrinsics_impl_gen",
":mc",
":support",
],
@@ -610,7 +519,7 @@ cc_library(
"include/llvm/Target/AArch64/Disassembler/*.inc",
"lib/Target/AArch64/Disassembler/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AArch64"],
deps = [
":aarch64_desc",
":aarch64_info",
@@ -638,7 +547,7 @@ cc_library(
"lib/Target/AArch64/AArch64*.h",
"lib/Target/AArch64/TargetInfo/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AArch64"],
deps = [
":code_gen",
":config",
@@ -661,7 +570,7 @@ cc_library(
"include/llvm/Target/AArch64/Utils/*.inc",
"lib/Target/AArch64/Utils/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AArch64"],
deps = [
":aarch64_target_gen",
":config",
@@ -683,6 +592,7 @@ cc_library(
"include/llvm/Transforms/AggressiveInstCombine/*.def",
"include/llvm/Transforms/AggressiveInstCombine/*.inc",
]),
+ copts = llvm_copts,
deps = [
":analysis",
":config",
@@ -707,6 +617,7 @@ cc_library(
"include/llvm/Analysis/*.def",
"include/llvm/Analysis/*.inc",
]),
+ copts = llvm_copts,
deps = [
":binary_format",
":config",
@@ -730,7 +641,7 @@ cc_library(
"include/llvm/Target/AMDGPU/MCTargetDesc/*.inc",
"lib/Target/AMDGPU/MCTargetDesc/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AMDGPU"],
deps = [
":amdgpu_asm_printer",
":amdgpu_info",
@@ -755,7 +666,7 @@ cc_library(
"include/llvm/Target/AMDGPU/Disassembler/*.inc",
"lib/Target/AMDGPU/Disassembler/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AMDGPU"],
deps = [
":amdgpu_desc",
":amdgpu_info",
@@ -780,8 +691,9 @@ cc_library(
"include/llvm/Target/AMDGPU/TargetInfo/*.inc",
"lib/Target/AMDGPU/TargetInfo/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AMDGPU"],
deps = [
+ ":amdgpu_r600_target_gen",
":amdgpu_target_gen",
":config",
":core",
@@ -802,8 +714,9 @@ cc_library(
"include/llvm/Target/AMDGPU/Utils/*.inc",
"lib/Target/AMDGPU/Utils/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AMDGPU"],
deps = [
+ ":amdgpu_r600_target_gen",
":amdgpu_target_gen",
":config",
":core",
@@ -825,7 +738,7 @@ cc_library(
"include/llvm/Target/AMDGPU/AsmParser/*.inc",
"lib/Target/AMDGPU/AsmParser/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AMDGPU"],
deps = [
":amdgpu_desc",
":amdgpu_info",
@@ -850,7 +763,7 @@ cc_library(
"include/llvm/Target/AMDGPU/InstPrinter/*.inc",
"lib/Target/AMDGPU/InstPrinter/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AMDGPU"],
deps = [
":amdgpu_utils",
":config",
@@ -872,7 +785,7 @@ cc_library(
"include/llvm/Target/AMDGPU/*.inc",
"lib/Target/AMDGPU/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AMDGPU"],
deps = [
":amdgpu_asm_printer",
":amdgpu_desc",
@@ -908,7 +821,7 @@ cc_library(
"include/llvm/Target/ARM/AsmParser/*.inc",
"lib/Target/ARM/AsmParser/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/ARM"],
deps = [
":arm_desc",
":arm_info",
@@ -934,7 +847,7 @@ cc_library(
"lib/Target/ARM/*.h",
"lib/Target/ARM/InstPrinter/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/ARM"],
deps = [
":arm_info",
":arm_target_gen",
@@ -958,7 +871,7 @@ cc_library(
"include/llvm/Target/ARM/*.inc",
"lib/Target/ARM/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/ARM"],
deps = [
":analysis",
":arm_asm_printer",
@@ -975,6 +888,7 @@ cc_library(
":selection_dag",
":support",
":target",
+ ":transform_utils",
],
)
@@ -993,14 +907,15 @@ cc_library(
"include/llvm/Target/ARM/MCTargetDesc/*.inc",
"lib/Target/ARM/MCTargetDesc/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/ARM"],
deps = [
":arm_asm_printer",
":arm_info",
":arm_target_gen",
":attributes_gen",
":config",
- ":intrinsics_gen",
+ ":intrinsic_enums_gen",
+ ":intrinsics_impl_gen",
":mc",
":mc_disassembler",
":support",
@@ -1020,7 +935,7 @@ cc_library(
"include/llvm/Target/ARM/Disassembler/*.inc",
"lib/Target/ARM/Disassembler/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/ARM"],
deps = [
":arm_desc",
":arm_info",
@@ -1045,7 +960,7 @@ cc_library(
"include/llvm/Target/ARM/TargetInfo/*.inc",
"lib/Target/ARM/TargetInfo/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/ARM"],
deps = [
":arm_target_gen",
":config",
@@ -1068,7 +983,7 @@ cc_library(
"include/llvm/Target/ARM/Utils/*.inc",
"lib/Target/ARM/Utils/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/ARM"],
deps = [
":arm_target_gen",
":config",
@@ -1090,6 +1005,7 @@ cc_library(
"include/llvm/AsmParser/*.def",
"include/llvm/AsmParser/*.inc",
]),
+ copts = llvm_copts,
deps = [
":binary_format",
":config",
@@ -1112,6 +1028,7 @@ cc_library(
"include/llvm/CodeGen/AsmPrinter/*.inc",
"lib/CodeGen/AsmPrinter/*.def",
]),
+ copts = llvm_copts,
deps = [
":analysis",
":binary_format",
@@ -1142,6 +1059,7 @@ cc_library(
"include/llvm/BinaryFormat/ELFRelocs/*.def",
"include/llvm/BinaryFormat/WasmRelocs/*.def",
]),
+ copts = llvm_copts,
deps = [
":config",
":support",
@@ -1162,6 +1080,7 @@ cc_library(
"include/llvm/Bitcode/Reader/*.inc",
"include/llvm/Bitcode/BitstreamReader.h",
]),
+ copts = llvm_copts,
deps = [
":config",
":core",
@@ -1185,6 +1104,7 @@ cc_library(
"include/llvm/Bitcode/BitcodeWriterPass.h",
"include/llvm/Bitcode/BitstreamWriter.h",
]),
+ copts = llvm_copts,
deps = [
":analysis",
":config",
@@ -1209,6 +1129,7 @@ cc_library(
"include/llvm/CodeGen/*.inc",
"include/llvm/CodeGen/**/*.h",
]),
+ copts = llvm_copts,
deps = [
":analysis",
":bit_reader",
@@ -1246,12 +1167,14 @@ cc_library(
"include/llvm/*.h",
"include/llvm/Analysis/*.def",
]),
+ copts = llvm_copts,
deps = [
":attributes_compat_gen",
":attributes_gen",
":binary_format",
":config",
- ":intrinsics_gen",
+ ":intrinsic_enums_gen",
+ ":intrinsics_impl_gen",
":support",
],
)
@@ -1269,6 +1192,7 @@ cc_library(
"include/llvm/DebugInfo/CodeView/*.def",
"include/llvm/DebugInfo/CodeView/*.inc",
]),
+ copts = llvm_copts,
deps = [
":binary_format",
":config",
@@ -1290,6 +1214,7 @@ cc_library(
"include/llvm/DebugInfo/MSF/*.def",
"include/llvm/DebugInfo/MSF/*.inc",
]),
+ copts = llvm_copts,
deps = [
":config",
":support",
@@ -1309,6 +1234,7 @@ cc_library(
"include/llvm/Demangle/*.def",
"include/llvm/Demangle/*.inc",
]),
+ copts = llvm_copts,
deps = [":config"],
)
@@ -1325,6 +1251,7 @@ cc_library(
"include/llvm/ExecutionEngine/*.def",
"include/llvm/ExecutionEngine/*.inc",
]),
+ copts = llvm_copts,
deps = [
":config",
":core",
@@ -1349,6 +1276,7 @@ cc_library(
"include/llvm/CodeGen/GlobalISel/*.def",
"include/llvm/CodeGen/GlobalISel/*.inc",
]),
+ copts = llvm_copts,
deps = [
":analysis",
":code_gen",
@@ -1378,6 +1306,7 @@ cc_library(
"include/llvm/Transforms/InstrProfiling.h",
"include/llvm/Transforms/PGOInstrumentation.h",
]),
+ copts = llvm_copts,
deps = [
":analysis",
":config",
@@ -1402,10 +1331,12 @@ cc_library(
"include/llvm/Transforms/InstCombine/*.def",
"include/llvm/Transforms/InstCombine/*.inc",
]),
+ copts = llvm_copts,
deps = [
":analysis",
":config",
":core",
+ ":instcombine_transforms_gen",
":support",
":transform_utils",
],
@@ -1427,6 +1358,7 @@ cc_library(
"include/llvm/Transforms/IPO/*.def",
"include/llvm/Transforms/IPO/*.inc",
]),
+ copts = llvm_copts,
deps = [
":aggressive_inst_combine",
":analysis",
@@ -1460,6 +1392,7 @@ cc_library(
"include/llvm/IRReader/*.def",
"include/llvm/IRReader/*.inc",
]),
+ copts = llvm_copts,
deps = [
":asm_parser",
":bit_reader",
@@ -1482,6 +1415,7 @@ cc_library(
"include/llvm/Linker/*.def",
"include/llvm/Linker/*.inc",
]),
+ copts = llvm_copts,
deps = [
":config",
":core",
@@ -1503,6 +1437,7 @@ cc_library(
"include/llvm/MC/*.def",
"include/llvm/MC/*.inc",
]),
+ copts = llvm_copts,
deps = [
":binary_format",
":config",
@@ -1524,6 +1459,7 @@ cc_library(
"include/llvm/MC/MCDisassembler/*.def",
"include/llvm/MC/MCDisassembler/*.inc",
]),
+ copts = llvm_copts,
deps = [
":config",
":mc",
@@ -1544,6 +1480,7 @@ cc_library(
"include/llvm/MC/MCParser/*.def",
"include/llvm/MC/MCParser/*.inc",
]),
+ copts = llvm_copts,
deps = [
":config",
":mc",
@@ -1564,7 +1501,7 @@ cc_library(
"include/llvm/Target/NVPTX/InstPrinter/*.inc",
"lib/Target/NVPTX/InstPrinter/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/NVPTX"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/NVPTX"],
deps = [
"nvptx_target_gen",
":attributes_gen",
@@ -1588,7 +1525,7 @@ cc_library(
"include/llvm/Target/NVPTX/*.inc",
"lib/Target/NVPTX/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/NVPTX"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/NVPTX"],
deps = [
":analysis",
":asm_printer",
@@ -1622,7 +1559,7 @@ cc_library(
"include/llvm/Target/NVPTX/MCTargetDesc/*.inc",
"lib/Target/NVPTX/MCTargetDesc/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/NVPTX"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/NVPTX"],
deps = [
"nvptx_target_gen",
":config",
@@ -1648,7 +1585,7 @@ cc_library(
"lib/Target/NVPTX/NVPTX.h",
"lib/Target/NVPTX/TargetInfo/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/NVPTX"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/NVPTX"],
deps = [
"nvptx_target_gen",
":attributes_gen",
@@ -1672,6 +1609,7 @@ cc_library(
"include/llvm/Object/*.def",
"include/llvm/Object/*.inc",
]),
+ copts = llvm_copts,
deps = [
":binary_format",
":bit_reader",
@@ -1697,6 +1635,7 @@ cc_library(
"include/llvm/Transforms/ObjCARC/*.def",
"include/llvm/Transforms/ObjCARC/*.inc",
]),
+ copts = llvm_copts,
deps = [
":analysis",
":config",
@@ -1719,13 +1658,16 @@ cc_library(
"include/llvm/ExecutionEngine/Orc/*.def",
"include/llvm/ExecutionEngine/Orc/*.inc",
]),
+ copts = llvm_copts,
deps = [
":config",
":core",
":execution_engine",
+ ":mc",
":object",
":runtime_dyld",
":support",
+ ":target",
":transform_utils",
],
)
@@ -1743,7 +1685,7 @@ cc_library(
"include/llvm/Target/PowerPC/AsmParser/*.inc",
"lib/Target/PowerPC/AsmParser/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/PowerPC"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/PowerPC"],
deps = [
":config",
":mc",
@@ -1767,11 +1709,12 @@ cc_library(
"include/llvm/Target/PowerPC/InstPrinter/*.inc",
"lib/Target/PowerPC/InstPrinter/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/PowerPC"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/PowerPC"],
deps = [
":attributes_gen",
":config",
- ":intrinsics_gen",
+ ":intrinsic_enums_gen",
+ ":intrinsics_impl_gen",
":mc",
":powerpc_info",
":powerpc_target_gen",
@@ -1792,7 +1735,7 @@ cc_library(
"include/llvm/Target/PowerPC/*.inc",
"lib/Target/PowerPC/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/PowerPC"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/PowerPC"],
deps = [
":analysis",
":asm_printer",
@@ -1824,11 +1767,12 @@ cc_library(
"include/llvm/Target/PowerPC/MCTargetDesc/*.inc",
"lib/Target/PowerPC/MCTargetDesc/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/PowerPC"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/PowerPC"],
deps = [
":attributes_gen",
":config",
- ":intrinsics_gen",
+ ":intrinsic_enums_gen",
+ ":intrinsics_impl_gen",
":mc",
":powerpc_asm_printer",
":powerpc_info",
@@ -1850,7 +1794,7 @@ cc_library(
"include/llvm/Target/PowerPC/Disassembler/*.inc",
"lib/Target/PowerPC/Disassembler/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/PowerPC"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/PowerPC"],
deps = [
":config",
":mc_disassembler",
@@ -1874,12 +1818,11 @@ cc_library(
"lib/Target/PowerPC/PPC*.h",
"lib/Target/PowerPC/TargetInfo/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/PowerPC"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/PowerPC"],
deps = [
":attributes_gen",
":config",
":core",
- ":intrinsics_gen",
":powerpc_target_gen",
":support",
":target",
@@ -1899,6 +1842,7 @@ cc_library(
"include/llvm/ProfileData/*.def",
"include/llvm/ProfileData/*.inc",
]),
+ copts = llvm_copts,
deps = [
":config",
":core",
@@ -1927,6 +1871,7 @@ cc_library(
"include/llvm/ExecutionEngine/RTDyldMemoryManager.h",
"include/llvm/ExecutionEngine/RuntimeDyld*.h",
]),
+ copts = llvm_copts,
deps = [
":config",
":mc",
@@ -1954,6 +1899,7 @@ cc_library(
"include/llvm/Transforms/IPO.h",
"include/llvm/Transforms/IPO/SCCP.h",
]),
+ copts = llvm_copts,
deps = [
":aggressive_inst_combine",
":analysis",
@@ -1979,6 +1925,7 @@ cc_library(
"include/llvm/CodeGen/SelectionDAG/*.def",
"include/llvm/CodeGen/SelectionDAG/*.inc",
]),
+ copts = llvm_copts,
deps = [
":analysis",
":code_gen",
@@ -1997,14 +1944,12 @@ cc_library(
"lib/Support/*.c",
"lib/Support/*.cpp",
"lib/Support/*.inc",
- "lib/Support/Unix/*.inc",
- "lib/Support/Unix/*.h",
"include/llvm-c/*.h",
"include/llvm/CodeGen/MachineValueType.h",
"include/llvm/BinaryFormat/COFF.h",
"include/llvm/BinaryFormat/MachO.h",
"lib/Support/*.h",
- ]),
+ ]) + llvm_support_platform_specific_srcs_glob(),
hdrs = glob([
"include/llvm/Support/*.h",
"include/llvm/Support/*.def",
@@ -2014,10 +1959,9 @@ cc_library(
"include/llvm/Support/WasmRelocs/*.def",
]) + [
"include/llvm/BinaryFormat/MachO.def",
- "include/llvm/Support/DataTypes.h",
"include/llvm/Support/VCSRevision.h",
- "include/llvm/ExecutionEngine/ObjectMemoryBuffer.h",
],
+ copts = llvm_copts,
deps = [
":config",
":demangle",
@@ -2040,6 +1984,7 @@ cc_library(
"include/llvm/TableGen/*.inc",
"include/llvm/Target/*.def",
]),
+ copts = llvm_copts,
deps = [
":config",
":mc",
@@ -2063,7 +2008,9 @@ cc_library(
"include/llvm/Target/*.def",
"include/llvm/Target/*.inc",
"include/llvm/CodeGen/*.def",
+ "include/llvm/CodeGen/*.inc",
]),
+ copts = llvm_copts,
deps = [
":analysis",
":config",
@@ -2088,6 +2035,7 @@ cc_library(
"include/llvm/Transforms/Utils/*.def",
"include/llvm/Transforms/Utils/*.inc",
]),
+ copts = llvm_copts,
deps = [
":analysis",
":config",
@@ -2111,6 +2059,7 @@ cc_library(
"include/llvm/Transforms/Vectorize/*.inc",
"include/llvm/Transforms/Vectorize.h",
]),
+ copts = llvm_copts,
deps = [
":analysis",
":config",
@@ -2134,7 +2083,7 @@ cc_library(
"include/llvm/Target/X86/AsmParser/*.inc",
"lib/Target/X86/AsmParser/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/X86"],
deps = [
":config",
":mc",
@@ -2159,7 +2108,7 @@ cc_library(
"include/llvm/Target/X86/InstPrinter/*.inc",
"lib/Target/X86/InstPrinter/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/X86"],
deps = [
":config",
":mc",
@@ -2183,7 +2132,7 @@ cc_library(
"include/llvm/Target/X86/*.inc",
"lib/Target/X86/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/X86"],
deps = [
":analysis",
":asm_printer",
@@ -2216,7 +2165,7 @@ cc_library(
"include/llvm/Target/X86/MCTargetDesc/*.inc",
"lib/Target/X86/MCTargetDesc/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/X86"],
deps = [
":config",
":mc",
@@ -2241,7 +2190,7 @@ cc_library(
"include/llvm/Target/X86/Disassembler/*.inc",
"lib/Target/X86/Disassembler/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/X86"],
deps = [
":config",
":mc_disassembler",
@@ -2264,7 +2213,7 @@ cc_library(
"include/llvm/Target/X86/TargetInfo/*.inc",
"lib/Target/X86/TargetInfo/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/X86"],
deps = [
":config",
":mc",
@@ -2286,7 +2235,7 @@ cc_library(
"include/llvm/Target/X86/Utils/*.inc",
"lib/Target/X86/Utils/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = llvm_copts + ["-Iexternal/llvm/lib/Target/X86"],
deps = [
":code_gen",
":config",
diff --git a/third_party/llvm/llvm.bzl b/third_party/llvm/llvm.bzl
index 0efcf319bd..54ca86f327 100644
--- a/third_party/llvm/llvm.bzl
+++ b/third_party/llvm/llvm.bzl
@@ -7,101 +7,408 @@ TODO(chandlerc): Currently this expresses include-based dependencies as
correctly understood by the build system.
"""
+def _dict_add(*dictionaries):
+ """Returns a new `dict` that has all the entries of the given dictionaries.
+
+ If the same key is present in more than one of the input dictionaries, the
+ last of them in the argument list overrides any earlier ones.
+
+ This function is designed to take zero or one arguments as well as multiple
+ dictionaries, so that it follows arithmetic identities and callers can avoid
+ special cases for their inputs: the sum of zero dictionaries is the empty
+ dictionary, and the sum of a single dictionary is a copy of itself.
+
+ Re-implemented here to avoid adding a dependency on skylib.
+
+ Args:
+ *dictionaries: Zero or more dictionaries to be added.
+
+ Returns:
+ A new `dict` that has all the entries of the given dictionaries.
+ """
+ result = {}
+ for d in dictionaries:
+ result.update(d)
+ return result
+
def gentbl(name, tblgen, td_file, td_srcs, tbl_outs, library = True, **kwargs):
- """gentbl() generates tabular code from a table definition file.
-
- Args:
- name: The name of the build rule for use in dependencies.
- tblgen: The binary used to produce the output.
- td_file: The primary table definitions file.
- td_srcs: A list of table definition files included transitively.
- tbl_outs: A list of tuples (opts, out), where each opts is a string of
- options passed to tblgen, and the out is the corresponding output file
- produced.
- library: Whether to bundle the generated files into a library.
- **kwargs: Keyword arguments to pass to subsidiary cc_library() rule.
- """
- if td_file not in td_srcs:
- td_srcs += [td_file]
- includes = []
- for (opts, out) in tbl_outs:
- outdir = out[:out.rindex("/")]
- if outdir not in includes:
- includes.append(outdir)
- rule_suffix = "_".join(opts.replace("-", "_").replace("=", "_").split(" "))
- native.genrule(
- name="%s_%s_genrule" % (name, rule_suffix),
- srcs=td_srcs,
- outs=[out],
- tools=[tblgen],
- message="Generating code from table: %s" % td_file,
- cmd=(("$(location %s) " + "-I external/llvm/include " +
- "-I external/llvm/tools/clang/include " +
- "-I $$(dirname $(location %s)) " + "%s $(location %s) -o $@") % (
- tblgen, td_file, opts, td_file)))
- # For now, all generated files can be assumed to comprise public interfaces.
- # If this is not true, you should specify library = False
- # and list the generated '.inc' files in "srcs".
- if library:
- native.cc_library(name=name, textual_hdrs=[f for (_, f) in tbl_outs],
- includes=includes, **kwargs)
+ """gentbl() generates tabular code from a table definition file.
+
+ Args:
+ name: The name of the build rule for use in dependencies.
+ tblgen: The binary used to produce the output.
+ td_file: The primary table definitions file.
+ td_srcs: A list of table definition files included transitively.
+ tbl_outs: A list of tuples (opts, out), where each opts is a string of
+ options passed to tblgen, and the out is the corresponding output file
+ produced.
+ library: Whether to bundle the generated files into a library.
+ **kwargs: Keyword arguments to pass to subsidiary cc_library() rule.
+ """
+ if td_file not in td_srcs:
+ td_srcs += [td_file]
+ includes = []
+ for (opts, out) in tbl_outs:
+ outdir = out[:out.rindex("/")]
+ if outdir not in includes:
+ includes.append(outdir)
+ rule_suffix = "_".join(opts.replace("-", "_").replace("=", "_").split(" "))
+ native.genrule(
+ name = "%s_%s_genrule" % (name, rule_suffix),
+ srcs = td_srcs,
+ outs = [out],
+ tools = [tblgen],
+ message = "Generating code from table: %s" % td_file,
+ cmd = (("$(location %s) " + "-I external/llvm/include " +
+ "-I external/llvm/tools/clang/include " +
+ "-I $$(dirname $(location %s)) " + "%s $(location %s) -o $@") % (
+ tblgen,
+ td_file,
+ opts,
+ td_file,
+ )),
+ )
+
+ # For now, all generated files can be assumed to comprise public interfaces.
+ # If this is not true, you should specify library = False
+ # and list the generated '.inc' files in "srcs".
+ if library:
+ native.cc_library(
+ name = name,
+ textual_hdrs = [f for (_, f) in tbl_outs],
+ includes = includes,
+ **kwargs
+ )
def llvm_target_cmake_vars(native_arch, target_triple):
- return {
- "LLVM_HOST_TRIPLE": target_triple,
- "LLVM_DEFAULT_TARGET_TRIPLE": target_triple,
- "LLVM_NATIVE_ARCH": native_arch,
- }
+ return {
+ "LLVM_HOST_TRIPLE": target_triple,
+ "LLVM_DEFAULT_TARGET_TRIPLE": target_triple,
+ "LLVM_NATIVE_ARCH": native_arch,
+ }
def _quote(s):
- """Quotes the given string for use in a shell command.
-
- This function double-quotes the given string (in case it contains spaces or
- other special characters) and escapes any special characters (dollar signs,
- double-quotes, and backslashes) that may be present.
-
- Args:
- s: The string to quote.
- Returns:
- An escaped and quoted version of the string that can be passed to a shell
- command.
- """
- return ('"' +
- s.replace("\\", "\\\\").replace("$", "\\$").replace('"', '\\"') +
- '"')
+ """Quotes the given string for use in a shell command.
+
+ This function double-quotes the given string (in case it contains spaces or
+ other special characters) and escapes any special characters (dollar signs,
+ double-quotes, and backslashes) that may be present.
+
+ Args:
+ s: The string to quote.
+
+ Returns:
+ An escaped and quoted version of the string that can be passed to a shell
+ command.
+ """
+ return ('"' +
+ s.replace("\\", "\\\\").replace("$", "\\$").replace('"', '\\"') +
+ '"')
def cmake_var_string(cmake_vars):
- """Converts a dictionary to an input suitable for expand_cmake_vars.
+ """Converts a dictionary to an input suitable for expand_cmake_vars.
- Ideally we would jist stringify in the expand_cmake_vars() rule, but select()
- interacts badly with genrules.
+ Ideally we would jist stringify in the expand_cmake_vars() rule, but select()
+ interacts badly with genrules.
- TODO(phawkins): replace the genrule() with native rule and delete this rule.
+ TODO(phawkins): replace the genrule() with native rule and delete this rule.
- Args:
- cmake_vars: a dictionary with string keys and values that are convertable to
- strings.
- """
- return " ".join([_quote("{}={}".format(k, str(v)))
- for (k, v) in cmake_vars.items()])
+ Args:
+ cmake_vars: a dictionary with string keys and values that are convertable to
+ strings.
+
+ Returns:
+ cmake_vars in a form suitable for passing to expand_cmake_vars.
+ """
+ return " ".join([
+ _quote("{}={}".format(k, str(v)))
+ for (k, v) in cmake_vars.items()
+ ])
def expand_cmake_vars(name, src, dst, cmake_vars):
- """Expands #cmakedefine, #cmakedefine01, and CMake variables in a text file.
-
- Args:
- name: the name of the rule
- src: the input of the rule
- dst: the output of the rule
- cmake_vars: a string containing the CMake variables, as generated by
- cmake_var_string.
- """
- expand_cmake_vars_tool = Label("@org_tensorflow//third_party/llvm:expand_cmake_vars")
- native.genrule(
- name = name,
- srcs = [src],
- tools = [expand_cmake_vars_tool],
- outs = [dst],
- cmd = ("$(location {}) ".format(expand_cmake_vars_tool) + cmake_vars +
- "< $< > $@")
- )
+ """Expands #cmakedefine, #cmakedefine01, and CMake variables in a text file.
+
+ Args:
+ name: the name of the rule
+ src: the input of the rule
+ dst: the output of the rule
+ cmake_vars: a string containing the CMake variables, as generated by
+ cmake_var_string.
+ """
+ expand_cmake_vars_tool = Label("@org_tensorflow//third_party/llvm:expand_cmake_vars")
+ native.genrule(
+ name = name,
+ srcs = [src],
+ tools = [expand_cmake_vars_tool],
+ outs = [dst],
+ cmd = ("$(location {}) ".format(expand_cmake_vars_tool) + cmake_vars +
+ "< $< > $@"),
+ )
+
+# TODO(phawkins): the set of CMake variables was hardcoded for expediency.
+# However, we should really detect many of these via configure-time tests.
+
+# The set of CMake variables common to all targets.
+cmake_vars = {
+ # LLVM features
+ "ENABLE_BACKTRACES": 1,
+ "LLVM_BINDIR": "/dev/null",
+ "LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING": 0,
+ "LLVM_ENABLE_ABI_BREAKING_CHECKS": 0,
+ "LLVM_ENABLE_THREADS": 1,
+ "LLVM_ENABLE_ZLIB": 1,
+ "LLVM_HAS_ATOMICS": 1,
+ "LLVM_INCLUDEDIR": "/dev/null",
+ "LLVM_INFODIR": "/dev/null",
+ "LLVM_MANDIR": "/dev/null",
+ "LLVM_NATIVE_TARGET": 1,
+ "LLVM_NATIVE_TARGETINFO": 1,
+ "LLVM_NATIVE_TARGETMC": 1,
+ "LLVM_NATIVE_ASMPRINTER": 1,
+ "LLVM_NATIVE_ASMPARSER": 1,
+ "LLVM_NATIVE_DISASSEMBLER": 1,
+ "LLVM_PREFIX": "/dev/null",
+ "LLVM_VERSION_MAJOR": 0,
+ "LLVM_VERSION_MINOR": 0,
+ "LLVM_VERSION_PATCH": 0,
+ "PACKAGE_NAME": "llvm",
+ "PACKAGE_STRING": "llvm tensorflow-trunk",
+ "PACKAGE_VERSION": "tensorflow-trunk",
+ "RETSIGTYPE": "void",
+}
+
+# The set of CMake variables common to POSIX targets.
+posix_cmake_vars = {
+ # Headers
+ "HAVE_DIRENT_H": 1,
+ "HAVE_DLFCN_H": 1,
+ "HAVE_ERRNO_H": 1,
+ "HAVE_EXECINFO_H": 1,
+ "HAVE_FCNTL_H": 1,
+ "HAVE_INTTYPES_H": 1,
+ "HAVE_PTHREAD_H": 1,
+ "HAVE_SIGNAL_H": 1,
+ "HAVE_STDINT_H": 1,
+ "HAVE_SYS_IOCTL_H": 1,
+ "HAVE_SYS_MMAN_H": 1,
+ "HAVE_SYS_PARAM_H": 1,
+ "HAVE_SYS_RESOURCE_H": 1,
+ "HAVE_SYS_STAT_H": 1,
+ "HAVE_SYS_TIME_H": 1,
+ "HAVE_SYS_TYPES_H": 1,
+ "HAVE_TERMIOS_H": 1,
+ "HAVE_UNISTD_H": 1,
+ "HAVE_ZLIB_H": 1,
+
+ # Features
+ "HAVE_BACKTRACE": 1,
+ "BACKTRACE_HEADER": "execinfo.h",
+ "HAVE_DLOPEN": 1,
+ "HAVE_FUTIMES": 1,
+ "HAVE_GETCWD": 1,
+ "HAVE_GETPAGESIZE": 1,
+ "HAVE_GETRLIMIT": 1,
+ "HAVE_GETRUSAGE": 1,
+ "HAVE_GETTIMEOFDAY": 1,
+ "HAVE_INT64_T": 1,
+ "HAVE_ISATTY": 1,
+ "HAVE_LIBEDIT": 1,
+ "HAVE_LIBPTHREAD": 1,
+ "HAVE_LIBZ": 1,
+ "HAVE_MKDTEMP": 1,
+ "HAVE_MKSTEMP": 1,
+ "HAVE_MKTEMP": 1,
+ "HAVE_PREAD": 1,
+ "HAVE_PTHREAD_GETSPECIFIC": 1,
+ "HAVE_PTHREAD_MUTEX_LOCK": 1,
+ "HAVE_PTHREAD_RWLOCK_INIT": 1,
+ "HAVE_REALPATH": 1,
+ "HAVE_SBRK": 1,
+ "HAVE_SETENV": 1,
+ "HAVE_SETRLIMIT": 1,
+ "HAVE_SIGALTSTACK": 1,
+ "HAVE_STRERROR": 1,
+ "HAVE_STRERROR_R": 1,
+ "HAVE_STRTOLL": 1,
+ "HAVE_SYSCONF": 1,
+ "HAVE_UINT64_T": 1,
+ "HAVE__UNWIND_BACKTRACE": 1,
+
+ # LLVM features
+ "LLVM_ON_UNIX": 1,
+ "LTDL_SHLIB_EXT": ".so",
+}
+
+# CMake variables specific to the Linux platform
+linux_cmake_vars = {
+ "HAVE_MALLOC_H": 1,
+ "HAVE_LINK_H": 1,
+ "HAVE_MALLINFO": 1,
+ "HAVE_FUTIMENS": 1,
+}
+
+# CMake variables specific to the Darwin (Mac OS X) platform.
+darwin_cmake_vars = {
+ "HAVE_MALLOC_MALLOC_H": 1,
+}
+
+# CMake variables specific to the Windows platform.
+win32_cmake_vars = {
+ # Headers
+ "HAVE_ERRNO_H": 1,
+ "HAVE_EXECINFO_H": 1,
+ "HAVE_FCNTL_H": 1,
+ "HAVE_FENV_H": 1,
+ "HAVE_INTTYPES_H": 1,
+ "HAVE_MALLOC_H": 1,
+ "HAVE_SIGNAL_H": 1,
+ "HAVE_STDINT_H": 1,
+ "HAVE_SYS_STAT_H": 1,
+ "HAVE_SYS_TYPES_H": 1,
+ "HAVE_ZLIB_H": 1,
+
+ # Features
+ "BACKTRACE_HEADER": "execinfo.h",
+ "HAVE_GETCWD": 1,
+ "HAVE_INT64_T": 1,
+ "HAVE_STRERROR": 1,
+ "HAVE_STRTOLL": 1,
+ "HAVE_SYSCONF": 1,
+ "HAVE_UINT64_T": 1,
+ "HAVE__CHSIZE_S": 1,
+ "HAVE___CHKSTK": 1,
+
+ # MSVC specific
+ "stricmp": "_stricmp",
+ "strdup": "_strdup",
+
+ # LLVM features
+ "LTDL_SHLIB_EXT": ".dll",
+}
+
+# Select a set of CMake variables based on the platform.
+# TODO(phawkins): use a better method to select the right host triple, rather
+# than hardcoding x86_64.
+llvm_all_cmake_vars = select({
+ "@org_tensorflow//tensorflow:darwin": cmake_var_string(
+ _dict_add(
+ cmake_vars,
+ llvm_target_cmake_vars("X86", "x86_64-apple-darwin"),
+ posix_cmake_vars,
+ darwin_cmake_vars,
+ ),
+ ),
+ "@org_tensorflow//tensorflow:linux_ppc64le": cmake_var_string(
+ _dict_add(
+ cmake_vars,
+ llvm_target_cmake_vars("PowerPC", "powerpc64le-unknown-linux_gnu"),
+ posix_cmake_vars,
+ linux_cmake_vars,
+ ),
+ ),
+ "@org_tensorflow//tensorflow:windows": cmake_var_string(
+ _dict_add(
+ cmake_vars,
+ llvm_target_cmake_vars("X86", "x86_64-pc-win32"),
+ win32_cmake_vars,
+ ),
+ ),
+ "//conditions:default": cmake_var_string(
+ _dict_add(
+ cmake_vars,
+ llvm_target_cmake_vars("X86", "x86_64-unknown-linux_gnu"),
+ posix_cmake_vars,
+ linux_cmake_vars,
+ ),
+ ),
+})
+
+llvm_linkopts = select({
+ "@org_tensorflow//tensorflow:windows": [],
+ "//conditions:default": ["-ldl", "-lm", "-lpthread"],
+})
+
+llvm_defines = select({
+ "@org_tensorflow//tensorflow:windows": [
+ "_CRT_SECURE_NO_DEPRECATE",
+ "_CRT_SECURE_NO_WARNINGS",
+ "_CRT_NONSTDC_NO_DEPRECATE",
+ "_CRT_NONSTDC_NO_WARNINGS",
+ "_SCL_SECURE_NO_DEPRECATE",
+ "_SCL_SECURE_NO_WARNINGS",
+ "UNICODE",
+ "_UNICODE",
+ ],
+ "//conditions:default": ["_DEBUG"],
+}) + [
+ "LLVM_ENABLE_STATS",
+ "__STDC_LIMIT_MACROS",
+ "__STDC_CONSTANT_MACROS",
+ "__STDC_FORMAT_MACROS",
+ "LLVM_BUILD_GLOBAL_ISEL",
+]
+
+llvm_copts = select({
+ "@org_tensorflow//tensorflow:windows": [
+ "-Zc:inline",
+ "-Zc:strictStrings",
+ "-Zc:rvalueCast",
+ "-Oi",
+ "-wd4141",
+ "-wd4146",
+ "-wd4180",
+ "-wd4244",
+ "-wd4258",
+ "-wd4267",
+ "-wd4291",
+ "-wd4345",
+ "-wd4351",
+ "-wd4355",
+ "-wd4456",
+ "-wd4457",
+ "-wd4458",
+ "-wd4459",
+ "-wd4503",
+ "-wd4624",
+ "-wd4722",
+ "-wd4800",
+ "-wd4100",
+ "-wd4127",
+ "-wd4512",
+ "-wd4505",
+ "-wd4610",
+ "-wd4510",
+ "-wd4702",
+ "-wd4245",
+ "-wd4706",
+ "-wd4310",
+ "-wd4701",
+ "-wd4703",
+ "-wd4389",
+ "-wd4611",
+ "-wd4805",
+ "-wd4204",
+ "-wd4577",
+ "-wd4091",
+ "-wd4592",
+ "-wd4319",
+ "-wd4324",
+ "-w14062",
+ "-we4238",
+ ],
+ "//conditions:default": [],
+})
+
+# Platform specific sources for libSupport.
+def llvm_support_platform_specific_srcs_glob():
+ return select({
+ "@org_tensorflow//tensorflow:windows": native.glob([
+ "lib/Support/Windows/*.inc",
+ "lib/Support/Windows/*.h",
+ ]),
+ "//conditions:default": native.glob([
+ "lib/Support/Unix/*.inc",
+ "lib/Support/Unix/*.h",
+ ]),
+ })
diff --git a/third_party/lmdb.BUILD b/third_party/lmdb.BUILD
index 9b3e1d97c8..f36a698ee3 100644
--- a/third_party/lmdb.BUILD
+++ b/third_party/lmdb.BUILD
@@ -20,7 +20,6 @@ cc_library(
],
linkopts = select({
":windows": ["-DEFAULTLIB:advapi32.lib"], # InitializeSecurityDescriptor, SetSecurityDescriptorDacl
- ":windows_msvc": ["-DEFAULTLIB:advapi32.lib"],
"//conditions:default": ["-lpthread"],
}),
visibility = ["//visibility:public"],
@@ -30,8 +29,3 @@ config_setting(
name = "windows",
values = {"cpu": "x64_windows"},
)
-
-config_setting(
- name = "windows_msvc",
- values = {"cpu": "x64_windows_msvc"},
-)
diff --git a/third_party/mkl/BUILD b/third_party/mkl/BUILD
index b27d341404..efff7fd51b 100644
--- a/third_party/mkl/BUILD
+++ b/third_party/mkl/BUILD
@@ -1,11 +1,29 @@
licenses(["notice"]) # 3-Clause BSD
-exports_files(["LICENSE"])
-
config_setting(
name = "using_mkl",
+ define_values = {
+ "using_mkl": "true",
+ },
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "using_mkl_ml_only",
+ define_values = {
+ "using_mkl": "true",
+ "using_mkl_ml_only": "true",
+ },
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "using_mkl_lnx_x64",
+ define_values = {
+ "using_mkl": "true",
+ },
values = {
- "define": "using_mkl=true",
+ "cpu": "k8",
},
visibility = ["//visibility:public"],
)
@@ -15,12 +33,39 @@ load(
"if_mkl",
)
+filegroup(
+ name = "LICENSE",
+ srcs = ["MKL_LICENSE"] + select({
+ "@org_tensorflow//tensorflow:linux_x86_64": [
+ "@mkl_linux//:LICENSE",
+ ],
+ "@org_tensorflow//tensorflow:darwin": [
+ "@mkl_darwin//:LICENSE",
+ ],
+ "@org_tensorflow//tensorflow:windows": [
+ "@mkl_windows//:LICENSE",
+ ],
+ "//conditions:default": [],
+ }),
+ visibility = ["//visibility:public"],
+)
+
cc_library(
name = "intel_binary_blob",
- srcs = if_mkl([
- "@mkl//:libmklml_intel.so",
- "@mkl//:libiomp5.so",
- ]),
visibility = ["//visibility:public"],
- deps = ["@mkl//:mkl_headers"],
+ deps = select({
+ "@org_tensorflow//tensorflow:linux_x86_64": [
+ "@mkl_linux//:mkl_headers",
+ "@mkl_linux//:mkl_libs_linux",
+ ],
+ "@org_tensorflow//tensorflow:darwin": [
+ "@mkl_darwin//:mkl_headers",
+ "@mkl_darwin//:mkl_libs_darwin",
+ ],
+ "@org_tensorflow//tensorflow:windows": [
+ "@mkl_windows//:mkl_headers",
+ "@mkl_windows//:mkl_libs_windows",
+ ],
+ "//conditions:default": [],
+ }),
)
diff --git a/third_party/mkl/MKL_LICENSE b/third_party/mkl/MKL_LICENSE
new file mode 100644
index 0000000000..9c8f3ea087
--- /dev/null
+++ b/third_party/mkl/MKL_LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. \ No newline at end of file
diff --git a/third_party/mkl/build_defs.bzl b/third_party/mkl/build_defs.bzl
index 8b73ddabdd..b645c0fc5c 100644
--- a/third_party/mkl/build_defs.bzl
+++ b/third_party/mkl/build_defs.bzl
@@ -1,6 +1,9 @@
# -*- Python -*-
"""Skylark macros for MKL.
if_mkl is a conditional to check if MKL is enabled or not.
+if_mkl_ml is a conditional to check if MKL-ML is enabled.
+if_mkl_ml_only is a conditional to check for MKL-ML-only (no MKL-DNN) mode.
+if_mkl_lnx_x64 is a conditional to check for MKL
mkl_repository is a repository rule for creating MKL repository rule that can
be pointed to either a local folder, or download it from the internet.
@@ -8,50 +11,116 @@ mkl_repository depends on the following environment variables:
* `TF_MKL_ROOT`: The root folder where a copy of libmkl is located.
"""
-
_TF_MKL_ROOT = "TF_MKL_ROOT"
-
def if_mkl(if_true, if_false = []):
"""Shorthand for select()'ing on whether we're building with MKL.
- Returns a select statement which evaluates to if_true if we're building
- with MKL enabled. Otherwise, the select statement evaluates to if_false.
+ Args:
+ if_true: expression to evaluate if building with MKL.
+ if_false: expression to evaluate if building without MKL.
+ Returns:
+ a select evaluating to either if_true or if_false as appropriate.
"""
return select({
str(Label("//third_party/mkl:using_mkl")): if_true,
- "//conditions:default": if_false
+ "//conditions:default": if_false,
})
+def if_mkl_ml(if_true, if_false = []):
+ """Shorthand for select()'ing on whether we're building with MKL-ML.
-def _enable_local_mkl(repository_ctx):
- return _TF_MKL_ROOT in repository_ctx.os.environ
+ Args:
+ if_true: expression to evaluate if building with MKL-ML.
+ if_false: expression to evaluate if building without MKL-ML
+ (i.e. without MKL at all, or with MKL-DNN only).
+
+ Returns:
+ a select evaluating to either if_true or if_false as appropriate.
+ """
+ return select({
+ str(Label("//third_party/mkl_dnn:using_mkl_dnn_only")): if_false,
+ str(Label("//third_party/mkl:using_mkl")): if_true,
+ "//conditions:default": if_false,
+ })
+
+def if_mkl_ml_only(if_true, if_false = []):
+ """Shorthand for select()'ing on whether we're building with MKL-ML only.
+
+ Args:
+ if_true: expression to evaluate if building with MKL-ML only.
+ if_false: expression to evaluate if building without MKL, or with MKL-DNN.
+
+ Returns:
+ a select evaluating to either if_true or if_false as appropriate.
+ """
+ return select({
+ str(Label("//third_party/mkl:using_mkl_ml_only")): if_true,
+ "//conditions:default": if_false,
+ })
+def if_mkl_lnx_x64(if_true, if_false = []):
+ """Shorthand to select() on if MKL is on and the target is Linux x86-64.
+
+ Args:
+ if_true: expression to evaluate if building with MKL is enabled and the
+ target platform is Linux x86-64.
+ if_false: expression to evaluate if building without MKL or for a
+ different platform.
+
+ Returns:
+ a select evaluating to either if_true or if_false as appropriate.
+ """
+ return select({
+ str(Label("//third_party/mkl:using_mkl_lnx_x64")): if_true,
+ "//conditions:default": if_false,
+ })
+
+def mkl_deps():
+ """Shorthand for select() to pull in the correct set of MKL library deps.
+
+ Can pull in MKL-ML, MKL-DNN, both, or neither depending on config settings.
+
+ Returns:
+ a select evaluating to a list of library dependencies, suitable for
+ inclusion in the deps attribute of rules.
+ """
+ return select({
+ str(Label("//third_party/mkl_dnn:using_mkl_dnn_only")): ["@mkl_dnn"],
+ str(Label("//third_party/mkl:using_mkl_ml_only")): ["//third_party/mkl:intel_binary_blob"],
+ str(Label("//third_party/mkl:using_mkl")): [
+ "//third_party/mkl:intel_binary_blob",
+ "@mkl_dnn",
+ ],
+ "//conditions:default": [],
+ })
+
+def _enable_local_mkl(repository_ctx):
+ return _TF_MKL_ROOT in repository_ctx.os.environ
def _mkl_autoconf_impl(repository_ctx):
- """Implementation of the local_mkl_autoconf repository rule."""
-
- if _enable_local_mkl(repository_ctx):
- # Symlink lib and include local folders.
- mkl_root = repository_ctx.os.environ[_TF_MKL_ROOT]
- mkl_lib_path = "%s/lib" % mkl_root
- repository_ctx.symlink(mkl_lib_path, "lib")
- mkl_include_path = "%s/include" % mkl_root
- repository_ctx.symlink(mkl_include_path, "include")
- mkl_license_path = "%s/license.txt" % mkl_root
- repository_ctx.symlink(mkl_license_path, "license.txt")
- else:
- # setup remote mkl repository.
- repository_ctx.download_and_extract(
- repository_ctx.attr.urls,
- sha256=repository_ctx.attr.sha256,
- stripPrefix=repository_ctx.attr.strip_prefix,
- )
-
- # Also setup BUILD file.
- repository_ctx.symlink(repository_ctx.attr.build_file, "BUILD")
+ """Implementation of the local_mkl_autoconf repository rule."""
+
+ if _enable_local_mkl(repository_ctx):
+ # Symlink lib and include local folders.
+ mkl_root = repository_ctx.os.environ[_TF_MKL_ROOT]
+ mkl_lib_path = "%s/lib" % mkl_root
+ repository_ctx.symlink(mkl_lib_path, "lib")
+ mkl_include_path = "%s/include" % mkl_root
+ repository_ctx.symlink(mkl_include_path, "include")
+ mkl_license_path = "%s/license.txt" % mkl_root
+ repository_ctx.symlink(mkl_license_path, "license.txt")
+ else:
+ # setup remote mkl repository.
+ repository_ctx.download_and_extract(
+ repository_ctx.attr.urls,
+ sha256 = repository_ctx.attr.sha256,
+ stripPrefix = repository_ctx.attr.strip_prefix,
+ )
+ # Also setup BUILD file.
+ repository_ctx.symlink(repository_ctx.attr.build_file, "BUILD")
mkl_repository = repository_rule(
implementation = _mkl_autoconf_impl,
diff --git a/third_party/mkl/mkl.BUILD b/third_party/mkl/mkl.BUILD
index 8db97232e1..c3a71e4ff9 100644
--- a/third_party/mkl/mkl.BUILD
+++ b/third_party/mkl/mkl.BUILD
@@ -17,14 +17,29 @@ cc_library(
visibility = ["//visibility:public"],
)
-filegroup(
- name = "libmklml_intel.so",
- srcs = ["lib/libmklml_intel.so"],
+cc_library(
+ name = "mkl_libs_linux",
+ srcs = [
+ "lib/libiomp5.so",
+ "lib/libmklml_intel.so",
+ ],
visibility = ["//visibility:public"],
)
-filegroup(
- name = "libiomp5.so",
- srcs = ["lib/libiomp5.so"],
+cc_library(
+ name = "mkl_libs_darwin",
+ srcs = [
+ "lib/libiomp5.dylib",
+ "lib/libmklml.dylib",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "mkl_libs_windows",
+ srcs = [
+ "lib/libiomp5md.lib",
+ "lib/mklml.lib",
+ ],
visibility = ["//visibility:public"],
)
diff --git a/third_party/mkl_dnn/BUILD b/third_party/mkl_dnn/BUILD
index 5b01f6e3e4..3e567fa9fc 100644
--- a/third_party/mkl_dnn/BUILD
+++ b/third_party/mkl_dnn/BUILD
@@ -1 +1,12 @@
licenses(["notice"])
+
+exports_files(["LICENSE"])
+
+config_setting(
+ name = "using_mkl_dnn_only",
+ define_values = {
+ "using_mkl": "true",
+ "using_mkl_dnn_only": "true",
+ },
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/mkl_dnn/LICENSE b/third_party/mkl_dnn/LICENSE
new file mode 100644
index 0000000000..8dada3edaf
--- /dev/null
+++ b/third_party/mkl_dnn/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/third_party/mkl_dnn/build_defs.bzl b/third_party/mkl_dnn/build_defs.bzl
new file mode 100644
index 0000000000..7ce2a7d9b0
--- /dev/null
+++ b/third_party/mkl_dnn/build_defs.bzl
@@ -0,0 +1,13 @@
+def if_mkl_open_source_only(if_true, if_false = []):
+ """Shorthand for select()'ing on whether we're building with
+ MKL-DNN open source lib only, without depending on MKL binary form.
+
+ Returns a select statement which evaluates to if_true if we're building
+ with MKL-DNN open source lib only. Otherwise,
+ the select statement evaluates to if_false.
+
+ """
+ return select({
+ str(Label("//third_party/mkl_dnn:using_mkl_dnn_only")): if_true,
+ "//conditions:default": if_false,
+ })
diff --git a/third_party/mkl_dnn/mkldnn.BUILD b/third_party/mkl_dnn/mkldnn.BUILD
index 58bb7a6a5d..597ac69e2f 100644
--- a/third_party/mkl_dnn/mkldnn.BUILD
+++ b/third_party/mkl_dnn/mkldnn.BUILD
@@ -1,16 +1,40 @@
exports_files(["LICENSE"])
+load(
+ "@org_tensorflow//third_party/mkl_dnn:build_defs.bzl",
+ "if_mkl_open_source_only",
+)
+
+config_setting(
+ name = "clang_linux_x86_64",
+ values = {
+ "cpu": "k8",
+ "define": "using_clang=true",
+ },
+)
+
cc_library(
name = "mkl_dnn",
srcs = glob([
"src/common/*.cpp",
"src/cpu/*.cpp",
+ "src/cpu/gemm/*.cpp",
]),
hdrs = glob(["include/*"]),
- copts = ["-fexceptions"] + select({
+ copts = [
+ "-fexceptions",
+ "-DUSE_MKL",
+ "-DUSE_CBLAS",
+ ] + if_mkl_open_source_only([
+ "-UUSE_MKL",
+ "-UUSE_CBLAS",
+ ]) + select({
"@org_tensorflow//tensorflow:linux_x86_64": [
- "-fopenmp",
+ "-fopenmp", # only works with gcc
],
+ # TODO(ibiryukov): enable openmp with clang by including libomp as a
+ # dependency.
+ ":clang_linux_x86_64": [],
"//conditions:default": [],
}),
includes = [
@@ -19,7 +43,23 @@ cc_library(
"src/common",
"src/cpu",
"src/cpu/xbyak",
+ "src/cpu/gemm",
],
nocopts = "-fno-exceptions",
visibility = ["//visibility:public"],
+ deps = select({
+ "@org_tensorflow//tensorflow:linux_x86_64": [
+ "@mkl_linux//:mkl_headers",
+ "@mkl_linux//:mkl_libs_linux",
+ ],
+ "@org_tensorflow//tensorflow:darwin": [
+ "@mkl_darwin//:mkl_headers",
+ "@mkl_darwin//:mkl_libs_darwin",
+ ],
+ "@org_tensorflow//tensorflow:windows": [
+ "@mkl_windows//:mkl_headers",
+ "@mkl_windows//:mkl_libs_windows",
+ ],
+ "//conditions:default": [],
+ }),
)
diff --git a/third_party/mpi/BUILD b/third_party/mpi/BUILD
index ff3f437e92..1d6ac2fceb 100644
--- a/third_party/mpi/BUILD
+++ b/third_party/mpi/BUILD
@@ -1,17 +1,5 @@
licenses(["restricted"])
-filegroup(
- name = "all_files",
- srcs = glob(
- ["**/*"],
- exclude = [
- "**/METADATA",
- "**/OWNERS",
- ],
- ),
- visibility = ["//tensorflow:__subpackages__"],
-)
-
load("//third_party/mpi:mpi.bzl", "mpi_hdr")
load("//third_party/mpi:mpi.bzl", "if_mpi")
diff --git a/third_party/nanopb.BUILD b/third_party/nanopb.BUILD
new file mode 100644
index 0000000000..d21866911b
--- /dev/null
+++ b/third_party/nanopb.BUILD
@@ -0,0 +1,23 @@
+# Description:
+# Nanopb, a tiny ANSI C protobuf implementation for use on embedded devices.
+
+licenses(["notice"]) # zlib license
+
+exports_files(["LICENSE.txt"])
+
+cc_library(
+ name = "nanopb",
+ srcs = [
+ "pb_common.c",
+ "pb_decode.c",
+ "pb_encode.c",
+ ],
+ hdrs = [
+ "pb.h",
+ "pb_common.h",
+ "pb_decode.h",
+ "pb_encode.h",
+ ],
+ includes = ["."],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/nasm.BUILD b/third_party/nasm.BUILD
index 341d58068b..d746a65e7e 100644
--- a/third_party/nasm.BUILD
+++ b/third_party/nasm.BUILD
@@ -8,45 +8,93 @@ exports_files(["LICENSE"])
cc_binary(
name = "nasm",
srcs = [
- "assemble.c",
- "assemble.h",
- "compiler.h",
- "crc64.c",
- "directiv.c",
- "directiv.h",
- "disp8.c",
- "disp8.h",
- "eval.c",
- "eval.h",
- "exprlib.c",
- "float.c",
- "float.h",
- "hashtbl.c",
- "hashtbl.h",
- "iflag.c",
- "iflag.h",
- "iflaggen.h",
- "ilog2.c",
- "insns.h",
- "insnsa.c",
- "insnsb.c",
- "insnsi.h",
- "labels.c",
- "labels.h",
- "lib/strlcpy.c",
- "listing.c",
- "listing.h",
- "macros.c",
- "md5.h",
- "md5c.c",
- "nasm.c",
- "nasm.h",
- "nasmlib.c",
- "nasmlib.h",
- "opflags.h",
+ "asm/assemble.c",
+ "asm/assemble.h",
+ "asm/directbl.c",
+ "asm/directiv.c",
+ "asm/directiv.h",
+ "asm/error.c",
+ "asm/eval.c",
+ "asm/eval.h",
+ "asm/exprdump.c",
+ "asm/exprlib.c",
+ "asm/float.c",
+ "asm/float.h",
+ "asm/labels.c",
+ "asm/listing.c",
+ "asm/listing.h",
+ "asm/nasm.c",
+ "asm/parser.c",
+ "asm/parser.h",
+ "asm/pptok.c",
+ "asm/pptok.h",
+ "asm/pragma.c",
+ "asm/preproc.c",
+ "asm/preproc.h",
+ "asm/preproc-nop.c",
+ "asm/quote.c",
+ "asm/quote.h",
+ "asm/rdstrnum.c",
+ "asm/segalloc.c",
+ "asm/stdscan.c",
+ "asm/stdscan.h",
+ "asm/strfunc.c",
+ "asm/tokens.h",
+ "asm/tokhash.c",
+ "common/common.c",
+ "config/unknown.h",
+ "disasm/disasm.c",
+ "disasm/disasm.h",
+ "disasm/sync.c",
+ "disasm/sync.h",
+ "include/compiler.h",
+ "include/disp8.h",
+ "include/error.h",
+ "include/hashtbl.h",
+ "include/iflag.h",
+ "include/insns.h",
+ "include/labels.h",
+ "include/md5.h",
+ "include/nasm.h",
+ "include/nasmint.h",
+ "include/nasmlib.h",
+ "include/opflags.h",
+ "include/perfhash.h",
+ "include/raa.h",
+ "include/rbtree.h",
+ "include/rdoff.h",
+ "include/saa.h",
+ "include/strlist.h",
+ "include/tables.h",
+ "include/ver.h",
+ "macros/macros.c",
+ "nasmlib/badenum.c",
+ "nasmlib/bsi.c",
+ "nasmlib/crc64.c",
+ "nasmlib/file.c",
+ "nasmlib/file.h",
+ "nasmlib/filename.c",
+ "nasmlib/hashtbl.c",
+ "nasmlib/ilog2.c",
+ "nasmlib/malloc.c",
+ "nasmlib/md5c.c",
+ "nasmlib/mmap.c",
+ "nasmlib/path.c",
+ "nasmlib/perfhash.c",
+ "nasmlib/raa.c",
+ "nasmlib/rbtree.c",
+ "nasmlib/readnum.c",
+ "nasmlib/realpath.c",
+ "nasmlib/saa.c",
+ "nasmlib/srcfile.c",
+ "nasmlib/string.c",
+ "nasmlib/strlist.c",
+ "nasmlib/ver.c",
+ "nasmlib/zerobuf.c",
"output/codeview.c",
"output/dwarf.h",
"output/elf.h",
+ "output/legacy.c",
"output/nulldbg.c",
"output/nullout.c",
"output/outaout.c",
@@ -56,9 +104,6 @@ cc_binary(
"output/outdbg.c",
"output/outelf.c",
"output/outelf.h",
- "output/outelf32.c",
- "output/outelf64.c",
- "output/outelfx32.c",
"output/outform.c",
"output/outform.h",
"output/outieee.c",
@@ -69,39 +114,37 @@ cc_binary(
"output/outrdf2.c",
"output/pecoff.h",
"output/stabs.h",
- "parser.c",
- "parser.h",
- "pptok.c",
- "pptok.h",
- "preproc.c",
- "preproc.h",
- "preproc-nop.c",
- "quote.c",
- "quote.h",
- "raa.c",
- "raa.h",
- "rbtree.c",
- "rbtree.h",
- "rdoff/rdoff.h",
- "realpath.c",
- "regflags.c",
- "regs.h",
- "regvals.c",
- "saa.c",
- "saa.h",
- "srcfile.c",
- "stdscan.c",
- "stdscan.h",
- "strfunc.c",
- "tables.h",
- "tokens.h",
- "tokhash.c",
- "ver.c",
+ "stdlib/snprintf.c",
+ "stdlib/strlcpy.c",
+ "stdlib/strnlen.c",
+ "stdlib/vsnprintf.c",
"version.h",
+ "x86/disp8.c",
+ "x86/iflag.c",
+ "x86/iflaggen.h",
+ "x86/insnsa.c",
+ "x86/insnsb.c",
+ "x86/insnsd.c",
+ "x86/insnsi.h",
+ "x86/insnsn.c",
+ "x86/regdis.c",
+ "x86/regdis.h",
+ "x86/regflags.c",
+ "x86/regs.c",
+ "x86/regs.h",
+ "x86/regvals.c",
+ ] + select({
+ ":windows": ["config/msvc.h"],
+ "//conditions:default": [],
+ }),
+ includes = [
+ "asm",
+ "include",
+ "output",
+ "x86",
],
copts = select({
":windows": [],
- ":windows_msvc": [],
"//conditions:default": [
"-w",
"-std=c99",
@@ -109,20 +152,15 @@ cc_binary(
}),
defines = select({
":windows": [],
- ":windows_msvc": [],
- "//conditions:default": ["HAVE_SNPRINTF"],
+ "//conditions:default": [
+ "HAVE_SNPRINTF",
+ "HAVE_SYS_TYPES_H",
+ ],
}),
visibility = ["@jpeg//:__pkg__"],
)
config_setting(
- name = "windows_msvc",
- values = {
- "cpu": "x64_windows_msvc",
- },
-)
-
-config_setting(
name = "windows",
values = {
"cpu": "x64_windows",
diff --git a/third_party/nccl/BUILD b/third_party/nccl/BUILD
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/third_party/nccl/BUILD
diff --git a/third_party/nccl/LICENSE b/third_party/nccl/LICENSE
new file mode 100644
index 0000000000..146d9b765c
--- /dev/null
+++ b/third_party/nccl/LICENSE
@@ -0,0 +1,203 @@
+Copyright 2018 The TensorFlow Authors. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2018, The TensorFlow Authors.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/third_party/nccl.BUILD b/third_party/nccl/nccl_archive.BUILD
index b2b8e18824..a05899e38d 100644
--- a/third_party/nccl.BUILD
+++ b/third_party/nccl/nccl_archive.BUILD
@@ -43,6 +43,7 @@ cc_library(
"-Iexternal/nccl_archive/src",
"-O3",
] + cuda_default_copts(),
+ include_prefix = "third_party/nccl",
linkopts = select({
"@org_tensorflow//tensorflow:android": [
"-pie",
@@ -61,6 +62,7 @@ cc_library(
"-lrt",
],
}),
+ strip_include_prefix = "src",
visibility = ["//visibility:public"],
deps = ["@local_config_cuda//cuda:cuda_headers"],
)
diff --git a/third_party/nccl/nccl_configure.bzl b/third_party/nccl/nccl_configure.bzl
new file mode 100644
index 0000000000..ce9447096e
--- /dev/null
+++ b/third_party/nccl/nccl_configure.bzl
@@ -0,0 +1,165 @@
+# -*- Python -*-
+"""Repository rule for NCCL configuration.
+
+`nccl_configure` depends on the following environment variables:
+
+ * `TF_NCCL_VERSION`: The NCCL version.
+ * `NCCL_INSTALL_PATH`: The installation path of the NCCL library.
+"""
+
+load(
+ "//third_party/gpus:cuda_configure.bzl",
+ "auto_configure_fail",
+ "find_cuda_define",
+ "matches_version",
+)
+
+_NCCL_INSTALL_PATH = "NCCL_INSTALL_PATH"
+_TF_NCCL_VERSION = "TF_NCCL_VERSION"
+_TF_NCCL_CONFIG_REPO = "TF_NCCL_CONFIG_REPO"
+
+_DEFINE_NCCL_MAJOR = "#define NCCL_MAJOR"
+_DEFINE_NCCL_MINOR = "#define NCCL_MINOR"
+_DEFINE_NCCL_PATCH = "#define NCCL_PATCH"
+
+_NCCL_DUMMY_BUILD_CONTENT = """
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "nccl",
+ visibility = ["//visibility:public"],
+)
+"""
+
+_NCCL_ARCHIVE_BUILD_CONTENT = """
+filegroup(
+ name = "LICENSE",
+ data = ["@nccl_archive//:LICENSE.txt"],
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "nccl",
+ actual = "@nccl_archive//:nccl",
+ visibility = ["//visibility:public"],
+)
+"""
+
+# Local build results in dynamic link and the license should not be included.
+_NCCL_REMOTE_BUILD_TEMPLATE = Label("//third_party/nccl:remote.BUILD.tpl")
+_NCCL_LOCAL_BUILD_TEMPLATE = Label("//third_party/nccl:system.BUILD.tpl")
+
+def _find_nccl_header(repository_ctx, nccl_install_path):
+ """Finds the NCCL header on the system.
+
+ Args:
+ repository_ctx: The repository context.
+ nccl_install_path: The NCCL library install directory.
+
+ Returns:
+ The path to the NCCL header.
+ """
+ header_path = repository_ctx.path("%s/include/nccl.h" % nccl_install_path)
+ if not header_path.exists:
+ auto_configure_fail("Cannot find %s" % str(header_path))
+ return header_path
+
+
+def _check_nccl_version(repository_ctx, nccl_install_path, nccl_version):
+ """Checks whether the header file matches the specified version of NCCL.
+
+ Args:
+ repository_ctx: The repository context.
+ nccl_install_path: The NCCL library install directory.
+ nccl_version: The expected NCCL version.
+
+ Returns:
+ A string containing the library version of NCCL.
+ """
+ header_path = _find_nccl_header(repository_ctx, nccl_install_path)
+ header_dir = str(header_path.realpath.dirname)
+ major_version = find_cuda_define(repository_ctx, header_dir, "nccl.h",
+ _DEFINE_NCCL_MAJOR)
+ minor_version = find_cuda_define(repository_ctx, header_dir, "nccl.h",
+ _DEFINE_NCCL_MINOR)
+ patch_version = find_cuda_define(repository_ctx, header_dir, "nccl.h",
+ _DEFINE_NCCL_PATCH)
+ header_version = "%s.%s.%s" % (major_version, minor_version, patch_version)
+ if not matches_version(nccl_version, header_version):
+ auto_configure_fail(
+ ("NCCL library version detected from %s/nccl.h (%s) does not match " +
+ "TF_NCCL_VERSION (%s). To fix this rerun configure again.") %
+ (header_dir, header_version, nccl_version))
+
+
+def _find_nccl_lib(repository_ctx, nccl_install_path, nccl_version):
+ """Finds the given NCCL library on the system.
+
+ Args:
+ repository_ctx: The repository context.
+ nccl_install_path: The NCCL library installation directory.
+ nccl_version: The version of NCCL library files as returned
+ by _nccl_version.
+
+ Returns:
+ The path to the NCCL library.
+ """
+ lib_path = repository_ctx.path("%s/lib/libnccl.so.%s" % (nccl_install_path,
+ nccl_version))
+ if not lib_path.exists:
+ auto_configure_fail("Cannot find NCCL library %s" % str(lib_path))
+ return lib_path
+
+
+def _nccl_configure_impl(repository_ctx):
+ """Implementation of the nccl_configure repository rule."""
+ if _TF_NCCL_VERSION not in repository_ctx.os.environ:
+ # Add a dummy build file to make bazel query happy.
+ repository_ctx.file("BUILD", _NCCL_DUMMY_BUILD_CONTENT)
+ return
+
+ if _TF_NCCL_CONFIG_REPO in repository_ctx.os.environ:
+ # Forward to the pre-configured remote repository.
+ repository_ctx.template("BUILD", _NCCL_REMOTE_BUILD_TEMPLATE, {
+ "%{target}": repository_ctx.os.environ[_TF_NCCL_CONFIG_REPO],
+ })
+ return
+
+ nccl_version = repository_ctx.os.environ[_TF_NCCL_VERSION].strip()
+ if matches_version("1", nccl_version):
+ # Alias to GitHub target from @nccl_archive.
+ if not matches_version(nccl_version, "1.3"):
+ auto_configure_fail(
+ "NCCL from GitHub must use version 1.3 (got %s)" % nccl_version)
+ repository_ctx.file("BUILD", _NCCL_ARCHIVE_BUILD_CONTENT)
+ else:
+ # Create target for locally installed NCCL.
+ nccl_install_path = repository_ctx.os.environ[_NCCL_INSTALL_PATH].strip()
+ _check_nccl_version(repository_ctx, nccl_install_path, nccl_version)
+ repository_ctx.template("BUILD", _NCCL_LOCAL_BUILD_TEMPLATE, {
+ "%{version}": nccl_version,
+ "%{install_path}": nccl_install_path,
+ })
+
+
+nccl_configure = repository_rule(
+ implementation=_nccl_configure_impl,
+ environ=[
+ _NCCL_INSTALL_PATH,
+ _TF_NCCL_VERSION,
+ ],
+)
+"""Detects and configures the NCCL configuration.
+
+Add the following to your WORKSPACE FILE:
+
+```python
+nccl_configure(name = "local_config_nccl")
+```
+
+Args:
+ name: A unique name for this workspace rule.
+"""
diff --git a/third_party/nccl/remote.BUILD.tpl b/third_party/nccl/remote.BUILD.tpl
new file mode 100644
index 0000000000..d66fc5563d
--- /dev/null
+++ b/third_party/nccl/remote.BUILD.tpl
@@ -0,0 +1,6 @@
+licenses(["restricted"])
+
+package(default_visibility = ["//visibility:public"])
+
+alias(name="LICENSE", actual = "%{target}:LICENSE")
+alias(name = "nccl", actual = "%{target}:nccl")
diff --git a/third_party/nccl/system.BUILD.tpl b/third_party/nccl/system.BUILD.tpl
new file mode 100644
index 0000000000..7ca835dedf
--- /dev/null
+++ b/third_party/nccl/system.BUILD.tpl
@@ -0,0 +1,26 @@
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "nccl",
+ srcs = ["libnccl.so.%{version}"],
+ hdrs = ["nccl.h"],
+ include_prefix = "third_party/nccl",
+ deps = [
+ "@local_config_cuda//cuda:cuda_headers",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+genrule(
+ name = "nccl-files",
+ outs = [
+ "libnccl.so.%{version}",
+ "nccl.h",
+ ],
+ cmd = """cp "%{install_path}/include/nccl.h" "$(@D)/nccl.h" &&
+ cp "%{install_path}/lib/libnccl.so.%{version}" "$(@D)/libnccl.so.%{version}" """,
+)
+
diff --git a/third_party/ngraph/BUILD b/third_party/ngraph/BUILD
new file mode 100644
index 0000000000..067771b43f
--- /dev/null
+++ b/third_party/ngraph/BUILD
@@ -0,0 +1 @@
+licenses(["notice"]) # 3-Clause BSD
diff --git a/third_party/ngraph/LICENSE b/third_party/ngraph/LICENSE
new file mode 100644
index 0000000000..9c8f3ea087
--- /dev/null
+++ b/third_party/ngraph/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. \ No newline at end of file
diff --git a/third_party/ngraph/NGRAPH_LICENSE b/third_party/ngraph/NGRAPH_LICENSE
new file mode 100644
index 0000000000..9c8f3ea087
--- /dev/null
+++ b/third_party/ngraph/NGRAPH_LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. \ No newline at end of file
diff --git a/third_party/ngraph/build_defs.bzl b/third_party/ngraph/build_defs.bzl
new file mode 100644
index 0000000000..3c34be524b
--- /dev/null
+++ b/third_party/ngraph/build_defs.bzl
@@ -0,0 +1,11 @@
+"""Build configurations for nGraph."""
+
+def clean_dep(dep):
+ return str(Label(dep))
+
+def if_ngraph(if_true, if_false = []):
+ """select()'ing on whether we're building with nGraph support."""
+ return select({
+ clean_dep("//tensorflow:with_ngraph_support"): if_true,
+ "//conditions:default": if_false,
+ })
diff --git a/third_party/ngraph/ngraph.BUILD b/third_party/ngraph/ngraph.BUILD
new file mode 100644
index 0000000000..31aa3cee51
--- /dev/null
+++ b/third_party/ngraph/ngraph.BUILD
@@ -0,0 +1,37 @@
+licenses(["notice"]) # 3-Clause BSD
+
+exports_files(["LICENSE"])
+
+cc_library(
+ name = "ngraph_core",
+ srcs = glob([
+ "src/ngraph/*.cpp",
+ "src/ngraph/autodiff/*.cpp",
+ "src/ngraph/builder/*.cpp",
+ "src/ngraph/descriptor/*.cpp",
+ "src/ngraph/descriptor/layout/*.cpp",
+ "src/ngraph/op/*.cpp",
+ "src/ngraph/op/util/*.cpp",
+ "src/ngraph/pattern/*.cpp",
+ "src/ngraph/pattern/*.hpp",
+ "src/ngraph/pass/*.cpp",
+ "src/ngraph/pass/*.hpp",
+ "src/ngraph/runtime/*.cpp",
+ "src/ngraph/type/*.cpp",
+ "src/ngraph/runtime/interpreter/*.cpp",
+ "src/ngraph/runtime/interpreter/*.hpp",
+ ]),
+ hdrs = glob(["src/ngraph/**/*.hpp"]),
+ deps = [
+ "@eigen_archive//:eigen",
+ "@nlohmann_json_lib",
+ ],
+ copts = [
+ "-I external/ngraph/src",
+ "-I external/nlohmann_json_lib/include/",
+ '-D SHARED_LIB_EXT=\\".so\\"',
+ '-D NGRAPH_VERSION=\\"0.5.0\\"',
+ ],
+ visibility = ["//visibility:public"],
+ alwayslink = 1,
+)
diff --git a/third_party/ngraph/ngraph_tf.BUILD b/third_party/ngraph/ngraph_tf.BUILD
new file mode 100644
index 0000000000..4d96ccf2f2
--- /dev/null
+++ b/third_party/ngraph/ngraph_tf.BUILD
@@ -0,0 +1,88 @@
+licenses(["notice"]) # 3-Clause BSD
+
+exports_files(["LICENSE"])
+
+load(
+ "@org_tensorflow//tensorflow:tensorflow.bzl",
+ "tf_cc_test",
+)
+
+cc_library(
+ name = "ngraph_libs_linux",
+ srcs = [
+ "lib/libiomp5.so",
+ "lib/libmklml_intel.so",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "ngraph_tf",
+ srcs = [
+ "src/ngraph_builder.h",
+ "src/ngraph_builder.cc",
+ "src/ngraph_cluster.h",
+ "src/ngraph_cluster.cc",
+ "src/ngraph_cluster_manager.h",
+ "src/ngraph_cluster_manager.cc",
+ "src/ngraph_confirm_pass.cc",
+ "src/ngraph_device.cc",
+ "src/ngraph_encapsulate_op.cc",
+ "src/ngraph_encapsulate_pass.cc",
+ "src/ngraph_freshness_tracker.h",
+ "src/ngraph_freshness_tracker.cc",
+ "src/ngraph_graph_rewrite_passes.cc",
+ "src/ngraph_liberate_pass.cc",
+ "src/ngraph_op_kernels.cc",
+ "src/ngraph_stub_ops.cc",
+ "src/ngraph_utils.h",
+ "src/ngraph_utils.cc",
+ "src/ngraph_send_recv_ops.cc",
+ "src/ngraph_variable_ops.cc",
+ "src/tf_graphcycles.cc",
+ "logging/ngraph_log.h",
+ "logging/ngraph_log.cc",
+ "logging/tf_graph_writer.h",
+ "logging/tf_graph_writer.cc",
+ ],
+ hdrs = [
+ "src/tf_graphcycles.h",
+ ],
+ deps = [
+ "@org_tensorflow//tensorflow/core:protos_all_proto_text",
+ "@org_tensorflow//tensorflow/core:framework_headers_lib",
+ "@org_tensorflow//tensorflow/core:core_cpu_headers_lib",
+ "@ngraph//:ngraph_core",
+ ],
+ copts = [
+ "-I external/ngraph_tf/src",
+ "-I external/ngraph_tf/logging",
+ "-I external/ngraph/src",
+ "-D NGRAPH_EMBEDDED_IN_TENSORFLOW=1",
+ ],
+ alwayslink = 1,
+ visibility = ["//visibility:public"],
+)
+
+tf_cc_test(
+ name = "ngraph_tf_tests",
+ size = "small",
+ srcs = [
+ "test/tf_exec.cpp",
+ "test/main.cpp",
+ ],
+ deps = [
+ ":ngraph_tf",
+ "@com_google_googletest//:gtest",
+ "@org_tensorflow//tensorflow/cc:cc_ops",
+ "@org_tensorflow//tensorflow/cc:client_session",
+ "@org_tensorflow//tensorflow/core:tensorflow",
+ ],
+ extra_copts = [
+ "-fexceptions ",
+ "-D NGRAPH_EMBEDDED_IN_TENSORFLOW=1",
+ "-I external/ngraph_tf/src",
+ "-I external/ngraph_tf/logging",
+ "-I external/ngraph/src",
+ ],
+)
diff --git a/third_party/ngraph/nlohmann_json.BUILD b/third_party/ngraph/nlohmann_json.BUILD
new file mode 100644
index 0000000000..04c8db6a96
--- /dev/null
+++ b/third_party/ngraph/nlohmann_json.BUILD
@@ -0,0 +1,15 @@
+licenses(["notice"]) # 3-Clause BSD
+
+exports_files(["LICENSE.MIT"])
+
+cc_library(
+ name = "nlohmann_json_lib",
+ hdrs = glob([
+ "include/nlohmann/**/*.hpp",
+ ]),
+ copts = [
+ "-I external/nlohmann_json_lib",
+ ],
+ visibility = ["//visibility:public"],
+ alwayslink = 1,
+)
diff --git a/third_party/png.BUILD b/third_party/png.BUILD
index 6a7ad719aa..c26a289717 100644
--- a/third_party/png.BUILD
+++ b/third_party/png.BUILD
@@ -9,27 +9,62 @@ cc_library(
name = "png",
srcs = [
"png.c",
+ "pngdebug.h",
"pngerror.c",
"pngget.c",
+ "pnginfo.h",
+ "pnglibconf.h",
"pngmem.c",
"pngpread.c",
+ "pngpriv.h",
"pngread.c",
"pngrio.c",
"pngrtran.c",
"pngrutil.c",
"pngset.c",
+ "pngstruct.h",
"pngtrans.c",
"pngwio.c",
"pngwrite.c",
"pngwtran.c",
"pngwutil.c",
- ],
+ ] + select({
+ ":windows": [
+ "intel/intel_init.c",
+ "intel/filter_sse2_intrinsics.c",
+ ],
+ "@org_tensorflow//tensorflow:linux_ppc64le": [
+ "powerpc/powerpc_init.c",
+ "powerpc/filter_vsx_intrinsics.c",
+ ],
+ "//conditions:default": [
+ ],
+ }),
hdrs = [
"png.h",
"pngconf.h",
],
includes = ["."],
- linkopts = ["-lm"],
+ copts = select({
+ ":windows": ["-DPNG_INTEL_SSE_OPT=1"],
+ "//conditions:default": [],
+ }),
+ linkopts = select({
+ ":windows": [],
+ "//conditions:default": ["-lm"],
+ }),
visibility = ["//visibility:public"],
deps = ["@zlib_archive//:zlib"],
)
+
+genrule(
+ name = "snappy_stubs_public_h",
+ srcs = ["scripts/pnglibconf.h.prebuilt"],
+ outs = ["pnglibconf.h"],
+ cmd = "sed -e 's/PNG_ZLIB_VERNUM 0/PNG_ZLIB_VERNUM 0x12b0/' $< >$@",
+)
+
+config_setting(
+ name = "windows",
+ values = {"cpu": "x64_windows"},
+)
diff --git a/third_party/png_fix_rpi.patch b/third_party/png_fix_rpi.patch
new file mode 100644
index 0000000000..80da7b3c06
--- /dev/null
+++ b/third_party/png_fix_rpi.patch
@@ -0,0 +1,16 @@
+diff -r -u /tmp/libpng-1.6.34/scripts/pnglibconf.h.prebuilt ./scripts/pnglibconf.h.prebuilt
+--- /tmp/libpng-1.6.34/scripts/pnglibconf.h.prebuilt 2017-09-29 01:42:33.000000000 -0700
++++ ./scripts/pnglibconf.h.prebuilt 2018-05-01 09:51:24.719318242 -0700
+@@ -20,6 +20,12 @@
+ #define PNG_ALIGNED_MEMORY_SUPPORTED
+ /*#undef PNG_ARM_NEON_API_SUPPORTED*/
+ /*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/
++
++/* Workaround not having a great build file by forcing
++ * png filter optimization to be disabled on arm */
++#define PNG_ARM_NEON_OPT 0
++
++
+ /*#undef PNG_POWERPC_VSX_API_SUPPORTED*/
+ /*#undef PNG_POWERPC_VSX_CHECK_SUPPORTED*/
+ #define PNG_BENIGN_ERRORS_SUPPORTED
diff --git a/third_party/py/python_configure.bzl b/third_party/py/python_configure.bzl
index 954f21f5f8..3c7e5c8469 100644
--- a/third_party/py/python_configure.bzl
+++ b/third_party/py/python_configure.bzl
@@ -6,6 +6,7 @@
* `PYTHON_LIB_PATH`: Location of python libraries.
"""
+_BAZEL_SH = "BAZEL_SH"
_PYTHON_BIN_PATH = "PYTHON_BIN_PATH"
_PYTHON_LIB_PATH = "PYTHON_LIB_PATH"
_TF_PYTHON_CONFIG_REPO = "TF_PYTHON_CONFIG_REPO"
@@ -152,6 +153,22 @@ def _get_python_bin(repository_ctx):
_PYTHON_BIN_PATH, repository_ctx.os.environ.get("PATH", "")))
+def _get_bash_bin(repository_ctx):
+ """Gets the bash bin path."""
+ bash_bin = repository_ctx.os.environ.get(_BAZEL_SH)
+ if bash_bin != None:
+ return bash_bin
+ else:
+ bash_bin_path = repository_ctx.which("bash")
+ if bash_bin_path != None:
+ return str(bash_bin_path)
+ else:
+ _fail("Cannot find bash in PATH, please make sure " +
+ "bash is installed and add its directory in PATH, or --define " +
+ "%s='/path/to/bash'.\nPATH=%s" % (
+ _BAZEL_SH, repository_ctx.os.environ.get("PATH", "")))
+
+
def _get_python_lib(repository_ctx, python_bin):
"""Gets the python lib path."""
python_lib = repository_ctx.os.environ.get(_PYTHON_LIB_PATH)
@@ -184,14 +201,14 @@ def _get_python_lib(repository_ctx, python_bin):
" print(paths[0])\n" +
"END")
cmd = '%s - %s' % (python_bin, print_lib)
- result = repository_ctx.execute(["bash", "-c", cmd])
+ result = repository_ctx.execute([_get_bash_bin(repository_ctx), "-c", cmd])
return result.stdout.strip('\n')
def _check_python_lib(repository_ctx, python_lib):
"""Checks the python lib path."""
cmd = 'test -d "%s" -a -x "%s"' % (python_lib, python_lib)
- result = repository_ctx.execute(["bash", "-c", cmd])
+ result = repository_ctx.execute([_get_bash_bin(repository_ctx), "-c", cmd])
if result.return_code == 1:
_fail("Invalid python library path: %s" % python_lib)
@@ -199,7 +216,7 @@ def _check_python_lib(repository_ctx, python_lib):
def _check_python_bin(repository_ctx, python_bin):
"""Checks the python bin path."""
cmd = '[[ -x "%s" ]] && [[ ! -d "%s" ]]' % (python_bin, python_bin)
- result = repository_ctx.execute(["bash", "-c", cmd])
+ result = repository_ctx.execute([_get_bash_bin(repository_ctx), "-c", cmd])
if result.return_code == 1:
_fail("--define %s='%s' is not executable. Is it the python binary?" % (
_PYTHON_BIN_PATH, python_bin))
@@ -294,6 +311,7 @@ def _python_autoconf_impl(repository_ctx):
python_configure = repository_rule(
implementation = _python_autoconf_impl,
environ = [
+ _BAZEL_SH,
_PYTHON_BIN_PATH,
_PYTHON_LIB_PATH,
_TF_PYTHON_CONFIG_REPO,
diff --git a/third_party/python_runtime/BUILD b/third_party/python_runtime/BUILD
new file mode 100644
index 0000000000..2a1609191f
--- /dev/null
+++ b/third_party/python_runtime/BUILD
@@ -0,0 +1,8 @@
+licenses(["notice"]) # New BSD, Python Software Foundation
+
+package(default_visibility = ["//visibility:public"])
+
+alias(
+ name = "headers",
+ actual = "@local_config_python//:python_headers",
+)
diff --git a/third_party/repo.bzl b/third_party/repo.bzl
index aa178fa8ca..7d1aa5dce9 100644
--- a/third_party/repo.bzl
+++ b/third_party/repo.bzl
@@ -16,95 +16,193 @@
_SINGLE_URL_WHITELIST = depset([
"arm_compiler",
- "ortools_archive",
])
def _is_windows(ctx):
- return ctx.os.name.lower().find("windows") != -1
+ return ctx.os.name.lower().find("windows") != -1
def _wrap_bash_cmd(ctx, cmd):
- if _is_windows(ctx):
- bazel_sh = _get_env_var(ctx, "BAZEL_SH")
- if not bazel_sh:
- fail("BAZEL_SH environment variable is not set")
- cmd = [bazel_sh, "-l", "-c", " ".join(cmd)]
- return cmd
+ if _is_windows(ctx):
+ bazel_sh = _get_env_var(ctx, "BAZEL_SH")
+ if not bazel_sh:
+ fail("BAZEL_SH environment variable is not set")
+ cmd = [bazel_sh, "-l", "-c", " ".join(cmd)]
+ return cmd
def _get_env_var(ctx, name):
- if name in ctx.os.environ:
- return ctx.os.environ[name]
- else:
- return None
+ if name in ctx.os.environ:
+ return ctx.os.environ[name]
+ else:
+ return None
+
+# Checks if we should use the system lib instead of the bundled one
+def _use_system_lib(ctx, name):
+ syslibenv = _get_env_var(ctx, "TF_SYSTEM_LIBS")
+ if syslibenv:
+ for n in syslibenv.strip().split(","):
+ if n.strip() == name:
+ return True
+ return False
# Executes specified command with arguments and calls 'fail' if it exited with
# non-zero code
def _execute_and_check_ret_code(repo_ctx, cmd_and_args):
- result = repo_ctx.execute(cmd_and_args, timeout=10)
- if result.return_code != 0:
- fail(("Non-zero return code({1}) when executing '{0}':\n" + "Stdout: {2}\n"
- + "Stderr: {3}").format(" ".join(cmd_and_args), result.return_code,
- result.stdout, result.stderr))
+ result = repo_ctx.execute(cmd_and_args, timeout = 10)
+ if result.return_code != 0:
+ fail(("Non-zero return code({1}) when executing '{0}':\n" + "Stdout: {2}\n" +
+ "Stderr: {3}").format(
+ " ".join(cmd_and_args),
+ result.return_code,
+ result.stdout,
+ result.stderr,
+ ))
def _repos_are_siblings():
- return Label("@foo//bar").workspace_root.startswith("../")
+ return Label("@foo//bar").workspace_root.startswith("../")
# Apply a patch_file to the repository root directory
# Runs 'patch -p1'
def _apply_patch(ctx, patch_file):
- # Don't check patch on Windows, because patch is only available under bash.
- if not _is_windows(ctx) and not ctx.which("patch"):
- fail("patch command is not found, please install it")
- cmd = _wrap_bash_cmd(
- ctx, ["patch", "-p1", "-d", ctx.path("."), "-i", ctx.path(patch_file)])
- _execute_and_check_ret_code(ctx, cmd)
+ # Don't check patch on Windows, because patch is only available under bash.
+ if not _is_windows(ctx) and not ctx.which("patch"):
+ fail("patch command is not found, please install it")
+ cmd = _wrap_bash_cmd(
+ ctx,
+ ["patch", "-p1", "-d", ctx.path("."), "-i", ctx.path(patch_file)],
+ )
+ _execute_and_check_ret_code(ctx, cmd)
def _apply_delete(ctx, paths):
- for path in paths:
- if path.startswith("/"):
- fail("refusing to rm -rf path starting with '/': " + path)
- if ".." in path:
- fail("refusing to rm -rf path containing '..': " + path)
- cmd = _wrap_bash_cmd(ctx, ["rm", "-rf"] + [ctx.path(path) for path in paths])
- _execute_and_check_ret_code(ctx, cmd)
+ for path in paths:
+ if path.startswith("/"):
+ fail("refusing to rm -rf path starting with '/': " + path)
+ if ".." in path:
+ fail("refusing to rm -rf path containing '..': " + path)
+ cmd = _wrap_bash_cmd(ctx, ["rm", "-rf"] + [ctx.path(path) for path in paths])
+ _execute_and_check_ret_code(ctx, cmd)
def _tf_http_archive(ctx):
- if ("mirror.bazel.build" not in ctx.attr.urls[0] or
- (len(ctx.attr.urls) < 2 and
- ctx.attr.name not in _SINGLE_URL_WHITELIST)):
- fail("tf_http_archive(urls) must have redundant URLs. The " +
- "mirror.bazel.build URL must be present and it must come first. " +
- "Even if you don't have permission to mirror the file, please " +
- "put the correctly formatted mirror URL there anyway, because " +
- "someone will come along shortly thereafter and mirror the file.")
- ctx.download_and_extract(
- ctx.attr.urls,
- "",
- ctx.attr.sha256,
- ctx.attr.type,
- ctx.attr.strip_prefix)
- if ctx.attr.delete:
- _apply_delete(ctx, ctx.attr.delete)
- if ctx.attr.patch_file != None:
- _apply_patch(ctx, ctx.attr.patch_file)
- if ctx.attr.build_file != None:
- ctx.template("BUILD", ctx.attr.build_file, {
- "%prefix%": ".." if _repos_are_siblings() else "external",
- }, False)
+ if ("mirror.bazel.build" not in ctx.attr.urls[0] and
+ (len(ctx.attr.urls) < 2 and
+ ctx.attr.name not in _SINGLE_URL_WHITELIST)):
+ fail("tf_http_archive(urls) must have redundant URLs. The " +
+ "mirror.bazel.build URL must be present and it must come first. " +
+ "Even if you don't have permission to mirror the file, please " +
+ "put the correctly formatted mirror URL there anyway, because " +
+ "someone will come along shortly thereafter and mirror the file.")
+
+ use_syslib = _use_system_lib(ctx, ctx.attr.name)
+ if not use_syslib:
+ ctx.download_and_extract(
+ ctx.attr.urls,
+ "",
+ ctx.attr.sha256,
+ ctx.attr.type,
+ ctx.attr.strip_prefix,
+ )
+ if ctx.attr.delete:
+ _apply_delete(ctx, ctx.attr.delete)
+ if ctx.attr.patch_file != None:
+ _apply_patch(ctx, ctx.attr.patch_file)
+
+ if use_syslib and ctx.attr.system_build_file != None:
+ # Use BUILD.bazel to avoid conflict with third party projects with
+ # BUILD or build (directory) underneath.
+ ctx.template("BUILD.bazel", ctx.attr.system_build_file, {
+ "%prefix%": ".." if _repos_are_siblings() else "external",
+ }, False)
+
+ elif ctx.attr.build_file != None:
+ # Use BUILD.bazel to avoid conflict with third party projects with
+ # BUILD or build (directory) underneath.
+ ctx.template("BUILD.bazel", ctx.attr.build_file, {
+ "%prefix%": ".." if _repos_are_siblings() else "external",
+ }, False)
tf_http_archive = repository_rule(
- implementation=_tf_http_archive,
- attrs={
- "sha256": attr.string(mandatory=True),
- "urls": attr.string_list(mandatory=True, allow_empty=False),
+ implementation = _tf_http_archive,
+ attrs = {
+ "sha256": attr.string(mandatory = True),
+ "urls": attr.string_list(mandatory = True, allow_empty = False),
"strip_prefix": attr.string(),
"type": attr.string(),
"delete": attr.string_list(),
"patch_file": attr.label(),
"build_file": attr.label(),
- })
+ "system_build_file": attr.label(),
+ },
+ environ = [
+ "TF_SYSTEM_LIBS",
+ ],
+)
"""Downloads and creates Bazel repos for dependencies.
This is a swappable replacement for both http_archive() and
new_http_archive() that offers some additional features. It also helps
ensure best practices are followed.
"""
+
+def _third_party_http_archive(ctx):
+ if ("mirror.bazel.build" not in ctx.attr.urls[0] and
+ (len(ctx.attr.urls) < 2 and
+ ctx.attr.name not in _SINGLE_URL_WHITELIST)):
+ fail("tf_http_archive(urls) must have redundant URLs. The " +
+ "mirror.bazel.build URL must be present and it must come first. " +
+ "Even if you don't have permission to mirror the file, please " +
+ "put the correctly formatted mirror URL there anyway, because " +
+ "someone will come along shortly thereafter and mirror the file.")
+
+ use_syslib = _use_system_lib(ctx, ctx.attr.name)
+
+ # Use "BUILD.bazel" to avoid conflict with third party projects that contain a
+ # file or directory called "BUILD"
+ buildfile_path = ctx.path("BUILD.bazel")
+
+ if use_syslib:
+ if ctx.attr.system_build_file == None:
+ fail("Bazel was configured with TF_SYSTEM_LIBS to use a system " +
+ "library for %s, but no system build file for %s was configured. " +
+ "Please add a system_build_file attribute to the repository rule" +
+ "for %s." % (ctx.attr.name, ctx.attr.name, ctx.attr.name))
+ ctx.symlink(Label(ctx.attr.system_build_file), buildfile_path)
+
+ else:
+ ctx.download_and_extract(
+ ctx.attr.urls,
+ "",
+ ctx.attr.sha256,
+ ctx.attr.type,
+ ctx.attr.strip_prefix,
+ )
+ if ctx.attr.delete:
+ _apply_delete(ctx, ctx.attr.delete)
+ if ctx.attr.patch_file != None:
+ _apply_patch(ctx, ctx.attr.patch_file)
+ ctx.symlink(Label(ctx.attr.build_file), buildfile_path)
+
+ for internal_src, external_dest in ctx.attr.link_files.items():
+ ctx.symlink(Label(internal_src), ctx.path(external_dest))
+
+# Downloads and creates Bazel repos for dependencies.
+#
+# This is an upgrade for tf_http_archive that works with go/tfbr-thirdparty.
+#
+# For link_files, specify each dict entry as:
+# "//path/to/source:file": "localfile"
+third_party_http_archive = repository_rule(
+ implementation = _third_party_http_archive,
+ attrs = {
+ "sha256": attr.string(mandatory = True),
+ "urls": attr.string_list(mandatory = True, allow_empty = False),
+ "strip_prefix": attr.string(),
+ "type": attr.string(),
+ "delete": attr.string_list(),
+ "build_file": attr.string(mandatory = True),
+ "system_build_file": attr.string(mandatory = False),
+ "patch_file": attr.label(),
+ "link_files": attr.string_dict(),
+ },
+ environ = [
+ "TF_SYSTEM_LIBS",
+ ],
+)
diff --git a/third_party/snappy.BUILD b/third_party/snappy.BUILD
index fd48ed8941..d93f030769 100644
--- a/third_party/snappy.BUILD
+++ b/third_party/snappy.BUILD
@@ -4,25 +4,12 @@ licenses(["notice"]) # BSD 3-Clause
exports_files(["COPYING"])
-config_setting(
- name = "windows",
- values = {"cpu": "x64_windows"},
- visibility = ["//visibility:public"],
-)
-
-config_setting(
- name = "windows_msvc",
- values = {"cpu": "x64_windows_msvc"},
- visibility = ["//visibility:public"],
-)
-
cc_library(
name = "snappy",
srcs = [
+ "config.h",
"snappy.cc",
"snappy.h",
- "snappy-c.cc",
- "snappy-c.h",
"snappy-internal.h",
"snappy-sinksource.cc",
"snappy-sinksource.h",
@@ -31,10 +18,11 @@ cc_library(
"snappy-stubs-public.h",
],
hdrs = ["snappy.h"],
- copts = select({
- ":windows": [],
- ":windows_msvc": [],
+ copts = ["-DHAVE_CONFIG_H"] + select({
+ "@org_tensorflow//tensorflow:windows": [],
"//conditions:default": [
+ "-fno-exceptions",
+ "-Wno-sign-compare",
"-Wno-shift-negative-value",
"-Wno-implicit-function-declaration",
],
@@ -42,20 +30,66 @@ cc_library(
)
genrule(
+ name = "config_h",
+ outs = ["config.h"],
+ cmd = "\n".join([
+ "cat <<'EOF' >$@",
+ "#define HAVE_STDDEF_H 1",
+ "#define HAVE_STDINT_H 1",
+ "",
+ "#ifdef __has_builtin",
+ "# if !defined(HAVE_BUILTIN_EXPECT) && __has_builtin(__builtin_expect)",
+ "# define HAVE_BUILTIN_EXPECT 1",
+ "# endif",
+ "# if !defined(HAVE_BUILTIN_CTZ) && __has_builtin(__builtin_ctzll)",
+ "# define HAVE_BUILTIN_CTZ 1",
+ "# endif",
+ "#elif defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4)",
+ "# ifndef HAVE_BUILTIN_EXPECT",
+ "# define HAVE_BUILTIN_EXPECT 1",
+ "# endif",
+ "# ifndef HAVE_BUILTIN_CTZ",
+ "# define HAVE_BUILTIN_CTZ 1",
+ "# endif",
+ "#endif",
+ "",
+ "#ifdef __has_include",
+ "# if !defined(HAVE_BYTESWAP_H) && __has_include(<byteswap.h>)",
+ "# define HAVE_BYTESWAP_H 1",
+ "# endif",
+ "# if !defined(HAVE_UNISTD_H) && __has_include(<unistd.h>)",
+ "# define HAVE_UNISTD_H 1",
+ "# endif",
+ "# if !defined(HAVE_SYS_ENDIAN_H) && __has_include(<sys/endian.h>)",
+ "# define HAVE_SYS_ENDIAN_H 1",
+ "# endif",
+ "# if !defined(HAVE_SYS_MMAN_H) && __has_include(<sys/mman.h>)",
+ "# define HAVE_SYS_MMAN_H 1",
+ "# endif",
+ "# if !defined(HAVE_SYS_UIO_H) && __has_include(<sys/uio.h>)",
+ "# define HAVE_SYS_UIO_H 1",
+ "# endif",
+ "#endif",
+ "",
+ "#ifndef SNAPPY_IS_BIG_ENDIAN",
+ "# ifdef __s390x__",
+ "# define SNAPPY_IS_BIG_ENDIAN 1",
+ "# elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__",
+ "# define SNAPPY_IS_BIG_ENDIAN 1",
+ "# endif",
+ "#endif",
+ "EOF",
+ ]),
+)
+
+genrule(
name = "snappy_stubs_public_h",
srcs = ["snappy-stubs-public.h.in"],
outs = ["snappy-stubs-public.h"],
cmd = ("sed " +
- "-e 's/@ac_cv_have_stdint_h@/1/g' " +
- "-e 's/@ac_cv_have_stddef_h@/1/g' " +
- "-e 's/@ac_cv_have_stdint_h@/1/g' " +
- select({
- "@org_tensorflow//tensorflow:windows": "-e 's/@ac_cv_have_sys_uio_h@/0/g' ",
- "@org_tensorflow//tensorflow:windows_msvc": "-e 's/@ac_cv_have_sys_uio_h@/0/g' ",
- "//conditions:default": "-e 's/@ac_cv_have_sys_uio_h@/1/g' ",
- }) +
- "-e 's/@SNAPPY_MAJOR@/1/g' " +
- "-e 's/@SNAPPY_MINOR@/1/g' " +
- "-e 's/@SNAPPY_PATCHLEVEL@/4/g' " +
+ "-e 's/$${\\(.*\\)_01}/\\1/g' " +
+ "-e 's/$${SNAPPY_MAJOR}/1/g' " +
+ "-e 's/$${SNAPPY_MINOR}/1/g' " +
+ "-e 's/$${SNAPPY_PATCHLEVEL}/4/g' " +
"$< >$@"),
)
diff --git a/third_party/sqlite.BUILD b/third_party/sqlite.BUILD
index 6da7953589..8b876fb56f 100644
--- a/third_party/sqlite.BUILD
+++ b/third_party/sqlite.BUILD
@@ -4,7 +4,7 @@
licenses(["unencumbered"]) # Public Domain
SQLITE_COPTS = [
- "-Os",
+ "-DSQLITE_ENABLE_JSON1",
"-DHAVE_DECL_STRERROR_R=1",
"-DHAVE_STDINT_H=1",
"-DHAVE_INTTYPES_H=1",
@@ -14,15 +14,14 @@ SQLITE_COPTS = [
"@org_tensorflow//tensorflow:windows": [
"-DSQLITE_MAX_TRIGGER_DEPTH=100",
],
- "@org_tensorflow//tensorflow:windows_msvc": [
- "-DSQLITE_MAX_TRIGGER_DEPTH=100",
- ],
"@org_tensorflow//tensorflow:darwin": [
+ "-Os",
"-DHAVE_GMTIME_R=1",
"-DHAVE_LOCALTIME_R=1",
"-DHAVE_USLEEP=1",
],
"//conditions:default": [
+ "-Os",
"-DHAVE_FDATASYNC=1",
"-DHAVE_GMTIME_R=1",
"-DHAVE_LOCALTIME_R=1",
@@ -47,7 +46,7 @@ cc_library(
"SQLITE_OMIT_DEPRECATED",
],
linkopts = select({
- "@org_tensorflow//tensorflow:windows_msvc": [],
+ "@org_tensorflow//tensorflow:windows": [],
"//conditions:default": [
"-ldl",
"-lpthread",
diff --git a/third_party/swig.BUILD b/third_party/swig.BUILD
index f2f647401b..59a3d9e671 100644
--- a/third_party/swig.BUILD
+++ b/third_party/swig.BUILD
@@ -71,7 +71,6 @@ cc_binary(
],
copts = ["$(STACK_FRAME_UNLIMITED)"] + select({
":windows": [],
- ":windows_msvc": [],
"//conditions:default": [
"-Wno-parentheses",
"-Wno-unused-variable",
@@ -332,11 +331,6 @@ genrule(
)
config_setting(
- name = "windows_msvc",
- values = {"cpu": "x64_windows_msvc"},
-)
-
-config_setting(
name = "windows",
values = {"cpu": "x64_windows"},
)
diff --git a/third_party/sycl/BUILD b/third_party/sycl/BUILD
index fbdf19f205..f631b6df06 100644
--- a/third_party/sycl/BUILD
+++ b/third_party/sycl/BUILD
@@ -1,15 +1,3 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # Apache 2.0
-
-filegroup(
- name = "all_files",
- srcs = glob(
- ["**/*"],
- exclude = [
- "**/METADATA",
- "**/OWNERS",
- ],
- ),
- visibility = ["//tensorflow:__subpackages__"],
-)
diff --git a/third_party/sycl/sycl/BUILD b/third_party/sycl/sycl/BUILD
index bc1d18b7b5..b045609954 100644
--- a/third_party/sycl/sycl/BUILD
+++ b/third_party/sycl/sycl/BUILD
@@ -5,15 +5,3 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # Apache 2.0
-
-filegroup(
- name = "all_files",
- srcs = glob(
- ["**/*"],
- exclude = [
- "**/METADATA",
- "**/OWNERS",
- ],
- ),
- visibility = ["//tensorflow:__subpackages__"],
-)
diff --git a/third_party/sycl/sycl/BUILD.tpl b/third_party/sycl/sycl/BUILD.tpl
index 21b1a2bbf7..b7e9aa8edb 100755
--- a/third_party/sycl/sycl/BUILD.tpl
+++ b/third_party/sycl/sycl/BUILD.tpl
@@ -21,7 +21,7 @@ config_setting(
name = "using_sycl_trisycl",
define_values = {
"using_sycl": "true",
- "using_trisycl": "false",
+ "using_trisycl": "true",
},
)
diff --git a/third_party/systemlibs/BUILD b/third_party/systemlibs/BUILD
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/third_party/systemlibs/BUILD
diff --git a/third_party/systemlibs/BUILD.tpl b/third_party/systemlibs/BUILD.tpl
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/third_party/systemlibs/BUILD.tpl
diff --git a/third_party/systemlibs/astor.BUILD b/third_party/systemlibs/astor.BUILD
new file mode 100644
index 0000000000..497ec4bcea
--- /dev/null
+++ b/third_party/systemlibs/astor.BUILD
@@ -0,0 +1,12 @@
+licenses(["notice"]) # New BSD
+
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+py_library(
+ name = "astor",
+ srcs_version = "PY2AND3",
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/build_defs.bzl.tpl b/third_party/systemlibs/build_defs.bzl.tpl
new file mode 100644
index 0000000000..3faa46c581
--- /dev/null
+++ b/third_party/systemlibs/build_defs.bzl.tpl
@@ -0,0 +1,32 @@
+# -*- Python -*-
+"""Skylark macros for system libraries.
+"""
+
+SYSTEM_LIBS_ENABLED = %{syslibs_enabled}
+
+SYSTEM_LIBS_LIST = [
+%{syslibs_list}
+]
+
+
+def if_any_system_libs(a, b=[]):
+ """Conditional which evaluates to 'a' if any system libraries are configured."""
+ if SYSTEM_LIBS_ENABLED:
+ return a
+ else:
+ return b
+
+
+def if_system_lib(lib, a, b=[]):
+ """Conditional which evaluates to 'a' if we're using the system version of lib"""
+
+ if SYSTEM_LIBS_ENABLED and lib in SYSTEM_LIBS_LIST:
+ return a
+ else:
+ return b
+
+
+def if_not_system_lib(lib, a, b=[]):
+ """Conditional which evaluates to 'a' if we're using the system version of lib"""
+
+ return if_system_lib(lib, b, a)
diff --git a/third_party/systemlibs/curl.BUILD b/third_party/systemlibs/curl.BUILD
new file mode 100644
index 0000000000..c5f125caa9
--- /dev/null
+++ b/third_party/systemlibs/curl.BUILD
@@ -0,0 +1,12 @@
+licenses(["notice"]) # MIT/X derivative license
+
+filegroup(
+ name = "COPYING",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "curl",
+ linkopts = ["-lcurl"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/cython.BUILD b/third_party/systemlibs/cython.BUILD
new file mode 100644
index 0000000000..1d52587676
--- /dev/null
+++ b/third_party/systemlibs/cython.BUILD
@@ -0,0 +1,13 @@
+licenses(["notice"]) # Apache-2.0
+
+genrule(
+ name = "lncython",
+ outs = ["cython"],
+ cmd = "ln -s $$(which cython) $@",
+)
+
+sh_binary(
+ name = "cython_binary",
+ srcs = ["cython"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/gif.BUILD b/third_party/systemlibs/gif.BUILD
new file mode 100644
index 0000000000..5eb2c918ba
--- /dev/null
+++ b/third_party/systemlibs/gif.BUILD
@@ -0,0 +1,12 @@
+licenses(["notice"]) # MIT
+
+filegroup(
+ name = "COPYING",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "gif",
+ linkopts = ["-lgif"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/grpc.BUILD b/third_party/systemlibs/grpc.BUILD
new file mode 100644
index 0000000000..fd90eb0dd3
--- /dev/null
+++ b/third_party/systemlibs/grpc.BUILD
@@ -0,0 +1,54 @@
+licenses(["notice"]) # Apache v2
+
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "grpc",
+ linkopts = ["-lgrpc"],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "grpc++",
+ linkopts = ["-lgrpc++"],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "grpc_unsecure",
+ linkopts = ["-lgrpc_unsecure"],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "grpc++_unsecure",
+ linkopts = ["-lgrpc++_unsecure"],
+ visibility = ["//visibility:public"],
+)
+
+genrule(
+ name = "ln_grpc_cpp_plugin",
+ outs = ["grpc_cpp_plugin.bin"],
+ cmd = "ln -s $$(which grpc_cpp_plugin) $@",
+)
+
+sh_binary(
+ name = "grpc_cpp_plugin",
+ srcs = ["grpc_cpp_plugin.bin"],
+ visibility = ["//visibility:public"],
+)
+
+genrule(
+ name = "ln_grpc_python_plugin",
+ outs = ["grpc_python_plugin.bin"],
+ cmd = "ln -s $$(which grpc_python_plugin) $@",
+)
+
+sh_binary(
+ name = "grpc_python_plugin",
+ srcs = ["grpc_python_plugin.bin"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/jemalloc.BUILD b/third_party/systemlibs/jemalloc.BUILD
new file mode 100644
index 0000000000..6a48d582ba
--- /dev/null
+++ b/third_party/systemlibs/jemalloc.BUILD
@@ -0,0 +1,30 @@
+licenses(["notice"]) # BSD
+
+filegroup(
+ name = "COPYING",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "jemalloc_headers",
+ defines = [
+ "jemalloc_posix_memalign=posix_memalign",
+ "jemalloc_malloc=malloc",
+ "jemalloc_realloc=realloc",
+ "jemalloc_free=free",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "jemalloc_impl",
+ linkopts = ["-ljemalloc"],
+ defines = [
+ "jemalloc_posix_memalign=posix_memalign",
+ "jemalloc_malloc=malloc",
+ "jemalloc_realloc=realloc",
+ "jemalloc_free=free",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [":jemalloc_headers"],
+)
diff --git a/third_party/systemlibs/jpeg.BUILD b/third_party/systemlibs/jpeg.BUILD
new file mode 100644
index 0000000000..f4f52da9bd
--- /dev/null
+++ b/third_party/systemlibs/jpeg.BUILD
@@ -0,0 +1,12 @@
+licenses(["notice"]) # custom notice-style license, see LICENSE.md
+
+filegroup(
+ name = "LICENSE.md",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "jpeg",
+ linkopts = ["-ljpeg"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/jsoncpp.BUILD b/third_party/systemlibs/jsoncpp.BUILD
new file mode 100644
index 0000000000..cf91917cfb
--- /dev/null
+++ b/third_party/systemlibs/jsoncpp.BUILD
@@ -0,0 +1,37 @@
+licenses(["unencumbered"]) # Public Domain or MIT
+
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+HEADERS = [
+ "include/json/autolink.h",
+ "include/json/config.h",
+ "include/json/features.h",
+ "include/json/forwards.h",
+ "include/json/json.h",
+ "include/json/reader.h",
+ "include/json/value.h",
+ "include/json/version.h",
+ "include/json/writer.h",
+]
+
+genrule(
+ name = "link_headers",
+ outs = HEADERS,
+ cmd = """
+ for i in $(OUTS); do
+ i=$${i##*/}
+ ln -vsf /usr/include/jsoncpp/json/$$i $(@D)/include/json/$$i
+ done
+ """,
+)
+
+cc_library(
+ name = "jsoncpp",
+ hdrs = HEADERS,
+ includes = ["."],
+ linkopts = ["-ljsoncpp"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/lmdb.BUILD b/third_party/systemlibs/lmdb.BUILD
new file mode 100644
index 0000000000..6177b095ec
--- /dev/null
+++ b/third_party/systemlibs/lmdb.BUILD
@@ -0,0 +1,12 @@
+licenses(["notice"]) # OpenLDAP Public License
+
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "lmdb",
+ linkopts = ["-llmdb"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/nasm.BUILD b/third_party/systemlibs/nasm.BUILD
new file mode 100644
index 0000000000..10ef8d8832
--- /dev/null
+++ b/third_party/systemlibs/nasm.BUILD
@@ -0,0 +1,12 @@
+licenses(["notice"]) # BSD 2-clause
+
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+sh_binary(
+ name = "nasm",
+ srcs = ["nasm"],
+ visibility = ["@jpeg//:__pkg__"],
+)
diff --git a/third_party/systemlibs/nsync.BUILD b/third_party/systemlibs/nsync.BUILD
new file mode 100644
index 0000000000..c5d4ad0a76
--- /dev/null
+++ b/third_party/systemlibs/nsync.BUILD
@@ -0,0 +1,23 @@
+licenses(["notice"]) # BSD 3-Clause
+
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "nsync_headers",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "nsync",
+ linkopts = ["-lnsync"],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "nsync_cpp",
+ linkopts = ["-lnsync_cpp"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/pcre.BUILD b/third_party/systemlibs/pcre.BUILD
new file mode 100644
index 0000000000..df74238847
--- /dev/null
+++ b/third_party/systemlibs/pcre.BUILD
@@ -0,0 +1,12 @@
+licenses(["notice"]) # BSD
+
+filegroup(
+ name = "LICENCE",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "pcre",
+ linkopts = ["-lpcre"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/png.BUILD b/third_party/systemlibs/png.BUILD
new file mode 100644
index 0000000000..fc6b6f2d8b
--- /dev/null
+++ b/third_party/systemlibs/png.BUILD
@@ -0,0 +1,12 @@
+licenses(["notice"]) # BSD/MIT-like license
+
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "png",
+ linkopts = ["-lpng"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/re2.BUILD b/third_party/systemlibs/re2.BUILD
new file mode 100644
index 0000000000..c18e252dbc
--- /dev/null
+++ b/third_party/systemlibs/re2.BUILD
@@ -0,0 +1,12 @@
+licenses(["notice"]) # BSD/MIT-like license
+
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "re2",
+ linkopts = ["-lre2"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/six.BUILD b/third_party/systemlibs/six.BUILD
new file mode 100644
index 0000000000..ff9b1a540b
--- /dev/null
+++ b/third_party/systemlibs/six.BUILD
@@ -0,0 +1,11 @@
+licenses(["notice"]) # MIT
+
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+py_library(
+ name = "six",
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/snappy.BUILD b/third_party/systemlibs/snappy.BUILD
new file mode 100644
index 0000000000..fd2db9e2df
--- /dev/null
+++ b/third_party/systemlibs/snappy.BUILD
@@ -0,0 +1,12 @@
+licenses(["notice"]) # BSD 3-Clause
+
+filegroup(
+ name = "COPYING",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "snappy",
+ linkopts = ["-lsnappy"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/sqlite.BUILD b/third_party/systemlibs/sqlite.BUILD
new file mode 100644
index 0000000000..20ee1ebbef
--- /dev/null
+++ b/third_party/systemlibs/sqlite.BUILD
@@ -0,0 +1,15 @@
+licenses(["unencumbered"]) # Public Domain
+
+# Production build of SQLite library that's baked into TensorFlow.
+cc_library(
+ name = "org_sqlite",
+ linkopts = ["-lsqlite3"],
+ visibility = ["//visibility:public"],
+)
+
+# This is a Copybara sync helper for Google.
+py_library(
+ name = "python",
+ srcs_version = "PY2AND3",
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/swig.BUILD b/third_party/systemlibs/swig.BUILD
new file mode 100644
index 0000000000..4c9b74dadb
--- /dev/null
+++ b/third_party/systemlibs/swig.BUILD
@@ -0,0 +1,23 @@
+licenses(["restricted"]) # GPLv3
+
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "templates",
+ visibility = ["//visibility:public"],
+)
+
+genrule(
+ name = "lnswiglink",
+ outs = ["swiglink"],
+ cmd = "ln -s $$(which swig) $@",
+)
+
+sh_binary(
+ name = "swig",
+ srcs = ["swiglink"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/syslibs_configure.bzl b/third_party/systemlibs/syslibs_configure.bzl
new file mode 100644
index 0000000000..8b09c9ac1f
--- /dev/null
+++ b/third_party/systemlibs/syslibs_configure.bzl
@@ -0,0 +1,158 @@
+# -*- Python -*-
+"""Repository rule for system library autoconfiguration.
+
+`syslibs_configure` depends on the following environment variables:
+
+ * `TF_SYSTEM_LIBS`: list of third party dependencies that should use
+ the system version instead
+"""
+
+_TF_SYSTEM_LIBS = "TF_SYSTEM_LIBS"
+
+VALID_LIBS = [
+ "astor_archive",
+ "com_googlesource_code_re2",
+ "curl",
+ "cython",
+ "flatbuffers",
+ "gif_archive",
+ "grpc",
+ "jemalloc",
+ "jpeg",
+ "jsoncpp_git",
+ "lmdb",
+ "nasm",
+ "nsync",
+ "org_sqlite",
+ "pcre",
+ "png_archive",
+ "six_archive",
+ "snappy",
+ "swig",
+ "termcolor_archive",
+ "zlib_archive",
+]
+
+def auto_configure_fail(msg):
+ """Output failure message when syslibs configuration fails."""
+ red = "\033[0;31m"
+ no_color = "\033[0m"
+ fail("\n%sSystem Library Configuration Error:%s %s\n" % (red, no_color, msg))
+
+def _is_windows(repository_ctx):
+ """Returns true if the host operating system is windows."""
+ os_name = repository_ctx.os.name.lower()
+ if os_name.find("windows") != -1:
+ return True
+ return False
+
+def _enable_syslibs(repository_ctx):
+ s = repository_ctx.os.environ.get(_TF_SYSTEM_LIBS, "").strip()
+ if not _is_windows(repository_ctx) and s != None and s != "":
+ return True
+ return False
+
+def _get_system_lib_list(repository_ctx):
+ """Gets the list of deps that should use the system lib.
+
+ Args:
+ repository_ctx: The repository context.
+
+ Returns:
+ A string version of a python list
+ """
+ if _TF_SYSTEM_LIBS not in repository_ctx.os.environ:
+ return []
+
+ libenv = repository_ctx.os.environ[_TF_SYSTEM_LIBS].strip()
+ libs = []
+
+ for lib in list(libenv.split(",")):
+ lib = lib.strip()
+ if lib == "":
+ continue
+ if lib not in VALID_LIBS:
+ auto_configure_fail("Invalid system lib set: %s" % lib)
+ return []
+ libs.append(lib)
+
+ return libs
+
+def _format_system_lib_list(repository_ctx):
+ """Formats the list of deps that should use the system lib.
+
+ Args:
+ repository_ctx: The repository context.
+
+ Returns:
+ A list of the names of deps that should use the system lib.
+ """
+ libs = _get_system_lib_list(repository_ctx)
+ ret = ""
+ for lib in libs:
+ ret += "'%s',\n" % lib
+
+ return ret
+
+def _tpl(repository_ctx, tpl, substitutions = {}, out = None):
+ if not out:
+ out = tpl.replace(":", "")
+ repository_ctx.template(
+ out,
+ Label("//third_party/systemlibs%s.tpl" % tpl),
+ substitutions,
+ False,
+ )
+
+def _create_dummy_repository(repository_ctx):
+ """Creates the dummy repository to build with all bundled libraries."""
+
+ _tpl(repository_ctx, ":BUILD")
+ _tpl(
+ repository_ctx,
+ ":build_defs.bzl",
+ {
+ "%{syslibs_enabled}": "False",
+ "%{syslibs_list}": "",
+ },
+ )
+
+def _create_local_repository(repository_ctx):
+ """Creates the repository to build with system libraries."""
+
+ _tpl(repository_ctx, ":BUILD")
+ _tpl(
+ repository_ctx,
+ ":build_defs.bzl",
+ {
+ "%{syslibs_enabled}": "True",
+ "%{syslibs_list}": _format_system_lib_list(repository_ctx),
+ },
+ )
+
+def _syslibs_autoconf_impl(repository_ctx):
+ """Implementation of the syslibs_configure repository rule."""
+ if not _enable_syslibs(repository_ctx):
+ _create_dummy_repository(repository_ctx)
+ else:
+ _create_local_repository(repository_ctx)
+
+syslibs_configure = repository_rule(
+ implementation = _syslibs_autoconf_impl,
+ environ = [
+ _TF_SYSTEM_LIBS,
+ ],
+)
+
+"""Configures the build to link to system libraries
+instead of using bundled versions.
+
+Add the following to your WORKSPACE FILE:
+
+```python
+syslibs_configure(name = "local_config_syslibs")
+```
+
+Args:
+ name: A unique name for this workspace rule.
+"""
diff --git a/third_party/systemlibs/termcolor.BUILD b/third_party/systemlibs/termcolor.BUILD
new file mode 100644
index 0000000000..915eb621d5
--- /dev/null
+++ b/third_party/systemlibs/termcolor.BUILD
@@ -0,0 +1,12 @@
+licenses(["notice"]) # MIT
+
+filegroup(
+ name = "COPYING.txt",
+ visibility = ["//visibility:public"],
+)
+
+py_library(
+ name = "termcolor",
+ srcs_version = "PY2AND3",
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/zlib.BUILD b/third_party/systemlibs/zlib.BUILD
new file mode 100644
index 0000000000..69462ae6cb
--- /dev/null
+++ b/third_party/systemlibs/zlib.BUILD
@@ -0,0 +1,12 @@
+licenses(["notice"]) # BSD/MIT-like license (for zlib)
+
+filegroup(
+ name = "zlib.h",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "zlib",
+ linkopts = ["-lz"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/tensorrt/tensorrt_configure.bzl b/third_party/tensorrt/tensorrt_configure.bzl
index 8e76e5d02a..9b946505a6 100644
--- a/third_party/tensorrt/tensorrt_configure.bzl
+++ b/third_party/tensorrt/tensorrt_configure.bzl
@@ -57,6 +57,10 @@ def _find_trt_header_dir(repository_ctx, trt_install_path):
path = "/usr/include/x86_64-linux-gnu"
if _headers_exist(repository_ctx, path):
return path
+ if trt_install_path == "/usr/lib/aarch64-linux-gnu":
+ path = "/usr/include/aarch64-linux-gnu"
+ if _headers_exist(repository_ctx, path):
+ return path
path = str(repository_ctx.path("%s/../include" % trt_install_path).realpath)
if _headers_exist(repository_ctx, path):
return path
diff --git a/third_party/tflite_ovic_testdata.BUILD b/third_party/tflite_ovic_testdata.BUILD
new file mode 100644
index 0000000000..de47ed61f9
--- /dev/null
+++ b/third_party/tflite_ovic_testdata.BUILD
@@ -0,0 +1,12 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # Apache 2.0
+
+exports_files(
+ glob(
+ ["**/*"],
+ exclude = [
+ "BUILD",
+ ],
+ ),
+)
diff --git a/third_party/toolchains/BUILD b/third_party/toolchains/BUILD
new file mode 100644
index 0000000000..4303751452
--- /dev/null
+++ b/third_party/toolchains/BUILD
@@ -0,0 +1,37 @@
+licenses(["restricted"])
+
+package(default_visibility = ["//visibility:public"])
+
+# Platform for use with remote execution with
+# custom container based off RBE Ubuntu16_04
+# http://gcr.io/cloud-marketplace/google/rbe-ubuntu16-04
+# Built with //tensorflow/tools/ci_build/Dockerfile.rbe.cpu
+platform(
+ name = "rbe_ubuntu16_04-tf",
+ constraint_values = [
+ "@bazel_tools//platforms:x86_64",
+ "@bazel_tools//platforms:linux",
+ "@bazel_tools//tools/cpp:clang",
+ "@bazel_toolchains//constraints:xenial",
+ ],
+ remote_execution_properties = """
+ properties: {
+ name: "container-image"
+ value:"docker://gcr.io/asci-toolchain/nosla-ubuntu16_04-tf@sha256:495a025ed5e273cfa5d53357ef93ac20500c008994e0be106c509f51555fb93c"
+ }""",
+)
+
+platform(
+ name = "rbe_cuda9.0-cudnn7-ubuntu14.04",
+ constraint_values = [
+ "@bazel_tools//platforms:x86_64",
+ "@bazel_tools//platforms:linux",
+ "@bazel_tools//tools/cpp:clang",
+ "@bazel_toolchains//constraints:xenial",
+ ],
+ remote_execution_properties = """
+ properties: {
+ name: "container-image"
+ value:"docker://gcr.io/asci-toolchain/nosla-cuda9.0-cudnn7-ubuntu14.04@sha256:ae58329b961e7c17d89725bf8fd72dfbd5850f4f3313de58e0cafbf5b0343735"
+ }""",
+)
diff --git a/third_party/toolchains/clang6/CROSSTOOL.tpl b/third_party/toolchains/clang6/CROSSTOOL.tpl
index 6b7e5a8808..ffba9850bb 100644
--- a/third_party/toolchains/clang6/CROSSTOOL.tpl
+++ b/third_party/toolchains/clang6/CROSSTOOL.tpl
@@ -76,9 +76,6 @@ toolchain {
# This adds a little bit more durability to our Clang build.
#
- # At the moment, this only only be needed for:
- # - add_boringssl_s390x.patch: --Wa,--noexecstack
- #
# Folks who do maintenance work on TF Bazel Clang should consider
# commenting out these lines, while doing that work, to gain a better
# understanding of what the intersection of support looks like between GCC
diff --git a/third_party/toolchains/cpus/py/BUILD b/third_party/toolchains/cpus/py/BUILD
index c175742cbf..1235988abb 100644
--- a/third_party/toolchains/cpus/py/BUILD
+++ b/third_party/toolchains/cpus/py/BUILD
@@ -6,18 +6,24 @@ licenses(["restricted"])
package(default_visibility = ["//visibility:public"])
+# To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib
+# See https://docs.python.org/3/extending/windows.html
+cc_import(
+ name = "python_lib",
+ interface_library = select({
+ ":windows": ":python_import_lib",
+ # A placeholder for Unix platforms which makes --no_build happy.
+ "//conditions:default": "not-existing.lib",
+ }),
+ system_provided = 1,
+)
+
cc_library(
name = "python_headers",
hdrs = [":python_include"],
- data = select({
- ":windows": [":python_import_lib"],
- "//conditions:default": [],
- }),
includes = ["python_include"],
- linkopts = select({
- # TODO(pcloudy): Ideally, this should just go into deps after resolving
- # https://github.com/bazelbuild/bazel/issues/3237,
- ":windows": ["$(locations :python_import_lib)"],
+ deps = select({
+ ":windows": [":python_lib"],
"//conditions:default": [],
}),
)
@@ -37,161 +43,135 @@ config_setting(
genrule(
name = "python_include",
outs = [
+ "python_include/Python-ast.h",
+ "python_include/Python.h",
+ "python_include/abstract.h",
+ "python_include/asdl.h",
+ "python_include/ast.h",
+ "python_include/bitset.h",
+ "python_include/boolobject.h",
+ "python_include/bufferobject.h",
+ "python_include/bytearrayobject.h",
+ "python_include/bytes_methods.h",
+ "python_include/bytesobject.h",
+ "python_include/cStringIO.h",
+ "python_include/cellobject.h",
+ "python_include/ceval.h",
+ "python_include/classobject.h",
+ "python_include/cobject.h",
"python_include/code.h",
+ "python_include/codecs.h",
+ "python_include/compile.h",
+ "python_include/complexobject.h",
+ "python_include/datetime.h",
+ "python_include/descrobject.h",
+ "python_include/dictobject.h",
"python_include/dtoa.h",
- "python_include/tupleobject.h",
- "python_include/object.h",
- "python_include/ast.h",
- "python_include/pymacconfig.h",
+ "python_include/enumobject.h",
"python_include/errcode.h",
+ "python_include/eval.h",
+ "python_include/fileobject.h",
+ "python_include/floatobject.h",
"python_include/frameobject.h",
- "python_include/pgenheaders.h",
- "python_include/cellobject.h",
+ "python_include/funcobject.h",
+ "python_include/genobject.h",
+ "python_include/graminit.h",
+ "python_include/grammar.h",
+ "python_include/import.h",
"python_include/intobject.h",
- "python_include/pythread.h",
- "python_include/cStringIO.h",
- "python_include/boolobject.h",
+ "python_include/intrcheck.h",
+ "python_include/iterobject.h",
+ "python_include/listobject.h",
+ "python_include/longintrepr.h",
+ "python_include/longobject.h",
+ "python_include/marshal.h",
+ "python_include/memoryobject.h",
+ "python_include/metagrammar.h",
+ "python_include/methodobject.h",
"python_include/modsupport.h",
- "python_include/import.h",
- "python_include/pymath.h",
+ "python_include/moduleobject.h",
"python_include/node.h",
- "python_include/funcobject.h",
- "python_include/eval.h",
- "python_include/longintrepr.h",
- "python_include/floatobject.h",
- "python_include/rangeobject.h",
- "python_include/pyfpe.h",
- "python_include/pystrcmp.h",
- "python_include/dictobject.h",
- "python_include/pyarena.h",
+ "python_include/object.h",
"python_include/objimpl.h",
- "python_include/bitset.h",
- "python_include/memoryobject.h",
- "python_include/bytearrayobject.h",
+ "python_include/opcode.h",
+ "python_include/osdefs.h",
+ "python_include/parsetok.h",
+ "python_include/patchlevel.h",
+ "python_include/pgen.h",
+ "python_include/pgenheaders.h",
+ "python_include/py_curses.h",
+ "python_include/pyarena.h",
+ "python_include/pycapsule.h",
+ "python_include/pyconfig.h",
+ "python_include/pyctype.h",
"python_include/pydebug.h",
"python_include/pyerrors.h",
- "python_include/weakrefobject.h",
- "python_include/grammar.h",
- "python_include/symtable.h",
- "python_include/longobject.h",
- "python_include/structmember.h",
- "python_include/enumobject.h",
- "python_include/classobject.h",
- "python_include/unicodeobject.h",
- "python_include/sliceobject.h",
- "python_include/pystrtod.h",
- "python_include/genobject.h",
- "python_include/pymactoolbox.h",
- "python_include/compile.h",
"python_include/pyexpat.h",
- "python_include/asdl.h",
- "python_include/codecs.h",
- "python_include/pyctype.h",
- "python_include/sysmodule.h",
- "python_include/methodobject.h",
- "python_include/graminit.h",
- "python_include/cobject.h",
- "python_include/intrcheck.h",
- "python_include/pyport.h",
- "python_include/warnings.h",
- "python_include/osdefs.h",
- "python_include/fileobject.h",
- "python_include/stringobject.h",
- "python_include/timefuncs.h",
- "python_include/traceback.h",
- "python_include/ceval.h",
- "python_include/bytes_methods.h",
- "python_include/pyconfig.h",
- "python_include/Python.h",
- "python_include/moduleobject.h",
- "python_include/pystate.h",
- "python_include/descrobject.h",
- "python_include/ucnhash.h",
+ "python_include/pyfpe.h",
"python_include/pygetopt.h",
+ "python_include/pymacconfig.h",
+ "python_include/pymactoolbox.h",
+ "python_include/pymath.h",
"python_include/pymem.h",
- "python_include/complexobject.h",
- "python_include/structseq.h",
- "python_include/datetime.h",
+ "python_include/pyport.h",
+ "python_include/pystate.h",
+ "python_include/pystrcmp.h",
+ "python_include/pystrtod.h",
"python_include/pythonrun.h",
- "python_include/numpy/oldnumeric.h",
- "python_include/numpy/npy_1_7_deprecated_api.h",
- "python_include/numpy/ufunc_api.txt",
- "python_include/numpy/multiarray_api.txt",
- "python_include/numpy/halffloat.h",
- "python_include/numpy/npy_common.h",
- "python_include/numpy/utils.h",
- "python_include/numpy/npy_interrupt.h",
- "python_include/numpy/npy_endian.h",
- "python_include/numpy/__ufunc_api.h",
- "python_include/numpy/_neighborhood_iterator_imp.h",
- "python_include/numpy/ufuncobject.h",
- "python_include/numpy/ndarraytypes.h",
- "python_include/numpy/npy_math.h",
- "python_include/numpy/noprefix.h",
- "python_include/numpy/npy_3kcompat.h",
- "python_include/numpy/arrayscalars.h",
- "python_include/numpy/npy_os.h",
- "python_include/numpy/ndarrayobject.h",
- "python_include/numpy/npy_no_deprecated_api.h",
- "python_include/numpy/arrayobject.h",
- "python_include/numpy/_numpyconfig.h",
- "python_include/numpy/__multiarray_api.h",
- "python_include/numpy/npy_cpu.h",
- "python_include/numpy/old_defines.h",
- "python_include/numpy/numpyconfig.h",
- "python_include/pycapsule.h",
+ "python_include/pythread.h",
+ "python_include/rangeobject.h",
"python_include/setobject.h",
- "python_include/listobject.h",
- "python_include/bytesobject.h",
- "python_include/pgen.h",
- "python_include/patchlevel.h",
- "python_include/opcode.h",
- "python_include/parsetok.h",
- "python_include/marshal.h",
+ "python_include/sliceobject.h",
+ "python_include/stringobject.h",
+ "python_include/structmember.h",
+ "python_include/structseq.h",
+ "python_include/symtable.h",
+ "python_include/sysmodule.h",
+ "python_include/timefuncs.h",
"python_include/token.h",
- "python_include/iterobject.h",
- "python_include/abstract.h",
- "python_include/py_curses.h",
- "python_include/metagrammar.h",
- "python_include/bufferobject.h",
- "python_include/Python-ast.h",
+ "python_include/traceback.h",
+ "python_include/tupleobject.h",
+ "python_include/ucnhash.h",
+ "python_include/unicodeobject.h",
+ "python_include/warnings.h",
+ "python_include/weakrefobject.h",
],
cmd = """
-cp "/usr/include/python2.7/code.h" "$(@D)/python_include/code.h" && cp "/usr/include/python2.7/dtoa.h" "$(@D)/python_include/dtoa.h" && cp "/usr/include/python2.7/tupleobject.h" "$(@D)/python_include/tupleobject.h" && cp "/usr/include/python2.7/object.h" "$(@D)/python_include/object.h" && cp "/usr/include/python2.7/ast.h" "$(@D)/python_include/ast.h" && cp "/usr/include/python2.7/pymacconfig.h" "$(@D)/python_include/pymacconfig.h" && cp "/usr/include/python2.7/errcode.h" "$(@D)/python_include/errcode.h" && cp "/usr/include/python2.7/frameobject.h" "$(@D)/python_include/frameobject.h" && cp "/usr/include/python2.7/pgenheaders.h" "$(@D)/python_include/pgenheaders.h" && cp "/usr/include/python2.7/cellobject.h" "$(@D)/python_include/cellobject.h" && cp "/usr/include/python2.7/intobject.h" "$(@D)/python_include/intobject.h" && cp "/usr/include/python2.7/pythread.h" "$(@D)/python_include/pythread.h" && cp "/usr/include/python2.7/cStringIO.h" "$(@D)/python_include/cStringIO.h" && cp "/usr/include/python2.7/boolobject.h" "$(@D)/python_include/boolobject.h" && cp "/usr/include/python2.7/modsupport.h" "$(@D)/python_include/modsupport.h" && cp "/usr/include/python2.7/import.h" "$(@D)/python_include/import.h" && cp "/usr/include/python2.7/pymath.h" "$(@D)/python_include/pymath.h" && cp "/usr/include/python2.7/node.h" "$(@D)/python_include/node.h" && cp "/usr/include/python2.7/funcobject.h" "$(@D)/python_include/funcobject.h" && cp "/usr/include/python2.7/eval.h" "$(@D)/python_include/eval.h" && cp "/usr/include/python2.7/longintrepr.h" "$(@D)/python_include/longintrepr.h" && cp "/usr/include/python2.7/floatobject.h" "$(@D)/python_include/floatobject.h" && cp "/usr/include/python2.7/rangeobject.h" "$(@D)/python_include/rangeobject.h" && cp "/usr/include/python2.7/pyfpe.h" "$(@D)/python_include/pyfpe.h" && cp "/usr/include/python2.7/pystrcmp.h" "$(@D)/python_include/pystrcmp.h" && cp "/usr/include/python2.7/dictobject.h" "$(@D)/python_include/dictobject.h" && cp "/usr/include/python2.7/pyarena.h" "$(@D)/python_include/pyarena.h" && cp "/usr/include/python2.7/objimpl.h" "$(@D)/python_include/objimpl.h" && cp "/usr/include/python2.7/bitset.h" "$(@D)/python_include/bitset.h" && cp "/usr/include/python2.7/memoryobject.h" "$(@D)/python_include/memoryobject.h" && cp "/usr/include/python2.7/bytearrayobject.h" "$(@D)/python_include/bytearrayobject.h" && cp "/usr/include/python2.7/pydebug.h" "$(@D)/python_include/pydebug.h" && cp "/usr/include/python2.7/pyerrors.h" "$(@D)/python_include/pyerrors.h" && cp "/usr/include/python2.7/weakrefobject.h" "$(@D)/python_include/weakrefobject.h" && cp "/usr/include/python2.7/grammar.h" "$(@D)/python_include/grammar.h" && cp "/usr/include/python2.7/symtable.h" "$(@D)/python_include/symtable.h" && cp "/usr/include/python2.7/longobject.h" "$(@D)/python_include/longobject.h" && cp "/usr/include/python2.7/structmember.h" "$(@D)/python_include/structmember.h" && cp "/usr/include/python2.7/enumobject.h" "$(@D)/python_include/enumobject.h" && cp "/usr/include/python2.7/classobject.h" "$(@D)/python_include/classobject.h" && cp "/usr/include/python2.7/unicodeobject.h" "$(@D)/python_include/unicodeobject.h" && cp "/usr/include/python2.7/sliceobject.h" "$(@D)/python_include/sliceobject.h" && cp "/usr/include/python2.7/pystrtod.h" "$(@D)/python_include/pystrtod.h" && cp "/usr/include/python2.7/genobject.h" "$(@D)/python_include/genobject.h" && cp "/usr/include/python2.7/pymactoolbox.h" "$(@D)/python_include/pymactoolbox.h" && cp "/usr/include/python2.7/compile.h" "$(@D)/python_include/compile.h" && cp "/usr/include/python2.7/pyexpat.h" "$(@D)/python_include/pyexpat.h" && cp "/usr/include/python2.7/asdl.h" "$(@D)/python_include/asdl.h" && cp "/usr/include/python2.7/codecs.h" "$(@D)/python_include/codecs.h" && cp "/usr/include/python2.7/pyctype.h" "$(@D)/python_include/pyctype.h" && cp "/usr/include/python2.7/sysmodule.h" "$(@D)/python_include/sysmodule.h" && cp "/usr/include/python2.7/methodobject.h" "$(@D)/python_include/methodobject.h" && cp "/usr/include/python2.7/graminit.h" "$(@D)/python_include/graminit.h" && cp "/usr/include/python2.7/cobject.h" "$(@D)/python_include/cobject.h" && cp "/usr/include/python2.7/intrcheck.h" "$(@D)/python_include/intrcheck.h" && cp "/usr/include/python2.7/pyport.h" "$(@D)/python_include/pyport.h" && cp "/usr/include/python2.7/warnings.h" "$(@D)/python_include/warnings.h" && cp "/usr/include/python2.7/osdefs.h" "$(@D)/python_include/osdefs.h" && cp "/usr/include/python2.7/fileobject.h" "$(@D)/python_include/fileobject.h" && cp "/usr/include/python2.7/stringobject.h" "$(@D)/python_include/stringobject.h" && cp "/usr/include/python2.7/timefuncs.h" "$(@D)/python_include/timefuncs.h" && cp "/usr/include/python2.7/traceback.h" "$(@D)/python_include/traceback.h" && cp "/usr/include/python2.7/ceval.h" "$(@D)/python_include/ceval.h" && cp "/usr/include/python2.7/bytes_methods.h" "$(@D)/python_include/bytes_methods.h" && cp "/usr/include/python2.7/pyconfig.h" "$(@D)/python_include/pyconfig.h" && cp "/usr/include/python2.7/Python.h" "$(@D)/python_include/Python.h" && cp "/usr/include/python2.7/moduleobject.h" "$(@D)/python_include/moduleobject.h" && cp "/usr/include/python2.7/pystate.h" "$(@D)/python_include/pystate.h" && cp "/usr/include/python2.7/descrobject.h" "$(@D)/python_include/descrobject.h" && cp "/usr/include/python2.7/ucnhash.h" "$(@D)/python_include/ucnhash.h" && cp "/usr/include/python2.7/pygetopt.h" "$(@D)/python_include/pygetopt.h" && cp "/usr/include/python2.7/pymem.h" "$(@D)/python_include/pymem.h" && cp "/usr/include/python2.7/complexobject.h" "$(@D)/python_include/complexobject.h" && cp "/usr/include/python2.7/structseq.h" "$(@D)/python_include/structseq.h" && cp "/usr/include/python2.7/datetime.h" "$(@D)/python_include/datetime.h" && cp "/usr/include/python2.7/pythonrun.h" "$(@D)/python_include/pythonrun.h" && cp "/usr/include/python2.7/numpy/oldnumeric.h" "$(@D)/python_include/numpy/oldnumeric.h" && cp "/usr/include/python2.7/numpy/npy_1_7_deprecated_api.h" "$(@D)/python_include/numpy/npy_1_7_deprecated_api.h" && cp "/usr/include/python2.7/numpy/ufunc_api.txt" "$(@D)/python_include/numpy/ufunc_api.txt" && cp "/usr/include/python2.7/numpy/multiarray_api.txt" "$(@D)/python_include/numpy/multiarray_api.txt" && cp "/usr/include/python2.7/numpy/halffloat.h" "$(@D)/python_include/numpy/halffloat.h" && cp "/usr/include/python2.7/numpy/npy_common.h" "$(@D)/python_include/numpy/npy_common.h" && cp "/usr/include/python2.7/numpy/utils.h" "$(@D)/python_include/numpy/utils.h" && cp "/usr/include/python2.7/numpy/npy_interrupt.h" "$(@D)/python_include/numpy/npy_interrupt.h" && cp "/usr/include/python2.7/numpy/npy_endian.h" "$(@D)/python_include/numpy/npy_endian.h" && cp "/usr/include/python2.7/numpy/__ufunc_api.h" "$(@D)/python_include/numpy/__ufunc_api.h" && cp "/usr/include/python2.7/numpy/_neighborhood_iterator_imp.h" "$(@D)/python_include/numpy/_neighborhood_iterator_imp.h" && cp "/usr/include/python2.7/numpy/ufuncobject.h" "$(@D)/python_include/numpy/ufuncobject.h" && cp "/usr/include/python2.7/numpy/ndarraytypes.h" "$(@D)/python_include/numpy/ndarraytypes.h" && cp "/usr/include/python2.7/numpy/npy_math.h" "$(@D)/python_include/numpy/npy_math.h" && cp "/usr/include/python2.7/numpy/noprefix.h" "$(@D)/python_include/numpy/noprefix.h" && cp "/usr/include/python2.7/numpy/npy_3kcompat.h" "$(@D)/python_include/numpy/npy_3kcompat.h" && cp "/usr/include/python2.7/numpy/arrayscalars.h" "$(@D)/python_include/numpy/arrayscalars.h" && cp "/usr/include/python2.7/numpy/npy_os.h" "$(@D)/python_include/numpy/npy_os.h" && cp "/usr/include/python2.7/numpy/ndarrayobject.h" "$(@D)/python_include/numpy/ndarrayobject.h" && cp "/usr/include/python2.7/numpy/npy_no_deprecated_api.h" "$(@D)/python_include/numpy/npy_no_deprecated_api.h" && cp "/usr/include/python2.7/numpy/arrayobject.h" "$(@D)/python_include/numpy/arrayobject.h" && cp "/usr/include/python2.7/numpy/_numpyconfig.h" "$(@D)/python_include/numpy/_numpyconfig.h" && cp "/usr/include/python2.7/numpy/__multiarray_api.h" "$(@D)/python_include/numpy/__multiarray_api.h" && cp "/usr/include/python2.7/numpy/npy_cpu.h" "$(@D)/python_include/numpy/npy_cpu.h" && cp "/usr/include/python2.7/numpy/old_defines.h" "$(@D)/python_include/numpy/old_defines.h" && cp "/usr/include/python2.7/numpy/numpyconfig.h" "$(@D)/python_include/numpy/numpyconfig.h" && cp "/usr/include/python2.7/pycapsule.h" "$(@D)/python_include/pycapsule.h" && cp "/usr/include/python2.7/setobject.h" "$(@D)/python_include/setobject.h" && cp "/usr/include/python2.7/listobject.h" "$(@D)/python_include/listobject.h" && cp "/usr/include/python2.7/bytesobject.h" "$(@D)/python_include/bytesobject.h" && cp "/usr/include/python2.7/pgen.h" "$(@D)/python_include/pgen.h" && cp "/usr/include/python2.7/patchlevel.h" "$(@D)/python_include/patchlevel.h" && cp "/usr/include/python2.7/opcode.h" "$(@D)/python_include/opcode.h" && cp "/usr/include/python2.7/parsetok.h" "$(@D)/python_include/parsetok.h" && cp "/usr/include/python2.7/marshal.h" "$(@D)/python_include/marshal.h" && cp "/usr/include/python2.7/token.h" "$(@D)/python_include/token.h" && cp "/usr/include/python2.7/iterobject.h" "$(@D)/python_include/iterobject.h" && cp "/usr/include/python2.7/abstract.h" "$(@D)/python_include/abstract.h" && cp "/usr/include/python2.7/py_curses.h" "$(@D)/python_include/py_curses.h" && cp "/usr/include/python2.7/metagrammar.h" "$(@D)/python_include/metagrammar.h" && cp "/usr/include/python2.7/bufferobject.h" "$(@D)/python_include/bufferobject.h" && cp "/usr/include/python2.7/Python-ast.h" "$(@D)/python_include/Python-ast.h"
+cp "/usr/include/python2.7/Python-ast.h" "$(@D)/python_include/Python-ast.h" && cp "/usr/include/python2.7/Python.h" "$(@D)/python_include/Python.h" && cp "/usr/include/python2.7/abstract.h" "$(@D)/python_include/abstract.h" && cp "/usr/include/python2.7/asdl.h" "$(@D)/python_include/asdl.h" && cp "/usr/include/python2.7/ast.h" "$(@D)/python_include/ast.h" && cp "/usr/include/python2.7/bitset.h" "$(@D)/python_include/bitset.h" && cp "/usr/include/python2.7/boolobject.h" "$(@D)/python_include/boolobject.h" && cp "/usr/include/python2.7/bufferobject.h" "$(@D)/python_include/bufferobject.h" && cp "/usr/include/python2.7/bytearrayobject.h" "$(@D)/python_include/bytearrayobject.h" && cp "/usr/include/python2.7/bytes_methods.h" "$(@D)/python_include/bytes_methods.h" && cp "/usr/include/python2.7/bytesobject.h" "$(@D)/python_include/bytesobject.h" && cp "/usr/include/python2.7/cStringIO.h" "$(@D)/python_include/cStringIO.h" && cp "/usr/include/python2.7/cellobject.h" "$(@D)/python_include/cellobject.h" && cp "/usr/include/python2.7/ceval.h" "$(@D)/python_include/ceval.h" && cp "/usr/include/python2.7/classobject.h" "$(@D)/python_include/classobject.h" && cp "/usr/include/python2.7/cobject.h" "$(@D)/python_include/cobject.h" && cp "/usr/include/python2.7/code.h" "$(@D)/python_include/code.h" && cp "/usr/include/python2.7/codecs.h" "$(@D)/python_include/codecs.h" && cp "/usr/include/python2.7/compile.h" "$(@D)/python_include/compile.h" && cp "/usr/include/python2.7/complexobject.h" "$(@D)/python_include/complexobject.h" && cp "/usr/include/python2.7/datetime.h" "$(@D)/python_include/datetime.h" && cp "/usr/include/python2.7/descrobject.h" "$(@D)/python_include/descrobject.h" && cp "/usr/include/python2.7/dictobject.h" "$(@D)/python_include/dictobject.h" && cp "/usr/include/python2.7/dtoa.h" "$(@D)/python_include/dtoa.h" && cp "/usr/include/python2.7/enumobject.h" "$(@D)/python_include/enumobject.h" && cp "/usr/include/python2.7/errcode.h" "$(@D)/python_include/errcode.h" && cp "/usr/include/python2.7/eval.h" "$(@D)/python_include/eval.h" && cp "/usr/include/python2.7/fileobject.h" "$(@D)/python_include/fileobject.h" && cp "/usr/include/python2.7/floatobject.h" "$(@D)/python_include/floatobject.h" && cp "/usr/include/python2.7/frameobject.h" "$(@D)/python_include/frameobject.h" && cp "/usr/include/python2.7/funcobject.h" "$(@D)/python_include/funcobject.h" && cp "/usr/include/python2.7/genobject.h" "$(@D)/python_include/genobject.h" && cp "/usr/include/python2.7/graminit.h" "$(@D)/python_include/graminit.h" && cp "/usr/include/python2.7/grammar.h" "$(@D)/python_include/grammar.h" && cp "/usr/include/python2.7/import.h" "$(@D)/python_include/import.h" && cp "/usr/include/python2.7/intobject.h" "$(@D)/python_include/intobject.h" && cp "/usr/include/python2.7/intrcheck.h" "$(@D)/python_include/intrcheck.h" && cp "/usr/include/python2.7/iterobject.h" "$(@D)/python_include/iterobject.h" && cp "/usr/include/python2.7/listobject.h" "$(@D)/python_include/listobject.h" && cp "/usr/include/python2.7/longintrepr.h" "$(@D)/python_include/longintrepr.h" && cp "/usr/include/python2.7/longobject.h" "$(@D)/python_include/longobject.h" && cp "/usr/include/python2.7/marshal.h" "$(@D)/python_include/marshal.h" && cp "/usr/include/python2.7/memoryobject.h" "$(@D)/python_include/memoryobject.h" && cp "/usr/include/python2.7/metagrammar.h" "$(@D)/python_include/metagrammar.h" && cp "/usr/include/python2.7/methodobject.h" "$(@D)/python_include/methodobject.h" && cp "/usr/include/python2.7/modsupport.h" "$(@D)/python_include/modsupport.h" && cp "/usr/include/python2.7/moduleobject.h" "$(@D)/python_include/moduleobject.h" && cp "/usr/include/python2.7/node.h" "$(@D)/python_include/node.h" && cp "/usr/include/python2.7/object.h" "$(@D)/python_include/object.h" && cp "/usr/include/python2.7/objimpl.h" "$(@D)/python_include/objimpl.h" && cp "/usr/include/python2.7/opcode.h" "$(@D)/python_include/opcode.h" && cp "/usr/include/python2.7/osdefs.h" "$(@D)/python_include/osdefs.h" && cp "/usr/include/python2.7/parsetok.h" "$(@D)/python_include/parsetok.h" && cp "/usr/include/python2.7/patchlevel.h" "$(@D)/python_include/patchlevel.h" && cp "/usr/include/python2.7/pgen.h" "$(@D)/python_include/pgen.h" && cp "/usr/include/python2.7/pgenheaders.h" "$(@D)/python_include/pgenheaders.h" && cp "/usr/include/python2.7/py_curses.h" "$(@D)/python_include/py_curses.h" && cp "/usr/include/python2.7/pyarena.h" "$(@D)/python_include/pyarena.h" && cp "/usr/include/python2.7/pycapsule.h" "$(@D)/python_include/pycapsule.h" && cp "/usr/include/python2.7/pyconfig.h" "$(@D)/python_include/pyconfig.h" && cp "/usr/include/python2.7/pyctype.h" "$(@D)/python_include/pyctype.h" && cp "/usr/include/python2.7/pydebug.h" "$(@D)/python_include/pydebug.h" && cp "/usr/include/python2.7/pyerrors.h" "$(@D)/python_include/pyerrors.h" && cp "/usr/include/python2.7/pyexpat.h" "$(@D)/python_include/pyexpat.h" && cp "/usr/include/python2.7/pyfpe.h" "$(@D)/python_include/pyfpe.h" && cp "/usr/include/python2.7/pygetopt.h" "$(@D)/python_include/pygetopt.h" && cp "/usr/include/python2.7/pymacconfig.h" "$(@D)/python_include/pymacconfig.h" && cp "/usr/include/python2.7/pymactoolbox.h" "$(@D)/python_include/pymactoolbox.h" && cp "/usr/include/python2.7/pymath.h" "$(@D)/python_include/pymath.h" && cp "/usr/include/python2.7/pymem.h" "$(@D)/python_include/pymem.h" && cp "/usr/include/python2.7/pyport.h" "$(@D)/python_include/pyport.h" && cp "/usr/include/python2.7/pystate.h" "$(@D)/python_include/pystate.h" && cp "/usr/include/python2.7/pystrcmp.h" "$(@D)/python_include/pystrcmp.h" && cp "/usr/include/python2.7/pystrtod.h" "$(@D)/python_include/pystrtod.h" && cp "/usr/include/python2.7/pythonrun.h" "$(@D)/python_include/pythonrun.h" && cp "/usr/include/python2.7/pythread.h" "$(@D)/python_include/pythread.h" && cp "/usr/include/python2.7/rangeobject.h" "$(@D)/python_include/rangeobject.h" && cp "/usr/include/python2.7/setobject.h" "$(@D)/python_include/setobject.h" && cp "/usr/include/python2.7/sliceobject.h" "$(@D)/python_include/sliceobject.h" && cp "/usr/include/python2.7/stringobject.h" "$(@D)/python_include/stringobject.h" && cp "/usr/include/python2.7/structmember.h" "$(@D)/python_include/structmember.h" && cp "/usr/include/python2.7/structseq.h" "$(@D)/python_include/structseq.h" && cp "/usr/include/python2.7/symtable.h" "$(@D)/python_include/symtable.h" && cp "/usr/include/python2.7/sysmodule.h" "$(@D)/python_include/sysmodule.h" && cp "/usr/include/python2.7/timefuncs.h" "$(@D)/python_include/timefuncs.h" && cp "/usr/include/python2.7/token.h" "$(@D)/python_include/token.h" && cp "/usr/include/python2.7/traceback.h" "$(@D)/python_include/traceback.h" && cp "/usr/include/python2.7/tupleobject.h" "$(@D)/python_include/tupleobject.h" && cp "/usr/include/python2.7/ucnhash.h" "$(@D)/python_include/ucnhash.h" && cp "/usr/include/python2.7/unicodeobject.h" "$(@D)/python_include/unicodeobject.h" && cp "/usr/include/python2.7/warnings.h" "$(@D)/python_include/warnings.h" && cp "/usr/include/python2.7/weakrefobject.h" "$(@D)/python_include/weakrefobject.h"
""",
)
genrule(
name = "numpy_include",
outs = [
- "numpy_include/numpy/oldnumeric.h",
- "numpy_include/numpy/npy_1_7_deprecated_api.h",
- "numpy_include/numpy/ufunc_api.txt",
- "numpy_include/numpy/multiarray_api.txt",
- "numpy_include/numpy/halffloat.h",
- "numpy_include/numpy/npy_common.h",
- "numpy_include/numpy/utils.h",
- "numpy_include/numpy/npy_interrupt.h",
- "numpy_include/numpy/npy_endian.h",
+ "numpy_include/numpy/__multiarray_api.h",
"numpy_include/numpy/__ufunc_api.h",
"numpy_include/numpy/_neighborhood_iterator_imp.h",
- "numpy_include/numpy/ufuncobject.h",
+ "numpy_include/numpy/_numpyconfig.h",
+ "numpy_include/numpy/arrayobject.h",
+ "numpy_include/numpy/arrayscalars.h",
+ "numpy_include/numpy/halffloat.h",
+ "numpy_include/numpy/multiarray_api.txt",
+ "numpy_include/numpy/ndarrayobject.h",
"numpy_include/numpy/ndarraytypes.h",
- "numpy_include/numpy/npy_math.h",
"numpy_include/numpy/noprefix.h",
+ "numpy_include/numpy/npy_1_7_deprecated_api.h",
"numpy_include/numpy/npy_3kcompat.h",
- "numpy_include/numpy/arrayscalars.h",
- "numpy_include/numpy/npy_os.h",
- "numpy_include/numpy/ndarrayobject.h",
- "numpy_include/numpy/npy_no_deprecated_api.h",
- "numpy_include/numpy/arrayobject.h",
- "numpy_include/numpy/_numpyconfig.h",
- "numpy_include/numpy/__multiarray_api.h",
+ "numpy_include/numpy/npy_common.h",
"numpy_include/numpy/npy_cpu.h",
- "numpy_include/numpy/old_defines.h",
+ "numpy_include/numpy/npy_endian.h",
+ "numpy_include/numpy/npy_interrupt.h",
+ "numpy_include/numpy/npy_math.h",
+ "numpy_include/numpy/npy_no_deprecated_api.h",
+ "numpy_include/numpy/npy_os.h",
"numpy_include/numpy/numpyconfig.h",
+ "numpy_include/numpy/old_defines.h",
+ "numpy_include/numpy/oldnumeric.h",
+ "numpy_include/numpy/ufunc_api.txt",
+ "numpy_include/numpy/ufuncobject.h",
+ "numpy_include/numpy/utils.h",
],
cmd = """
-cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/oldnumeric.h" "$(@D)/numpy_include/numpy/oldnumeric.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_1_7_deprecated_api.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufunc_api.txt" "$(@D)/numpy_include/numpy/ufunc_api.txt" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/multiarray_api.txt" "$(@D)/numpy_include/numpy/multiarray_api.txt" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/halffloat.h" "$(@D)/numpy_include/numpy/halffloat.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_common.h" "$(@D)/numpy_include/numpy/npy_common.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/utils.h" "$(@D)/numpy_include/numpy/utils.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_interrupt.h" "$(@D)/numpy_include/numpy/npy_interrupt.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_endian.h" "$(@D)/numpy_include/numpy/npy_endian.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h" "$(@D)/numpy_include/numpy/__ufunc_api.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/_neighborhood_iterator_imp.h" "$(@D)/numpy_include/numpy/_neighborhood_iterator_imp.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h" "$(@D)/numpy_include/numpy/ufuncobject.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h" "$(@D)/numpy_include/numpy/ndarraytypes.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_math.h" "$(@D)/numpy_include/numpy/npy_math.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/noprefix.h" "$(@D)/numpy_include/numpy/noprefix.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_3kcompat.h" "$(@D)/numpy_include/numpy/npy_3kcompat.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayscalars.h" "$(@D)/numpy_include/numpy/arrayscalars.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_os.h" "$(@D)/numpy_include/numpy/npy_os.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h" "$(@D)/numpy_include/numpy/ndarrayobject.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_no_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_no_deprecated_api.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h" "$(@D)/numpy_include/numpy/arrayobject.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/_numpyconfig.h" "$(@D)/numpy_include/numpy/_numpyconfig.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h" "$(@D)/numpy_include/numpy/__multiarray_api.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_cpu.h" "$(@D)/numpy_include/numpy/npy_cpu.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/old_defines.h" "$(@D)/numpy_include/numpy/old_defines.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/numpyconfig.h" "$(@D)/numpy_include/numpy/numpyconfig.h"
+cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h" "$(@D)/numpy_include/numpy/__multiarray_api.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h" "$(@D)/numpy_include/numpy/__ufunc_api.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/_neighborhood_iterator_imp.h" "$(@D)/numpy_include/numpy/_neighborhood_iterator_imp.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/_numpyconfig.h" "$(@D)/numpy_include/numpy/_numpyconfig.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h" "$(@D)/numpy_include/numpy/arrayobject.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayscalars.h" "$(@D)/numpy_include/numpy/arrayscalars.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/halffloat.h" "$(@D)/numpy_include/numpy/halffloat.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/multiarray_api.txt" "$(@D)/numpy_include/numpy/multiarray_api.txt" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h" "$(@D)/numpy_include/numpy/ndarrayobject.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h" "$(@D)/numpy_include/numpy/ndarraytypes.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/noprefix.h" "$(@D)/numpy_include/numpy/noprefix.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_1_7_deprecated_api.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_3kcompat.h" "$(@D)/numpy_include/numpy/npy_3kcompat.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_common.h" "$(@D)/numpy_include/numpy/npy_common.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_cpu.h" "$(@D)/numpy_include/numpy/npy_cpu.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_endian.h" "$(@D)/numpy_include/numpy/npy_endian.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_interrupt.h" "$(@D)/numpy_include/numpy/npy_interrupt.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_math.h" "$(@D)/numpy_include/numpy/npy_math.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_no_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_no_deprecated_api.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_os.h" "$(@D)/numpy_include/numpy/npy_os.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/numpyconfig.h" "$(@D)/numpy_include/numpy/numpyconfig.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/old_defines.h" "$(@D)/numpy_include/numpy/old_defines.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/oldnumeric.h" "$(@D)/numpy_include/numpy/oldnumeric.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ufunc_api.txt" "$(@D)/numpy_include/numpy/ufunc_api.txt" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h" "$(@D)/numpy_include/numpy/ufuncobject.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/utils.h" "$(@D)/numpy_include/numpy/utils.h"
""",
)
diff --git a/third_party/toolchains/cpus/py3/BUILD b/third_party/toolchains/cpus/py3/BUILD
index 932a25239f..d47256ebef 100644
--- a/third_party/toolchains/cpus/py3/BUILD
+++ b/third_party/toolchains/cpus/py3/BUILD
@@ -6,18 +6,24 @@ licenses(["restricted"])
package(default_visibility = ["//visibility:public"])
+# To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib
+# See https://docs.python.org/3/extending/windows.html
+cc_import(
+ name = "python_lib",
+ interface_library = select({
+ ":windows": ":python_import_lib",
+ # A placeholder for Unix platforms which makes --no_build happy.
+ "//conditions:default": "not-existing.lib",
+ }),
+ system_provided = 1,
+)
+
cc_library(
name = "python_headers",
hdrs = [":python_include"],
- data = select({
- ":windows": [":python_import_lib"],
- "//conditions:default": [],
- }),
includes = ["python_include"],
- linkopts = select({
- # TODO(pcloudy): Ideally, this should just go into deps after resolving
- # https://github.com/bazelbuild/bazel/issues/3237,
- ":windows": ["$(locations :python_import_lib)"],
+ deps = select({
+ ":windows": [":python_lib"],
"//conditions:default": [],
}),
)
@@ -37,143 +43,143 @@ config_setting(
genrule(
name = "python_include",
outs = [
- "python_include/code.h",
- "python_include/dtoa.h",
- "python_include/tupleobject.h",
- "python_include/object.h",
- "python_include/ast.h",
- "python_include/pymacconfig.h",
- "python_include/errcode.h",
- "python_include/frameobject.h",
- "python_include/typeslots.h",
- "python_include/pgenheaders.h",
- "python_include/cellobject.h",
- "python_include/pythread.h",
- "python_include/boolobject.h",
+ "python_include/Python-ast.h",
+ "python_include/Python.h",
+ "python_include/abstract.h",
"python_include/accu.h",
- "python_include/modsupport.h",
- "python_include/import.h",
- "python_include/pymath.h",
- "python_include/node.h",
- "python_include/funcobject.h",
- "python_include/eval.h",
- "python_include/pyatomic.h",
- "python_include/longintrepr.h",
- "python_include/floatobject.h",
- "python_include/rangeobject.h",
- "python_include/pyfpe.h",
- "python_include/pystrcmp.h",
- "python_include/fileutils.h",
- "python_include/dictobject.h",
- "python_include/pyarena.h",
- "python_include/osmodule.h",
- "python_include/objimpl.h",
+ "python_include/asdl.h",
+ "python_include/ast.h",
"python_include/bitset.h",
- "python_include/memoryobject.h",
+ "python_include/bltinmodule.h",
+ "python_include/boolobject.h",
"python_include/bytearrayobject.h",
- "python_include/pydebug.h",
- "python_include/pyerrors.h",
- "python_include/weakrefobject.h",
- "python_include/grammar.h",
- "python_include/symtable.h",
- "python_include/longobject.h",
- "python_include/structmember.h",
- "python_include/enumobject.h",
- "python_include/pymacro.h",
+ "python_include/bytes_methods.h",
+ "python_include/bytesobject.h",
+ "python_include/cellobject.h",
+ "python_include/ceval.h",
"python_include/classobject.h",
- "python_include/unicodeobject.h",
- "python_include/sliceobject.h",
- "python_include/pystrtod.h",
- "python_include/genobject.h",
- "python_include/compile.h",
- "python_include/pyexpat.h",
- "python_include/asdl.h",
+ "python_include/code.h",
"python_include/codecs.h",
+ "python_include/compile.h",
+ "python_include/complexobject.h",
+ "python_include/datetime.h",
+ "python_include/descrobject.h",
+ "python_include/dictobject.h",
+ "python_include/dtoa.h",
"python_include/dynamic_annotations.h",
- "python_include/pyctype.h",
- "python_include/sysmodule.h",
- "python_include/methodobject.h",
+ "python_include/enumobject.h",
+ "python_include/errcode.h",
+ "python_include/eval.h",
+ "python_include/fileobject.h",
+ "python_include/fileutils.h",
+ "python_include/floatobject.h",
+ "python_include/frameobject.h",
+ "python_include/funcobject.h",
+ "python_include/genobject.h",
"python_include/graminit.h",
- "python_include/bltinmodule.h",
+ "python_include/grammar.h",
+ "python_include/import.h",
"python_include/intrcheck.h",
- "python_include/pyport.h",
- "python_include/warnings.h",
- "python_include/osdefs.h",
- "python_include/pydtrace.h",
- "python_include/pylifecycle.h",
- "python_include/fileobject.h",
- "python_include/pytime.h",
- "python_include/traceback.h",
- "python_include/ceval.h",
- "python_include/bytes_methods.h",
- "python_include/namespaceobject.h",
- "python_include/pyconfig.h",
- "python_include/Python.h",
+ "python_include/iterobject.h",
+ "python_include/listobject.h",
+ "python_include/longintrepr.h",
+ "python_include/longobject.h",
+ "python_include/marshal.h",
+ "python_include/memoryobject.h",
+ "python_include/metagrammar.h",
+ "python_include/methodobject.h",
+ "python_include/modsupport.h",
"python_include/moduleobject.h",
- "python_include/pystate.h",
- "python_include/descrobject.h",
+ "python_include/namespaceobject.h",
+ "python_include/node.h",
+ "python_include/object.h",
+ "python_include/objimpl.h",
"python_include/odictobject.h",
- "python_include/ucnhash.h",
+ "python_include/opcode.h",
+ "python_include/osdefs.h",
+ "python_include/osmodule.h",
+ "python_include/parsetok.h",
+ "python_include/patchlevel.h",
+ "python_include/pgen.h",
+ "python_include/pgenheaders.h",
+ "python_include/py_curses.h",
+ "python_include/pyarena.h",
+ "python_include/pyatomic.h",
+ "python_include/pycapsule.h",
+ "python_include/pyconfig.h",
+ "python_include/pyctype.h",
+ "python_include/pydebug.h",
+ "python_include/pydtrace.h",
+ "python_include/pyerrors.h",
+ "python_include/pyexpat.h",
+ "python_include/pyfpe.h",
"python_include/pygetopt.h",
+ "python_include/pyhash.h",
+ "python_include/pylifecycle.h",
+ "python_include/pymacconfig.h",
+ "python_include/pymacro.h",
+ "python_include/pymath.h",
"python_include/pymem.h",
- "python_include/complexobject.h",
- "python_include/structseq.h",
- "python_include/datetime.h",
+ "python_include/pyport.h",
+ "python_include/pystate.h",
+ "python_include/pystrcmp.h",
+ "python_include/pystrhex.h",
+ "python_include/pystrtod.h",
"python_include/pythonrun.h",
- "python_include/pyhash.h",
- "python_include/pycapsule.h",
+ "python_include/pythread.h",
+ "python_include/pytime.h",
+ "python_include/rangeobject.h",
"python_include/setobject.h",
- "python_include/listobject.h",
- "python_include/bytesobject.h",
- "python_include/pgen.h",
- "python_include/patchlevel.h",
- "python_include/opcode.h",
- "python_include/parsetok.h",
- "python_include/pystrhex.h",
- "python_include/marshal.h",
+ "python_include/sliceobject.h",
+ "python_include/structmember.h",
+ "python_include/structseq.h",
+ "python_include/symtable.h",
+ "python_include/sysmodule.h",
"python_include/token.h",
- "python_include/iterobject.h",
- "python_include/abstract.h",
- "python_include/py_curses.h",
- "python_include/metagrammar.h",
- "python_include/Python-ast.h",
+ "python_include/traceback.h",
+ "python_include/tupleobject.h",
+ "python_include/typeslots.h",
+ "python_include/ucnhash.h",
+ "python_include/unicodeobject.h",
+ "python_include/warnings.h",
+ "python_include/weakrefobject.h",
],
cmd = """
-cp "/opt/python3.6/include/python3.6m/code.h" "$(@D)/python_include/code.h" && cp "/opt/python3.6/include/python3.6m/dtoa.h" "$(@D)/python_include/dtoa.h" && cp "/opt/python3.6/include/python3.6m/tupleobject.h" "$(@D)/python_include/tupleobject.h" && cp "/opt/python3.6/include/python3.6m/object.h" "$(@D)/python_include/object.h" && cp "/opt/python3.6/include/python3.6m/ast.h" "$(@D)/python_include/ast.h" && cp "/opt/python3.6/include/python3.6m/pymacconfig.h" "$(@D)/python_include/pymacconfig.h" && cp "/opt/python3.6/include/python3.6m/errcode.h" "$(@D)/python_include/errcode.h" && cp "/opt/python3.6/include/python3.6m/frameobject.h" "$(@D)/python_include/frameobject.h" && cp "/opt/python3.6/include/python3.6m/typeslots.h" "$(@D)/python_include/typeslots.h" && cp "/opt/python3.6/include/python3.6m/pgenheaders.h" "$(@D)/python_include/pgenheaders.h" && cp "/opt/python3.6/include/python3.6m/cellobject.h" "$(@D)/python_include/cellobject.h" && cp "/opt/python3.6/include/python3.6m/pythread.h" "$(@D)/python_include/pythread.h" && cp "/opt/python3.6/include/python3.6m/boolobject.h" "$(@D)/python_include/boolobject.h" && cp "/opt/python3.6/include/python3.6m/accu.h" "$(@D)/python_include/accu.h" && cp "/opt/python3.6/include/python3.6m/modsupport.h" "$(@D)/python_include/modsupport.h" && cp "/opt/python3.6/include/python3.6m/import.h" "$(@D)/python_include/import.h" && cp "/opt/python3.6/include/python3.6m/pymath.h" "$(@D)/python_include/pymath.h" && cp "/opt/python3.6/include/python3.6m/node.h" "$(@D)/python_include/node.h" && cp "/opt/python3.6/include/python3.6m/funcobject.h" "$(@D)/python_include/funcobject.h" && cp "/opt/python3.6/include/python3.6m/eval.h" "$(@D)/python_include/eval.h" && cp "/opt/python3.6/include/python3.6m/pyatomic.h" "$(@D)/python_include/pyatomic.h" && cp "/opt/python3.6/include/python3.6m/longintrepr.h" "$(@D)/python_include/longintrepr.h" && cp "/opt/python3.6/include/python3.6m/floatobject.h" "$(@D)/python_include/floatobject.h" && cp "/opt/python3.6/include/python3.6m/rangeobject.h" "$(@D)/python_include/rangeobject.h" && cp "/opt/python3.6/include/python3.6m/pyfpe.h" "$(@D)/python_include/pyfpe.h" && cp "/opt/python3.6/include/python3.6m/pystrcmp.h" "$(@D)/python_include/pystrcmp.h" && cp "/opt/python3.6/include/python3.6m/fileutils.h" "$(@D)/python_include/fileutils.h" && cp "/opt/python3.6/include/python3.6m/dictobject.h" "$(@D)/python_include/dictobject.h" && cp "/opt/python3.6/include/python3.6m/pyarena.h" "$(@D)/python_include/pyarena.h" && cp "/opt/python3.6/include/python3.6m/osmodule.h" "$(@D)/python_include/osmodule.h" && cp "/opt/python3.6/include/python3.6m/objimpl.h" "$(@D)/python_include/objimpl.h" && cp "/opt/python3.6/include/python3.6m/bitset.h" "$(@D)/python_include/bitset.h" && cp "/opt/python3.6/include/python3.6m/memoryobject.h" "$(@D)/python_include/memoryobject.h" && cp "/opt/python3.6/include/python3.6m/bytearrayobject.h" "$(@D)/python_include/bytearrayobject.h" && cp "/opt/python3.6/include/python3.6m/pydebug.h" "$(@D)/python_include/pydebug.h" && cp "/opt/python3.6/include/python3.6m/pyerrors.h" "$(@D)/python_include/pyerrors.h" && cp "/opt/python3.6/include/python3.6m/weakrefobject.h" "$(@D)/python_include/weakrefobject.h" && cp "/opt/python3.6/include/python3.6m/grammar.h" "$(@D)/python_include/grammar.h" && cp "/opt/python3.6/include/python3.6m/symtable.h" "$(@D)/python_include/symtable.h" && cp "/opt/python3.6/include/python3.6m/longobject.h" "$(@D)/python_include/longobject.h" && cp "/opt/python3.6/include/python3.6m/structmember.h" "$(@D)/python_include/structmember.h" && cp "/opt/python3.6/include/python3.6m/enumobject.h" "$(@D)/python_include/enumobject.h" && cp "/opt/python3.6/include/python3.6m/pymacro.h" "$(@D)/python_include/pymacro.h" && cp "/opt/python3.6/include/python3.6m/classobject.h" "$(@D)/python_include/classobject.h" && cp "/opt/python3.6/include/python3.6m/unicodeobject.h" "$(@D)/python_include/unicodeobject.h" && cp "/opt/python3.6/include/python3.6m/sliceobject.h" "$(@D)/python_include/sliceobject.h" && cp "/opt/python3.6/include/python3.6m/pystrtod.h" "$(@D)/python_include/pystrtod.h" && cp "/opt/python3.6/include/python3.6m/genobject.h" "$(@D)/python_include/genobject.h" && cp "/opt/python3.6/include/python3.6m/compile.h" "$(@D)/python_include/compile.h" && cp "/opt/python3.6/include/python3.6m/pyexpat.h" "$(@D)/python_include/pyexpat.h" && cp "/opt/python3.6/include/python3.6m/asdl.h" "$(@D)/python_include/asdl.h" && cp "/opt/python3.6/include/python3.6m/codecs.h" "$(@D)/python_include/codecs.h" && cp "/opt/python3.6/include/python3.6m/dynamic_annotations.h" "$(@D)/python_include/dynamic_annotations.h" && cp "/opt/python3.6/include/python3.6m/pyctype.h" "$(@D)/python_include/pyctype.h" && cp "/opt/python3.6/include/python3.6m/sysmodule.h" "$(@D)/python_include/sysmodule.h" && cp "/opt/python3.6/include/python3.6m/methodobject.h" "$(@D)/python_include/methodobject.h" && cp "/opt/python3.6/include/python3.6m/graminit.h" "$(@D)/python_include/graminit.h" && cp "/opt/python3.6/include/python3.6m/bltinmodule.h" "$(@D)/python_include/bltinmodule.h" && cp "/opt/python3.6/include/python3.6m/intrcheck.h" "$(@D)/python_include/intrcheck.h" && cp "/opt/python3.6/include/python3.6m/pyport.h" "$(@D)/python_include/pyport.h" && cp "/opt/python3.6/include/python3.6m/warnings.h" "$(@D)/python_include/warnings.h" && cp "/opt/python3.6/include/python3.6m/osdefs.h" "$(@D)/python_include/osdefs.h" && cp "/opt/python3.6/include/python3.6m/pydtrace.h" "$(@D)/python_include/pydtrace.h" && cp "/opt/python3.6/include/python3.6m/pylifecycle.h" "$(@D)/python_include/pylifecycle.h" && cp "/opt/python3.6/include/python3.6m/fileobject.h" "$(@D)/python_include/fileobject.h" && cp "/opt/python3.6/include/python3.6m/pytime.h" "$(@D)/python_include/pytime.h" && cp "/opt/python3.6/include/python3.6m/traceback.h" "$(@D)/python_include/traceback.h" && cp "/opt/python3.6/include/python3.6m/ceval.h" "$(@D)/python_include/ceval.h" && cp "/opt/python3.6/include/python3.6m/bytes_methods.h" "$(@D)/python_include/bytes_methods.h" && cp "/opt/python3.6/include/python3.6m/namespaceobject.h" "$(@D)/python_include/namespaceobject.h" && cp "/opt/python3.6/include/python3.6m/pyconfig.h" "$(@D)/python_include/pyconfig.h" && cp "/opt/python3.6/include/python3.6m/Python.h" "$(@D)/python_include/Python.h" && cp "/opt/python3.6/include/python3.6m/moduleobject.h" "$(@D)/python_include/moduleobject.h" && cp "/opt/python3.6/include/python3.6m/pystate.h" "$(@D)/python_include/pystate.h" && cp "/opt/python3.6/include/python3.6m/descrobject.h" "$(@D)/python_include/descrobject.h" && cp "/opt/python3.6/include/python3.6m/odictobject.h" "$(@D)/python_include/odictobject.h" && cp "/opt/python3.6/include/python3.6m/ucnhash.h" "$(@D)/python_include/ucnhash.h" && cp "/opt/python3.6/include/python3.6m/pygetopt.h" "$(@D)/python_include/pygetopt.h" && cp "/opt/python3.6/include/python3.6m/pymem.h" "$(@D)/python_include/pymem.h" && cp "/opt/python3.6/include/python3.6m/complexobject.h" "$(@D)/python_include/complexobject.h" && cp "/opt/python3.6/include/python3.6m/structseq.h" "$(@D)/python_include/structseq.h" && cp "/opt/python3.6/include/python3.6m/datetime.h" "$(@D)/python_include/datetime.h" && cp "/opt/python3.6/include/python3.6m/pythonrun.h" "$(@D)/python_include/pythonrun.h" && cp "/opt/python3.6/include/python3.6m/pyhash.h" "$(@D)/python_include/pyhash.h" && cp "/opt/python3.6/include/python3.6m/pycapsule.h" "$(@D)/python_include/pycapsule.h" && cp "/opt/python3.6/include/python3.6m/setobject.h" "$(@D)/python_include/setobject.h" && cp "/opt/python3.6/include/python3.6m/listobject.h" "$(@D)/python_include/listobject.h" && cp "/opt/python3.6/include/python3.6m/bytesobject.h" "$(@D)/python_include/bytesobject.h" && cp "/opt/python3.6/include/python3.6m/pgen.h" "$(@D)/python_include/pgen.h" && cp "/opt/python3.6/include/python3.6m/patchlevel.h" "$(@D)/python_include/patchlevel.h" && cp "/opt/python3.6/include/python3.6m/opcode.h" "$(@D)/python_include/opcode.h" && cp "/opt/python3.6/include/python3.6m/parsetok.h" "$(@D)/python_include/parsetok.h" && cp "/opt/python3.6/include/python3.6m/pystrhex.h" "$(@D)/python_include/pystrhex.h" && cp "/opt/python3.6/include/python3.6m/marshal.h" "$(@D)/python_include/marshal.h" && cp "/opt/python3.6/include/python3.6m/token.h" "$(@D)/python_include/token.h" && cp "/opt/python3.6/include/python3.6m/iterobject.h" "$(@D)/python_include/iterobject.h" && cp "/opt/python3.6/include/python3.6m/abstract.h" "$(@D)/python_include/abstract.h" && cp "/opt/python3.6/include/python3.6m/py_curses.h" "$(@D)/python_include/py_curses.h" && cp "/opt/python3.6/include/python3.6m/metagrammar.h" "$(@D)/python_include/metagrammar.h" && cp "/opt/python3.6/include/python3.6m/Python-ast.h" "$(@D)/python_include/Python-ast.h"
+cp "/opt/python3.6/include/python3.6m/Python-ast.h" "$(@D)/python_include/Python-ast.h" && cp "/opt/python3.6/include/python3.6m/Python.h" "$(@D)/python_include/Python.h" && cp "/opt/python3.6/include/python3.6m/abstract.h" "$(@D)/python_include/abstract.h" && cp "/opt/python3.6/include/python3.6m/accu.h" "$(@D)/python_include/accu.h" && cp "/opt/python3.6/include/python3.6m/asdl.h" "$(@D)/python_include/asdl.h" && cp "/opt/python3.6/include/python3.6m/ast.h" "$(@D)/python_include/ast.h" && cp "/opt/python3.6/include/python3.6m/bitset.h" "$(@D)/python_include/bitset.h" && cp "/opt/python3.6/include/python3.6m/bltinmodule.h" "$(@D)/python_include/bltinmodule.h" && cp "/opt/python3.6/include/python3.6m/boolobject.h" "$(@D)/python_include/boolobject.h" && cp "/opt/python3.6/include/python3.6m/bytearrayobject.h" "$(@D)/python_include/bytearrayobject.h" && cp "/opt/python3.6/include/python3.6m/bytes_methods.h" "$(@D)/python_include/bytes_methods.h" && cp "/opt/python3.6/include/python3.6m/bytesobject.h" "$(@D)/python_include/bytesobject.h" && cp "/opt/python3.6/include/python3.6m/cellobject.h" "$(@D)/python_include/cellobject.h" && cp "/opt/python3.6/include/python3.6m/ceval.h" "$(@D)/python_include/ceval.h" && cp "/opt/python3.6/include/python3.6m/classobject.h" "$(@D)/python_include/classobject.h" && cp "/opt/python3.6/include/python3.6m/code.h" "$(@D)/python_include/code.h" && cp "/opt/python3.6/include/python3.6m/codecs.h" "$(@D)/python_include/codecs.h" && cp "/opt/python3.6/include/python3.6m/compile.h" "$(@D)/python_include/compile.h" && cp "/opt/python3.6/include/python3.6m/complexobject.h" "$(@D)/python_include/complexobject.h" && cp "/opt/python3.6/include/python3.6m/datetime.h" "$(@D)/python_include/datetime.h" && cp "/opt/python3.6/include/python3.6m/descrobject.h" "$(@D)/python_include/descrobject.h" && cp "/opt/python3.6/include/python3.6m/dictobject.h" "$(@D)/python_include/dictobject.h" && cp "/opt/python3.6/include/python3.6m/dtoa.h" "$(@D)/python_include/dtoa.h" && cp "/opt/python3.6/include/python3.6m/dynamic_annotations.h" "$(@D)/python_include/dynamic_annotations.h" && cp "/opt/python3.6/include/python3.6m/enumobject.h" "$(@D)/python_include/enumobject.h" && cp "/opt/python3.6/include/python3.6m/errcode.h" "$(@D)/python_include/errcode.h" && cp "/opt/python3.6/include/python3.6m/eval.h" "$(@D)/python_include/eval.h" && cp "/opt/python3.6/include/python3.6m/fileobject.h" "$(@D)/python_include/fileobject.h" && cp "/opt/python3.6/include/python3.6m/fileutils.h" "$(@D)/python_include/fileutils.h" && cp "/opt/python3.6/include/python3.6m/floatobject.h" "$(@D)/python_include/floatobject.h" && cp "/opt/python3.6/include/python3.6m/frameobject.h" "$(@D)/python_include/frameobject.h" && cp "/opt/python3.6/include/python3.6m/funcobject.h" "$(@D)/python_include/funcobject.h" && cp "/opt/python3.6/include/python3.6m/genobject.h" "$(@D)/python_include/genobject.h" && cp "/opt/python3.6/include/python3.6m/graminit.h" "$(@D)/python_include/graminit.h" && cp "/opt/python3.6/include/python3.6m/grammar.h" "$(@D)/python_include/grammar.h" && cp "/opt/python3.6/include/python3.6m/import.h" "$(@D)/python_include/import.h" && cp "/opt/python3.6/include/python3.6m/intrcheck.h" "$(@D)/python_include/intrcheck.h" && cp "/opt/python3.6/include/python3.6m/iterobject.h" "$(@D)/python_include/iterobject.h" && cp "/opt/python3.6/include/python3.6m/listobject.h" "$(@D)/python_include/listobject.h" && cp "/opt/python3.6/include/python3.6m/longintrepr.h" "$(@D)/python_include/longintrepr.h" && cp "/opt/python3.6/include/python3.6m/longobject.h" "$(@D)/python_include/longobject.h" && cp "/opt/python3.6/include/python3.6m/marshal.h" "$(@D)/python_include/marshal.h" && cp "/opt/python3.6/include/python3.6m/memoryobject.h" "$(@D)/python_include/memoryobject.h" && cp "/opt/python3.6/include/python3.6m/metagrammar.h" "$(@D)/python_include/metagrammar.h" && cp "/opt/python3.6/include/python3.6m/methodobject.h" "$(@D)/python_include/methodobject.h" && cp "/opt/python3.6/include/python3.6m/modsupport.h" "$(@D)/python_include/modsupport.h" && cp "/opt/python3.6/include/python3.6m/moduleobject.h" "$(@D)/python_include/moduleobject.h" && cp "/opt/python3.6/include/python3.6m/namespaceobject.h" "$(@D)/python_include/namespaceobject.h" && cp "/opt/python3.6/include/python3.6m/node.h" "$(@D)/python_include/node.h" && cp "/opt/python3.6/include/python3.6m/object.h" "$(@D)/python_include/object.h" && cp "/opt/python3.6/include/python3.6m/objimpl.h" "$(@D)/python_include/objimpl.h" && cp "/opt/python3.6/include/python3.6m/odictobject.h" "$(@D)/python_include/odictobject.h" && cp "/opt/python3.6/include/python3.6m/opcode.h" "$(@D)/python_include/opcode.h" && cp "/opt/python3.6/include/python3.6m/osdefs.h" "$(@D)/python_include/osdefs.h" && cp "/opt/python3.6/include/python3.6m/osmodule.h" "$(@D)/python_include/osmodule.h" && cp "/opt/python3.6/include/python3.6m/parsetok.h" "$(@D)/python_include/parsetok.h" && cp "/opt/python3.6/include/python3.6m/patchlevel.h" "$(@D)/python_include/patchlevel.h" && cp "/opt/python3.6/include/python3.6m/pgen.h" "$(@D)/python_include/pgen.h" && cp "/opt/python3.6/include/python3.6m/pgenheaders.h" "$(@D)/python_include/pgenheaders.h" && cp "/opt/python3.6/include/python3.6m/py_curses.h" "$(@D)/python_include/py_curses.h" && cp "/opt/python3.6/include/python3.6m/pyarena.h" "$(@D)/python_include/pyarena.h" && cp "/opt/python3.6/include/python3.6m/pyatomic.h" "$(@D)/python_include/pyatomic.h" && cp "/opt/python3.6/include/python3.6m/pycapsule.h" "$(@D)/python_include/pycapsule.h" && cp "/opt/python3.6/include/python3.6m/pyconfig.h" "$(@D)/python_include/pyconfig.h" && cp "/opt/python3.6/include/python3.6m/pyctype.h" "$(@D)/python_include/pyctype.h" && cp "/opt/python3.6/include/python3.6m/pydebug.h" "$(@D)/python_include/pydebug.h" && cp "/opt/python3.6/include/python3.6m/pydtrace.h" "$(@D)/python_include/pydtrace.h" && cp "/opt/python3.6/include/python3.6m/pyerrors.h" "$(@D)/python_include/pyerrors.h" && cp "/opt/python3.6/include/python3.6m/pyexpat.h" "$(@D)/python_include/pyexpat.h" && cp "/opt/python3.6/include/python3.6m/pyfpe.h" "$(@D)/python_include/pyfpe.h" && cp "/opt/python3.6/include/python3.6m/pygetopt.h" "$(@D)/python_include/pygetopt.h" && cp "/opt/python3.6/include/python3.6m/pyhash.h" "$(@D)/python_include/pyhash.h" && cp "/opt/python3.6/include/python3.6m/pylifecycle.h" "$(@D)/python_include/pylifecycle.h" && cp "/opt/python3.6/include/python3.6m/pymacconfig.h" "$(@D)/python_include/pymacconfig.h" && cp "/opt/python3.6/include/python3.6m/pymacro.h" "$(@D)/python_include/pymacro.h" && cp "/opt/python3.6/include/python3.6m/pymath.h" "$(@D)/python_include/pymath.h" && cp "/opt/python3.6/include/python3.6m/pymem.h" "$(@D)/python_include/pymem.h" && cp "/opt/python3.6/include/python3.6m/pyport.h" "$(@D)/python_include/pyport.h" && cp "/opt/python3.6/include/python3.6m/pystate.h" "$(@D)/python_include/pystate.h" && cp "/opt/python3.6/include/python3.6m/pystrcmp.h" "$(@D)/python_include/pystrcmp.h" && cp "/opt/python3.6/include/python3.6m/pystrhex.h" "$(@D)/python_include/pystrhex.h" && cp "/opt/python3.6/include/python3.6m/pystrtod.h" "$(@D)/python_include/pystrtod.h" && cp "/opt/python3.6/include/python3.6m/pythonrun.h" "$(@D)/python_include/pythonrun.h" && cp "/opt/python3.6/include/python3.6m/pythread.h" "$(@D)/python_include/pythread.h" && cp "/opt/python3.6/include/python3.6m/pytime.h" "$(@D)/python_include/pytime.h" && cp "/opt/python3.6/include/python3.6m/rangeobject.h" "$(@D)/python_include/rangeobject.h" && cp "/opt/python3.6/include/python3.6m/setobject.h" "$(@D)/python_include/setobject.h" && cp "/opt/python3.6/include/python3.6m/sliceobject.h" "$(@D)/python_include/sliceobject.h" && cp "/opt/python3.6/include/python3.6m/structmember.h" "$(@D)/python_include/structmember.h" && cp "/opt/python3.6/include/python3.6m/structseq.h" "$(@D)/python_include/structseq.h" && cp "/opt/python3.6/include/python3.6m/symtable.h" "$(@D)/python_include/symtable.h" && cp "/opt/python3.6/include/python3.6m/sysmodule.h" "$(@D)/python_include/sysmodule.h" && cp "/opt/python3.6/include/python3.6m/token.h" "$(@D)/python_include/token.h" && cp "/opt/python3.6/include/python3.6m/traceback.h" "$(@D)/python_include/traceback.h" && cp "/opt/python3.6/include/python3.6m/tupleobject.h" "$(@D)/python_include/tupleobject.h" && cp "/opt/python3.6/include/python3.6m/typeslots.h" "$(@D)/python_include/typeslots.h" && cp "/opt/python3.6/include/python3.6m/ucnhash.h" "$(@D)/python_include/ucnhash.h" && cp "/opt/python3.6/include/python3.6m/unicodeobject.h" "$(@D)/python_include/unicodeobject.h" && cp "/opt/python3.6/include/python3.6m/warnings.h" "$(@D)/python_include/warnings.h" && cp "/opt/python3.6/include/python3.6m/weakrefobject.h" "$(@D)/python_include/weakrefobject.h"
""",
)
genrule(
name = "numpy_include",
outs = [
- "numpy_include/numpy/oldnumeric.h",
- "numpy_include/numpy/npy_1_7_deprecated_api.h",
- "numpy_include/numpy/ufunc_api.txt",
- "numpy_include/numpy/multiarray_api.txt",
- "numpy_include/numpy/halffloat.h",
- "numpy_include/numpy/npy_common.h",
- "numpy_include/numpy/utils.h",
- "numpy_include/numpy/npy_interrupt.h",
- "numpy_include/numpy/npy_endian.h",
+ "numpy_include/numpy/__multiarray_api.h",
"numpy_include/numpy/__ufunc_api.h",
"numpy_include/numpy/_neighborhood_iterator_imp.h",
- "numpy_include/numpy/ufuncobject.h",
+ "numpy_include/numpy/_numpyconfig.h",
+ "numpy_include/numpy/arrayobject.h",
+ "numpy_include/numpy/arrayscalars.h",
+ "numpy_include/numpy/halffloat.h",
+ "numpy_include/numpy/multiarray_api.txt",
+ "numpy_include/numpy/ndarrayobject.h",
"numpy_include/numpy/ndarraytypes.h",
- "numpy_include/numpy/npy_math.h",
"numpy_include/numpy/noprefix.h",
+ "numpy_include/numpy/npy_1_7_deprecated_api.h",
"numpy_include/numpy/npy_3kcompat.h",
- "numpy_include/numpy/arrayscalars.h",
- "numpy_include/numpy/npy_os.h",
- "numpy_include/numpy/ndarrayobject.h",
- "numpy_include/numpy/npy_no_deprecated_api.h",
- "numpy_include/numpy/arrayobject.h",
- "numpy_include/numpy/_numpyconfig.h",
- "numpy_include/numpy/__multiarray_api.h",
+ "numpy_include/numpy/npy_common.h",
"numpy_include/numpy/npy_cpu.h",
- "numpy_include/numpy/old_defines.h",
+ "numpy_include/numpy/npy_endian.h",
+ "numpy_include/numpy/npy_interrupt.h",
+ "numpy_include/numpy/npy_math.h",
+ "numpy_include/numpy/npy_no_deprecated_api.h",
+ "numpy_include/numpy/npy_os.h",
"numpy_include/numpy/numpyconfig.h",
+ "numpy_include/numpy/old_defines.h",
+ "numpy_include/numpy/oldnumeric.h",
+ "numpy_include/numpy/ufunc_api.txt",
+ "numpy_include/numpy/ufuncobject.h",
+ "numpy_include/numpy/utils.h",
],
cmd = """
-cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/oldnumeric.h" "$(@D)/numpy_include/numpy/oldnumeric.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_1_7_deprecated_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ufunc_api.txt" "$(@D)/numpy_include/numpy/ufunc_api.txt" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/multiarray_api.txt" "$(@D)/numpy_include/numpy/multiarray_api.txt" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/halffloat.h" "$(@D)/numpy_include/numpy/halffloat.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_common.h" "$(@D)/numpy_include/numpy/npy_common.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/utils.h" "$(@D)/numpy_include/numpy/utils.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_interrupt.h" "$(@D)/numpy_include/numpy/npy_interrupt.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_endian.h" "$(@D)/numpy_include/numpy/npy_endian.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/__ufunc_api.h" "$(@D)/numpy_include/numpy/__ufunc_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/_neighborhood_iterator_imp.h" "$(@D)/numpy_include/numpy/_neighborhood_iterator_imp.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ufuncobject.h" "$(@D)/numpy_include/numpy/ufuncobject.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h" "$(@D)/numpy_include/numpy/ndarraytypes.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_math.h" "$(@D)/numpy_include/numpy/npy_math.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/noprefix.h" "$(@D)/numpy_include/numpy/noprefix.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_3kcompat.h" "$(@D)/numpy_include/numpy/npy_3kcompat.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/arrayscalars.h" "$(@D)/numpy_include/numpy/arrayscalars.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_os.h" "$(@D)/numpy_include/numpy/npy_os.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h" "$(@D)/numpy_include/numpy/ndarrayobject.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_no_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_no_deprecated_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h" "$(@D)/numpy_include/numpy/arrayobject.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/_numpyconfig.h" "$(@D)/numpy_include/numpy/_numpyconfig.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/__multiarray_api.h" "$(@D)/numpy_include/numpy/__multiarray_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_cpu.h" "$(@D)/numpy_include/numpy/npy_cpu.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/old_defines.h" "$(@D)/numpy_include/numpy/old_defines.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/numpyconfig.h" "$(@D)/numpy_include/numpy/numpyconfig.h"
+cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/__multiarray_api.h" "$(@D)/numpy_include/numpy/__multiarray_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/__ufunc_api.h" "$(@D)/numpy_include/numpy/__ufunc_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/_neighborhood_iterator_imp.h" "$(@D)/numpy_include/numpy/_neighborhood_iterator_imp.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/_numpyconfig.h" "$(@D)/numpy_include/numpy/_numpyconfig.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h" "$(@D)/numpy_include/numpy/arrayobject.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/arrayscalars.h" "$(@D)/numpy_include/numpy/arrayscalars.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/halffloat.h" "$(@D)/numpy_include/numpy/halffloat.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/multiarray_api.txt" "$(@D)/numpy_include/numpy/multiarray_api.txt" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h" "$(@D)/numpy_include/numpy/ndarrayobject.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h" "$(@D)/numpy_include/numpy/ndarraytypes.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/noprefix.h" "$(@D)/numpy_include/numpy/noprefix.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_1_7_deprecated_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_3kcompat.h" "$(@D)/numpy_include/numpy/npy_3kcompat.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_common.h" "$(@D)/numpy_include/numpy/npy_common.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_cpu.h" "$(@D)/numpy_include/numpy/npy_cpu.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_endian.h" "$(@D)/numpy_include/numpy/npy_endian.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_interrupt.h" "$(@D)/numpy_include/numpy/npy_interrupt.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_math.h" "$(@D)/numpy_include/numpy/npy_math.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_no_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_no_deprecated_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_os.h" "$(@D)/numpy_include/numpy/npy_os.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/numpyconfig.h" "$(@D)/numpy_include/numpy/numpyconfig.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/old_defines.h" "$(@D)/numpy_include/numpy/old_defines.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/oldnumeric.h" "$(@D)/numpy_include/numpy/oldnumeric.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ufunc_api.txt" "$(@D)/numpy_include/numpy/ufunc_api.txt" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ufuncobject.h" "$(@D)/numpy_include/numpy/ufuncobject.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/utils.h" "$(@D)/numpy_include/numpy/utils.h"
""",
)
diff --git a/third_party/toolchains/gpus/crosstool/BUILD b/third_party/toolchains/gpus/crosstool/BUILD
index 1f9065007c..bb0b6b3bbb 100644
--- a/third_party/toolchains/gpus/crosstool/BUILD
+++ b/third_party/toolchains/gpus/crosstool/BUILD
@@ -11,6 +11,7 @@ cc_toolchain_suite(
toolchains = {
"local|compiler": ":cc-compiler-local",
"darwin|compiler": ":cc-compiler-darwin",
+ "x64_windows|msvc-cl": ":cc-compiler-windows",
},
)
@@ -46,6 +47,20 @@ cc_toolchain(
supports_param_files = 0,
)
+cc_toolchain(
+ name = "cc-compiler-windows",
+ all_files = ":empty",
+ compiler_files = ":empty",
+ cpu = "x64_windows",
+ dwp_files = ":empty",
+ dynamic_runtime_libs = [":empty"],
+ linker_files = ":empty",
+ objcopy_files = ":empty",
+ static_runtime_libs = [":empty"],
+ strip_files = ":empty",
+ supports_param_files = 1,
+)
+
filegroup(
name = "empty",
srcs = [],
@@ -55,3 +70,8 @@ filegroup(
name = "crosstool_wrapper_driver_is_not_gcc",
srcs = ["clang/bin/crosstool_wrapper_driver_is_not_gcc"],
)
+
+filegroup(
+ name = "windows_msvc_wrapper_files",
+ srcs = glob(["windows/msvc_*"]),
+)
diff --git a/third_party/toolchains/gpus/crosstool/CROSSTOOL b/third_party/toolchains/gpus/crosstool/CROSSTOOL
index d6ee7e38c4..b8eeb31ecb 100644
--- a/third_party/toolchains/gpus/crosstool/CROSSTOOL
+++ b/third_party/toolchains/gpus/crosstool/CROSSTOOL
@@ -26,6 +26,10 @@ default_toolchain {
cpu: "ppc"
toolchain_identifier: "local_linux"
}
+default_toolchain {
+ cpu: "x64_windows"
+ toolchain_identifier: "local_windows"
+}
toolchain {
abi_version: "local"
@@ -144,9 +148,11 @@ toolchain {
flag_group {
# All warnings are enabled. Maybe enable -Werror as well?
flag: "-Wall"
+
# Some parts of the codebase set -Werror and hit this warning, so
# switch it off for now.
flag: "-Wno-invalid-partial-specialization"
+
}
}
}
@@ -307,3 +313,1120 @@ toolchain {
cxx_builtin_include_directory: "/usr/include/x86_64-linux-gnu"
cxx_builtin_include_directory: "/usr/include"
}
+
+toolchain {
+ abi_version: "local"
+ abi_libc_version: "local"
+ compiler: "compiler"
+ host_system_name: "local"
+ needsPic: true
+ target_libc: "macosx"
+ target_cpu: "darwin"
+ target_system_name: "local"
+ toolchain_identifier: "local_darwin"
+ feature {
+ name: "c++11"
+ flag_set {
+ action: "c++-compile"
+ flag_group {
+ flag: "-std=c++11"
+ }
+ }
+ }
+
+ feature {
+ name: "stdlib"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "-lc++"
+ }
+ }
+ }
+
+ feature {
+ name: "determinism"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # Make C++ compilation deterministic. Use linkstamping instead of these
+ # compiler symbols.
+ flag: "-Wno-builtin-macro-redefined"
+ flag: "-D__DATE__=\"redacted\""
+ flag: "-D__TIMESTAMP__=\"redacted\""
+ flag: "-D__TIME__=\"redacted\""
+ }
+ }
+ }
+
+ # This feature will be enabled for builds that support pic by bazel.
+ feature {
+ name: "pic"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ expand_if_all_available: "pic"
+ flag: "-fPIC"
+ }
+ flag_group {
+ expand_if_none_available: "pic"
+ flag: "-fPIE"
+ }
+ }
+ }
+
+ # Security hardening on by default.
+ feature {
+ name: "hardening"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
+ # We need to undef it before redefining it as some distributions now
+ # have it enabled by default.
+ flag: "-U_FORTIFY_SOURCE"
+ flag: "-D_FORTIFY_SOURCE=1"
+ flag: "-fstack-protector"
+ }
+ }
+ flag_set {
+ action: "c++-link-executable"
+ flag_group {
+ flag: "-pie"
+ }
+ }
+ }
+
+ feature {
+ name: "warnings"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # All warnings are enabled. Maybe enable -Werror as well?
+ flag: "-Wall"
+
+ # Some parts of the codebase set -Werror and hit this warning, so
+ # switch it off for now.
+ flag: "-Wno-invalid-partial-specialization"
+
+ }
+ }
+ }
+
+ # Keep stack frames for debugging, even in opt mode.
+ feature {
+ name: "frame-pointer"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-fno-omit-frame-pointer"
+ }
+ }
+ }
+
+ feature {
+ name: "no-canonical-prefixes"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag:"-no-canonical-prefixes"
+ }
+ }
+ }
+
+ feature {
+ name: "disable-assertions"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-DNDEBUG"
+ }
+ }
+ }
+
+ feature {
+ name: "linker-bin-path"
+
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "-B/usr/bin/"
+ }
+ }
+ }
+
+ feature {
+ name: "undefined-dynamic"
+ flag_set {
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "c++-link-executable"
+ flag_group {
+ flag: "-undefined"
+ flag: "dynamic_lookup"
+ }
+ }
+ }
+
+ feature {
+ name: "common"
+ implies: "stdlib"
+ implies: "c++11"
+ implies: "determinism"
+ implies: "hardening"
+ implies: "warnings"
+ implies: "frame-pointer"
+ implies: "no-canonical-prefixes"
+ implies: "linker-bin-path"
+ implies: "undefined-dynamic"
+ }
+
+ feature {
+ name: "opt"
+ implies: "common"
+ implies: "disable-assertions"
+
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # No debug symbols.
+ # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt
+ # or even generally? However, that can't happen here, as it requires
+ # special handling in Bazel.
+ flag: "-g0"
+
+ # Conservative choice for -O
+ # -O3 can increase binary size and even slow down the resulting binaries.
+ # Profile first and / or use FDO if you need better performance than this.
+ flag: "-O2"
+
+ # Removal of unused code and data at link time (can this increase binary size in some cases?).
+ flag: "-ffunction-sections"
+ flag: "-fdata-sections"
+ }
+ }
+ }
+
+ feature {
+ name: "fastbuild"
+ implies: "common"
+ }
+
+ feature {
+ name: "dbg"
+ implies: "common"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-g"
+ }
+ }
+ }
+
+ # Set clang as a C/C++ compiler.
+ tool_path { name: "gcc" path: "/usr/local/bin/clang" }
+
+ # Use the default system toolchain for everything else.
+ tool_path { name: "ar" path: "/usr/bin/libtool" }
+ tool_path { name: "compat-ld" path: "/usr/bin/ld" }
+ tool_path { name: "cpp" path: "/usr/bin/cpp" }
+ tool_path { name: "dwp" path: "/usr/bin/dwp" }
+ tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ tool_path { name: "ld" path: "/usr/bin/ld" }
+ tool_path { name: "nm" path: "/usr/bin/nm" }
+ tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
+ tool_path { name: "objdump" path: "/usr/bin/objdump" }
+ tool_path { name: "strip" path: "/usr/bin/strip" }
+
+ # Enabled dynamic linking.
+ linking_mode_flags { mode: DYNAMIC }
+
+ cxx_builtin_include_directory: "/usr/include/c++/5.4.0"
+ cxx_builtin_include_directory: "/usr/include/x86_64-linux-gnu/c++/5.4.0"
+ cxx_builtin_include_directory: "/usr/include/c++/5.4.0/backward"
+ cxx_builtin_include_directory: "/usr/local/include"
+ cxx_builtin_include_directory: "/usr/local/lib/clang/7.0.0/include"
+ cxx_builtin_include_directory: "/usr/include/x86_64-linux-gnu"
+ cxx_builtin_include_directory: "/usr/include"
+}
+
+toolchain {
+ toolchain_identifier: "local_windows"
+ host_system_name: "local"
+ target_system_name: "local"
+
+ abi_version: "local"
+ abi_libc_version: "local"
+ target_cpu: "x64_windows"
+ compiler: "msvc-cl"
+ target_libc: "msvcrt"
+
+
+
+ tool_path {
+ name: "ar"
+ path: ""
+ }
+ tool_path {
+ name: "ml"
+ path: ""
+ }
+ tool_path {
+ name: "cpp"
+ path: ""
+ }
+ tool_path {
+ name: "gcc"
+ path: ""
+ }
+ tool_path {
+ name: "gcov"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ tool_path {
+ name: "ld"
+ path: ""
+ }
+ tool_path {
+ name: "nm"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ tool_path {
+ name: "objcopy"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ tool_path {
+ name: "objdump"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ tool_path {
+ name: "strip"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ supports_interface_shared_objects: true
+
+ # TODO(pcloudy): Review those flags below, they should be defined by cl.exe
+ compiler_flag: "/DCOMPILER_MSVC"
+
+ # Don't define min/max macros in windows.h.
+ compiler_flag: "/DNOMINMAX"
+
+ # Platform defines.
+ compiler_flag: "/D_WIN32_WINNT=0x0600"
+ # Turn off warning messages.
+ compiler_flag: "/D_CRT_SECURE_NO_DEPRECATE"
+ compiler_flag: "/D_CRT_SECURE_NO_WARNINGS"
+ compiler_flag: "/D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS"
+
+ # Useful options to have on for compilation.
+ # Increase the capacity of object files to 2^32 sections.
+ compiler_flag: "/bigobj"
+ # Allocate 500MB for precomputed headers.
+ compiler_flag: "/Zm500"
+ # Use unsigned char by default.
+ compiler_flag: "/J"
+ # Use function level linking.
+ compiler_flag: "/Gy"
+ # Use string pooling.
+ compiler_flag: "/GF"
+ # Catch C++ exceptions only and tell the compiler to assume that functions declared
+ # as extern "C" never throw a C++ exception.
+ compiler_flag: "/EHsc"
+
+ # Globally disabled warnings.
+ # Don't warn about elements of array being be default initialized.
+ compiler_flag: "/wd4351"
+ # Don't warn about no matching delete found.
+ compiler_flag: "/wd4291"
+ # Don't warn about diamond inheritance patterns.
+ compiler_flag: "/wd4250"
+ # Don't warn about insecure functions (e.g. non _s functions).
+ compiler_flag: "/wd4996"
+
+ linker_flag: "/MACHINE:X64"
+
+ feature {
+ name: "no_legacy_features"
+ }
+
+ # Suppress startup banner.
+ feature {
+ name: "nologo"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-module-compile"
+ action: "c++-module-codegen"
+ action: "c++-header-parsing"
+ action: "assemble"
+ action: "preprocess-assemble"
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "c++-link-static-library"
+ flag_group {
+ flag: "/nologo"
+ }
+ }
+ }
+
+ feature {
+ name: 'has_configured_linker_path'
+ }
+
+ # This feature indicates strip is not supported, building stripped binary will just result a copy of orignial binary
+ feature {
+ name: 'no_stripping'
+ }
+
+ # This feature indicates this is a toolchain targeting Windows.
+ feature {
+ name: 'targets_windows'
+ implies: 'copy_dynamic_libraries_to_binary'
+ enabled: true
+ }
+
+ feature {
+ name: 'copy_dynamic_libraries_to_binary'
+ }
+
+ action_config {
+ config_name: 'assemble'
+ action_name: 'assemble'
+ tool {
+ tool_path: ''
+ }
+ implies: 'compiler_input_flags'
+ implies: 'compiler_output_flags'
+ implies: 'nologo'
+ implies: 'msvc_env'
+ implies: 'sysroot'
+ }
+
+ action_config {
+ config_name: 'preprocess-assemble'
+ action_name: 'preprocess-assemble'
+ tool {
+ tool_path: ''
+ }
+ implies: 'compiler_input_flags'
+ implies: 'compiler_output_flags'
+ implies: 'nologo'
+ implies: 'msvc_env'
+ implies: 'sysroot'
+ }
+
+ action_config {
+ config_name: 'c-compile'
+ action_name: 'c-compile'
+ tool {
+ tool_path: ''
+ }
+ implies: 'compiler_input_flags'
+ implies: 'compiler_output_flags'
+ implies: 'legacy_compile_flags'
+ implies: 'nologo'
+ implies: 'msvc_env'
+ implies: 'parse_showincludes'
+ implies: 'user_compile_flags'
+ implies: 'sysroot'
+ implies: 'unfiltered_compile_flags'
+ }
+
+ action_config {
+ config_name: 'c++-compile'
+ action_name: 'c++-compile'
+ tool {
+ tool_path: ''
+ }
+ implies: 'compiler_input_flags'
+ implies: 'compiler_output_flags'
+ implies: 'legacy_compile_flags'
+ implies: 'nologo'
+ implies: 'msvc_env'
+ implies: 'parse_showincludes'
+ implies: 'user_compile_flags'
+ implies: 'sysroot'
+ implies: 'unfiltered_compile_flags'
+ }
+
+ action_config {
+ config_name: 'c++-link-executable'
+ action_name: 'c++-link-executable'
+ tool {
+ tool_path: ''
+ }
+ implies: 'nologo'
+ implies: 'linkstamps'
+ implies: 'output_execpath_flags'
+ implies: 'input_param_flags'
+ implies: 'user_link_flags'
+ implies: 'legacy_link_flags'
+ implies: 'linker_subsystem_flag'
+ implies: 'linker_param_file'
+ implies: 'msvc_env'
+ implies: 'no_stripping'
+ }
+
+ action_config {
+ config_name: 'c++-link-dynamic-library'
+ action_name: 'c++-link-dynamic-library'
+ tool {
+ tool_path: ''
+ }
+ implies: 'nologo'
+ implies: 'shared_flag'
+ implies: 'linkstamps'
+ implies: 'output_execpath_flags'
+ implies: 'input_param_flags'
+ implies: 'user_link_flags'
+ implies: 'legacy_link_flags'
+ implies: 'linker_subsystem_flag'
+ implies: 'linker_param_file'
+ implies: 'msvc_env'
+ implies: 'no_stripping'
+ implies: 'has_configured_linker_path'
+ implies: 'def_file'
+ }
+
+ action_config {
+ config_name: 'c++-link-nodeps-dynamic-library'
+ action_name: 'c++-link-nodeps-dynamic-library'
+ tool {
+ tool_path: ''
+ }
+ implies: 'nologo'
+ implies: 'shared_flag'
+ implies: 'linkstamps'
+ implies: 'output_execpath_flags'
+ implies: 'input_param_flags'
+ implies: 'user_link_flags'
+ implies: 'legacy_link_flags'
+ implies: 'linker_subsystem_flag'
+ implies: 'linker_param_file'
+ implies: 'msvc_env'
+ implies: 'no_stripping'
+ implies: 'has_configured_linker_path'
+ implies: 'def_file'
+ }
+
+ action_config {
+ config_name: 'c++-link-static-library'
+ action_name: 'c++-link-static-library'
+ tool {
+ tool_path: ''
+ }
+ implies: 'nologo'
+ implies: 'archiver_flags'
+ implies: 'input_param_flags'
+ implies: 'linker_param_file'
+ implies: 'msvc_env'
+ }
+
+ # TODO(b/65151735): Remove legacy_compile_flags feature when legacy fields are
+ # not used in this crosstool
+ feature {
+ name: 'legacy_compile_flags'
+ flag_set {
+ expand_if_all_available: 'legacy_compile_flags'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ iterate_over: 'legacy_compile_flags'
+ flag: '%{legacy_compile_flags}'
+ }
+ }
+ }
+
+ feature {
+ name: "msvc_env"
+ env_set {
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-module-compile"
+ action: "c++-module-codegen"
+ action: "c++-header-parsing"
+ action: "assemble"
+ action: "preprocess-assemble"
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "c++-link-static-library"
+ env_entry {
+ key: "PATH"
+ value: ""
+ }
+ env_entry {
+ key: "INCLUDE"
+ value: ""
+ }
+ env_entry {
+ key: "LIB"
+ value: ""
+ }
+ env_entry {
+ key: "TMP"
+ value: ""
+ }
+ env_entry {
+ key: "TEMP"
+ value: ""
+ }
+ }
+ }
+
+ feature {
+ name: 'include_paths'
+ flag_set {
+ action: "assemble"
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ flag_group {
+ iterate_over: 'quote_include_paths'
+ flag: '/I%{quote_include_paths}'
+ }
+ flag_group {
+ iterate_over: 'include_paths'
+ flag: '/I%{include_paths}'
+ }
+ flag_group {
+ iterate_over: 'system_include_paths'
+ flag: '/I%{system_include_paths}'
+ }
+ }
+ }
+
+ feature {
+ name: "preprocessor_defines"
+ flag_set {
+ action: "assemble"
+ action: "preprocess-assemble"
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-header-parsing"
+ action: "c++-module-compile"
+ flag_group {
+ flag: "/D%{preprocessor_defines}"
+ iterate_over: "preprocessor_defines"
+ }
+ }
+ }
+
+ # Tell Bazel to parse the output of /showIncludes
+ feature {
+ name: 'parse_showincludes'
+ flag_set {
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-module-compile'
+ action: 'c++-header-parsing'
+ flag_group {
+ flag: "/showIncludes"
+ }
+ }
+ }
+
+
+ feature {
+ name: 'generate_pdb_file'
+ requires: {
+ feature: 'dbg'
+ }
+ requires: {
+ feature: 'fastbuild'
+ }
+ }
+
+ feature {
+ name: 'shared_flag'
+ flag_set {
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: '/DLL'
+ }
+ }
+ }
+
+ feature {
+ name: 'linkstamps'
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ expand_if_all_available: 'linkstamp_paths'
+ flag_group {
+ iterate_over: 'linkstamp_paths'
+ flag: '%{linkstamp_paths}'
+ }
+ }
+ }
+
+ feature {
+ name: 'output_execpath_flags'
+ flag_set {
+ expand_if_all_available: 'output_execpath'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: '/OUT:%{output_execpath}'
+ }
+ }
+ }
+
+ feature {
+ name: 'archiver_flags'
+ flag_set {
+ expand_if_all_available: 'output_execpath'
+ action: 'c++-link-static-library'
+ flag_group {
+ flag: '/OUT:%{output_execpath}'
+ }
+ }
+ }
+
+ feature {
+ name: 'input_param_flags'
+ flag_set {
+ expand_if_all_available: 'interface_library_output_path'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/IMPLIB:%{interface_library_output_path}"
+ }
+ }
+ flag_set {
+ expand_if_all_available: 'libopts'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ iterate_over: 'libopts'
+ flag: '%{libopts}'
+ }
+ }
+ flag_set {
+ expand_if_all_available: 'libraries_to_link'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ action: 'c++-link-static-library'
+ flag_group {
+ iterate_over: 'libraries_to_link'
+ flag_group {
+ expand_if_equal: {
+ variable: 'libraries_to_link.type'
+ value: 'object_file_group'
+ }
+ iterate_over: 'libraries_to_link.object_files'
+ flag_group {
+ flag: '%{libraries_to_link.object_files}'
+ }
+ }
+ flag_group {
+ expand_if_equal: {
+ variable: 'libraries_to_link.type'
+ value: 'object_file'
+ }
+ flag_group {
+ flag: '%{libraries_to_link.name}'
+ }
+ }
+ flag_group {
+ expand_if_equal: {
+ variable: 'libraries_to_link.type'
+ value: 'interface_library'
+ }
+ flag_group {
+ flag: '%{libraries_to_link.name}'
+ }
+ }
+ flag_group {
+ expand_if_equal: {
+ variable: 'libraries_to_link.type'
+ value: 'static_library'
+ }
+ flag_group {
+ expand_if_false: 'libraries_to_link.is_whole_archive'
+ flag: '%{libraries_to_link.name}'
+ }
+ flag_group {
+ expand_if_true: 'libraries_to_link.is_whole_archive'
+ flag: '/WHOLEARCHIVE:%{libraries_to_link.name}'
+ }
+ }
+ }
+ }
+ }
+
+ # Since this feature is declared earlier in the CROSSTOOL than
+ # "user_link_flags", this feature will be applied prior to it anwyhere they
+ # are both implied. And since "user_link_flags" contains the linkopts from
+ # the build rule, this allows the user to override the /SUBSYSTEM in the BUILD
+ # file.
+ feature {
+ name: 'linker_subsystem_flag'
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: '/SUBSYSTEM:CONSOLE'
+ }
+ }
+ }
+
+ # The "user_link_flags" contains user-defined linkopts (from build rules)
+ # so it should be defined after features that declare user-overridable flags.
+ # For example the "linker_subsystem_flag" defines a default "/SUBSYSTEM" flag
+ # but we want to let the user override it, therefore "link_flag_subsystem" is
+ # defined earlier in the CROSSTOOL file than "user_link_flags".
+ feature {
+ name: 'user_link_flags'
+ flag_set {
+ expand_if_all_available: 'user_link_flags'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ iterate_over: 'user_link_flags'
+ flag: '%{user_link_flags}'
+ }
+ }
+ }
+ feature {
+ name: 'legacy_link_flags'
+ flag_set {
+ expand_if_all_available: 'legacy_link_flags'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ iterate_over: 'legacy_link_flags'
+ flag: '%{legacy_link_flags}'
+ }
+ }
+ }
+
+ feature {
+ name: 'linker_param_file'
+ flag_set {
+ expand_if_all_available: 'linker_param_file'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ action: 'c++-link-static-library'
+ flag_group {
+ flag: '@%{linker_param_file}'
+ }
+ }
+ }
+
+ feature {
+ name: 'static_link_msvcrt'
+ }
+
+ feature {
+ name: 'static_link_msvcrt_no_debug'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/MT"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEFAULTLIB:libcmt.lib"
+ }
+ }
+ requires: { feature: 'fastbuild'}
+ requires: { feature: 'opt'}
+ }
+
+ feature {
+ name: 'dynamic_link_msvcrt_no_debug'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/MD"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEFAULTLIB:msvcrt.lib"
+ }
+ }
+ requires: { feature: 'fastbuild'}
+ requires: { feature: 'opt'}
+ }
+
+ feature {
+ name: 'static_link_msvcrt_debug'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/MTd"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEFAULTLIB:libcmtd.lib"
+ }
+ }
+ requires: { feature: 'dbg'}
+ }
+
+ feature {
+ name: 'dynamic_link_msvcrt_debug'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/MDd"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEFAULTLIB:msvcrtd.lib"
+ }
+ }
+ requires: { feature: 'dbg'}
+ }
+
+ feature {
+ name: 'dbg'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/Od"
+ flag: "/Z7"
+ flag: "/DDEBUG"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEBUG:FULL"
+ flag: "/INCREMENTAL:NO"
+ }
+ }
+ implies: 'generate_pdb_file'
+ }
+
+ feature {
+ name: 'fastbuild'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/Od"
+ flag: "/Z7"
+ flag: "/DDEBUG"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEBUG:FASTLINK"
+ flag: "/INCREMENTAL:NO"
+ }
+ }
+ implies: 'generate_pdb_file'
+ }
+
+ feature {
+ name: 'opt'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/O2"
+ flag: "/DNDEBUG"
+ }
+ }
+ }
+
+ feature {
+ name: 'user_compile_flags'
+ flag_set {
+ expand_if_all_available: 'user_compile_flags'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ iterate_over: 'user_compile_flags'
+ flag: '%{user_compile_flags}'
+ }
+ }
+ }
+
+ feature {
+ name: 'sysroot'
+ flag_set {
+ expand_if_all_available: 'sysroot'
+ action: 'assemble'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ iterate_over: 'sysroot'
+ flag: '--sysroot=%{sysroot}'
+ }
+ }
+ }
+
+ feature {
+ name: 'unfiltered_compile_flags'
+ flag_set {
+ expand_if_all_available: 'unfiltered_compile_flags'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ iterate_over: 'unfiltered_compile_flags'
+ flag: '%{unfiltered_compile_flags}'
+ }
+ }
+ }
+
+ feature {
+ name: 'compiler_output_flags'
+ flag_set {
+ action: 'assemble'
+ flag_group {
+ expand_if_all_available: 'output_file'
+ expand_if_none_available: 'output_assembly_file'
+ expand_if_none_available: 'output_preprocess_file'
+ flag: '/Fo%{output_file}'
+ flag: '/Zi'
+ }
+ }
+ flag_set {
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ expand_if_all_available: 'output_file'
+ expand_if_none_available: 'output_assembly_file'
+ expand_if_none_available: 'output_preprocess_file'
+ flag: '/Fo%{output_file}'
+ }
+ flag_group {
+ expand_if_all_available: 'output_file'
+ expand_if_all_available: 'output_assembly_file'
+ flag: '/Fa%{output_file}'
+ }
+ flag_group {
+ expand_if_all_available: 'output_file'
+ expand_if_all_available: 'output_preprocess_file'
+ flag: '/P'
+ flag: '/Fi%{output_file}'
+ }
+ }
+ }
+
+ feature {
+ name: 'compiler_input_flags'
+ flag_set {
+ action: 'assemble'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ expand_if_all_available: 'source_file'
+ flag: '/c'
+ flag: '%{source_file}'
+ }
+ }
+ }
+
+ feature {
+ name : 'def_file',
+ flag_set {
+ expand_if_all_available: 'def_file_path'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEF:%{def_file_path}"
+ # We can specify a different DLL name in DEF file, /ignore:4070 suppresses
+ # the warning message about DLL name doesn't match the default one.
+ # See https://msdn.microsoft.com/en-us/library/sfkk2fz7.aspx
+ flag: "/ignore:4070"
+ }
+ }
+ }
+
+ feature {
+ name: 'windows_export_all_symbols'
+ }
+
+ feature {
+ name: 'no_windows_export_all_symbols'
+ }
+
+ linking_mode_flags { mode: DYNAMIC }
+} \ No newline at end of file
diff --git a/third_party/toolchains/gpus/cuda/BUILD b/third_party/toolchains/gpus/cuda/BUILD
index cfc6930851..f59e025019 100644
--- a/third_party/toolchains/gpus/cuda/BUILD
+++ b/third_party/toolchains/gpus/cuda/BUILD
@@ -133,6 +133,15 @@ cc_library(
)
cc_library(
+ name = "cudnn_header",
+ includes = [
+ ".",
+ "cuda/include",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
name = "cufft",
srcs = ["cuda/lib/libcufft.so.9.0"],
data = ["cuda/lib/libcufft.so.9.0"],
@@ -1191,33 +1200,10 @@ if [ -d "$(@D)/extras" ]; then rm $(@D)/extras -drf; fi && if [ -d "$(@D)/includ
genrule(
name = "cuda-nvvm",
outs = [
- "cuda/nvvm/bin/cicc",
- "cuda/nvvm/include/nvvm.h",
- "cuda/nvvm/lib64/libnvvm.so",
- "cuda/nvvm/lib64/libnvvm.so.3",
- "cuda/nvvm/lib64/libnvvm.so.3.2.0",
"cuda/nvvm/libdevice/libdevice.10.bc",
- "cuda/nvvm/libnvvm-samples/CMakeLists.txt",
- "cuda/nvvm/libnvvm-samples/README.txt",
- "cuda/nvvm/libnvvm-samples/build.bat",
- "cuda/nvvm/libnvvm-samples/build.sh",
- "cuda/nvvm/libnvvm-samples/common/include/DDSWriter.h",
- "cuda/nvvm/libnvvm-samples/common/include/drvapi_error_string.h",
- "cuda/nvvm/libnvvm-samples/cuda-c-linking/CMakeLists.txt",
- "cuda/nvvm/libnvvm-samples/cuda-c-linking/README.txt",
- "cuda/nvvm/libnvvm-samples/cuda-c-linking/cuda-c-linking.cpp",
- "cuda/nvvm/libnvvm-samples/cuda-c-linking/math-funcs.cu",
- "cuda/nvvm/libnvvm-samples/ptxgen/CMakeLists.txt",
- "cuda/nvvm/libnvvm-samples/ptxgen/README.txt",
- "cuda/nvvm/libnvvm-samples/ptxgen/ptxgen.c",
- "cuda/nvvm/libnvvm-samples/simple/CMakeLists.txt",
- "cuda/nvvm/libnvvm-samples/simple/README.txt",
- "cuda/nvvm/libnvvm-samples/simple/simple-gpu.ll",
- "cuda/nvvm/libnvvm-samples/simple/simple-gpu64.ll",
- "cuda/nvvm/libnvvm-samples/simple/simple.c",
],
cmd = """
-if [ -d "$(@D)/extras" ]; then rm $(@D)/extras -drf; fi && if [ -d "$(@D)/include" ]; then rm $(@D)/include -drf; fi && if [ -d "$(@D)/lib" ]; then rm $(@D)/lib -drf; fi && if [ -d "$(@D)/nvvm" ]; then rm $(@D)/nvvm -drf; fi && cp "/usr/local/cuda-9.0/nvvm/bin/cicc" "$(@D)/cuda/nvvm/bin/cicc" && cp "/usr/local/cuda-9.0/nvvm/include/nvvm.h" "$(@D)/cuda/nvvm/include/nvvm.h" && cp "/usr/local/cuda-9.0/nvvm/lib64/libnvvm.so" "$(@D)/cuda/nvvm/lib64/libnvvm.so" && cp "/usr/local/cuda-9.0/nvvm/lib64/libnvvm.so.3" "$(@D)/cuda/nvvm/lib64/libnvvm.so.3" && cp "/usr/local/cuda-9.0/nvvm/lib64/libnvvm.so.3.2.0" "$(@D)/cuda/nvvm/lib64/libnvvm.so.3.2.0" && cp "/usr/local/cuda-9.0/nvvm/libdevice/libdevice.10.bc" "$(@D)/cuda/nvvm/libdevice/libdevice.10.bc" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/CMakeLists.txt" "$(@D)/cuda/nvvm/libnvvm-samples/CMakeLists.txt" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/README.txt" "$(@D)/cuda/nvvm/libnvvm-samples/README.txt" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/build.bat" "$(@D)/cuda/nvvm/libnvvm-samples/build.bat" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/build.sh" "$(@D)/cuda/nvvm/libnvvm-samples/build.sh" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/common/include/DDSWriter.h" "$(@D)/cuda/nvvm/libnvvm-samples/common/include/DDSWriter.h" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/common/include/drvapi_error_string.h" "$(@D)/cuda/nvvm/libnvvm-samples/common/include/drvapi_error_string.h" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/cuda-c-linking/CMakeLists.txt" "$(@D)/cuda/nvvm/libnvvm-samples/cuda-c-linking/CMakeLists.txt" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/cuda-c-linking/README.txt" "$(@D)/cuda/nvvm/libnvvm-samples/cuda-c-linking/README.txt" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/cuda-c-linking/cuda-c-linking.cpp" "$(@D)/cuda/nvvm/libnvvm-samples/cuda-c-linking/cuda-c-linking.cpp" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/cuda-c-linking/math-funcs.cu" "$(@D)/cuda/nvvm/libnvvm-samples/cuda-c-linking/math-funcs.cu" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/ptxgen/CMakeLists.txt" "$(@D)/cuda/nvvm/libnvvm-samples/ptxgen/CMakeLists.txt" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/ptxgen/README.txt" "$(@D)/cuda/nvvm/libnvvm-samples/ptxgen/README.txt" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/ptxgen/ptxgen.c" "$(@D)/cuda/nvvm/libnvvm-samples/ptxgen/ptxgen.c" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/simple/CMakeLists.txt" "$(@D)/cuda/nvvm/libnvvm-samples/simple/CMakeLists.txt" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/simple/README.txt" "$(@D)/cuda/nvvm/libnvvm-samples/simple/README.txt" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/simple/simple-gpu.ll" "$(@D)/cuda/nvvm/libnvvm-samples/simple/simple-gpu.ll" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/simple/simple-gpu64.ll" "$(@D)/cuda/nvvm/libnvvm-samples/simple/simple-gpu64.ll" && cp "/usr/local/cuda-9.0/nvvm/libnvvm-samples/simple/simple.c" "$(@D)/cuda/nvvm/libnvvm-samples/simple/simple.c"
+if [ -d "$(@D)/extras" ]; then rm $(@D)/extras -drf; fi && if [ -d "$(@D)/include" ]; then rm $(@D)/include -drf; fi && if [ -d "$(@D)/lib" ]; then rm $(@D)/lib -drf; fi && if [ -d "$(@D)/nvvm" ]; then rm $(@D)/nvvm -drf; fi && cp "/usr/local/cuda-9.0/nvvm/libdevice/libdevice.10.bc" "$(@D)//libdevice.10.bc"
""",
)
@@ -1272,7 +1258,7 @@ genrule(
"cuda/lib/libcupti.so.9.0",
],
cmd = """
-if [ -d "$(@D)/extras" ]; then rm $(@D)/extras -drf; fi && if [ -d "$(@D)/include" ]; then rm $(@D)/include -drf; fi && if [ -d "$(@D)/lib" ]; then rm $(@D)/lib -drf; fi && if [ -d "$(@D)/nvvm" ]; then rm $(@D)/nvvm -drf; fi && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/stubs/libcuda.so" "$(@D)/cuda/lib/libcuda.so" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudart.so.9.0.176" "$(@D)/cuda/lib/libcudart.so.9.0" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudart_static.a" "$(@D)/cuda/lib/libcudart_static.a" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcublas.so.9.0.282" "$(@D)/cuda/lib/libcublas.so.9.0" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcusolver.so.9.0.176" "$(@D)/cuda/lib/libcusolver.so.9.0" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcurand.so.9.0.176" "$(@D)/cuda/lib/libcurand.so.9.0" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcufft.so.9.0.176" "$(@D)/cuda/lib/libcufft.so.9.0" && cp "/usr/lib/x86_64-linux-gnu/libcudnn.so.7.0.5" "$(@D)/cuda/lib/libcudnn.so.7" && cp "/usr/local/cuda-9.0/extras/CUPTI/lib64/libcupti.so.9.0.176" "$(@D)/cuda/lib/libcupti.so.9.0"
+if [ -d "$(@D)/extras" ]; then rm $(@D)/extras -drf; fi && if [ -d "$(@D)/include" ]; then rm $(@D)/include -drf; fi && if [ -d "$(@D)/lib" ]; then rm $(@D)/lib -drf; fi && if [ -d "$(@D)/nvvm" ]; then rm $(@D)/nvvm -drf; fi && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/stubs/libcuda.so" "$(@D)/cuda/lib/libcuda.so" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudart.so.9.0.176" "$(@D)/cuda/lib/libcudart.so.9.0" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudart_static.a" "$(@D)/cuda/lib/libcudart_static.a" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcublas.so.9.0.480" "$(@D)/cuda/lib/libcublas.so.9.0" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcusolver.so.9.0.176" "$(@D)/cuda/lib/libcusolver.so.9.0" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcurand.so.9.0.176" "$(@D)/cuda/lib/libcurand.so.9.0" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcufft.so.9.0.176" "$(@D)/cuda/lib/libcufft.so.9.0" && cp "/usr/lib/x86_64-linux-gnu/libcudnn.so.7.2.1" "$(@D)/cuda/lib/libcudnn.so.7" && cp "/usr/local/cuda-9.0/extras/CUPTI/lib64/libcupti.so.9.0.176" "$(@D)/cuda/lib/libcupti.so.9.0"
""",
)
diff --git a/third_party/toolchains/gpus/cuda/build_defs.bzl b/third_party/toolchains/gpus/cuda/build_defs.bzl
index badaf43019..9210bfe016 100644
--- a/third_party/toolchains/gpus/cuda/build_defs.bzl
+++ b/third_party/toolchains/gpus/cuda/build_defs.bzl
@@ -2,6 +2,7 @@
# execution service.
# DO NOT EDIT: automatically generated file
+# Macros for building CUDA code.
def if_cuda(if_true, if_false = []):
"""Shorthand for select()'ing on whether we're building with CUDA.
@@ -12,15 +13,13 @@ def if_cuda(if_true, if_false = []):
return select({
"@local_config_cuda//cuda:using_nvcc": if_true,
"@local_config_cuda//cuda:using_clang": if_true,
- "//conditions:default": if_false
+ "//conditions:default": if_false,
})
-
def cuda_default_copts():
"""Default options for all CUDA compilations."""
return if_cuda(["-x", "cuda", "-DGOOGLE_CUDA=1"] + ["--cuda-gpu-arch=sm_30"])
-
def cuda_is_configured():
"""Returns true if CUDA was enabled during the configure process."""
return True
@@ -32,6 +31,5 @@ def if_cuda_is_configured(x):
--config=cuda. Used to allow non-CUDA code to depend on CUDA libraries.
"""
if cuda_is_configured():
- return x
+ return x
return []
-
diff --git a/third_party/toolchains/gpus/cuda/cuda/cuda_config.h b/third_party/toolchains/gpus/cuda/cuda/cuda_config.h
index f6662274cc..7cdaf144ad 100644
--- a/third_party/toolchains/gpus/cuda/cuda/cuda_config.h
+++ b/third_party/toolchains/gpus/cuda/cuda/cuda_config.h
@@ -19,9 +19,9 @@ limitations under the License.
#define TF_CUDA_CAPABILITIES CudaVersion("3.0")
-#define TF_CUDA_VERSION "8.0"
-#define TF_CUDNN_VERSION "5"
+#define TF_CUDA_VERSION "9.0"
+#define TF_CUDNN_VERSION "7"
-#define TF_CUDA_TOOLKIT_PATH "/usr/local/cuda-8.0"
+#define TF_CUDA_TOOLKIT_PATH "/usr/local/cuda-9.0"
#endif // CUDA_CUDA_CONFIG_H_
diff --git a/third_party/toolchains/gpus/py/BUILD b/third_party/toolchains/gpus/py/BUILD
index 2d5ace93ff..1235988abb 100644
--- a/third_party/toolchains/gpus/py/BUILD
+++ b/third_party/toolchains/gpus/py/BUILD
@@ -6,18 +6,24 @@ licenses(["restricted"])
package(default_visibility = ["//visibility:public"])
+# To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib
+# See https://docs.python.org/3/extending/windows.html
+cc_import(
+ name = "python_lib",
+ interface_library = select({
+ ":windows": ":python_import_lib",
+ # A placeholder for Unix platforms which makes --no_build happy.
+ "//conditions:default": "not-existing.lib",
+ }),
+ system_provided = 1,
+)
+
cc_library(
name = "python_headers",
hdrs = [":python_include"],
- data = select({
- ":windows": [":python_import_lib"],
- "//conditions:default": [],
- }),
includes = ["python_include"],
- linkopts = select({
- # TODO(pcloudy): Ideally, this should just go into deps after resolving
- # https://github.com/bazelbuild/bazel/issues/3237,
- ":windows": ["$(locations :python_import_lib)"],
+ deps = select({
+ ":windows": [":python_lib"],
"//conditions:default": [],
}),
)
diff --git a/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/WORKSPACE b/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/WORKSPACE
new file mode 100644
index 0000000000..b61f572d6d
--- /dev/null
+++ b/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/WORKSPACE
@@ -0,0 +1,2 @@
+# DO NOT EDIT: automatically generated WORKSPACE file for cuda_configure rule
+workspace(name = "local_config_cuda")
diff --git a/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/BUILD b/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/BUILD
new file mode 100755
index 0000000000..2d3e41127d
--- /dev/null
+++ b/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/BUILD
@@ -0,0 +1,1268 @@
+licenses(["restricted"]) # MPL2, portions GPL v3, LGPL v3, BSD-like
+
+package(default_visibility = ["//visibility:public"])
+
+config_setting(
+ name = "using_nvcc",
+ values = {
+ "define": "using_cuda_nvcc=true",
+ },
+)
+
+config_setting(
+ name = "using_clang",
+ values = {
+ "define": "using_cuda_clang=true",
+ },
+)
+
+# Equivalent to using_clang && -c opt.
+config_setting(
+ name = "using_clang_opt",
+ values = {
+ "define": "using_cuda_clang=true",
+ "compilation_mode": "opt",
+ },
+)
+
+config_setting(
+ name = "darwin",
+ values = {"cpu": "darwin"},
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "freebsd",
+ values = {"cpu": "freebsd"},
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cuda_headers",
+ hdrs = [
+ "cuda/cuda_config.h",
+ ":cuda-include",
+ ":cudnn-include",
+ ],
+ includes = [
+ ".",
+ "cuda/include",
+ "cuda/include/crt",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cudart_static",
+ srcs = ["cuda/lib/libcudart_static.a"],
+ includes = [
+ ".",
+ "cuda/include",
+ ],
+ linkopts = select({
+ ":freebsd": [],
+ "//conditions:default": ["-ldl"],
+ }) + [
+ "-lpthread",
+ "-lrt",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cuda_driver",
+ srcs = ["cuda/lib/libcuda.so"],
+ includes = [
+ ".",
+ "cuda/include",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cudart",
+ srcs = ["cuda/lib/libcudart.so.9.0"],
+ data = ["cuda/lib/libcudart.so.9.0"],
+ includes = [
+ ".",
+ "cuda/include",
+ ],
+ linkstatic = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cublas",
+ srcs = ["cuda/lib/libcublas.so.9.0"],
+ data = ["cuda/lib/libcublas.so.9.0"],
+ includes = [
+ ".",
+ "cuda/include",
+ ],
+ linkstatic = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cusolver",
+ srcs = ["cuda/lib/libcusolver.so.9.0"],
+ data = ["cuda/lib/libcusolver.so.9.0"],
+ includes = [
+ ".",
+ "cuda/include",
+ ],
+ linkopts = ["-lgomp"],
+ linkstatic = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cudnn",
+ srcs = ["cuda/lib/libcudnn.so.7"],
+ data = ["cuda/lib/libcudnn.so.7"],
+ includes = [
+ ".",
+ "cuda/include",
+ ],
+ linkstatic = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cudnn_header",
+ includes = [
+ ".",
+ "cuda/include",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cufft",
+ srcs = ["cuda/lib/libcufft.so.9.0"],
+ data = ["cuda/lib/libcufft.so.9.0"],
+ includes = [
+ ".",
+ "cuda/include",
+ ],
+ linkstatic = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "curand",
+ srcs = ["cuda/lib/libcurand.so.9.0"],
+ data = ["cuda/lib/libcurand.so.9.0"],
+ includes = [
+ ".",
+ "cuda/include",
+ ],
+ linkstatic = 1,
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cuda",
+ visibility = ["//visibility:public"],
+ deps = [
+ ":cublas",
+ ":cuda_headers",
+ ":cudart",
+ ":cudnn",
+ ":cufft",
+ ":curand",
+ ],
+)
+
+cc_library(
+ name = "cupti_headers",
+ hdrs = [
+ "cuda/cuda_config.h",
+ ":cuda-extras",
+ ],
+ includes = [
+ ".",
+ "cuda/extras/CUPTI/include/",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "cupti_dsos",
+ data = ["cuda/lib/libcupti.so.9.0"],
+ includes = [
+ ".",
+ "cuda/include",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "libdevice_root",
+ data = [":cuda-nvvm"],
+ visibility = ["//visibility:public"],
+)
+
+genrule(
+ name = "cuda-include",
+ outs = [
+ "cuda/include/CL/cl.h",
+ "cuda/include/CL/cl.hpp",
+ "cuda/include/CL/cl_egl.h",
+ "cuda/include/CL/cl_ext.h",
+ "cuda/include/CL/cl_gl.h",
+ "cuda/include/CL/cl_gl_ext.h",
+ "cuda/include/CL/cl_platform.h",
+ "cuda/include/CL/opencl.h",
+ "cuda/include/builtin_types.h",
+ "cuda/include/channel_descriptor.h",
+ "cuda/include/common_functions.h",
+ "cuda/include/cooperative_groups.h",
+ "cuda/include/cooperative_groups_helpers.h",
+ "cuda/include/crt/common_functions.h",
+ "cuda/include/crt/device_double_functions.h",
+ "cuda/include/crt/device_double_functions.hpp",
+ "cuda/include/crt/device_functions.h",
+ "cuda/include/crt/device_functions.hpp",
+ "cuda/include/crt/func_macro.h",
+ "cuda/include/crt/host_config.h",
+ "cuda/include/crt/host_defines.h",
+ "cuda/include/crt/host_runtime.h",
+ "cuda/include/crt/math_functions.h",
+ "cuda/include/crt/math_functions.hpp",
+ "cuda/include/crt/mma.h",
+ "cuda/include/crt/mma.hpp",
+ "cuda/include/crt/nvfunctional",
+ "cuda/include/crt/sm_70_rt.h",
+ "cuda/include/crt/sm_70_rt.hpp",
+ "cuda/include/crt/storage_class.h",
+ "cuda/include/cuComplex.h",
+ "cuda/include/cublas.h",
+ "cuda/include/cublasXt.h",
+ "cuda/include/cublas_api.h",
+ "cuda/include/cublas_v2.h",
+ "cuda/include/cuda.h",
+ "cuda/include/cudaEGL.h",
+ "cuda/include/cudaGL.h",
+ "cuda/include/cudaProfiler.h",
+ "cuda/include/cudaVDPAU.h",
+ "cuda/include/cuda_device_runtime_api.h",
+ "cuda/include/cuda_fp16.h",
+ "cuda/include/cuda_fp16.hpp",
+ "cuda/include/cuda_gl_interop.h",
+ "cuda/include/cuda_occupancy.h",
+ "cuda/include/cuda_profiler_api.h",
+ "cuda/include/cuda_runtime.h",
+ "cuda/include/cuda_runtime_api.h",
+ "cuda/include/cuda_surface_types.h",
+ "cuda/include/cuda_texture_types.h",
+ "cuda/include/cuda_vdpau_interop.h",
+ "cuda/include/cudalibxt.h",
+ "cuda/include/cufft.h",
+ "cuda/include/cufftXt.h",
+ "cuda/include/cufftw.h",
+ "cuda/include/curand.h",
+ "cuda/include/curand_discrete.h",
+ "cuda/include/curand_discrete2.h",
+ "cuda/include/curand_globals.h",
+ "cuda/include/curand_kernel.h",
+ "cuda/include/curand_lognormal.h",
+ "cuda/include/curand_mrg32k3a.h",
+ "cuda/include/curand_mtgp32.h",
+ "cuda/include/curand_mtgp32_host.h",
+ "cuda/include/curand_mtgp32_kernel.h",
+ "cuda/include/curand_mtgp32dc_p_11213.h",
+ "cuda/include/curand_normal.h",
+ "cuda/include/curand_normal_static.h",
+ "cuda/include/curand_philox4x32_x.h",
+ "cuda/include/curand_poisson.h",
+ "cuda/include/curand_precalc.h",
+ "cuda/include/curand_uniform.h",
+ "cuda/include/cusolverDn.h",
+ "cuda/include/cusolverRf.h",
+ "cuda/include/cusolverSp.h",
+ "cuda/include/cusolverSp_LOWLEVEL_PREVIEW.h",
+ "cuda/include/cusolver_common.h",
+ "cuda/include/cusparse.h",
+ "cuda/include/cusparse_v2.h",
+ "cuda/include/device_atomic_functions.h",
+ "cuda/include/device_atomic_functions.hpp",
+ "cuda/include/device_double_functions.h",
+ "cuda/include/device_double_functions.hpp",
+ "cuda/include/device_functions.h",
+ "cuda/include/device_functions.hpp",
+ "cuda/include/device_functions_decls.h",
+ "cuda/include/device_launch_parameters.h",
+ "cuda/include/device_types.h",
+ "cuda/include/driver_functions.h",
+ "cuda/include/driver_types.h",
+ "cuda/include/dynlink_cuda.h",
+ "cuda/include/dynlink_cuda_cuda.h",
+ "cuda/include/dynlink_cuviddec.h",
+ "cuda/include/dynlink_nvcuvid.h",
+ "cuda/include/fatBinaryCtl.h",
+ "cuda/include/fatbinary.h",
+ "cuda/include/host_config.h",
+ "cuda/include/host_defines.h",
+ "cuda/include/library_types.h",
+ "cuda/include/math_constants.h",
+ "cuda/include/math_functions.h",
+ "cuda/include/math_functions.hpp",
+ "cuda/include/math_functions_dbl_ptx3.h",
+ "cuda/include/math_functions_dbl_ptx3.hpp",
+ "cuda/include/mma.h",
+ "cuda/include/npp.h",
+ "cuda/include/nppcore.h",
+ "cuda/include/nppdefs.h",
+ "cuda/include/nppi.h",
+ "cuda/include/nppi_arithmetic_and_logical_operations.h",
+ "cuda/include/nppi_color_conversion.h",
+ "cuda/include/nppi_compression_functions.h",
+ "cuda/include/nppi_computer_vision.h",
+ "cuda/include/nppi_data_exchange_and_initialization.h",
+ "cuda/include/nppi_filtering_functions.h",
+ "cuda/include/nppi_geometry_transforms.h",
+ "cuda/include/nppi_linear_transforms.h",
+ "cuda/include/nppi_morphological_operations.h",
+ "cuda/include/nppi_statistics_functions.h",
+ "cuda/include/nppi_support_functions.h",
+ "cuda/include/nppi_threshold_and_compare_operations.h",
+ "cuda/include/npps.h",
+ "cuda/include/npps_arithmetic_and_logical_operations.h",
+ "cuda/include/npps_conversion_functions.h",
+ "cuda/include/npps_filtering_functions.h",
+ "cuda/include/npps_initialization.h",
+ "cuda/include/npps_statistics_functions.h",
+ "cuda/include/npps_support_functions.h",
+ "cuda/include/nppversion.h",
+ "cuda/include/nvToolsExt.h",
+ "cuda/include/nvToolsExtCuda.h",
+ "cuda/include/nvToolsExtCudaRt.h",
+ "cuda/include/nvToolsExtMeta.h",
+ "cuda/include/nvToolsExtSync.h",
+ "cuda/include/nvblas.h",
+ "cuda/include/nvfunctional",
+ "cuda/include/nvgraph.h",
+ "cuda/include/nvml.h",
+ "cuda/include/nvrtc.h",
+ "cuda/include/sm_20_atomic_functions.h",
+ "cuda/include/sm_20_atomic_functions.hpp",
+ "cuda/include/sm_20_intrinsics.h",
+ "cuda/include/sm_20_intrinsics.hpp",
+ "cuda/include/sm_30_intrinsics.h",
+ "cuda/include/sm_30_intrinsics.hpp",
+ "cuda/include/sm_32_atomic_functions.h",
+ "cuda/include/sm_32_atomic_functions.hpp",
+ "cuda/include/sm_32_intrinsics.h",
+ "cuda/include/sm_32_intrinsics.hpp",
+ "cuda/include/sm_35_atomic_functions.h",
+ "cuda/include/sm_35_intrinsics.h",
+ "cuda/include/sm_60_atomic_functions.h",
+ "cuda/include/sm_60_atomic_functions.hpp",
+ "cuda/include/sm_61_intrinsics.h",
+ "cuda/include/sm_61_intrinsics.hpp",
+ "cuda/include/sobol_direction_vectors.h",
+ "cuda/include/surface_functions.h",
+ "cuda/include/surface_functions.hpp",
+ "cuda/include/surface_indirect_functions.h",
+ "cuda/include/surface_indirect_functions.hpp",
+ "cuda/include/surface_types.h",
+ "cuda/include/texture_fetch_functions.h",
+ "cuda/include/texture_fetch_functions.hpp",
+ "cuda/include/texture_indirect_functions.h",
+ "cuda/include/texture_indirect_functions.hpp",
+ "cuda/include/texture_types.h",
+ "cuda/include/thrust/adjacent_difference.h",
+ "cuda/include/thrust/advance.h",
+ "cuda/include/thrust/binary_search.h",
+ "cuda/include/thrust/complex.h",
+ "cuda/include/thrust/copy.h",
+ "cuda/include/thrust/count.h",
+ "cuda/include/thrust/detail/adjacent_difference.inl",
+ "cuda/include/thrust/detail/advance.inl",
+ "cuda/include/thrust/detail/allocator/allocator_traits.h",
+ "cuda/include/thrust/detail/allocator/allocator_traits.inl",
+ "cuda/include/thrust/detail/allocator/copy_construct_range.h",
+ "cuda/include/thrust/detail/allocator/copy_construct_range.inl",
+ "cuda/include/thrust/detail/allocator/default_construct_range.h",
+ "cuda/include/thrust/detail/allocator/default_construct_range.inl",
+ "cuda/include/thrust/detail/allocator/destroy_range.h",
+ "cuda/include/thrust/detail/allocator/destroy_range.inl",
+ "cuda/include/thrust/detail/allocator/fill_construct_range.h",
+ "cuda/include/thrust/detail/allocator/fill_construct_range.inl",
+ "cuda/include/thrust/detail/allocator/malloc_allocator.h",
+ "cuda/include/thrust/detail/allocator/malloc_allocator.inl",
+ "cuda/include/thrust/detail/allocator/no_throw_allocator.h",
+ "cuda/include/thrust/detail/allocator/tagged_allocator.h",
+ "cuda/include/thrust/detail/allocator/tagged_allocator.inl",
+ "cuda/include/thrust/detail/allocator/temporary_allocator.h",
+ "cuda/include/thrust/detail/allocator/temporary_allocator.inl",
+ "cuda/include/thrust/detail/binary_search.inl",
+ "cuda/include/thrust/detail/complex/arithmetic.h",
+ "cuda/include/thrust/detail/complex/c99math.h",
+ "cuda/include/thrust/detail/complex/catrig.h",
+ "cuda/include/thrust/detail/complex/catrigf.h",
+ "cuda/include/thrust/detail/complex/ccosh.h",
+ "cuda/include/thrust/detail/complex/ccoshf.h",
+ "cuda/include/thrust/detail/complex/cexp.h",
+ "cuda/include/thrust/detail/complex/cexpf.h",
+ "cuda/include/thrust/detail/complex/clog.h",
+ "cuda/include/thrust/detail/complex/clogf.h",
+ "cuda/include/thrust/detail/complex/complex.inl",
+ "cuda/include/thrust/detail/complex/cpow.h",
+ "cuda/include/thrust/detail/complex/cpowf.h",
+ "cuda/include/thrust/detail/complex/cproj.h",
+ "cuda/include/thrust/detail/complex/csinh.h",
+ "cuda/include/thrust/detail/complex/csinhf.h",
+ "cuda/include/thrust/detail/complex/csqrt.h",
+ "cuda/include/thrust/detail/complex/csqrtf.h",
+ "cuda/include/thrust/detail/complex/ctanh.h",
+ "cuda/include/thrust/detail/complex/ctanhf.h",
+ "cuda/include/thrust/detail/complex/math_private.h",
+ "cuda/include/thrust/detail/complex/stream.h",
+ "cuda/include/thrust/detail/config.h",
+ "cuda/include/thrust/detail/config/compiler.h",
+ "cuda/include/thrust/detail/config/compiler_fence.h",
+ "cuda/include/thrust/detail/config/config.h",
+ "cuda/include/thrust/detail/config/debug.h",
+ "cuda/include/thrust/detail/config/device_system.h",
+ "cuda/include/thrust/detail/config/exec_check_disable.h",
+ "cuda/include/thrust/detail/config/forceinline.h",
+ "cuda/include/thrust/detail/config/global_workarounds.h",
+ "cuda/include/thrust/detail/config/host_device.h",
+ "cuda/include/thrust/detail/config/host_system.h",
+ "cuda/include/thrust/detail/config/simple_defines.h",
+ "cuda/include/thrust/detail/contiguous_storage.h",
+ "cuda/include/thrust/detail/contiguous_storage.inl",
+ "cuda/include/thrust/detail/copy.h",
+ "cuda/include/thrust/detail/copy.inl",
+ "cuda/include/thrust/detail/copy_if.h",
+ "cuda/include/thrust/detail/copy_if.inl",
+ "cuda/include/thrust/detail/count.inl",
+ "cuda/include/thrust/detail/cstdint.h",
+ "cuda/include/thrust/detail/device_delete.inl",
+ "cuda/include/thrust/detail/device_free.inl",
+ "cuda/include/thrust/detail/device_malloc.inl",
+ "cuda/include/thrust/detail/device_new.inl",
+ "cuda/include/thrust/detail/device_ptr.inl",
+ "cuda/include/thrust/detail/device_reference.inl",
+ "cuda/include/thrust/detail/device_vector.inl",
+ "cuda/include/thrust/detail/dispatch/is_trivial_copy.h",
+ "cuda/include/thrust/detail/distance.inl",
+ "cuda/include/thrust/detail/equal.inl",
+ "cuda/include/thrust/detail/execute_with_allocator.h",
+ "cuda/include/thrust/detail/execution_policy.h",
+ "cuda/include/thrust/detail/extrema.inl",
+ "cuda/include/thrust/detail/fill.inl",
+ "cuda/include/thrust/detail/find.inl",
+ "cuda/include/thrust/detail/for_each.inl",
+ "cuda/include/thrust/detail/function.h",
+ "cuda/include/thrust/detail/functional.inl",
+ "cuda/include/thrust/detail/functional/actor.h",
+ "cuda/include/thrust/detail/functional/actor.inl",
+ "cuda/include/thrust/detail/functional/argument.h",
+ "cuda/include/thrust/detail/functional/composite.h",
+ "cuda/include/thrust/detail/functional/operators.h",
+ "cuda/include/thrust/detail/functional/operators/arithmetic_operators.h",
+ "cuda/include/thrust/detail/functional/operators/assignment_operator.h",
+ "cuda/include/thrust/detail/functional/operators/bitwise_operators.h",
+ "cuda/include/thrust/detail/functional/operators/compound_assignment_operators.h",
+ "cuda/include/thrust/detail/functional/operators/logical_operators.h",
+ "cuda/include/thrust/detail/functional/operators/operator_adaptors.h",
+ "cuda/include/thrust/detail/functional/operators/relational_operators.h",
+ "cuda/include/thrust/detail/functional/placeholder.h",
+ "cuda/include/thrust/detail/functional/value.h",
+ "cuda/include/thrust/detail/gather.inl",
+ "cuda/include/thrust/detail/generate.inl",
+ "cuda/include/thrust/detail/get_iterator_value.h",
+ "cuda/include/thrust/detail/host_vector.inl",
+ "cuda/include/thrust/detail/inner_product.inl",
+ "cuda/include/thrust/detail/integer_math.h",
+ "cuda/include/thrust/detail/integer_traits.h",
+ "cuda/include/thrust/detail/internal_functional.h",
+ "cuda/include/thrust/detail/logical.inl",
+ "cuda/include/thrust/detail/malloc_and_free.h",
+ "cuda/include/thrust/detail/merge.inl",
+ "cuda/include/thrust/detail/minmax.h",
+ "cuda/include/thrust/detail/mismatch.inl",
+ "cuda/include/thrust/detail/mpl/math.h",
+ "cuda/include/thrust/detail/numeric_traits.h",
+ "cuda/include/thrust/detail/overlapped_copy.h",
+ "cuda/include/thrust/detail/pair.inl",
+ "cuda/include/thrust/detail/partition.inl",
+ "cuda/include/thrust/detail/pointer.h",
+ "cuda/include/thrust/detail/pointer.inl",
+ "cuda/include/thrust/detail/range/head_flags.h",
+ "cuda/include/thrust/detail/range/tail_flags.h",
+ "cuda/include/thrust/detail/raw_pointer_cast.h",
+ "cuda/include/thrust/detail/raw_reference_cast.h",
+ "cuda/include/thrust/detail/reduce.inl",
+ "cuda/include/thrust/detail/reference.h",
+ "cuda/include/thrust/detail/reference.inl",
+ "cuda/include/thrust/detail/reference_forward_declaration.h",
+ "cuda/include/thrust/detail/remove.inl",
+ "cuda/include/thrust/detail/replace.inl",
+ "cuda/include/thrust/detail/reverse.inl",
+ "cuda/include/thrust/detail/scan.inl",
+ "cuda/include/thrust/detail/scatter.inl",
+ "cuda/include/thrust/detail/seq.h",
+ "cuda/include/thrust/detail/sequence.inl",
+ "cuda/include/thrust/detail/set_operations.inl",
+ "cuda/include/thrust/detail/sort.inl",
+ "cuda/include/thrust/detail/static_assert.h",
+ "cuda/include/thrust/detail/static_map.h",
+ "cuda/include/thrust/detail/swap.h",
+ "cuda/include/thrust/detail/swap.inl",
+ "cuda/include/thrust/detail/swap_ranges.inl",
+ "cuda/include/thrust/detail/tabulate.inl",
+ "cuda/include/thrust/detail/temporary_array.h",
+ "cuda/include/thrust/detail/temporary_array.inl",
+ "cuda/include/thrust/detail/temporary_buffer.h",
+ "cuda/include/thrust/detail/transform.inl",
+ "cuda/include/thrust/detail/transform_reduce.inl",
+ "cuda/include/thrust/detail/transform_scan.inl",
+ "cuda/include/thrust/detail/trivial_sequence.h",
+ "cuda/include/thrust/detail/tuple.inl",
+ "cuda/include/thrust/detail/tuple_meta_transform.h",
+ "cuda/include/thrust/detail/tuple_transform.h",
+ "cuda/include/thrust/detail/type_traits.h",
+ "cuda/include/thrust/detail/type_traits/algorithm/intermediate_type_from_function_and_iterators.h",
+ "cuda/include/thrust/detail/type_traits/function_traits.h",
+ "cuda/include/thrust/detail/type_traits/has_member_function.h",
+ "cuda/include/thrust/detail/type_traits/has_nested_type.h",
+ "cuda/include/thrust/detail/type_traits/has_trivial_assign.h",
+ "cuda/include/thrust/detail/type_traits/is_call_possible.h",
+ "cuda/include/thrust/detail/type_traits/is_metafunction_defined.h",
+ "cuda/include/thrust/detail/type_traits/iterator/is_discard_iterator.h",
+ "cuda/include/thrust/detail/type_traits/iterator/is_output_iterator.h",
+ "cuda/include/thrust/detail/type_traits/minimum_type.h",
+ "cuda/include/thrust/detail/type_traits/pointer_traits.h",
+ "cuda/include/thrust/detail/type_traits/result_of_adaptable_function.h",
+ "cuda/include/thrust/detail/uninitialized_copy.inl",
+ "cuda/include/thrust/detail/uninitialized_fill.inl",
+ "cuda/include/thrust/detail/unique.inl",
+ "cuda/include/thrust/detail/use_default.h",
+ "cuda/include/thrust/detail/util/align.h",
+ "cuda/include/thrust/detail/util/blocking.h",
+ "cuda/include/thrust/detail/vector_base.h",
+ "cuda/include/thrust/detail/vector_base.inl",
+ "cuda/include/thrust/device_allocator.h",
+ "cuda/include/thrust/device_delete.h",
+ "cuda/include/thrust/device_free.h",
+ "cuda/include/thrust/device_malloc.h",
+ "cuda/include/thrust/device_malloc_allocator.h",
+ "cuda/include/thrust/device_new.h",
+ "cuda/include/thrust/device_new_allocator.h",
+ "cuda/include/thrust/device_ptr.h",
+ "cuda/include/thrust/device_reference.h",
+ "cuda/include/thrust/device_vector.h",
+ "cuda/include/thrust/distance.h",
+ "cuda/include/thrust/equal.h",
+ "cuda/include/thrust/execution_policy.h",
+ "cuda/include/thrust/extrema.h",
+ "cuda/include/thrust/fill.h",
+ "cuda/include/thrust/find.h",
+ "cuda/include/thrust/for_each.h",
+ "cuda/include/thrust/functional.h",
+ "cuda/include/thrust/gather.h",
+ "cuda/include/thrust/generate.h",
+ "cuda/include/thrust/host_vector.h",
+ "cuda/include/thrust/inner_product.h",
+ "cuda/include/thrust/iterator/constant_iterator.h",
+ "cuda/include/thrust/iterator/counting_iterator.h",
+ "cuda/include/thrust/iterator/detail/any_assign.h",
+ "cuda/include/thrust/iterator/detail/any_system_tag.h",
+ "cuda/include/thrust/iterator/detail/constant_iterator_base.h",
+ "cuda/include/thrust/iterator/detail/counting_iterator.inl",
+ "cuda/include/thrust/iterator/detail/device_system_tag.h",
+ "cuda/include/thrust/iterator/detail/discard_iterator_base.h",
+ "cuda/include/thrust/iterator/detail/distance_from_result.h",
+ "cuda/include/thrust/iterator/detail/host_system_tag.h",
+ "cuda/include/thrust/iterator/detail/is_iterator_category.h",
+ "cuda/include/thrust/iterator/detail/is_trivial_iterator.h",
+ "cuda/include/thrust/iterator/detail/iterator_adaptor_base.h",
+ "cuda/include/thrust/iterator/detail/iterator_category_to_system.h",
+ "cuda/include/thrust/iterator/detail/iterator_category_to_traversal.h",
+ "cuda/include/thrust/iterator/detail/iterator_category_with_system_and_traversal.h",
+ "cuda/include/thrust/iterator/detail/iterator_facade_category.h",
+ "cuda/include/thrust/iterator/detail/iterator_traits.inl",
+ "cuda/include/thrust/iterator/detail/iterator_traversal_tags.h",
+ "cuda/include/thrust/iterator/detail/join_iterator.h",
+ "cuda/include/thrust/iterator/detail/minimum_category.h",
+ "cuda/include/thrust/iterator/detail/minimum_system.h",
+ "cuda/include/thrust/iterator/detail/normal_iterator.h",
+ "cuda/include/thrust/iterator/detail/permutation_iterator_base.h",
+ "cuda/include/thrust/iterator/detail/retag.h",
+ "cuda/include/thrust/iterator/detail/reverse_iterator.inl",
+ "cuda/include/thrust/iterator/detail/reverse_iterator_base.h",
+ "cuda/include/thrust/iterator/detail/tagged_iterator.h",
+ "cuda/include/thrust/iterator/detail/transform_iterator.inl",
+ "cuda/include/thrust/iterator/detail/transform_output_iterator.inl",
+ "cuda/include/thrust/iterator/detail/tuple_of_iterator_references.h",
+ "cuda/include/thrust/iterator/detail/universal_categories.h",
+ "cuda/include/thrust/iterator/detail/zip_iterator.inl",
+ "cuda/include/thrust/iterator/detail/zip_iterator_base.h",
+ "cuda/include/thrust/iterator/discard_iterator.h",
+ "cuda/include/thrust/iterator/iterator_adaptor.h",
+ "cuda/include/thrust/iterator/iterator_categories.h",
+ "cuda/include/thrust/iterator/iterator_facade.h",
+ "cuda/include/thrust/iterator/iterator_traits.h",
+ "cuda/include/thrust/iterator/permutation_iterator.h",
+ "cuda/include/thrust/iterator/retag.h",
+ "cuda/include/thrust/iterator/reverse_iterator.h",
+ "cuda/include/thrust/iterator/transform_iterator.h",
+ "cuda/include/thrust/iterator/transform_output_iterator.h",
+ "cuda/include/thrust/iterator/zip_iterator.h",
+ "cuda/include/thrust/logical.h",
+ "cuda/include/thrust/memory.h",
+ "cuda/include/thrust/merge.h",
+ "cuda/include/thrust/mismatch.h",
+ "cuda/include/thrust/pair.h",
+ "cuda/include/thrust/partition.h",
+ "cuda/include/thrust/random.h",
+ "cuda/include/thrust/random/detail/discard_block_engine.inl",
+ "cuda/include/thrust/random/detail/linear_congruential_engine.inl",
+ "cuda/include/thrust/random/detail/linear_congruential_engine_discard.h",
+ "cuda/include/thrust/random/detail/linear_feedback_shift_engine.inl",
+ "cuda/include/thrust/random/detail/linear_feedback_shift_engine_wordmask.h",
+ "cuda/include/thrust/random/detail/mod.h",
+ "cuda/include/thrust/random/detail/normal_distribution.inl",
+ "cuda/include/thrust/random/detail/normal_distribution_base.h",
+ "cuda/include/thrust/random/detail/random_core_access.h",
+ "cuda/include/thrust/random/detail/subtract_with_carry_engine.inl",
+ "cuda/include/thrust/random/detail/uniform_int_distribution.inl",
+ "cuda/include/thrust/random/detail/uniform_real_distribution.inl",
+ "cuda/include/thrust/random/detail/xor_combine_engine.inl",
+ "cuda/include/thrust/random/detail/xor_combine_engine_max.h",
+ "cuda/include/thrust/random/discard_block_engine.h",
+ "cuda/include/thrust/random/linear_congruential_engine.h",
+ "cuda/include/thrust/random/linear_feedback_shift_engine.h",
+ "cuda/include/thrust/random/normal_distribution.h",
+ "cuda/include/thrust/random/subtract_with_carry_engine.h",
+ "cuda/include/thrust/random/uniform_int_distribution.h",
+ "cuda/include/thrust/random/uniform_real_distribution.h",
+ "cuda/include/thrust/random/xor_combine_engine.h",
+ "cuda/include/thrust/reduce.h",
+ "cuda/include/thrust/remove.h",
+ "cuda/include/thrust/replace.h",
+ "cuda/include/thrust/reverse.h",
+ "cuda/include/thrust/scan.h",
+ "cuda/include/thrust/scatter.h",
+ "cuda/include/thrust/sequence.h",
+ "cuda/include/thrust/set_operations.h",
+ "cuda/include/thrust/sort.h",
+ "cuda/include/thrust/swap.h",
+ "cuda/include/thrust/system/cpp/detail/adjacent_difference.h",
+ "cuda/include/thrust/system/cpp/detail/assign_value.h",
+ "cuda/include/thrust/system/cpp/detail/binary_search.h",
+ "cuda/include/thrust/system/cpp/detail/copy.h",
+ "cuda/include/thrust/system/cpp/detail/copy_if.h",
+ "cuda/include/thrust/system/cpp/detail/count.h",
+ "cuda/include/thrust/system/cpp/detail/equal.h",
+ "cuda/include/thrust/system/cpp/detail/execution_policy.h",
+ "cuda/include/thrust/system/cpp/detail/extrema.h",
+ "cuda/include/thrust/system/cpp/detail/fill.h",
+ "cuda/include/thrust/system/cpp/detail/find.h",
+ "cuda/include/thrust/system/cpp/detail/for_each.h",
+ "cuda/include/thrust/system/cpp/detail/gather.h",
+ "cuda/include/thrust/system/cpp/detail/generate.h",
+ "cuda/include/thrust/system/cpp/detail/get_value.h",
+ "cuda/include/thrust/system/cpp/detail/inner_product.h",
+ "cuda/include/thrust/system/cpp/detail/iter_swap.h",
+ "cuda/include/thrust/system/cpp/detail/logical.h",
+ "cuda/include/thrust/system/cpp/detail/malloc_and_free.h",
+ "cuda/include/thrust/system/cpp/detail/memory.inl",
+ "cuda/include/thrust/system/cpp/detail/merge.h",
+ "cuda/include/thrust/system/cpp/detail/mismatch.h",
+ "cuda/include/thrust/system/cpp/detail/par.h",
+ "cuda/include/thrust/system/cpp/detail/partition.h",
+ "cuda/include/thrust/system/cpp/detail/reduce.h",
+ "cuda/include/thrust/system/cpp/detail/reduce_by_key.h",
+ "cuda/include/thrust/system/cpp/detail/remove.h",
+ "cuda/include/thrust/system/cpp/detail/replace.h",
+ "cuda/include/thrust/system/cpp/detail/reverse.h",
+ "cuda/include/thrust/system/cpp/detail/scan.h",
+ "cuda/include/thrust/system/cpp/detail/scan_by_key.h",
+ "cuda/include/thrust/system/cpp/detail/scatter.h",
+ "cuda/include/thrust/system/cpp/detail/sequence.h",
+ "cuda/include/thrust/system/cpp/detail/set_operations.h",
+ "cuda/include/thrust/system/cpp/detail/sort.h",
+ "cuda/include/thrust/system/cpp/detail/swap_ranges.h",
+ "cuda/include/thrust/system/cpp/detail/tabulate.h",
+ "cuda/include/thrust/system/cpp/detail/temporary_buffer.h",
+ "cuda/include/thrust/system/cpp/detail/transform.h",
+ "cuda/include/thrust/system/cpp/detail/transform_reduce.h",
+ "cuda/include/thrust/system/cpp/detail/transform_scan.h",
+ "cuda/include/thrust/system/cpp/detail/uninitialized_copy.h",
+ "cuda/include/thrust/system/cpp/detail/uninitialized_fill.h",
+ "cuda/include/thrust/system/cpp/detail/unique.h",
+ "cuda/include/thrust/system/cpp/detail/unique_by_key.h",
+ "cuda/include/thrust/system/cpp/detail/vector.inl",
+ "cuda/include/thrust/system/cpp/execution_policy.h",
+ "cuda/include/thrust/system/cpp/memory.h",
+ "cuda/include/thrust/system/cpp/vector.h",
+ "cuda/include/thrust/system/cuda/config.h",
+ "cuda/include/thrust/system/cuda/detail/adjacent_difference.h",
+ "cuda/include/thrust/system/cuda/detail/assign_value.h",
+ "cuda/include/thrust/system/cuda/detail/binary_search.h",
+ "cuda/include/thrust/system/cuda/detail/copy.h",
+ "cuda/include/thrust/system/cuda/detail/copy_if.h",
+ "cuda/include/thrust/system/cuda/detail/core/agent_launcher.h",
+ "cuda/include/thrust/system/cuda/detail/core/alignment.h",
+ "cuda/include/thrust/system/cuda/detail/core/triple_chevron_launch.h",
+ "cuda/include/thrust/system/cuda/detail/core/util.h",
+ "cuda/include/thrust/system/cuda/detail/count.h",
+ "cuda/include/thrust/system/cuda/detail/cross_system.h",
+ "cuda/include/thrust/system/cuda/detail/cub/agent/agent_histogram.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/agent/agent_radix_sort_downsweep.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/agent/agent_radix_sort_upsweep.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/agent/agent_reduce.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/agent/agent_reduce_by_key.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/agent/agent_rle.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/agent/agent_scan.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/agent/agent_segment_fixup.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/agent/agent_select_if.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/agent/agent_spmv_csrt.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/agent/agent_spmv_orig.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/agent/agent_spmv_row_based.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/agent/single_pass_scan_operators.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/block_adjacent_difference.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/block_discontinuity.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/block_exchange.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/block_histogram.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/block_load.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/block_radix_rank.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/block_radix_sort.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/block_raking_layout.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/block_reduce.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/block_scan.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/block_shuffle.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/block_store.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_histogram_atomic.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_histogram_sort.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_reduce_raking.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_reduce_raking_commutative_only.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_reduce_warp_reductions.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_scan_raking.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_scan_warp_scans.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_scan_warp_scans2.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_scan_warp_scans3.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/cub.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/device_histogram.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/device_partition.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/device_radix_sort.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/device_reduce.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/device_run_length_encode.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/device_scan.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/device_segmented_radix_sort.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/device_segmented_reduce.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/device_select.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/device_spmv.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_histogram.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_radix_sort.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_reduce.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_reduce_by_key.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_rle.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_scan.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_select_if.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_spmv_csrt.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_spmv_orig.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_spmv_row_based.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/grid/grid_barrier.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/grid/grid_even_share.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/grid/grid_mapping.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/grid/grid_queue.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/host/mutex.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/iterator/arg_index_input_iterator.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/iterator/cache_modified_input_iterator.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/iterator/cache_modified_output_iterator.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/iterator/constant_input_iterator.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/iterator/counting_input_iterator.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/iterator/discard_output_iterator.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/iterator/tex_obj_input_iterator.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/iterator/tex_ref_input_iterator.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/iterator/transform_input_iterator.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/thread/thread_load.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/thread/thread_operators.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/thread/thread_reduce.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/thread/thread_scan.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/thread/thread_search.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/thread/thread_store.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/util_allocator.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/util_arch.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/util_debug.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/util_device.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/util_macro.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/util_namespace.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/util_ptx.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/util_type.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/warp/specializations/warp_reduce_shfl.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/warp/specializations/warp_reduce_smem.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/warp/specializations/warp_scan_shfl.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/warp/specializations/warp_scan_smem.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/warp/warp_reduce.cuh",
+ "cuda/include/thrust/system/cuda/detail/cub/warp/warp_scan.cuh",
+ "cuda/include/thrust/system/cuda/detail/equal.h",
+ "cuda/include/thrust/system/cuda/detail/error.inl",
+ "cuda/include/thrust/system/cuda/detail/execution_policy.h",
+ "cuda/include/thrust/system/cuda/detail/extrema.h",
+ "cuda/include/thrust/system/cuda/detail/fill.h",
+ "cuda/include/thrust/system/cuda/detail/find.h",
+ "cuda/include/thrust/system/cuda/detail/for_each.h",
+ "cuda/include/thrust/system/cuda/detail/gather.h",
+ "cuda/include/thrust/system/cuda/detail/generate.h",
+ "cuda/include/thrust/system/cuda/detail/get_value.h",
+ "cuda/include/thrust/system/cuda/detail/guarded_cuda_runtime_api.h",
+ "cuda/include/thrust/system/cuda/detail/guarded_driver_types.h",
+ "cuda/include/thrust/system/cuda/detail/inner_product.h",
+ "cuda/include/thrust/system/cuda/detail/internal/copy_cross_system.h",
+ "cuda/include/thrust/system/cuda/detail/internal/copy_device_to_device.h",
+ "cuda/include/thrust/system/cuda/detail/iter_swap.h",
+ "cuda/include/thrust/system/cuda/detail/logical.h",
+ "cuda/include/thrust/system/cuda/detail/malloc_and_free.h",
+ "cuda/include/thrust/system/cuda/detail/memory.inl",
+ "cuda/include/thrust/system/cuda/detail/memory_buffer.h",
+ "cuda/include/thrust/system/cuda/detail/merge.h",
+ "cuda/include/thrust/system/cuda/detail/mismatch.h",
+ "cuda/include/thrust/system/cuda/detail/par.h",
+ "cuda/include/thrust/system/cuda/detail/par_to_seq.h",
+ "cuda/include/thrust/system/cuda/detail/parallel_for.h",
+ "cuda/include/thrust/system/cuda/detail/partition.h",
+ "cuda/include/thrust/system/cuda/detail/reduce.h",
+ "cuda/include/thrust/system/cuda/detail/reduce_by_key.h",
+ "cuda/include/thrust/system/cuda/detail/remove.h",
+ "cuda/include/thrust/system/cuda/detail/replace.h",
+ "cuda/include/thrust/system/cuda/detail/reverse.h",
+ "cuda/include/thrust/system/cuda/detail/scan.h",
+ "cuda/include/thrust/system/cuda/detail/scan_by_key.h",
+ "cuda/include/thrust/system/cuda/detail/scatter.h",
+ "cuda/include/thrust/system/cuda/detail/sequence.h",
+ "cuda/include/thrust/system/cuda/detail/set_operations.h",
+ "cuda/include/thrust/system/cuda/detail/sort.h",
+ "cuda/include/thrust/system/cuda/detail/swap_ranges.h",
+ "cuda/include/thrust/system/cuda/detail/tabulate.h",
+ "cuda/include/thrust/system/cuda/detail/temporary_buffer.h",
+ "cuda/include/thrust/system/cuda/detail/terminate.h",
+ "cuda/include/thrust/system/cuda/detail/transform.h",
+ "cuda/include/thrust/system/cuda/detail/transform_reduce.h",
+ "cuda/include/thrust/system/cuda/detail/transform_scan.h",
+ "cuda/include/thrust/system/cuda/detail/uninitialized_copy.h",
+ "cuda/include/thrust/system/cuda/detail/uninitialized_fill.h",
+ "cuda/include/thrust/system/cuda/detail/unique.h",
+ "cuda/include/thrust/system/cuda/detail/unique_by_key.h",
+ "cuda/include/thrust/system/cuda/detail/util.h",
+ "cuda/include/thrust/system/cuda/detail/vector.inl",
+ "cuda/include/thrust/system/cuda/error.h",
+ "cuda/include/thrust/system/cuda/execution_policy.h",
+ "cuda/include/thrust/system/cuda/experimental/pinned_allocator.h",
+ "cuda/include/thrust/system/cuda/memory.h",
+ "cuda/include/thrust/system/cuda/vector.h",
+ "cuda/include/thrust/system/detail/adl/adjacent_difference.h",
+ "cuda/include/thrust/system/detail/adl/assign_value.h",
+ "cuda/include/thrust/system/detail/adl/binary_search.h",
+ "cuda/include/thrust/system/detail/adl/copy.h",
+ "cuda/include/thrust/system/detail/adl/copy_if.h",
+ "cuda/include/thrust/system/detail/adl/count.h",
+ "cuda/include/thrust/system/detail/adl/equal.h",
+ "cuda/include/thrust/system/detail/adl/extrema.h",
+ "cuda/include/thrust/system/detail/adl/fill.h",
+ "cuda/include/thrust/system/detail/adl/find.h",
+ "cuda/include/thrust/system/detail/adl/for_each.h",
+ "cuda/include/thrust/system/detail/adl/gather.h",
+ "cuda/include/thrust/system/detail/adl/generate.h",
+ "cuda/include/thrust/system/detail/adl/get_value.h",
+ "cuda/include/thrust/system/detail/adl/inner_product.h",
+ "cuda/include/thrust/system/detail/adl/iter_swap.h",
+ "cuda/include/thrust/system/detail/adl/logical.h",
+ "cuda/include/thrust/system/detail/adl/malloc_and_free.h",
+ "cuda/include/thrust/system/detail/adl/merge.h",
+ "cuda/include/thrust/system/detail/adl/mismatch.h",
+ "cuda/include/thrust/system/detail/adl/partition.h",
+ "cuda/include/thrust/system/detail/adl/reduce.h",
+ "cuda/include/thrust/system/detail/adl/reduce_by_key.h",
+ "cuda/include/thrust/system/detail/adl/remove.h",
+ "cuda/include/thrust/system/detail/adl/replace.h",
+ "cuda/include/thrust/system/detail/adl/reverse.h",
+ "cuda/include/thrust/system/detail/adl/scan.h",
+ "cuda/include/thrust/system/detail/adl/scan_by_key.h",
+ "cuda/include/thrust/system/detail/adl/scatter.h",
+ "cuda/include/thrust/system/detail/adl/sequence.h",
+ "cuda/include/thrust/system/detail/adl/set_operations.h",
+ "cuda/include/thrust/system/detail/adl/sort.h",
+ "cuda/include/thrust/system/detail/adl/swap_ranges.h",
+ "cuda/include/thrust/system/detail/adl/tabulate.h",
+ "cuda/include/thrust/system/detail/adl/temporary_buffer.h",
+ "cuda/include/thrust/system/detail/adl/transform.h",
+ "cuda/include/thrust/system/detail/adl/transform_reduce.h",
+ "cuda/include/thrust/system/detail/adl/transform_scan.h",
+ "cuda/include/thrust/system/detail/adl/uninitialized_copy.h",
+ "cuda/include/thrust/system/detail/adl/uninitialized_fill.h",
+ "cuda/include/thrust/system/detail/adl/unique.h",
+ "cuda/include/thrust/system/detail/adl/unique_by_key.h",
+ "cuda/include/thrust/system/detail/bad_alloc.h",
+ "cuda/include/thrust/system/detail/errno.h",
+ "cuda/include/thrust/system/detail/error_category.inl",
+ "cuda/include/thrust/system/detail/error_code.inl",
+ "cuda/include/thrust/system/detail/error_condition.inl",
+ "cuda/include/thrust/system/detail/generic/adjacent_difference.h",
+ "cuda/include/thrust/system/detail/generic/adjacent_difference.inl",
+ "cuda/include/thrust/system/detail/generic/advance.h",
+ "cuda/include/thrust/system/detail/generic/advance.inl",
+ "cuda/include/thrust/system/detail/generic/binary_search.h",
+ "cuda/include/thrust/system/detail/generic/binary_search.inl",
+ "cuda/include/thrust/system/detail/generic/copy.h",
+ "cuda/include/thrust/system/detail/generic/copy.inl",
+ "cuda/include/thrust/system/detail/generic/copy_if.h",
+ "cuda/include/thrust/system/detail/generic/copy_if.inl",
+ "cuda/include/thrust/system/detail/generic/count.h",
+ "cuda/include/thrust/system/detail/generic/count.inl",
+ "cuda/include/thrust/system/detail/generic/distance.h",
+ "cuda/include/thrust/system/detail/generic/distance.inl",
+ "cuda/include/thrust/system/detail/generic/equal.h",
+ "cuda/include/thrust/system/detail/generic/equal.inl",
+ "cuda/include/thrust/system/detail/generic/extrema.h",
+ "cuda/include/thrust/system/detail/generic/extrema.inl",
+ "cuda/include/thrust/system/detail/generic/fill.h",
+ "cuda/include/thrust/system/detail/generic/find.h",
+ "cuda/include/thrust/system/detail/generic/find.inl",
+ "cuda/include/thrust/system/detail/generic/for_each.h",
+ "cuda/include/thrust/system/detail/generic/gather.h",
+ "cuda/include/thrust/system/detail/generic/gather.inl",
+ "cuda/include/thrust/system/detail/generic/generate.h",
+ "cuda/include/thrust/system/detail/generic/generate.inl",
+ "cuda/include/thrust/system/detail/generic/inner_product.h",
+ "cuda/include/thrust/system/detail/generic/inner_product.inl",
+ "cuda/include/thrust/system/detail/generic/logical.h",
+ "cuda/include/thrust/system/detail/generic/memory.h",
+ "cuda/include/thrust/system/detail/generic/memory.inl",
+ "cuda/include/thrust/system/detail/generic/merge.h",
+ "cuda/include/thrust/system/detail/generic/merge.inl",
+ "cuda/include/thrust/system/detail/generic/mismatch.h",
+ "cuda/include/thrust/system/detail/generic/mismatch.inl",
+ "cuda/include/thrust/system/detail/generic/partition.h",
+ "cuda/include/thrust/system/detail/generic/partition.inl",
+ "cuda/include/thrust/system/detail/generic/reduce.h",
+ "cuda/include/thrust/system/detail/generic/reduce.inl",
+ "cuda/include/thrust/system/detail/generic/reduce_by_key.h",
+ "cuda/include/thrust/system/detail/generic/reduce_by_key.inl",
+ "cuda/include/thrust/system/detail/generic/remove.h",
+ "cuda/include/thrust/system/detail/generic/remove.inl",
+ "cuda/include/thrust/system/detail/generic/replace.h",
+ "cuda/include/thrust/system/detail/generic/replace.inl",
+ "cuda/include/thrust/system/detail/generic/reverse.h",
+ "cuda/include/thrust/system/detail/generic/reverse.inl",
+ "cuda/include/thrust/system/detail/generic/scalar/binary_search.h",
+ "cuda/include/thrust/system/detail/generic/scalar/binary_search.inl",
+ "cuda/include/thrust/system/detail/generic/scan.h",
+ "cuda/include/thrust/system/detail/generic/scan.inl",
+ "cuda/include/thrust/system/detail/generic/scan_by_key.h",
+ "cuda/include/thrust/system/detail/generic/scan_by_key.inl",
+ "cuda/include/thrust/system/detail/generic/scatter.h",
+ "cuda/include/thrust/system/detail/generic/scatter.inl",
+ "cuda/include/thrust/system/detail/generic/select_system.h",
+ "cuda/include/thrust/system/detail/generic/sequence.h",
+ "cuda/include/thrust/system/detail/generic/sequence.inl",
+ "cuda/include/thrust/system/detail/generic/set_operations.h",
+ "cuda/include/thrust/system/detail/generic/set_operations.inl",
+ "cuda/include/thrust/system/detail/generic/sort.h",
+ "cuda/include/thrust/system/detail/generic/sort.inl",
+ "cuda/include/thrust/system/detail/generic/swap_ranges.h",
+ "cuda/include/thrust/system/detail/generic/swap_ranges.inl",
+ "cuda/include/thrust/system/detail/generic/tabulate.h",
+ "cuda/include/thrust/system/detail/generic/tabulate.inl",
+ "cuda/include/thrust/system/detail/generic/tag.h",
+ "cuda/include/thrust/system/detail/generic/temporary_buffer.h",
+ "cuda/include/thrust/system/detail/generic/temporary_buffer.inl",
+ "cuda/include/thrust/system/detail/generic/transform.h",
+ "cuda/include/thrust/system/detail/generic/transform.inl",
+ "cuda/include/thrust/system/detail/generic/transform_reduce.h",
+ "cuda/include/thrust/system/detail/generic/transform_reduce.inl",
+ "cuda/include/thrust/system/detail/generic/transform_scan.h",
+ "cuda/include/thrust/system/detail/generic/transform_scan.inl",
+ "cuda/include/thrust/system/detail/generic/type_traits.h",
+ "cuda/include/thrust/system/detail/generic/uninitialized_copy.h",
+ "cuda/include/thrust/system/detail/generic/uninitialized_copy.inl",
+ "cuda/include/thrust/system/detail/generic/uninitialized_fill.h",
+ "cuda/include/thrust/system/detail/generic/uninitialized_fill.inl",
+ "cuda/include/thrust/system/detail/generic/unique.h",
+ "cuda/include/thrust/system/detail/generic/unique.inl",
+ "cuda/include/thrust/system/detail/generic/unique_by_key.h",
+ "cuda/include/thrust/system/detail/generic/unique_by_key.inl",
+ "cuda/include/thrust/system/detail/internal/decompose.h",
+ "cuda/include/thrust/system/detail/sequential/adjacent_difference.h",
+ "cuda/include/thrust/system/detail/sequential/assign_value.h",
+ "cuda/include/thrust/system/detail/sequential/binary_search.h",
+ "cuda/include/thrust/system/detail/sequential/copy.h",
+ "cuda/include/thrust/system/detail/sequential/copy.inl",
+ "cuda/include/thrust/system/detail/sequential/copy_backward.h",
+ "cuda/include/thrust/system/detail/sequential/copy_if.h",
+ "cuda/include/thrust/system/detail/sequential/count.h",
+ "cuda/include/thrust/system/detail/sequential/equal.h",
+ "cuda/include/thrust/system/detail/sequential/execution_policy.h",
+ "cuda/include/thrust/system/detail/sequential/extrema.h",
+ "cuda/include/thrust/system/detail/sequential/fill.h",
+ "cuda/include/thrust/system/detail/sequential/find.h",
+ "cuda/include/thrust/system/detail/sequential/for_each.h",
+ "cuda/include/thrust/system/detail/sequential/gather.h",
+ "cuda/include/thrust/system/detail/sequential/general_copy.h",
+ "cuda/include/thrust/system/detail/sequential/generate.h",
+ "cuda/include/thrust/system/detail/sequential/get_value.h",
+ "cuda/include/thrust/system/detail/sequential/inner_product.h",
+ "cuda/include/thrust/system/detail/sequential/insertion_sort.h",
+ "cuda/include/thrust/system/detail/sequential/iter_swap.h",
+ "cuda/include/thrust/system/detail/sequential/logical.h",
+ "cuda/include/thrust/system/detail/sequential/malloc_and_free.h",
+ "cuda/include/thrust/system/detail/sequential/merge.h",
+ "cuda/include/thrust/system/detail/sequential/merge.inl",
+ "cuda/include/thrust/system/detail/sequential/mismatch.h",
+ "cuda/include/thrust/system/detail/sequential/partition.h",
+ "cuda/include/thrust/system/detail/sequential/reduce.h",
+ "cuda/include/thrust/system/detail/sequential/reduce_by_key.h",
+ "cuda/include/thrust/system/detail/sequential/remove.h",
+ "cuda/include/thrust/system/detail/sequential/replace.h",
+ "cuda/include/thrust/system/detail/sequential/reverse.h",
+ "cuda/include/thrust/system/detail/sequential/scan.h",
+ "cuda/include/thrust/system/detail/sequential/scan_by_key.h",
+ "cuda/include/thrust/system/detail/sequential/scatter.h",
+ "cuda/include/thrust/system/detail/sequential/sequence.h",
+ "cuda/include/thrust/system/detail/sequential/set_operations.h",
+ "cuda/include/thrust/system/detail/sequential/sort.h",
+ "cuda/include/thrust/system/detail/sequential/sort.inl",
+ "cuda/include/thrust/system/detail/sequential/stable_merge_sort.h",
+ "cuda/include/thrust/system/detail/sequential/stable_merge_sort.inl",
+ "cuda/include/thrust/system/detail/sequential/stable_primitive_sort.h",
+ "cuda/include/thrust/system/detail/sequential/stable_primitive_sort.inl",
+ "cuda/include/thrust/system/detail/sequential/stable_radix_sort.h",
+ "cuda/include/thrust/system/detail/sequential/stable_radix_sort.inl",
+ "cuda/include/thrust/system/detail/sequential/swap_ranges.h",
+ "cuda/include/thrust/system/detail/sequential/tabulate.h",
+ "cuda/include/thrust/system/detail/sequential/temporary_buffer.h",
+ "cuda/include/thrust/system/detail/sequential/transform.h",
+ "cuda/include/thrust/system/detail/sequential/transform_reduce.h",
+ "cuda/include/thrust/system/detail/sequential/transform_scan.h",
+ "cuda/include/thrust/system/detail/sequential/trivial_copy.h",
+ "cuda/include/thrust/system/detail/sequential/uninitialized_copy.h",
+ "cuda/include/thrust/system/detail/sequential/uninitialized_fill.h",
+ "cuda/include/thrust/system/detail/sequential/unique.h",
+ "cuda/include/thrust/system/detail/sequential/unique_by_key.h",
+ "cuda/include/thrust/system/detail/system_error.inl",
+ "cuda/include/thrust/system/error_code.h",
+ "cuda/include/thrust/system/omp/detail/adjacent_difference.h",
+ "cuda/include/thrust/system/omp/detail/assign_value.h",
+ "cuda/include/thrust/system/omp/detail/binary_search.h",
+ "cuda/include/thrust/system/omp/detail/copy.h",
+ "cuda/include/thrust/system/omp/detail/copy.inl",
+ "cuda/include/thrust/system/omp/detail/copy_if.h",
+ "cuda/include/thrust/system/omp/detail/copy_if.inl",
+ "cuda/include/thrust/system/omp/detail/count.h",
+ "cuda/include/thrust/system/omp/detail/default_decomposition.h",
+ "cuda/include/thrust/system/omp/detail/default_decomposition.inl",
+ "cuda/include/thrust/system/omp/detail/equal.h",
+ "cuda/include/thrust/system/omp/detail/execution_policy.h",
+ "cuda/include/thrust/system/omp/detail/extrema.h",
+ "cuda/include/thrust/system/omp/detail/fill.h",
+ "cuda/include/thrust/system/omp/detail/find.h",
+ "cuda/include/thrust/system/omp/detail/for_each.h",
+ "cuda/include/thrust/system/omp/detail/for_each.inl",
+ "cuda/include/thrust/system/omp/detail/gather.h",
+ "cuda/include/thrust/system/omp/detail/generate.h",
+ "cuda/include/thrust/system/omp/detail/get_value.h",
+ "cuda/include/thrust/system/omp/detail/inner_product.h",
+ "cuda/include/thrust/system/omp/detail/iter_swap.h",
+ "cuda/include/thrust/system/omp/detail/logical.h",
+ "cuda/include/thrust/system/omp/detail/malloc_and_free.h",
+ "cuda/include/thrust/system/omp/detail/memory.inl",
+ "cuda/include/thrust/system/omp/detail/merge.h",
+ "cuda/include/thrust/system/omp/detail/mismatch.h",
+ "cuda/include/thrust/system/omp/detail/par.h",
+ "cuda/include/thrust/system/omp/detail/partition.h",
+ "cuda/include/thrust/system/omp/detail/partition.inl",
+ "cuda/include/thrust/system/omp/detail/reduce.h",
+ "cuda/include/thrust/system/omp/detail/reduce.inl",
+ "cuda/include/thrust/system/omp/detail/reduce_by_key.h",
+ "cuda/include/thrust/system/omp/detail/reduce_by_key.inl",
+ "cuda/include/thrust/system/omp/detail/reduce_intervals.h",
+ "cuda/include/thrust/system/omp/detail/reduce_intervals.inl",
+ "cuda/include/thrust/system/omp/detail/remove.h",
+ "cuda/include/thrust/system/omp/detail/remove.inl",
+ "cuda/include/thrust/system/omp/detail/replace.h",
+ "cuda/include/thrust/system/omp/detail/reverse.h",
+ "cuda/include/thrust/system/omp/detail/scan.h",
+ "cuda/include/thrust/system/omp/detail/scan_by_key.h",
+ "cuda/include/thrust/system/omp/detail/scatter.h",
+ "cuda/include/thrust/system/omp/detail/sequence.h",
+ "cuda/include/thrust/system/omp/detail/set_operations.h",
+ "cuda/include/thrust/system/omp/detail/sort.h",
+ "cuda/include/thrust/system/omp/detail/sort.inl",
+ "cuda/include/thrust/system/omp/detail/swap_ranges.h",
+ "cuda/include/thrust/system/omp/detail/tabulate.h",
+ "cuda/include/thrust/system/omp/detail/temporary_buffer.h",
+ "cuda/include/thrust/system/omp/detail/transform.h",
+ "cuda/include/thrust/system/omp/detail/transform_reduce.h",
+ "cuda/include/thrust/system/omp/detail/transform_scan.h",
+ "cuda/include/thrust/system/omp/detail/uninitialized_copy.h",
+ "cuda/include/thrust/system/omp/detail/uninitialized_fill.h",
+ "cuda/include/thrust/system/omp/detail/unique.h",
+ "cuda/include/thrust/system/omp/detail/unique.inl",
+ "cuda/include/thrust/system/omp/detail/unique_by_key.h",
+ "cuda/include/thrust/system/omp/detail/unique_by_key.inl",
+ "cuda/include/thrust/system/omp/detail/vector.inl",
+ "cuda/include/thrust/system/omp/execution_policy.h",
+ "cuda/include/thrust/system/omp/memory.h",
+ "cuda/include/thrust/system/omp/vector.h",
+ "cuda/include/thrust/system/system_error.h",
+ "cuda/include/thrust/system/tbb/detail/adjacent_difference.h",
+ "cuda/include/thrust/system/tbb/detail/assign_value.h",
+ "cuda/include/thrust/system/tbb/detail/binary_search.h",
+ "cuda/include/thrust/system/tbb/detail/copy.h",
+ "cuda/include/thrust/system/tbb/detail/copy.inl",
+ "cuda/include/thrust/system/tbb/detail/copy_if.h",
+ "cuda/include/thrust/system/tbb/detail/copy_if.inl",
+ "cuda/include/thrust/system/tbb/detail/count.h",
+ "cuda/include/thrust/system/tbb/detail/equal.h",
+ "cuda/include/thrust/system/tbb/detail/execution_policy.h",
+ "cuda/include/thrust/system/tbb/detail/extrema.h",
+ "cuda/include/thrust/system/tbb/detail/fill.h",
+ "cuda/include/thrust/system/tbb/detail/find.h",
+ "cuda/include/thrust/system/tbb/detail/for_each.h",
+ "cuda/include/thrust/system/tbb/detail/for_each.inl",
+ "cuda/include/thrust/system/tbb/detail/gather.h",
+ "cuda/include/thrust/system/tbb/detail/generate.h",
+ "cuda/include/thrust/system/tbb/detail/get_value.h",
+ "cuda/include/thrust/system/tbb/detail/inner_product.h",
+ "cuda/include/thrust/system/tbb/detail/iter_swap.h",
+ "cuda/include/thrust/system/tbb/detail/logical.h",
+ "cuda/include/thrust/system/tbb/detail/malloc_and_free.h",
+ "cuda/include/thrust/system/tbb/detail/memory.inl",
+ "cuda/include/thrust/system/tbb/detail/merge.h",
+ "cuda/include/thrust/system/tbb/detail/merge.inl",
+ "cuda/include/thrust/system/tbb/detail/mismatch.h",
+ "cuda/include/thrust/system/tbb/detail/par.h",
+ "cuda/include/thrust/system/tbb/detail/partition.h",
+ "cuda/include/thrust/system/tbb/detail/partition.inl",
+ "cuda/include/thrust/system/tbb/detail/reduce.h",
+ "cuda/include/thrust/system/tbb/detail/reduce.inl",
+ "cuda/include/thrust/system/tbb/detail/reduce_by_key.h",
+ "cuda/include/thrust/system/tbb/detail/reduce_by_key.inl",
+ "cuda/include/thrust/system/tbb/detail/reduce_intervals.h",
+ "cuda/include/thrust/system/tbb/detail/remove.h",
+ "cuda/include/thrust/system/tbb/detail/remove.inl",
+ "cuda/include/thrust/system/tbb/detail/replace.h",
+ "cuda/include/thrust/system/tbb/detail/reverse.h",
+ "cuda/include/thrust/system/tbb/detail/scan.h",
+ "cuda/include/thrust/system/tbb/detail/scan.inl",
+ "cuda/include/thrust/system/tbb/detail/scan_by_key.h",
+ "cuda/include/thrust/system/tbb/detail/scatter.h",
+ "cuda/include/thrust/system/tbb/detail/sequence.h",
+ "cuda/include/thrust/system/tbb/detail/set_operations.h",
+ "cuda/include/thrust/system/tbb/detail/sort.h",
+ "cuda/include/thrust/system/tbb/detail/sort.inl",
+ "cuda/include/thrust/system/tbb/detail/swap_ranges.h",
+ "cuda/include/thrust/system/tbb/detail/tabulate.h",
+ "cuda/include/thrust/system/tbb/detail/temporary_buffer.h",
+ "cuda/include/thrust/system/tbb/detail/transform.h",
+ "cuda/include/thrust/system/tbb/detail/transform_reduce.h",
+ "cuda/include/thrust/system/tbb/detail/transform_scan.h",
+ "cuda/include/thrust/system/tbb/detail/uninitialized_copy.h",
+ "cuda/include/thrust/system/tbb/detail/uninitialized_fill.h",
+ "cuda/include/thrust/system/tbb/detail/unique.h",
+ "cuda/include/thrust/system/tbb/detail/unique.inl",
+ "cuda/include/thrust/system/tbb/detail/unique_by_key.h",
+ "cuda/include/thrust/system/tbb/detail/unique_by_key.inl",
+ "cuda/include/thrust/system/tbb/detail/vector.inl",
+ "cuda/include/thrust/system/tbb/execution_policy.h",
+ "cuda/include/thrust/system/tbb/memory.h",
+ "cuda/include/thrust/system/tbb/vector.h",
+ "cuda/include/thrust/system_error.h",
+ "cuda/include/thrust/tabulate.h",
+ "cuda/include/thrust/transform.h",
+ "cuda/include/thrust/transform_reduce.h",
+ "cuda/include/thrust/transform_scan.h",
+ "cuda/include/thrust/tuple.h",
+ "cuda/include/thrust/uninitialized_copy.h",
+ "cuda/include/thrust/uninitialized_fill.h",
+ "cuda/include/thrust/unique.h",
+ "cuda/include/thrust/version.h",
+ "cuda/include/vector_functions.h",
+ "cuda/include/vector_functions.hpp",
+ "cuda/include/vector_types.h",
+ ],
+ cmd = """
+if [ -d "$(@D)/extras" ]; then rm $(@D)/extras -drf; fi && if [ -d "$(@D)/include" ]; then rm $(@D)/include -drf; fi && if [ -d "$(@D)/lib" ]; then rm $(@D)/lib -drf; fi && if [ -d "$(@D)/nvvm" ]; then rm $(@D)/nvvm -drf; fi && cp "/usr/local/cuda-9.0/include/CL/cl.h" "$(@D)/cuda/include/CL/cl.h" && cp "/usr/local/cuda-9.0/include/CL/cl.hpp" "$(@D)/cuda/include/CL/cl.hpp" && cp "/usr/local/cuda-9.0/include/CL/cl_egl.h" "$(@D)/cuda/include/CL/cl_egl.h" && cp "/usr/local/cuda-9.0/include/CL/cl_ext.h" "$(@D)/cuda/include/CL/cl_ext.h" && cp "/usr/local/cuda-9.0/include/CL/cl_gl.h" "$(@D)/cuda/include/CL/cl_gl.h" && cp "/usr/local/cuda-9.0/include/CL/cl_gl_ext.h" "$(@D)/cuda/include/CL/cl_gl_ext.h" && cp "/usr/local/cuda-9.0/include/CL/cl_platform.h" "$(@D)/cuda/include/CL/cl_platform.h" && cp "/usr/local/cuda-9.0/include/CL/opencl.h" "$(@D)/cuda/include/CL/opencl.h" && cp "/usr/local/cuda-9.0/include/builtin_types.h" "$(@D)/cuda/include/builtin_types.h" && cp "/usr/local/cuda-9.0/include/channel_descriptor.h" "$(@D)/cuda/include/channel_descriptor.h" && cp "/usr/local/cuda-9.0/include/common_functions.h" "$(@D)/cuda/include/common_functions.h" && cp "/usr/local/cuda-9.0/include/cooperative_groups.h" "$(@D)/cuda/include/cooperative_groups.h" && cp "/usr/local/cuda-9.0/include/cooperative_groups_helpers.h" "$(@D)/cuda/include/cooperative_groups_helpers.h" && cp "/usr/local/cuda-9.0/include/crt/common_functions.h" "$(@D)/cuda/include/crt/common_functions.h" && cp "/usr/local/cuda-9.0/include/crt/device_double_functions.h" "$(@D)/cuda/include/crt/device_double_functions.h" && cp "/usr/local/cuda-9.0/include/crt/device_double_functions.hpp" "$(@D)/cuda/include/crt/device_double_functions.hpp" && cp "/usr/local/cuda-9.0/include/crt/device_functions.h" "$(@D)/cuda/include/crt/device_functions.h" && cp "/usr/local/cuda-9.0/include/crt/device_functions.hpp" "$(@D)/cuda/include/crt/device_functions.hpp" && cp "/usr/local/cuda-9.0/include/crt/func_macro.h" "$(@D)/cuda/include/crt/func_macro.h" && cp "/usr/local/cuda-9.0/include/crt/host_config.h" "$(@D)/cuda/include/crt/host_config.h" && cp "/usr/local/cuda-9.0/include/crt/host_defines.h" "$(@D)/cuda/include/crt/host_defines.h" && cp "/usr/local/cuda-9.0/include/crt/host_runtime.h" "$(@D)/cuda/include/crt/host_runtime.h" && cp "/usr/local/cuda-9.0/include/crt/math_functions.h" "$(@D)/cuda/include/crt/math_functions.h" && cp "/usr/local/cuda-9.0/include/crt/math_functions.hpp" "$(@D)/cuda/include/crt/math_functions.hpp" && cp "/usr/local/cuda-9.0/include/crt/mma.h" "$(@D)/cuda/include/crt/mma.h" && cp "/usr/local/cuda-9.0/include/crt/mma.hpp" "$(@D)/cuda/include/crt/mma.hpp" && cp "/usr/local/cuda-9.0/include/crt/nvfunctional" "$(@D)/cuda/include/crt/nvfunctional" && cp "/usr/local/cuda-9.0/include/crt/sm_70_rt.h" "$(@D)/cuda/include/crt/sm_70_rt.h" && cp "/usr/local/cuda-9.0/include/crt/sm_70_rt.hpp" "$(@D)/cuda/include/crt/sm_70_rt.hpp" && cp "/usr/local/cuda-9.0/include/crt/storage_class.h" "$(@D)/cuda/include/crt/storage_class.h" && cp "/usr/local/cuda-9.0/include/cuComplex.h" "$(@D)/cuda/include/cuComplex.h" && cp "/usr/local/cuda-9.0/include/cublas.h" "$(@D)/cuda/include/cublas.h" && cp "/usr/local/cuda-9.0/include/cublasXt.h" "$(@D)/cuda/include/cublasXt.h" && cp "/usr/local/cuda-9.0/include/cublas_api.h" "$(@D)/cuda/include/cublas_api.h" && cp "/usr/local/cuda-9.0/include/cublas_v2.h" "$(@D)/cuda/include/cublas_v2.h" && cp "/usr/local/cuda-9.0/include/cuda.h" "$(@D)/cuda/include/cuda.h" && cp "/usr/local/cuda-9.0/include/cudaEGL.h" "$(@D)/cuda/include/cudaEGL.h" && cp "/usr/local/cuda-9.0/include/cudaGL.h" "$(@D)/cuda/include/cudaGL.h" && cp "/usr/local/cuda-9.0/include/cudaProfiler.h" "$(@D)/cuda/include/cudaProfiler.h" && cp "/usr/local/cuda-9.0/include/cudaVDPAU.h" "$(@D)/cuda/include/cudaVDPAU.h" && cp "/usr/local/cuda-9.0/include/cuda_device_runtime_api.h" "$(@D)/cuda/include/cuda_device_runtime_api.h" && cp "/usr/local/cuda-9.0/include/cuda_fp16.h" "$(@D)/cuda/include/cuda_fp16.h" && cp "/usr/local/cuda-9.0/include/cuda_fp16.hpp" "$(@D)/cuda/include/cuda_fp16.hpp" && cp "/usr/local/cuda-9.0/include/cuda_gl_interop.h" "$(@D)/cuda/include/cuda_gl_interop.h" && cp "/usr/local/cuda-9.0/include/cuda_occupancy.h" "$(@D)/cuda/include/cuda_occupancy.h" && cp "/usr/local/cuda-9.0/include/cuda_profiler_api.h" "$(@D)/cuda/include/cuda_profiler_api.h" && cp "/usr/local/cuda-9.0/include/cuda_runtime.h" "$(@D)/cuda/include/cuda_runtime.h" && cp "/usr/local/cuda-9.0/include/cuda_runtime_api.h" "$(@D)/cuda/include/cuda_runtime_api.h" && cp "/usr/local/cuda-9.0/include/cuda_surface_types.h" "$(@D)/cuda/include/cuda_surface_types.h" && cp "/usr/local/cuda-9.0/include/cuda_texture_types.h" "$(@D)/cuda/include/cuda_texture_types.h" && cp "/usr/local/cuda-9.0/include/cuda_vdpau_interop.h" "$(@D)/cuda/include/cuda_vdpau_interop.h" && cp "/usr/local/cuda-9.0/include/cudalibxt.h" "$(@D)/cuda/include/cudalibxt.h" && cp "/usr/local/cuda-9.0/include/cufft.h" "$(@D)/cuda/include/cufft.h" && cp "/usr/local/cuda-9.0/include/cufftXt.h" "$(@D)/cuda/include/cufftXt.h" && cp "/usr/local/cuda-9.0/include/cufftw.h" "$(@D)/cuda/include/cufftw.h" && cp "/usr/local/cuda-9.0/include/curand.h" "$(@D)/cuda/include/curand.h" && cp "/usr/local/cuda-9.0/include/curand_discrete.h" "$(@D)/cuda/include/curand_discrete.h" && cp "/usr/local/cuda-9.0/include/curand_discrete2.h" "$(@D)/cuda/include/curand_discrete2.h" && cp "/usr/local/cuda-9.0/include/curand_globals.h" "$(@D)/cuda/include/curand_globals.h" && cp "/usr/local/cuda-9.0/include/curand_kernel.h" "$(@D)/cuda/include/curand_kernel.h" && cp "/usr/local/cuda-9.0/include/curand_lognormal.h" "$(@D)/cuda/include/curand_lognormal.h" && cp "/usr/local/cuda-9.0/include/curand_mrg32k3a.h" "$(@D)/cuda/include/curand_mrg32k3a.h" && cp "/usr/local/cuda-9.0/include/curand_mtgp32.h" "$(@D)/cuda/include/curand_mtgp32.h" && cp "/usr/local/cuda-9.0/include/curand_mtgp32_host.h" "$(@D)/cuda/include/curand_mtgp32_host.h" && cp "/usr/local/cuda-9.0/include/curand_mtgp32_kernel.h" "$(@D)/cuda/include/curand_mtgp32_kernel.h" && cp "/usr/local/cuda-9.0/include/curand_mtgp32dc_p_11213.h" "$(@D)/cuda/include/curand_mtgp32dc_p_11213.h" && cp "/usr/local/cuda-9.0/include/curand_normal.h" "$(@D)/cuda/include/curand_normal.h" && cp "/usr/local/cuda-9.0/include/curand_normal_static.h" "$(@D)/cuda/include/curand_normal_static.h" && cp "/usr/local/cuda-9.0/include/curand_philox4x32_x.h" "$(@D)/cuda/include/curand_philox4x32_x.h" && cp "/usr/local/cuda-9.0/include/curand_poisson.h" "$(@D)/cuda/include/curand_poisson.h" && cp "/usr/local/cuda-9.0/include/curand_precalc.h" "$(@D)/cuda/include/curand_precalc.h" && cp "/usr/local/cuda-9.0/include/curand_uniform.h" "$(@D)/cuda/include/curand_uniform.h" && cp "/usr/local/cuda-9.0/include/cusolverDn.h" "$(@D)/cuda/include/cusolverDn.h" && cp "/usr/local/cuda-9.0/include/cusolverRf.h" "$(@D)/cuda/include/cusolverRf.h" && cp "/usr/local/cuda-9.0/include/cusolverSp.h" "$(@D)/cuda/include/cusolverSp.h" && cp "/usr/local/cuda-9.0/include/cusolverSp_LOWLEVEL_PREVIEW.h" "$(@D)/cuda/include/cusolverSp_LOWLEVEL_PREVIEW.h" && cp "/usr/local/cuda-9.0/include/cusolver_common.h" "$(@D)/cuda/include/cusolver_common.h" && cp "/usr/local/cuda-9.0/include/cusparse.h" "$(@D)/cuda/include/cusparse.h" && cp "/usr/local/cuda-9.0/include/cusparse_v2.h" "$(@D)/cuda/include/cusparse_v2.h" && cp "/usr/local/cuda-9.0/include/device_atomic_functions.h" "$(@D)/cuda/include/device_atomic_functions.h" && cp "/usr/local/cuda-9.0/include/device_atomic_functions.hpp" "$(@D)/cuda/include/device_atomic_functions.hpp" && cp "/usr/local/cuda-9.0/include/device_double_functions.h" "$(@D)/cuda/include/device_double_functions.h" && cp "/usr/local/cuda-9.0/include/device_double_functions.hpp" "$(@D)/cuda/include/device_double_functions.hpp" && cp "/usr/local/cuda-9.0/include/device_functions.h" "$(@D)/cuda/include/device_functions.h" && cp "/usr/local/cuda-9.0/include/device_functions.hpp" "$(@D)/cuda/include/device_functions.hpp" && cp "/usr/local/cuda-9.0/include/device_functions_decls.h" "$(@D)/cuda/include/device_functions_decls.h" && cp "/usr/local/cuda-9.0/include/device_launch_parameters.h" "$(@D)/cuda/include/device_launch_parameters.h" && cp "/usr/local/cuda-9.0/include/device_types.h" "$(@D)/cuda/include/device_types.h" && cp "/usr/local/cuda-9.0/include/driver_functions.h" "$(@D)/cuda/include/driver_functions.h" && cp "/usr/local/cuda-9.0/include/driver_types.h" "$(@D)/cuda/include/driver_types.h" && cp "/usr/local/cuda-9.0/include/dynlink_cuda.h" "$(@D)/cuda/include/dynlink_cuda.h" && cp "/usr/local/cuda-9.0/include/dynlink_cuda_cuda.h" "$(@D)/cuda/include/dynlink_cuda_cuda.h" && cp "/usr/local/cuda-9.0/include/dynlink_cuviddec.h" "$(@D)/cuda/include/dynlink_cuviddec.h" && cp "/usr/local/cuda-9.0/include/dynlink_nvcuvid.h" "$(@D)/cuda/include/dynlink_nvcuvid.h" && cp "/usr/local/cuda-9.0/include/fatBinaryCtl.h" "$(@D)/cuda/include/fatBinaryCtl.h" && cp "/usr/local/cuda-9.0/include/fatbinary.h" "$(@D)/cuda/include/fatbinary.h" && cp "/usr/local/cuda-9.0/include/host_config.h" "$(@D)/cuda/include/host_config.h" && cp "/usr/local/cuda-9.0/include/host_defines.h" "$(@D)/cuda/include/host_defines.h" && cp "/usr/local/cuda-9.0/include/library_types.h" "$(@D)/cuda/include/library_types.h" && cp "/usr/local/cuda-9.0/include/math_constants.h" "$(@D)/cuda/include/math_constants.h" && cp "/usr/local/cuda-9.0/include/math_functions.h" "$(@D)/cuda/include/math_functions.h" && cp "/usr/local/cuda-9.0/include/math_functions.hpp" "$(@D)/cuda/include/math_functions.hpp" && cp "/usr/local/cuda-9.0/include/math_functions_dbl_ptx3.h" "$(@D)/cuda/include/math_functions_dbl_ptx3.h" && cp "/usr/local/cuda-9.0/include/math_functions_dbl_ptx3.hpp" "$(@D)/cuda/include/math_functions_dbl_ptx3.hpp" && cp "/usr/local/cuda-9.0/include/mma.h" "$(@D)/cuda/include/mma.h" && cp "/usr/local/cuda-9.0/include/npp.h" "$(@D)/cuda/include/npp.h" && cp "/usr/local/cuda-9.0/include/nppcore.h" "$(@D)/cuda/include/nppcore.h" && cp "/usr/local/cuda-9.0/include/nppdefs.h" "$(@D)/cuda/include/nppdefs.h" && cp "/usr/local/cuda-9.0/include/nppi.h" "$(@D)/cuda/include/nppi.h" && cp "/usr/local/cuda-9.0/include/nppi_arithmetic_and_logical_operations.h" "$(@D)/cuda/include/nppi_arithmetic_and_logical_operations.h" && cp "/usr/local/cuda-9.0/include/nppi_color_conversion.h" "$(@D)/cuda/include/nppi_color_conversion.h" && cp "/usr/local/cuda-9.0/include/nppi_compression_functions.h" "$(@D)/cuda/include/nppi_compression_functions.h" && cp "/usr/local/cuda-9.0/include/nppi_computer_vision.h" "$(@D)/cuda/include/nppi_computer_vision.h" && cp "/usr/local/cuda-9.0/include/nppi_data_exchange_and_initialization.h" "$(@D)/cuda/include/nppi_data_exchange_and_initialization.h" && cp "/usr/local/cuda-9.0/include/nppi_filtering_functions.h" "$(@D)/cuda/include/nppi_filtering_functions.h" && cp "/usr/local/cuda-9.0/include/nppi_geometry_transforms.h" "$(@D)/cuda/include/nppi_geometry_transforms.h" && cp "/usr/local/cuda-9.0/include/nppi_linear_transforms.h" "$(@D)/cuda/include/nppi_linear_transforms.h" && cp "/usr/local/cuda-9.0/include/nppi_morphological_operations.h" "$(@D)/cuda/include/nppi_morphological_operations.h" && cp "/usr/local/cuda-9.0/include/nppi_statistics_functions.h" "$(@D)/cuda/include/nppi_statistics_functions.h" && cp "/usr/local/cuda-9.0/include/nppi_support_functions.h" "$(@D)/cuda/include/nppi_support_functions.h" && cp "/usr/local/cuda-9.0/include/nppi_threshold_and_compare_operations.h" "$(@D)/cuda/include/nppi_threshold_and_compare_operations.h" && cp "/usr/local/cuda-9.0/include/npps.h" "$(@D)/cuda/include/npps.h" && cp "/usr/local/cuda-9.0/include/npps_arithmetic_and_logical_operations.h" "$(@D)/cuda/include/npps_arithmetic_and_logical_operations.h" && cp "/usr/local/cuda-9.0/include/npps_conversion_functions.h" "$(@D)/cuda/include/npps_conversion_functions.h" && cp "/usr/local/cuda-9.0/include/npps_filtering_functions.h" "$(@D)/cuda/include/npps_filtering_functions.h" && cp "/usr/local/cuda-9.0/include/npps_initialization.h" "$(@D)/cuda/include/npps_initialization.h" && cp "/usr/local/cuda-9.0/include/npps_statistics_functions.h" "$(@D)/cuda/include/npps_statistics_functions.h" && cp "/usr/local/cuda-9.0/include/npps_support_functions.h" "$(@D)/cuda/include/npps_support_functions.h" && cp "/usr/local/cuda-9.0/include/nppversion.h" "$(@D)/cuda/include/nppversion.h" && cp "/usr/local/cuda-9.0/include/nvToolsExt.h" "$(@D)/cuda/include/nvToolsExt.h" && cp "/usr/local/cuda-9.0/include/nvToolsExtCuda.h" "$(@D)/cuda/include/nvToolsExtCuda.h" && cp "/usr/local/cuda-9.0/include/nvToolsExtCudaRt.h" "$(@D)/cuda/include/nvToolsExtCudaRt.h" && cp "/usr/local/cuda-9.0/include/nvToolsExtMeta.h" "$(@D)/cuda/include/nvToolsExtMeta.h" && cp "/usr/local/cuda-9.0/include/nvToolsExtSync.h" "$(@D)/cuda/include/nvToolsExtSync.h" && cp "/usr/local/cuda-9.0/include/nvblas.h" "$(@D)/cuda/include/nvblas.h" && cp "/usr/local/cuda-9.0/include/nvfunctional" "$(@D)/cuda/include/nvfunctional" && cp "/usr/local/cuda-9.0/include/nvgraph.h" "$(@D)/cuda/include/nvgraph.h" && cp "/usr/local/cuda-9.0/include/nvml.h" "$(@D)/cuda/include/nvml.h" && cp "/usr/local/cuda-9.0/include/nvrtc.h" "$(@D)/cuda/include/nvrtc.h" && cp "/usr/local/cuda-9.0/include/sm_20_atomic_functions.h" "$(@D)/cuda/include/sm_20_atomic_functions.h" && cp "/usr/local/cuda-9.0/include/sm_20_atomic_functions.hpp" "$(@D)/cuda/include/sm_20_atomic_functions.hpp" && cp "/usr/local/cuda-9.0/include/sm_20_intrinsics.h" "$(@D)/cuda/include/sm_20_intrinsics.h" && cp "/usr/local/cuda-9.0/include/sm_20_intrinsics.hpp" "$(@D)/cuda/include/sm_20_intrinsics.hpp" && cp "/usr/local/cuda-9.0/include/sm_30_intrinsics.h" "$(@D)/cuda/include/sm_30_intrinsics.h" && cp "/usr/local/cuda-9.0/include/sm_30_intrinsics.hpp" "$(@D)/cuda/include/sm_30_intrinsics.hpp" && cp "/usr/local/cuda-9.0/include/sm_32_atomic_functions.h" "$(@D)/cuda/include/sm_32_atomic_functions.h" && cp "/usr/local/cuda-9.0/include/sm_32_atomic_functions.hpp" "$(@D)/cuda/include/sm_32_atomic_functions.hpp" && cp "/usr/local/cuda-9.0/include/sm_32_intrinsics.h" "$(@D)/cuda/include/sm_32_intrinsics.h" && cp "/usr/local/cuda-9.0/include/sm_32_intrinsics.hpp" "$(@D)/cuda/include/sm_32_intrinsics.hpp" && cp "/usr/local/cuda-9.0/include/sm_35_atomic_functions.h" "$(@D)/cuda/include/sm_35_atomic_functions.h" && cp "/usr/local/cuda-9.0/include/sm_35_intrinsics.h" "$(@D)/cuda/include/sm_35_intrinsics.h" && cp "/usr/local/cuda-9.0/include/sm_60_atomic_functions.h" "$(@D)/cuda/include/sm_60_atomic_functions.h" && cp "/usr/local/cuda-9.0/include/sm_60_atomic_functions.hpp" "$(@D)/cuda/include/sm_60_atomic_functions.hpp" && cp "/usr/local/cuda-9.0/include/sm_61_intrinsics.h" "$(@D)/cuda/include/sm_61_intrinsics.h" && cp "/usr/local/cuda-9.0/include/sm_61_intrinsics.hpp" "$(@D)/cuda/include/sm_61_intrinsics.hpp" && cp "/usr/local/cuda-9.0/include/sobol_direction_vectors.h" "$(@D)/cuda/include/sobol_direction_vectors.h" && cp "/usr/local/cuda-9.0/include/surface_functions.h" "$(@D)/cuda/include/surface_functions.h" && cp "/usr/local/cuda-9.0/include/surface_functions.hpp" "$(@D)/cuda/include/surface_functions.hpp" && cp "/usr/local/cuda-9.0/include/surface_indirect_functions.h" "$(@D)/cuda/include/surface_indirect_functions.h" && cp "/usr/local/cuda-9.0/include/surface_indirect_functions.hpp" "$(@D)/cuda/include/surface_indirect_functions.hpp" && cp "/usr/local/cuda-9.0/include/surface_types.h" "$(@D)/cuda/include/surface_types.h" && cp "/usr/local/cuda-9.0/include/texture_fetch_functions.h" "$(@D)/cuda/include/texture_fetch_functions.h" && cp "/usr/local/cuda-9.0/include/texture_fetch_functions.hpp" "$(@D)/cuda/include/texture_fetch_functions.hpp" && cp "/usr/local/cuda-9.0/include/texture_indirect_functions.h" "$(@D)/cuda/include/texture_indirect_functions.h" && cp "/usr/local/cuda-9.0/include/texture_indirect_functions.hpp" "$(@D)/cuda/include/texture_indirect_functions.hpp" && cp "/usr/local/cuda-9.0/include/texture_types.h" "$(@D)/cuda/include/texture_types.h" && cp "/usr/local/cuda-9.0/include/thrust/adjacent_difference.h" "$(@D)/cuda/include/thrust/adjacent_difference.h" && cp "/usr/local/cuda-9.0/include/thrust/advance.h" "$(@D)/cuda/include/thrust/advance.h" && cp "/usr/local/cuda-9.0/include/thrust/binary_search.h" "$(@D)/cuda/include/thrust/binary_search.h" && cp "/usr/local/cuda-9.0/include/thrust/complex.h" "$(@D)/cuda/include/thrust/complex.h" && cp "/usr/local/cuda-9.0/include/thrust/copy.h" "$(@D)/cuda/include/thrust/copy.h" && cp "/usr/local/cuda-9.0/include/thrust/count.h" "$(@D)/cuda/include/thrust/count.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/adjacent_difference.inl" "$(@D)/cuda/include/thrust/detail/adjacent_difference.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/advance.inl" "$(@D)/cuda/include/thrust/detail/advance.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/allocator_traits.h" "$(@D)/cuda/include/thrust/detail/allocator/allocator_traits.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/allocator_traits.inl" "$(@D)/cuda/include/thrust/detail/allocator/allocator_traits.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/copy_construct_range.h" "$(@D)/cuda/include/thrust/detail/allocator/copy_construct_range.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/copy_construct_range.inl" "$(@D)/cuda/include/thrust/detail/allocator/copy_construct_range.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/default_construct_range.h" "$(@D)/cuda/include/thrust/detail/allocator/default_construct_range.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/default_construct_range.inl" "$(@D)/cuda/include/thrust/detail/allocator/default_construct_range.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/destroy_range.h" "$(@D)/cuda/include/thrust/detail/allocator/destroy_range.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/destroy_range.inl" "$(@D)/cuda/include/thrust/detail/allocator/destroy_range.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/fill_construct_range.h" "$(@D)/cuda/include/thrust/detail/allocator/fill_construct_range.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/fill_construct_range.inl" "$(@D)/cuda/include/thrust/detail/allocator/fill_construct_range.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/malloc_allocator.h" "$(@D)/cuda/include/thrust/detail/allocator/malloc_allocator.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/malloc_allocator.inl" "$(@D)/cuda/include/thrust/detail/allocator/malloc_allocator.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/no_throw_allocator.h" "$(@D)/cuda/include/thrust/detail/allocator/no_throw_allocator.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/tagged_allocator.h" "$(@D)/cuda/include/thrust/detail/allocator/tagged_allocator.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/tagged_allocator.inl" "$(@D)/cuda/include/thrust/detail/allocator/tagged_allocator.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/temporary_allocator.h" "$(@D)/cuda/include/thrust/detail/allocator/temporary_allocator.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/allocator/temporary_allocator.inl" "$(@D)/cuda/include/thrust/detail/allocator/temporary_allocator.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/binary_search.inl" "$(@D)/cuda/include/thrust/detail/binary_search.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/arithmetic.h" "$(@D)/cuda/include/thrust/detail/complex/arithmetic.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/c99math.h" "$(@D)/cuda/include/thrust/detail/complex/c99math.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/catrig.h" "$(@D)/cuda/include/thrust/detail/complex/catrig.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/catrigf.h" "$(@D)/cuda/include/thrust/detail/complex/catrigf.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/ccosh.h" "$(@D)/cuda/include/thrust/detail/complex/ccosh.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/ccoshf.h" "$(@D)/cuda/include/thrust/detail/complex/ccoshf.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/cexp.h" "$(@D)/cuda/include/thrust/detail/complex/cexp.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/cexpf.h" "$(@D)/cuda/include/thrust/detail/complex/cexpf.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/clog.h" "$(@D)/cuda/include/thrust/detail/complex/clog.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/clogf.h" "$(@D)/cuda/include/thrust/detail/complex/clogf.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/complex.inl" "$(@D)/cuda/include/thrust/detail/complex/complex.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/cpow.h" "$(@D)/cuda/include/thrust/detail/complex/cpow.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/cpowf.h" "$(@D)/cuda/include/thrust/detail/complex/cpowf.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/cproj.h" "$(@D)/cuda/include/thrust/detail/complex/cproj.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/csinh.h" "$(@D)/cuda/include/thrust/detail/complex/csinh.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/csinhf.h" "$(@D)/cuda/include/thrust/detail/complex/csinhf.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/csqrt.h" "$(@D)/cuda/include/thrust/detail/complex/csqrt.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/csqrtf.h" "$(@D)/cuda/include/thrust/detail/complex/csqrtf.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/ctanh.h" "$(@D)/cuda/include/thrust/detail/complex/ctanh.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/ctanhf.h" "$(@D)/cuda/include/thrust/detail/complex/ctanhf.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/math_private.h" "$(@D)/cuda/include/thrust/detail/complex/math_private.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/complex/stream.h" "$(@D)/cuda/include/thrust/detail/complex/stream.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/config.h" "$(@D)/cuda/include/thrust/detail/config.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/config/compiler.h" "$(@D)/cuda/include/thrust/detail/config/compiler.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/config/compiler_fence.h" "$(@D)/cuda/include/thrust/detail/config/compiler_fence.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/config/config.h" "$(@D)/cuda/include/thrust/detail/config/config.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/config/debug.h" "$(@D)/cuda/include/thrust/detail/config/debug.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/config/device_system.h" "$(@D)/cuda/include/thrust/detail/config/device_system.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/config/exec_check_disable.h" "$(@D)/cuda/include/thrust/detail/config/exec_check_disable.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/config/forceinline.h" "$(@D)/cuda/include/thrust/detail/config/forceinline.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/config/global_workarounds.h" "$(@D)/cuda/include/thrust/detail/config/global_workarounds.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/config/host_device.h" "$(@D)/cuda/include/thrust/detail/config/host_device.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/config/host_system.h" "$(@D)/cuda/include/thrust/detail/config/host_system.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/config/simple_defines.h" "$(@D)/cuda/include/thrust/detail/config/simple_defines.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/contiguous_storage.h" "$(@D)/cuda/include/thrust/detail/contiguous_storage.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/contiguous_storage.inl" "$(@D)/cuda/include/thrust/detail/contiguous_storage.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/copy.h" "$(@D)/cuda/include/thrust/detail/copy.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/copy.inl" "$(@D)/cuda/include/thrust/detail/copy.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/copy_if.h" "$(@D)/cuda/include/thrust/detail/copy_if.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/copy_if.inl" "$(@D)/cuda/include/thrust/detail/copy_if.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/count.inl" "$(@D)/cuda/include/thrust/detail/count.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/cstdint.h" "$(@D)/cuda/include/thrust/detail/cstdint.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/device_delete.inl" "$(@D)/cuda/include/thrust/detail/device_delete.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/device_free.inl" "$(@D)/cuda/include/thrust/detail/device_free.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/device_malloc.inl" "$(@D)/cuda/include/thrust/detail/device_malloc.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/device_new.inl" "$(@D)/cuda/include/thrust/detail/device_new.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/device_ptr.inl" "$(@D)/cuda/include/thrust/detail/device_ptr.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/device_reference.inl" "$(@D)/cuda/include/thrust/detail/device_reference.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/device_vector.inl" "$(@D)/cuda/include/thrust/detail/device_vector.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/dispatch/is_trivial_copy.h" "$(@D)/cuda/include/thrust/detail/dispatch/is_trivial_copy.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/distance.inl" "$(@D)/cuda/include/thrust/detail/distance.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/equal.inl" "$(@D)/cuda/include/thrust/detail/equal.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/execute_with_allocator.h" "$(@D)/cuda/include/thrust/detail/execute_with_allocator.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/execution_policy.h" "$(@D)/cuda/include/thrust/detail/execution_policy.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/extrema.inl" "$(@D)/cuda/include/thrust/detail/extrema.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/fill.inl" "$(@D)/cuda/include/thrust/detail/fill.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/find.inl" "$(@D)/cuda/include/thrust/detail/find.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/for_each.inl" "$(@D)/cuda/include/thrust/detail/for_each.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/function.h" "$(@D)/cuda/include/thrust/detail/function.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional.inl" "$(@D)/cuda/include/thrust/detail/functional.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/actor.h" "$(@D)/cuda/include/thrust/detail/functional/actor.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/actor.inl" "$(@D)/cuda/include/thrust/detail/functional/actor.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/argument.h" "$(@D)/cuda/include/thrust/detail/functional/argument.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/composite.h" "$(@D)/cuda/include/thrust/detail/functional/composite.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/operators.h" "$(@D)/cuda/include/thrust/detail/functional/operators.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/operators/arithmetic_operators.h" "$(@D)/cuda/include/thrust/detail/functional/operators/arithmetic_operators.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/operators/assignment_operator.h" "$(@D)/cuda/include/thrust/detail/functional/operators/assignment_operator.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/operators/bitwise_operators.h" "$(@D)/cuda/include/thrust/detail/functional/operators/bitwise_operators.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/operators/compound_assignment_operators.h" "$(@D)/cuda/include/thrust/detail/functional/operators/compound_assignment_operators.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/operators/logical_operators.h" "$(@D)/cuda/include/thrust/detail/functional/operators/logical_operators.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/operators/operator_adaptors.h" "$(@D)/cuda/include/thrust/detail/functional/operators/operator_adaptors.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/operators/relational_operators.h" "$(@D)/cuda/include/thrust/detail/functional/operators/relational_operators.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/placeholder.h" "$(@D)/cuda/include/thrust/detail/functional/placeholder.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/functional/value.h" "$(@D)/cuda/include/thrust/detail/functional/value.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/gather.inl" "$(@D)/cuda/include/thrust/detail/gather.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/generate.inl" "$(@D)/cuda/include/thrust/detail/generate.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/get_iterator_value.h" "$(@D)/cuda/include/thrust/detail/get_iterator_value.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/host_vector.inl" "$(@D)/cuda/include/thrust/detail/host_vector.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/inner_product.inl" "$(@D)/cuda/include/thrust/detail/inner_product.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/integer_math.h" "$(@D)/cuda/include/thrust/detail/integer_math.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/integer_traits.h" "$(@D)/cuda/include/thrust/detail/integer_traits.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/internal_functional.h" "$(@D)/cuda/include/thrust/detail/internal_functional.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/logical.inl" "$(@D)/cuda/include/thrust/detail/logical.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/malloc_and_free.h" "$(@D)/cuda/include/thrust/detail/malloc_and_free.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/merge.inl" "$(@D)/cuda/include/thrust/detail/merge.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/minmax.h" "$(@D)/cuda/include/thrust/detail/minmax.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/mismatch.inl" "$(@D)/cuda/include/thrust/detail/mismatch.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/mpl/math.h" "$(@D)/cuda/include/thrust/detail/mpl/math.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/numeric_traits.h" "$(@D)/cuda/include/thrust/detail/numeric_traits.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/overlapped_copy.h" "$(@D)/cuda/include/thrust/detail/overlapped_copy.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/pair.inl" "$(@D)/cuda/include/thrust/detail/pair.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/partition.inl" "$(@D)/cuda/include/thrust/detail/partition.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/pointer.h" "$(@D)/cuda/include/thrust/detail/pointer.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/pointer.inl" "$(@D)/cuda/include/thrust/detail/pointer.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/range/head_flags.h" "$(@D)/cuda/include/thrust/detail/range/head_flags.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/range/tail_flags.h" "$(@D)/cuda/include/thrust/detail/range/tail_flags.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/raw_pointer_cast.h" "$(@D)/cuda/include/thrust/detail/raw_pointer_cast.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/raw_reference_cast.h" "$(@D)/cuda/include/thrust/detail/raw_reference_cast.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/reduce.inl" "$(@D)/cuda/include/thrust/detail/reduce.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/reference.h" "$(@D)/cuda/include/thrust/detail/reference.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/reference.inl" "$(@D)/cuda/include/thrust/detail/reference.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/reference_forward_declaration.h" "$(@D)/cuda/include/thrust/detail/reference_forward_declaration.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/remove.inl" "$(@D)/cuda/include/thrust/detail/remove.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/replace.inl" "$(@D)/cuda/include/thrust/detail/replace.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/reverse.inl" "$(@D)/cuda/include/thrust/detail/reverse.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/scan.inl" "$(@D)/cuda/include/thrust/detail/scan.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/scatter.inl" "$(@D)/cuda/include/thrust/detail/scatter.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/seq.h" "$(@D)/cuda/include/thrust/detail/seq.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/sequence.inl" "$(@D)/cuda/include/thrust/detail/sequence.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/set_operations.inl" "$(@D)/cuda/include/thrust/detail/set_operations.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/sort.inl" "$(@D)/cuda/include/thrust/detail/sort.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/static_assert.h" "$(@D)/cuda/include/thrust/detail/static_assert.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/static_map.h" "$(@D)/cuda/include/thrust/detail/static_map.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/swap.h" "$(@D)/cuda/include/thrust/detail/swap.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/swap.inl" "$(@D)/cuda/include/thrust/detail/swap.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/swap_ranges.inl" "$(@D)/cuda/include/thrust/detail/swap_ranges.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/tabulate.inl" "$(@D)/cuda/include/thrust/detail/tabulate.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/temporary_array.h" "$(@D)/cuda/include/thrust/detail/temporary_array.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/temporary_array.inl" "$(@D)/cuda/include/thrust/detail/temporary_array.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/temporary_buffer.h" "$(@D)/cuda/include/thrust/detail/temporary_buffer.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/transform.inl" "$(@D)/cuda/include/thrust/detail/transform.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/transform_reduce.inl" "$(@D)/cuda/include/thrust/detail/transform_reduce.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/transform_scan.inl" "$(@D)/cuda/include/thrust/detail/transform_scan.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/trivial_sequence.h" "$(@D)/cuda/include/thrust/detail/trivial_sequence.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/tuple.inl" "$(@D)/cuda/include/thrust/detail/tuple.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/tuple_meta_transform.h" "$(@D)/cuda/include/thrust/detail/tuple_meta_transform.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/tuple_transform.h" "$(@D)/cuda/include/thrust/detail/tuple_transform.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/type_traits.h" "$(@D)/cuda/include/thrust/detail/type_traits.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/type_traits/algorithm/intermediate_type_from_function_and_iterators.h" "$(@D)/cuda/include/thrust/detail/type_traits/algorithm/intermediate_type_from_function_and_iterators.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/type_traits/function_traits.h" "$(@D)/cuda/include/thrust/detail/type_traits/function_traits.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/type_traits/has_member_function.h" "$(@D)/cuda/include/thrust/detail/type_traits/has_member_function.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/type_traits/has_nested_type.h" "$(@D)/cuda/include/thrust/detail/type_traits/has_nested_type.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/type_traits/has_trivial_assign.h" "$(@D)/cuda/include/thrust/detail/type_traits/has_trivial_assign.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/type_traits/is_call_possible.h" "$(@D)/cuda/include/thrust/detail/type_traits/is_call_possible.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/type_traits/is_metafunction_defined.h" "$(@D)/cuda/include/thrust/detail/type_traits/is_metafunction_defined.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/type_traits/iterator/is_discard_iterator.h" "$(@D)/cuda/include/thrust/detail/type_traits/iterator/is_discard_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/type_traits/iterator/is_output_iterator.h" "$(@D)/cuda/include/thrust/detail/type_traits/iterator/is_output_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/type_traits/minimum_type.h" "$(@D)/cuda/include/thrust/detail/type_traits/minimum_type.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/type_traits/pointer_traits.h" "$(@D)/cuda/include/thrust/detail/type_traits/pointer_traits.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/type_traits/result_of_adaptable_function.h" "$(@D)/cuda/include/thrust/detail/type_traits/result_of_adaptable_function.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/uninitialized_copy.inl" "$(@D)/cuda/include/thrust/detail/uninitialized_copy.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/uninitialized_fill.inl" "$(@D)/cuda/include/thrust/detail/uninitialized_fill.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/unique.inl" "$(@D)/cuda/include/thrust/detail/unique.inl" && cp "/usr/local/cuda-9.0/include/thrust/detail/use_default.h" "$(@D)/cuda/include/thrust/detail/use_default.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/util/align.h" "$(@D)/cuda/include/thrust/detail/util/align.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/util/blocking.h" "$(@D)/cuda/include/thrust/detail/util/blocking.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/vector_base.h" "$(@D)/cuda/include/thrust/detail/vector_base.h" && cp "/usr/local/cuda-9.0/include/thrust/detail/vector_base.inl" "$(@D)/cuda/include/thrust/detail/vector_base.inl" && cp "/usr/local/cuda-9.0/include/thrust/device_allocator.h" "$(@D)/cuda/include/thrust/device_allocator.h" && cp "/usr/local/cuda-9.0/include/thrust/device_delete.h" "$(@D)/cuda/include/thrust/device_delete.h" && cp "/usr/local/cuda-9.0/include/thrust/device_free.h" "$(@D)/cuda/include/thrust/device_free.h" && cp "/usr/local/cuda-9.0/include/thrust/device_malloc.h" "$(@D)/cuda/include/thrust/device_malloc.h" && cp "/usr/local/cuda-9.0/include/thrust/device_malloc_allocator.h" "$(@D)/cuda/include/thrust/device_malloc_allocator.h" && cp "/usr/local/cuda-9.0/include/thrust/device_new.h" "$(@D)/cuda/include/thrust/device_new.h" && cp "/usr/local/cuda-9.0/include/thrust/device_new_allocator.h" "$(@D)/cuda/include/thrust/device_new_allocator.h" && cp "/usr/local/cuda-9.0/include/thrust/device_ptr.h" "$(@D)/cuda/include/thrust/device_ptr.h" && cp "/usr/local/cuda-9.0/include/thrust/device_reference.h" "$(@D)/cuda/include/thrust/device_reference.h" && cp "/usr/local/cuda-9.0/include/thrust/device_vector.h" "$(@D)/cuda/include/thrust/device_vector.h" && cp "/usr/local/cuda-9.0/include/thrust/distance.h" "$(@D)/cuda/include/thrust/distance.h" && cp "/usr/local/cuda-9.0/include/thrust/equal.h" "$(@D)/cuda/include/thrust/equal.h" && cp "/usr/local/cuda-9.0/include/thrust/execution_policy.h" "$(@D)/cuda/include/thrust/execution_policy.h" && cp "/usr/local/cuda-9.0/include/thrust/extrema.h" "$(@D)/cuda/include/thrust/extrema.h" && cp "/usr/local/cuda-9.0/include/thrust/fill.h" "$(@D)/cuda/include/thrust/fill.h" && cp "/usr/local/cuda-9.0/include/thrust/find.h" "$(@D)/cuda/include/thrust/find.h" && cp "/usr/local/cuda-9.0/include/thrust/for_each.h" "$(@D)/cuda/include/thrust/for_each.h" && cp "/usr/local/cuda-9.0/include/thrust/functional.h" "$(@D)/cuda/include/thrust/functional.h" && cp "/usr/local/cuda-9.0/include/thrust/gather.h" "$(@D)/cuda/include/thrust/gather.h" && cp "/usr/local/cuda-9.0/include/thrust/generate.h" "$(@D)/cuda/include/thrust/generate.h" && cp "/usr/local/cuda-9.0/include/thrust/host_vector.h" "$(@D)/cuda/include/thrust/host_vector.h" && cp "/usr/local/cuda-9.0/include/thrust/inner_product.h" "$(@D)/cuda/include/thrust/inner_product.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/constant_iterator.h" "$(@D)/cuda/include/thrust/iterator/constant_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/counting_iterator.h" "$(@D)/cuda/include/thrust/iterator/counting_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/any_assign.h" "$(@D)/cuda/include/thrust/iterator/detail/any_assign.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/any_system_tag.h" "$(@D)/cuda/include/thrust/iterator/detail/any_system_tag.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/constant_iterator_base.h" "$(@D)/cuda/include/thrust/iterator/detail/constant_iterator_base.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/counting_iterator.inl" "$(@D)/cuda/include/thrust/iterator/detail/counting_iterator.inl" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/device_system_tag.h" "$(@D)/cuda/include/thrust/iterator/detail/device_system_tag.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/discard_iterator_base.h" "$(@D)/cuda/include/thrust/iterator/detail/discard_iterator_base.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/distance_from_result.h" "$(@D)/cuda/include/thrust/iterator/detail/distance_from_result.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/host_system_tag.h" "$(@D)/cuda/include/thrust/iterator/detail/host_system_tag.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/is_iterator_category.h" "$(@D)/cuda/include/thrust/iterator/detail/is_iterator_category.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/is_trivial_iterator.h" "$(@D)/cuda/include/thrust/iterator/detail/is_trivial_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/iterator_adaptor_base.h" "$(@D)/cuda/include/thrust/iterator/detail/iterator_adaptor_base.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/iterator_category_to_system.h" "$(@D)/cuda/include/thrust/iterator/detail/iterator_category_to_system.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/iterator_category_to_traversal.h" "$(@D)/cuda/include/thrust/iterator/detail/iterator_category_to_traversal.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/iterator_category_with_system_and_traversal.h" "$(@D)/cuda/include/thrust/iterator/detail/iterator_category_with_system_and_traversal.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/iterator_facade_category.h" "$(@D)/cuda/include/thrust/iterator/detail/iterator_facade_category.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/iterator_traits.inl" "$(@D)/cuda/include/thrust/iterator/detail/iterator_traits.inl" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/iterator_traversal_tags.h" "$(@D)/cuda/include/thrust/iterator/detail/iterator_traversal_tags.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/join_iterator.h" "$(@D)/cuda/include/thrust/iterator/detail/join_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/minimum_category.h" "$(@D)/cuda/include/thrust/iterator/detail/minimum_category.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/minimum_system.h" "$(@D)/cuda/include/thrust/iterator/detail/minimum_system.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/normal_iterator.h" "$(@D)/cuda/include/thrust/iterator/detail/normal_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/permutation_iterator_base.h" "$(@D)/cuda/include/thrust/iterator/detail/permutation_iterator_base.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/retag.h" "$(@D)/cuda/include/thrust/iterator/detail/retag.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/reverse_iterator.inl" "$(@D)/cuda/include/thrust/iterator/detail/reverse_iterator.inl" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/reverse_iterator_base.h" "$(@D)/cuda/include/thrust/iterator/detail/reverse_iterator_base.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/tagged_iterator.h" "$(@D)/cuda/include/thrust/iterator/detail/tagged_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/transform_iterator.inl" "$(@D)/cuda/include/thrust/iterator/detail/transform_iterator.inl" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/transform_output_iterator.inl" "$(@D)/cuda/include/thrust/iterator/detail/transform_output_iterator.inl" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/tuple_of_iterator_references.h" "$(@D)/cuda/include/thrust/iterator/detail/tuple_of_iterator_references.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/universal_categories.h" "$(@D)/cuda/include/thrust/iterator/detail/universal_categories.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/zip_iterator.inl" "$(@D)/cuda/include/thrust/iterator/detail/zip_iterator.inl" && cp "/usr/local/cuda-9.0/include/thrust/iterator/detail/zip_iterator_base.h" "$(@D)/cuda/include/thrust/iterator/detail/zip_iterator_base.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/discard_iterator.h" "$(@D)/cuda/include/thrust/iterator/discard_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/iterator_adaptor.h" "$(@D)/cuda/include/thrust/iterator/iterator_adaptor.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/iterator_categories.h" "$(@D)/cuda/include/thrust/iterator/iterator_categories.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/iterator_facade.h" "$(@D)/cuda/include/thrust/iterator/iterator_facade.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/iterator_traits.h" "$(@D)/cuda/include/thrust/iterator/iterator_traits.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/permutation_iterator.h" "$(@D)/cuda/include/thrust/iterator/permutation_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/retag.h" "$(@D)/cuda/include/thrust/iterator/retag.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/reverse_iterator.h" "$(@D)/cuda/include/thrust/iterator/reverse_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/transform_iterator.h" "$(@D)/cuda/include/thrust/iterator/transform_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/transform_output_iterator.h" "$(@D)/cuda/include/thrust/iterator/transform_output_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/iterator/zip_iterator.h" "$(@D)/cuda/include/thrust/iterator/zip_iterator.h" && cp "/usr/local/cuda-9.0/include/thrust/logical.h" "$(@D)/cuda/include/thrust/logical.h" && cp "/usr/local/cuda-9.0/include/thrust/memory.h" "$(@D)/cuda/include/thrust/memory.h" && cp "/usr/local/cuda-9.0/include/thrust/merge.h" "$(@D)/cuda/include/thrust/merge.h" && cp "/usr/local/cuda-9.0/include/thrust/mismatch.h" "$(@D)/cuda/include/thrust/mismatch.h" && cp "/usr/local/cuda-9.0/include/thrust/pair.h" "$(@D)/cuda/include/thrust/pair.h" && cp "/usr/local/cuda-9.0/include/thrust/partition.h" "$(@D)/cuda/include/thrust/partition.h" && cp "/usr/local/cuda-9.0/include/thrust/random.h" "$(@D)/cuda/include/thrust/random.h" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/discard_block_engine.inl" "$(@D)/cuda/include/thrust/random/detail/discard_block_engine.inl" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/linear_congruential_engine.inl" "$(@D)/cuda/include/thrust/random/detail/linear_congruential_engine.inl" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/linear_congruential_engine_discard.h" "$(@D)/cuda/include/thrust/random/detail/linear_congruential_engine_discard.h" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/linear_feedback_shift_engine.inl" "$(@D)/cuda/include/thrust/random/detail/linear_feedback_shift_engine.inl" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/linear_feedback_shift_engine_wordmask.h" "$(@D)/cuda/include/thrust/random/detail/linear_feedback_shift_engine_wordmask.h" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/mod.h" "$(@D)/cuda/include/thrust/random/detail/mod.h" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/normal_distribution.inl" "$(@D)/cuda/include/thrust/random/detail/normal_distribution.inl" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/normal_distribution_base.h" "$(@D)/cuda/include/thrust/random/detail/normal_distribution_base.h" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/random_core_access.h" "$(@D)/cuda/include/thrust/random/detail/random_core_access.h" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/subtract_with_carry_engine.inl" "$(@D)/cuda/include/thrust/random/detail/subtract_with_carry_engine.inl" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/uniform_int_distribution.inl" "$(@D)/cuda/include/thrust/random/detail/uniform_int_distribution.inl" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/uniform_real_distribution.inl" "$(@D)/cuda/include/thrust/random/detail/uniform_real_distribution.inl" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/xor_combine_engine.inl" "$(@D)/cuda/include/thrust/random/detail/xor_combine_engine.inl" && cp "/usr/local/cuda-9.0/include/thrust/random/detail/xor_combine_engine_max.h" "$(@D)/cuda/include/thrust/random/detail/xor_combine_engine_max.h" && cp "/usr/local/cuda-9.0/include/thrust/random/discard_block_engine.h" "$(@D)/cuda/include/thrust/random/discard_block_engine.h" && cp "/usr/local/cuda-9.0/include/thrust/random/linear_congruential_engine.h" "$(@D)/cuda/include/thrust/random/linear_congruential_engine.h" && cp "/usr/local/cuda-9.0/include/thrust/random/linear_feedback_shift_engine.h" "$(@D)/cuda/include/thrust/random/linear_feedback_shift_engine.h" && cp "/usr/local/cuda-9.0/include/thrust/random/normal_distribution.h" "$(@D)/cuda/include/thrust/random/normal_distribution.h" && cp "/usr/local/cuda-9.0/include/thrust/random/subtract_with_carry_engine.h" "$(@D)/cuda/include/thrust/random/subtract_with_carry_engine.h" && cp "/usr/local/cuda-9.0/include/thrust/random/uniform_int_distribution.h" "$(@D)/cuda/include/thrust/random/uniform_int_distribution.h" && cp "/usr/local/cuda-9.0/include/thrust/random/uniform_real_distribution.h" "$(@D)/cuda/include/thrust/random/uniform_real_distribution.h" && cp "/usr/local/cuda-9.0/include/thrust/random/xor_combine_engine.h" "$(@D)/cuda/include/thrust/random/xor_combine_engine.h" && cp "/usr/local/cuda-9.0/include/thrust/reduce.h" "$(@D)/cuda/include/thrust/reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/remove.h" "$(@D)/cuda/include/thrust/remove.h" && cp "/usr/local/cuda-9.0/include/thrust/replace.h" "$(@D)/cuda/include/thrust/replace.h" && cp "/usr/local/cuda-9.0/include/thrust/reverse.h" "$(@D)/cuda/include/thrust/reverse.h" && cp "/usr/local/cuda-9.0/include/thrust/scan.h" "$(@D)/cuda/include/thrust/scan.h" && cp "/usr/local/cuda-9.0/include/thrust/scatter.h" "$(@D)/cuda/include/thrust/scatter.h" && cp "/usr/local/cuda-9.0/include/thrust/sequence.h" "$(@D)/cuda/include/thrust/sequence.h" && cp "/usr/local/cuda-9.0/include/thrust/set_operations.h" "$(@D)/cuda/include/thrust/set_operations.h" && cp "/usr/local/cuda-9.0/include/thrust/sort.h" "$(@D)/cuda/include/thrust/sort.h" && cp "/usr/local/cuda-9.0/include/thrust/swap.h" "$(@D)/cuda/include/thrust/swap.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/adjacent_difference.h" "$(@D)/cuda/include/thrust/system/cpp/detail/adjacent_difference.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/assign_value.h" "$(@D)/cuda/include/thrust/system/cpp/detail/assign_value.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/binary_search.h" "$(@D)/cuda/include/thrust/system/cpp/detail/binary_search.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/copy.h" "$(@D)/cuda/include/thrust/system/cpp/detail/copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/copy_if.h" "$(@D)/cuda/include/thrust/system/cpp/detail/copy_if.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/count.h" "$(@D)/cuda/include/thrust/system/cpp/detail/count.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/equal.h" "$(@D)/cuda/include/thrust/system/cpp/detail/equal.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/execution_policy.h" "$(@D)/cuda/include/thrust/system/cpp/detail/execution_policy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/extrema.h" "$(@D)/cuda/include/thrust/system/cpp/detail/extrema.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/fill.h" "$(@D)/cuda/include/thrust/system/cpp/detail/fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/find.h" "$(@D)/cuda/include/thrust/system/cpp/detail/find.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/for_each.h" "$(@D)/cuda/include/thrust/system/cpp/detail/for_each.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/gather.h" "$(@D)/cuda/include/thrust/system/cpp/detail/gather.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/generate.h" "$(@D)/cuda/include/thrust/system/cpp/detail/generate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/get_value.h" "$(@D)/cuda/include/thrust/system/cpp/detail/get_value.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/inner_product.h" "$(@D)/cuda/include/thrust/system/cpp/detail/inner_product.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/iter_swap.h" "$(@D)/cuda/include/thrust/system/cpp/detail/iter_swap.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/logical.h" "$(@D)/cuda/include/thrust/system/cpp/detail/logical.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/malloc_and_free.h" "$(@D)/cuda/include/thrust/system/cpp/detail/malloc_and_free.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/memory.inl" "$(@D)/cuda/include/thrust/system/cpp/detail/memory.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/merge.h" "$(@D)/cuda/include/thrust/system/cpp/detail/merge.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/mismatch.h" "$(@D)/cuda/include/thrust/system/cpp/detail/mismatch.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/par.h" "$(@D)/cuda/include/thrust/system/cpp/detail/par.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/partition.h" "$(@D)/cuda/include/thrust/system/cpp/detail/partition.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/reduce.h" "$(@D)/cuda/include/thrust/system/cpp/detail/reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/reduce_by_key.h" "$(@D)/cuda/include/thrust/system/cpp/detail/reduce_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/remove.h" "$(@D)/cuda/include/thrust/system/cpp/detail/remove.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/replace.h" "$(@D)/cuda/include/thrust/system/cpp/detail/replace.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/reverse.h" "$(@D)/cuda/include/thrust/system/cpp/detail/reverse.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/scan.h" "$(@D)/cuda/include/thrust/system/cpp/detail/scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/scan_by_key.h" "$(@D)/cuda/include/thrust/system/cpp/detail/scan_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/scatter.h" "$(@D)/cuda/include/thrust/system/cpp/detail/scatter.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/sequence.h" "$(@D)/cuda/include/thrust/system/cpp/detail/sequence.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/set_operations.h" "$(@D)/cuda/include/thrust/system/cpp/detail/set_operations.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/sort.h" "$(@D)/cuda/include/thrust/system/cpp/detail/sort.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/swap_ranges.h" "$(@D)/cuda/include/thrust/system/cpp/detail/swap_ranges.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/tabulate.h" "$(@D)/cuda/include/thrust/system/cpp/detail/tabulate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/temporary_buffer.h" "$(@D)/cuda/include/thrust/system/cpp/detail/temporary_buffer.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/transform.h" "$(@D)/cuda/include/thrust/system/cpp/detail/transform.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/transform_reduce.h" "$(@D)/cuda/include/thrust/system/cpp/detail/transform_reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/transform_scan.h" "$(@D)/cuda/include/thrust/system/cpp/detail/transform_scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/uninitialized_copy.h" "$(@D)/cuda/include/thrust/system/cpp/detail/uninitialized_copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/uninitialized_fill.h" "$(@D)/cuda/include/thrust/system/cpp/detail/uninitialized_fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/unique.h" "$(@D)/cuda/include/thrust/system/cpp/detail/unique.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/unique_by_key.h" "$(@D)/cuda/include/thrust/system/cpp/detail/unique_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/detail/vector.inl" "$(@D)/cuda/include/thrust/system/cpp/detail/vector.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/execution_policy.h" "$(@D)/cuda/include/thrust/system/cpp/execution_policy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/memory.h" "$(@D)/cuda/include/thrust/system/cpp/memory.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cpp/vector.h" "$(@D)/cuda/include/thrust/system/cpp/vector.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/config.h" "$(@D)/cuda/include/thrust/system/cuda/config.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/adjacent_difference.h" "$(@D)/cuda/include/thrust/system/cuda/detail/adjacent_difference.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/assign_value.h" "$(@D)/cuda/include/thrust/system/cuda/detail/assign_value.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/binary_search.h" "$(@D)/cuda/include/thrust/system/cuda/detail/binary_search.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/copy.h" "$(@D)/cuda/include/thrust/system/cuda/detail/copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/copy_if.h" "$(@D)/cuda/include/thrust/system/cuda/detail/copy_if.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/core/agent_launcher.h" "$(@D)/cuda/include/thrust/system/cuda/detail/core/agent_launcher.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/core/alignment.h" "$(@D)/cuda/include/thrust/system/cuda/detail/core/alignment.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/core/triple_chevron_launch.h" "$(@D)/cuda/include/thrust/system/cuda/detail/core/triple_chevron_launch.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/core/util.h" "$(@D)/cuda/include/thrust/system/cuda/detail/core/util.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/count.h" "$(@D)/cuda/include/thrust/system/cuda/detail/count.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cross_system.h" "$(@D)/cuda/include/thrust/system/cuda/detail/cross_system.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/agent/agent_histogram.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/agent/agent_histogram.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/agent/agent_radix_sort_downsweep.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/agent/agent_radix_sort_downsweep.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/agent/agent_radix_sort_upsweep.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/agent/agent_radix_sort_upsweep.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/agent/agent_reduce.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/agent/agent_reduce.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/agent/agent_reduce_by_key.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/agent/agent_reduce_by_key.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/agent/agent_rle.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/agent/agent_rle.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/agent/agent_scan.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/agent/agent_scan.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/agent/agent_segment_fixup.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/agent/agent_segment_fixup.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/agent/agent_select_if.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/agent/agent_select_if.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/agent/agent_spmv_csrt.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/agent/agent_spmv_csrt.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/agent/agent_spmv_orig.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/agent/agent_spmv_orig.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/agent/agent_spmv_row_based.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/agent/agent_spmv_row_based.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/agent/single_pass_scan_operators.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/agent/single_pass_scan_operators.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/block_adjacent_difference.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/block_adjacent_difference.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/block_discontinuity.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/block_discontinuity.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/block_exchange.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/block_exchange.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/block_histogram.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/block_histogram.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/block_load.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/block_load.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/block_radix_rank.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/block_radix_rank.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/block_radix_sort.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/block_radix_sort.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/block_raking_layout.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/block_raking_layout.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/block_reduce.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/block_reduce.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/block_scan.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/block_scan.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/block_shuffle.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/block_shuffle.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/block_store.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/block_store.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/specializations/block_histogram_atomic.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_histogram_atomic.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/specializations/block_histogram_sort.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_histogram_sort.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/specializations/block_reduce_raking.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_reduce_raking.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/specializations/block_reduce_raking_commutative_only.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_reduce_raking_commutative_only.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/specializations/block_reduce_warp_reductions.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_reduce_warp_reductions.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/specializations/block_scan_raking.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_scan_raking.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/specializations/block_scan_warp_scans.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_scan_warp_scans.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/specializations/block_scan_warp_scans2.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_scan_warp_scans2.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/block/specializations/block_scan_warp_scans3.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/block/specializations/block_scan_warp_scans3.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/cub.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/cub.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/device_histogram.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/device_histogram.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/device_partition.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/device_partition.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/device_radix_sort.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/device_radix_sort.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/device_reduce.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/device_reduce.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/device_run_length_encode.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/device_run_length_encode.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/device_scan.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/device_scan.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/device_segmented_radix_sort.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/device_segmented_radix_sort.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/device_segmented_reduce.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/device_segmented_reduce.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/device_select.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/device_select.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/device_spmv.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/device_spmv.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_histogram.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_histogram.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_radix_sort.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_radix_sort.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_reduce.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_reduce.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_reduce_by_key.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_reduce_by_key.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_rle.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_rle.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_scan.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_scan.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_select_if.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_select_if.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_spmv_csrt.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_spmv_csrt.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_spmv_orig.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_spmv_orig.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_spmv_row_based.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/device/dispatch/dispatch_spmv_row_based.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/grid/grid_barrier.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/grid/grid_barrier.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/grid/grid_even_share.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/grid/grid_even_share.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/grid/grid_mapping.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/grid/grid_mapping.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/grid/grid_queue.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/grid/grid_queue.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/host/mutex.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/host/mutex.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/iterator/arg_index_input_iterator.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/iterator/arg_index_input_iterator.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/iterator/cache_modified_input_iterator.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/iterator/cache_modified_input_iterator.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/iterator/cache_modified_output_iterator.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/iterator/cache_modified_output_iterator.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/iterator/constant_input_iterator.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/iterator/constant_input_iterator.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/iterator/counting_input_iterator.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/iterator/counting_input_iterator.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/iterator/discard_output_iterator.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/iterator/discard_output_iterator.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/iterator/tex_obj_input_iterator.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/iterator/tex_obj_input_iterator.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/iterator/tex_ref_input_iterator.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/iterator/tex_ref_input_iterator.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/iterator/transform_input_iterator.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/iterator/transform_input_iterator.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/thread/thread_load.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/thread/thread_load.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/thread/thread_operators.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/thread/thread_operators.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/thread/thread_reduce.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/thread/thread_reduce.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/thread/thread_scan.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/thread/thread_scan.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/thread/thread_search.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/thread/thread_search.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/thread/thread_store.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/thread/thread_store.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/util_allocator.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/util_allocator.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/util_arch.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/util_arch.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/util_debug.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/util_debug.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/util_device.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/util_device.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/util_macro.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/util_macro.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/util_namespace.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/util_namespace.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/util_ptx.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/util_ptx.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/util_type.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/util_type.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/warp/specializations/warp_reduce_shfl.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/warp/specializations/warp_reduce_shfl.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/warp/specializations/warp_reduce_smem.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/warp/specializations/warp_reduce_smem.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/warp/specializations/warp_scan_shfl.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/warp/specializations/warp_scan_shfl.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/warp/specializations/warp_scan_smem.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/warp/specializations/warp_scan_smem.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/warp/warp_reduce.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/warp/warp_reduce.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/cub/warp/warp_scan.cuh" "$(@D)/cuda/include/thrust/system/cuda/detail/cub/warp/warp_scan.cuh" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/equal.h" "$(@D)/cuda/include/thrust/system/cuda/detail/equal.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/error.inl" "$(@D)/cuda/include/thrust/system/cuda/detail/error.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/execution_policy.h" "$(@D)/cuda/include/thrust/system/cuda/detail/execution_policy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/extrema.h" "$(@D)/cuda/include/thrust/system/cuda/detail/extrema.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/fill.h" "$(@D)/cuda/include/thrust/system/cuda/detail/fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/find.h" "$(@D)/cuda/include/thrust/system/cuda/detail/find.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/for_each.h" "$(@D)/cuda/include/thrust/system/cuda/detail/for_each.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/gather.h" "$(@D)/cuda/include/thrust/system/cuda/detail/gather.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/generate.h" "$(@D)/cuda/include/thrust/system/cuda/detail/generate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/get_value.h" "$(@D)/cuda/include/thrust/system/cuda/detail/get_value.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/guarded_cuda_runtime_api.h" "$(@D)/cuda/include/thrust/system/cuda/detail/guarded_cuda_runtime_api.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/guarded_driver_types.h" "$(@D)/cuda/include/thrust/system/cuda/detail/guarded_driver_types.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/inner_product.h" "$(@D)/cuda/include/thrust/system/cuda/detail/inner_product.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/internal/copy_cross_system.h" "$(@D)/cuda/include/thrust/system/cuda/detail/internal/copy_cross_system.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/internal/copy_device_to_device.h" "$(@D)/cuda/include/thrust/system/cuda/detail/internal/copy_device_to_device.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/iter_swap.h" "$(@D)/cuda/include/thrust/system/cuda/detail/iter_swap.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/logical.h" "$(@D)/cuda/include/thrust/system/cuda/detail/logical.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/malloc_and_free.h" "$(@D)/cuda/include/thrust/system/cuda/detail/malloc_and_free.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/memory.inl" "$(@D)/cuda/include/thrust/system/cuda/detail/memory.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/memory_buffer.h" "$(@D)/cuda/include/thrust/system/cuda/detail/memory_buffer.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/merge.h" "$(@D)/cuda/include/thrust/system/cuda/detail/merge.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/mismatch.h" "$(@D)/cuda/include/thrust/system/cuda/detail/mismatch.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/par.h" "$(@D)/cuda/include/thrust/system/cuda/detail/par.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/par_to_seq.h" "$(@D)/cuda/include/thrust/system/cuda/detail/par_to_seq.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/parallel_for.h" "$(@D)/cuda/include/thrust/system/cuda/detail/parallel_for.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/partition.h" "$(@D)/cuda/include/thrust/system/cuda/detail/partition.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/reduce.h" "$(@D)/cuda/include/thrust/system/cuda/detail/reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/reduce_by_key.h" "$(@D)/cuda/include/thrust/system/cuda/detail/reduce_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/remove.h" "$(@D)/cuda/include/thrust/system/cuda/detail/remove.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/replace.h" "$(@D)/cuda/include/thrust/system/cuda/detail/replace.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/reverse.h" "$(@D)/cuda/include/thrust/system/cuda/detail/reverse.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/scan.h" "$(@D)/cuda/include/thrust/system/cuda/detail/scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/scan_by_key.h" "$(@D)/cuda/include/thrust/system/cuda/detail/scan_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/scatter.h" "$(@D)/cuda/include/thrust/system/cuda/detail/scatter.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/sequence.h" "$(@D)/cuda/include/thrust/system/cuda/detail/sequence.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/set_operations.h" "$(@D)/cuda/include/thrust/system/cuda/detail/set_operations.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/sort.h" "$(@D)/cuda/include/thrust/system/cuda/detail/sort.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/swap_ranges.h" "$(@D)/cuda/include/thrust/system/cuda/detail/swap_ranges.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/tabulate.h" "$(@D)/cuda/include/thrust/system/cuda/detail/tabulate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/temporary_buffer.h" "$(@D)/cuda/include/thrust/system/cuda/detail/temporary_buffer.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/terminate.h" "$(@D)/cuda/include/thrust/system/cuda/detail/terminate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/transform.h" "$(@D)/cuda/include/thrust/system/cuda/detail/transform.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/transform_reduce.h" "$(@D)/cuda/include/thrust/system/cuda/detail/transform_reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/transform_scan.h" "$(@D)/cuda/include/thrust/system/cuda/detail/transform_scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/uninitialized_copy.h" "$(@D)/cuda/include/thrust/system/cuda/detail/uninitialized_copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/uninitialized_fill.h" "$(@D)/cuda/include/thrust/system/cuda/detail/uninitialized_fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/unique.h" "$(@D)/cuda/include/thrust/system/cuda/detail/unique.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/unique_by_key.h" "$(@D)/cuda/include/thrust/system/cuda/detail/unique_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/util.h" "$(@D)/cuda/include/thrust/system/cuda/detail/util.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/detail/vector.inl" "$(@D)/cuda/include/thrust/system/cuda/detail/vector.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/error.h" "$(@D)/cuda/include/thrust/system/cuda/error.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/execution_policy.h" "$(@D)/cuda/include/thrust/system/cuda/execution_policy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/experimental/pinned_allocator.h" "$(@D)/cuda/include/thrust/system/cuda/experimental/pinned_allocator.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/memory.h" "$(@D)/cuda/include/thrust/system/cuda/memory.h" && cp "/usr/local/cuda-9.0/include/thrust/system/cuda/vector.h" "$(@D)/cuda/include/thrust/system/cuda/vector.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/adjacent_difference.h" "$(@D)/cuda/include/thrust/system/detail/adl/adjacent_difference.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/assign_value.h" "$(@D)/cuda/include/thrust/system/detail/adl/assign_value.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/binary_search.h" "$(@D)/cuda/include/thrust/system/detail/adl/binary_search.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/copy.h" "$(@D)/cuda/include/thrust/system/detail/adl/copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/copy_if.h" "$(@D)/cuda/include/thrust/system/detail/adl/copy_if.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/count.h" "$(@D)/cuda/include/thrust/system/detail/adl/count.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/equal.h" "$(@D)/cuda/include/thrust/system/detail/adl/equal.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/extrema.h" "$(@D)/cuda/include/thrust/system/detail/adl/extrema.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/fill.h" "$(@D)/cuda/include/thrust/system/detail/adl/fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/find.h" "$(@D)/cuda/include/thrust/system/detail/adl/find.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/for_each.h" "$(@D)/cuda/include/thrust/system/detail/adl/for_each.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/gather.h" "$(@D)/cuda/include/thrust/system/detail/adl/gather.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/generate.h" "$(@D)/cuda/include/thrust/system/detail/adl/generate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/get_value.h" "$(@D)/cuda/include/thrust/system/detail/adl/get_value.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/inner_product.h" "$(@D)/cuda/include/thrust/system/detail/adl/inner_product.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/iter_swap.h" "$(@D)/cuda/include/thrust/system/detail/adl/iter_swap.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/logical.h" "$(@D)/cuda/include/thrust/system/detail/adl/logical.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/malloc_and_free.h" "$(@D)/cuda/include/thrust/system/detail/adl/malloc_and_free.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/merge.h" "$(@D)/cuda/include/thrust/system/detail/adl/merge.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/mismatch.h" "$(@D)/cuda/include/thrust/system/detail/adl/mismatch.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/partition.h" "$(@D)/cuda/include/thrust/system/detail/adl/partition.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/reduce.h" "$(@D)/cuda/include/thrust/system/detail/adl/reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/reduce_by_key.h" "$(@D)/cuda/include/thrust/system/detail/adl/reduce_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/remove.h" "$(@D)/cuda/include/thrust/system/detail/adl/remove.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/replace.h" "$(@D)/cuda/include/thrust/system/detail/adl/replace.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/reverse.h" "$(@D)/cuda/include/thrust/system/detail/adl/reverse.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/scan.h" "$(@D)/cuda/include/thrust/system/detail/adl/scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/scan_by_key.h" "$(@D)/cuda/include/thrust/system/detail/adl/scan_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/scatter.h" "$(@D)/cuda/include/thrust/system/detail/adl/scatter.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/sequence.h" "$(@D)/cuda/include/thrust/system/detail/adl/sequence.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/set_operations.h" "$(@D)/cuda/include/thrust/system/detail/adl/set_operations.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/sort.h" "$(@D)/cuda/include/thrust/system/detail/adl/sort.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/swap_ranges.h" "$(@D)/cuda/include/thrust/system/detail/adl/swap_ranges.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/tabulate.h" "$(@D)/cuda/include/thrust/system/detail/adl/tabulate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/temporary_buffer.h" "$(@D)/cuda/include/thrust/system/detail/adl/temporary_buffer.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/transform.h" "$(@D)/cuda/include/thrust/system/detail/adl/transform.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/transform_reduce.h" "$(@D)/cuda/include/thrust/system/detail/adl/transform_reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/transform_scan.h" "$(@D)/cuda/include/thrust/system/detail/adl/transform_scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/uninitialized_copy.h" "$(@D)/cuda/include/thrust/system/detail/adl/uninitialized_copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/uninitialized_fill.h" "$(@D)/cuda/include/thrust/system/detail/adl/uninitialized_fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/unique.h" "$(@D)/cuda/include/thrust/system/detail/adl/unique.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/adl/unique_by_key.h" "$(@D)/cuda/include/thrust/system/detail/adl/unique_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/bad_alloc.h" "$(@D)/cuda/include/thrust/system/detail/bad_alloc.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/errno.h" "$(@D)/cuda/include/thrust/system/detail/errno.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/error_category.inl" "$(@D)/cuda/include/thrust/system/detail/error_category.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/error_code.inl" "$(@D)/cuda/include/thrust/system/detail/error_code.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/error_condition.inl" "$(@D)/cuda/include/thrust/system/detail/error_condition.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/adjacent_difference.h" "$(@D)/cuda/include/thrust/system/detail/generic/adjacent_difference.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/adjacent_difference.inl" "$(@D)/cuda/include/thrust/system/detail/generic/adjacent_difference.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/advance.h" "$(@D)/cuda/include/thrust/system/detail/generic/advance.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/advance.inl" "$(@D)/cuda/include/thrust/system/detail/generic/advance.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/binary_search.h" "$(@D)/cuda/include/thrust/system/detail/generic/binary_search.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/binary_search.inl" "$(@D)/cuda/include/thrust/system/detail/generic/binary_search.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/copy.h" "$(@D)/cuda/include/thrust/system/detail/generic/copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/copy.inl" "$(@D)/cuda/include/thrust/system/detail/generic/copy.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/copy_if.h" "$(@D)/cuda/include/thrust/system/detail/generic/copy_if.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/copy_if.inl" "$(@D)/cuda/include/thrust/system/detail/generic/copy_if.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/count.h" "$(@D)/cuda/include/thrust/system/detail/generic/count.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/count.inl" "$(@D)/cuda/include/thrust/system/detail/generic/count.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/distance.h" "$(@D)/cuda/include/thrust/system/detail/generic/distance.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/distance.inl" "$(@D)/cuda/include/thrust/system/detail/generic/distance.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/equal.h" "$(@D)/cuda/include/thrust/system/detail/generic/equal.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/equal.inl" "$(@D)/cuda/include/thrust/system/detail/generic/equal.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/extrema.h" "$(@D)/cuda/include/thrust/system/detail/generic/extrema.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/extrema.inl" "$(@D)/cuda/include/thrust/system/detail/generic/extrema.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/fill.h" "$(@D)/cuda/include/thrust/system/detail/generic/fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/find.h" "$(@D)/cuda/include/thrust/system/detail/generic/find.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/find.inl" "$(@D)/cuda/include/thrust/system/detail/generic/find.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/for_each.h" "$(@D)/cuda/include/thrust/system/detail/generic/for_each.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/gather.h" "$(@D)/cuda/include/thrust/system/detail/generic/gather.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/gather.inl" "$(@D)/cuda/include/thrust/system/detail/generic/gather.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/generate.h" "$(@D)/cuda/include/thrust/system/detail/generic/generate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/generate.inl" "$(@D)/cuda/include/thrust/system/detail/generic/generate.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/inner_product.h" "$(@D)/cuda/include/thrust/system/detail/generic/inner_product.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/inner_product.inl" "$(@D)/cuda/include/thrust/system/detail/generic/inner_product.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/logical.h" "$(@D)/cuda/include/thrust/system/detail/generic/logical.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/memory.h" "$(@D)/cuda/include/thrust/system/detail/generic/memory.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/memory.inl" "$(@D)/cuda/include/thrust/system/detail/generic/memory.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/merge.h" "$(@D)/cuda/include/thrust/system/detail/generic/merge.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/merge.inl" "$(@D)/cuda/include/thrust/system/detail/generic/merge.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/mismatch.h" "$(@D)/cuda/include/thrust/system/detail/generic/mismatch.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/mismatch.inl" "$(@D)/cuda/include/thrust/system/detail/generic/mismatch.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/partition.h" "$(@D)/cuda/include/thrust/system/detail/generic/partition.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/partition.inl" "$(@D)/cuda/include/thrust/system/detail/generic/partition.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/reduce.h" "$(@D)/cuda/include/thrust/system/detail/generic/reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/reduce.inl" "$(@D)/cuda/include/thrust/system/detail/generic/reduce.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/reduce_by_key.h" "$(@D)/cuda/include/thrust/system/detail/generic/reduce_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/reduce_by_key.inl" "$(@D)/cuda/include/thrust/system/detail/generic/reduce_by_key.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/remove.h" "$(@D)/cuda/include/thrust/system/detail/generic/remove.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/remove.inl" "$(@D)/cuda/include/thrust/system/detail/generic/remove.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/replace.h" "$(@D)/cuda/include/thrust/system/detail/generic/replace.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/replace.inl" "$(@D)/cuda/include/thrust/system/detail/generic/replace.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/reverse.h" "$(@D)/cuda/include/thrust/system/detail/generic/reverse.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/reverse.inl" "$(@D)/cuda/include/thrust/system/detail/generic/reverse.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/scalar/binary_search.h" "$(@D)/cuda/include/thrust/system/detail/generic/scalar/binary_search.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/scalar/binary_search.inl" "$(@D)/cuda/include/thrust/system/detail/generic/scalar/binary_search.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/scan.h" "$(@D)/cuda/include/thrust/system/detail/generic/scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/scan.inl" "$(@D)/cuda/include/thrust/system/detail/generic/scan.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/scan_by_key.h" "$(@D)/cuda/include/thrust/system/detail/generic/scan_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/scan_by_key.inl" "$(@D)/cuda/include/thrust/system/detail/generic/scan_by_key.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/scatter.h" "$(@D)/cuda/include/thrust/system/detail/generic/scatter.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/scatter.inl" "$(@D)/cuda/include/thrust/system/detail/generic/scatter.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/select_system.h" "$(@D)/cuda/include/thrust/system/detail/generic/select_system.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/sequence.h" "$(@D)/cuda/include/thrust/system/detail/generic/sequence.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/sequence.inl" "$(@D)/cuda/include/thrust/system/detail/generic/sequence.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/set_operations.h" "$(@D)/cuda/include/thrust/system/detail/generic/set_operations.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/set_operations.inl" "$(@D)/cuda/include/thrust/system/detail/generic/set_operations.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/sort.h" "$(@D)/cuda/include/thrust/system/detail/generic/sort.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/sort.inl" "$(@D)/cuda/include/thrust/system/detail/generic/sort.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/swap_ranges.h" "$(@D)/cuda/include/thrust/system/detail/generic/swap_ranges.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/swap_ranges.inl" "$(@D)/cuda/include/thrust/system/detail/generic/swap_ranges.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/tabulate.h" "$(@D)/cuda/include/thrust/system/detail/generic/tabulate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/tabulate.inl" "$(@D)/cuda/include/thrust/system/detail/generic/tabulate.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/tag.h" "$(@D)/cuda/include/thrust/system/detail/generic/tag.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/temporary_buffer.h" "$(@D)/cuda/include/thrust/system/detail/generic/temporary_buffer.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/temporary_buffer.inl" "$(@D)/cuda/include/thrust/system/detail/generic/temporary_buffer.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/transform.h" "$(@D)/cuda/include/thrust/system/detail/generic/transform.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/transform.inl" "$(@D)/cuda/include/thrust/system/detail/generic/transform.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/transform_reduce.h" "$(@D)/cuda/include/thrust/system/detail/generic/transform_reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/transform_reduce.inl" "$(@D)/cuda/include/thrust/system/detail/generic/transform_reduce.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/transform_scan.h" "$(@D)/cuda/include/thrust/system/detail/generic/transform_scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/transform_scan.inl" "$(@D)/cuda/include/thrust/system/detail/generic/transform_scan.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/type_traits.h" "$(@D)/cuda/include/thrust/system/detail/generic/type_traits.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/uninitialized_copy.h" "$(@D)/cuda/include/thrust/system/detail/generic/uninitialized_copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/uninitialized_copy.inl" "$(@D)/cuda/include/thrust/system/detail/generic/uninitialized_copy.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/uninitialized_fill.h" "$(@D)/cuda/include/thrust/system/detail/generic/uninitialized_fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/uninitialized_fill.inl" "$(@D)/cuda/include/thrust/system/detail/generic/uninitialized_fill.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/unique.h" "$(@D)/cuda/include/thrust/system/detail/generic/unique.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/unique.inl" "$(@D)/cuda/include/thrust/system/detail/generic/unique.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/unique_by_key.h" "$(@D)/cuda/include/thrust/system/detail/generic/unique_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/generic/unique_by_key.inl" "$(@D)/cuda/include/thrust/system/detail/generic/unique_by_key.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/internal/decompose.h" "$(@D)/cuda/include/thrust/system/detail/internal/decompose.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/adjacent_difference.h" "$(@D)/cuda/include/thrust/system/detail/sequential/adjacent_difference.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/assign_value.h" "$(@D)/cuda/include/thrust/system/detail/sequential/assign_value.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/binary_search.h" "$(@D)/cuda/include/thrust/system/detail/sequential/binary_search.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/copy.h" "$(@D)/cuda/include/thrust/system/detail/sequential/copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/copy.inl" "$(@D)/cuda/include/thrust/system/detail/sequential/copy.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/copy_backward.h" "$(@D)/cuda/include/thrust/system/detail/sequential/copy_backward.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/copy_if.h" "$(@D)/cuda/include/thrust/system/detail/sequential/copy_if.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/count.h" "$(@D)/cuda/include/thrust/system/detail/sequential/count.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/equal.h" "$(@D)/cuda/include/thrust/system/detail/sequential/equal.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/execution_policy.h" "$(@D)/cuda/include/thrust/system/detail/sequential/execution_policy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/extrema.h" "$(@D)/cuda/include/thrust/system/detail/sequential/extrema.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/fill.h" "$(@D)/cuda/include/thrust/system/detail/sequential/fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/find.h" "$(@D)/cuda/include/thrust/system/detail/sequential/find.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/for_each.h" "$(@D)/cuda/include/thrust/system/detail/sequential/for_each.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/gather.h" "$(@D)/cuda/include/thrust/system/detail/sequential/gather.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/general_copy.h" "$(@D)/cuda/include/thrust/system/detail/sequential/general_copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/generate.h" "$(@D)/cuda/include/thrust/system/detail/sequential/generate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/get_value.h" "$(@D)/cuda/include/thrust/system/detail/sequential/get_value.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/inner_product.h" "$(@D)/cuda/include/thrust/system/detail/sequential/inner_product.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/insertion_sort.h" "$(@D)/cuda/include/thrust/system/detail/sequential/insertion_sort.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/iter_swap.h" "$(@D)/cuda/include/thrust/system/detail/sequential/iter_swap.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/logical.h" "$(@D)/cuda/include/thrust/system/detail/sequential/logical.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/malloc_and_free.h" "$(@D)/cuda/include/thrust/system/detail/sequential/malloc_and_free.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/merge.h" "$(@D)/cuda/include/thrust/system/detail/sequential/merge.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/merge.inl" "$(@D)/cuda/include/thrust/system/detail/sequential/merge.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/mismatch.h" "$(@D)/cuda/include/thrust/system/detail/sequential/mismatch.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/partition.h" "$(@D)/cuda/include/thrust/system/detail/sequential/partition.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/reduce.h" "$(@D)/cuda/include/thrust/system/detail/sequential/reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/reduce_by_key.h" "$(@D)/cuda/include/thrust/system/detail/sequential/reduce_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/remove.h" "$(@D)/cuda/include/thrust/system/detail/sequential/remove.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/replace.h" "$(@D)/cuda/include/thrust/system/detail/sequential/replace.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/reverse.h" "$(@D)/cuda/include/thrust/system/detail/sequential/reverse.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/scan.h" "$(@D)/cuda/include/thrust/system/detail/sequential/scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/scan_by_key.h" "$(@D)/cuda/include/thrust/system/detail/sequential/scan_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/scatter.h" "$(@D)/cuda/include/thrust/system/detail/sequential/scatter.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/sequence.h" "$(@D)/cuda/include/thrust/system/detail/sequential/sequence.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/set_operations.h" "$(@D)/cuda/include/thrust/system/detail/sequential/set_operations.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/sort.h" "$(@D)/cuda/include/thrust/system/detail/sequential/sort.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/sort.inl" "$(@D)/cuda/include/thrust/system/detail/sequential/sort.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/stable_merge_sort.h" "$(@D)/cuda/include/thrust/system/detail/sequential/stable_merge_sort.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/stable_merge_sort.inl" "$(@D)/cuda/include/thrust/system/detail/sequential/stable_merge_sort.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/stable_primitive_sort.h" "$(@D)/cuda/include/thrust/system/detail/sequential/stable_primitive_sort.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/stable_primitive_sort.inl" "$(@D)/cuda/include/thrust/system/detail/sequential/stable_primitive_sort.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/stable_radix_sort.h" "$(@D)/cuda/include/thrust/system/detail/sequential/stable_radix_sort.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/stable_radix_sort.inl" "$(@D)/cuda/include/thrust/system/detail/sequential/stable_radix_sort.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/swap_ranges.h" "$(@D)/cuda/include/thrust/system/detail/sequential/swap_ranges.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/tabulate.h" "$(@D)/cuda/include/thrust/system/detail/sequential/tabulate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/temporary_buffer.h" "$(@D)/cuda/include/thrust/system/detail/sequential/temporary_buffer.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/transform.h" "$(@D)/cuda/include/thrust/system/detail/sequential/transform.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/transform_reduce.h" "$(@D)/cuda/include/thrust/system/detail/sequential/transform_reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/transform_scan.h" "$(@D)/cuda/include/thrust/system/detail/sequential/transform_scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/trivial_copy.h" "$(@D)/cuda/include/thrust/system/detail/sequential/trivial_copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/uninitialized_copy.h" "$(@D)/cuda/include/thrust/system/detail/sequential/uninitialized_copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/uninitialized_fill.h" "$(@D)/cuda/include/thrust/system/detail/sequential/uninitialized_fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/unique.h" "$(@D)/cuda/include/thrust/system/detail/sequential/unique.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/sequential/unique_by_key.h" "$(@D)/cuda/include/thrust/system/detail/sequential/unique_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/detail/system_error.inl" "$(@D)/cuda/include/thrust/system/detail/system_error.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/error_code.h" "$(@D)/cuda/include/thrust/system/error_code.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/adjacent_difference.h" "$(@D)/cuda/include/thrust/system/omp/detail/adjacent_difference.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/assign_value.h" "$(@D)/cuda/include/thrust/system/omp/detail/assign_value.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/binary_search.h" "$(@D)/cuda/include/thrust/system/omp/detail/binary_search.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/copy.h" "$(@D)/cuda/include/thrust/system/omp/detail/copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/copy.inl" "$(@D)/cuda/include/thrust/system/omp/detail/copy.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/copy_if.h" "$(@D)/cuda/include/thrust/system/omp/detail/copy_if.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/copy_if.inl" "$(@D)/cuda/include/thrust/system/omp/detail/copy_if.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/count.h" "$(@D)/cuda/include/thrust/system/omp/detail/count.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/default_decomposition.h" "$(@D)/cuda/include/thrust/system/omp/detail/default_decomposition.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/default_decomposition.inl" "$(@D)/cuda/include/thrust/system/omp/detail/default_decomposition.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/equal.h" "$(@D)/cuda/include/thrust/system/omp/detail/equal.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/execution_policy.h" "$(@D)/cuda/include/thrust/system/omp/detail/execution_policy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/extrema.h" "$(@D)/cuda/include/thrust/system/omp/detail/extrema.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/fill.h" "$(@D)/cuda/include/thrust/system/omp/detail/fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/find.h" "$(@D)/cuda/include/thrust/system/omp/detail/find.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/for_each.h" "$(@D)/cuda/include/thrust/system/omp/detail/for_each.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/for_each.inl" "$(@D)/cuda/include/thrust/system/omp/detail/for_each.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/gather.h" "$(@D)/cuda/include/thrust/system/omp/detail/gather.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/generate.h" "$(@D)/cuda/include/thrust/system/omp/detail/generate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/get_value.h" "$(@D)/cuda/include/thrust/system/omp/detail/get_value.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/inner_product.h" "$(@D)/cuda/include/thrust/system/omp/detail/inner_product.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/iter_swap.h" "$(@D)/cuda/include/thrust/system/omp/detail/iter_swap.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/logical.h" "$(@D)/cuda/include/thrust/system/omp/detail/logical.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/malloc_and_free.h" "$(@D)/cuda/include/thrust/system/omp/detail/malloc_and_free.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/memory.inl" "$(@D)/cuda/include/thrust/system/omp/detail/memory.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/merge.h" "$(@D)/cuda/include/thrust/system/omp/detail/merge.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/mismatch.h" "$(@D)/cuda/include/thrust/system/omp/detail/mismatch.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/par.h" "$(@D)/cuda/include/thrust/system/omp/detail/par.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/partition.h" "$(@D)/cuda/include/thrust/system/omp/detail/partition.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/partition.inl" "$(@D)/cuda/include/thrust/system/omp/detail/partition.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/reduce.h" "$(@D)/cuda/include/thrust/system/omp/detail/reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/reduce.inl" "$(@D)/cuda/include/thrust/system/omp/detail/reduce.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/reduce_by_key.h" "$(@D)/cuda/include/thrust/system/omp/detail/reduce_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/reduce_by_key.inl" "$(@D)/cuda/include/thrust/system/omp/detail/reduce_by_key.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/reduce_intervals.h" "$(@D)/cuda/include/thrust/system/omp/detail/reduce_intervals.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/reduce_intervals.inl" "$(@D)/cuda/include/thrust/system/omp/detail/reduce_intervals.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/remove.h" "$(@D)/cuda/include/thrust/system/omp/detail/remove.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/remove.inl" "$(@D)/cuda/include/thrust/system/omp/detail/remove.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/replace.h" "$(@D)/cuda/include/thrust/system/omp/detail/replace.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/reverse.h" "$(@D)/cuda/include/thrust/system/omp/detail/reverse.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/scan.h" "$(@D)/cuda/include/thrust/system/omp/detail/scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/scan_by_key.h" "$(@D)/cuda/include/thrust/system/omp/detail/scan_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/scatter.h" "$(@D)/cuda/include/thrust/system/omp/detail/scatter.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/sequence.h" "$(@D)/cuda/include/thrust/system/omp/detail/sequence.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/set_operations.h" "$(@D)/cuda/include/thrust/system/omp/detail/set_operations.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/sort.h" "$(@D)/cuda/include/thrust/system/omp/detail/sort.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/sort.inl" "$(@D)/cuda/include/thrust/system/omp/detail/sort.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/swap_ranges.h" "$(@D)/cuda/include/thrust/system/omp/detail/swap_ranges.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/tabulate.h" "$(@D)/cuda/include/thrust/system/omp/detail/tabulate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/temporary_buffer.h" "$(@D)/cuda/include/thrust/system/omp/detail/temporary_buffer.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/transform.h" "$(@D)/cuda/include/thrust/system/omp/detail/transform.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/transform_reduce.h" "$(@D)/cuda/include/thrust/system/omp/detail/transform_reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/transform_scan.h" "$(@D)/cuda/include/thrust/system/omp/detail/transform_scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/uninitialized_copy.h" "$(@D)/cuda/include/thrust/system/omp/detail/uninitialized_copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/uninitialized_fill.h" "$(@D)/cuda/include/thrust/system/omp/detail/uninitialized_fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/unique.h" "$(@D)/cuda/include/thrust/system/omp/detail/unique.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/unique.inl" "$(@D)/cuda/include/thrust/system/omp/detail/unique.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/unique_by_key.h" "$(@D)/cuda/include/thrust/system/omp/detail/unique_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/unique_by_key.inl" "$(@D)/cuda/include/thrust/system/omp/detail/unique_by_key.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/detail/vector.inl" "$(@D)/cuda/include/thrust/system/omp/detail/vector.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/execution_policy.h" "$(@D)/cuda/include/thrust/system/omp/execution_policy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/memory.h" "$(@D)/cuda/include/thrust/system/omp/memory.h" && cp "/usr/local/cuda-9.0/include/thrust/system/omp/vector.h" "$(@D)/cuda/include/thrust/system/omp/vector.h" && cp "/usr/local/cuda-9.0/include/thrust/system/system_error.h" "$(@D)/cuda/include/thrust/system/system_error.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/adjacent_difference.h" "$(@D)/cuda/include/thrust/system/tbb/detail/adjacent_difference.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/assign_value.h" "$(@D)/cuda/include/thrust/system/tbb/detail/assign_value.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/binary_search.h" "$(@D)/cuda/include/thrust/system/tbb/detail/binary_search.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/copy.h" "$(@D)/cuda/include/thrust/system/tbb/detail/copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/copy.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/copy.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/copy_if.h" "$(@D)/cuda/include/thrust/system/tbb/detail/copy_if.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/copy_if.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/copy_if.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/count.h" "$(@D)/cuda/include/thrust/system/tbb/detail/count.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/equal.h" "$(@D)/cuda/include/thrust/system/tbb/detail/equal.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/execution_policy.h" "$(@D)/cuda/include/thrust/system/tbb/detail/execution_policy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/extrema.h" "$(@D)/cuda/include/thrust/system/tbb/detail/extrema.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/fill.h" "$(@D)/cuda/include/thrust/system/tbb/detail/fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/find.h" "$(@D)/cuda/include/thrust/system/tbb/detail/find.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/for_each.h" "$(@D)/cuda/include/thrust/system/tbb/detail/for_each.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/for_each.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/for_each.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/gather.h" "$(@D)/cuda/include/thrust/system/tbb/detail/gather.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/generate.h" "$(@D)/cuda/include/thrust/system/tbb/detail/generate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/get_value.h" "$(@D)/cuda/include/thrust/system/tbb/detail/get_value.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/inner_product.h" "$(@D)/cuda/include/thrust/system/tbb/detail/inner_product.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/iter_swap.h" "$(@D)/cuda/include/thrust/system/tbb/detail/iter_swap.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/logical.h" "$(@D)/cuda/include/thrust/system/tbb/detail/logical.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/malloc_and_free.h" "$(@D)/cuda/include/thrust/system/tbb/detail/malloc_and_free.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/memory.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/memory.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/merge.h" "$(@D)/cuda/include/thrust/system/tbb/detail/merge.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/merge.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/merge.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/mismatch.h" "$(@D)/cuda/include/thrust/system/tbb/detail/mismatch.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/par.h" "$(@D)/cuda/include/thrust/system/tbb/detail/par.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/partition.h" "$(@D)/cuda/include/thrust/system/tbb/detail/partition.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/partition.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/partition.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/reduce.h" "$(@D)/cuda/include/thrust/system/tbb/detail/reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/reduce.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/reduce.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/reduce_by_key.h" "$(@D)/cuda/include/thrust/system/tbb/detail/reduce_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/reduce_by_key.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/reduce_by_key.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/reduce_intervals.h" "$(@D)/cuda/include/thrust/system/tbb/detail/reduce_intervals.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/remove.h" "$(@D)/cuda/include/thrust/system/tbb/detail/remove.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/remove.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/remove.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/replace.h" "$(@D)/cuda/include/thrust/system/tbb/detail/replace.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/reverse.h" "$(@D)/cuda/include/thrust/system/tbb/detail/reverse.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/scan.h" "$(@D)/cuda/include/thrust/system/tbb/detail/scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/scan.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/scan.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/scan_by_key.h" "$(@D)/cuda/include/thrust/system/tbb/detail/scan_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/scatter.h" "$(@D)/cuda/include/thrust/system/tbb/detail/scatter.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/sequence.h" "$(@D)/cuda/include/thrust/system/tbb/detail/sequence.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/set_operations.h" "$(@D)/cuda/include/thrust/system/tbb/detail/set_operations.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/sort.h" "$(@D)/cuda/include/thrust/system/tbb/detail/sort.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/sort.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/sort.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/swap_ranges.h" "$(@D)/cuda/include/thrust/system/tbb/detail/swap_ranges.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/tabulate.h" "$(@D)/cuda/include/thrust/system/tbb/detail/tabulate.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/temporary_buffer.h" "$(@D)/cuda/include/thrust/system/tbb/detail/temporary_buffer.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/transform.h" "$(@D)/cuda/include/thrust/system/tbb/detail/transform.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/transform_reduce.h" "$(@D)/cuda/include/thrust/system/tbb/detail/transform_reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/transform_scan.h" "$(@D)/cuda/include/thrust/system/tbb/detail/transform_scan.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/uninitialized_copy.h" "$(@D)/cuda/include/thrust/system/tbb/detail/uninitialized_copy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/uninitialized_fill.h" "$(@D)/cuda/include/thrust/system/tbb/detail/uninitialized_fill.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/unique.h" "$(@D)/cuda/include/thrust/system/tbb/detail/unique.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/unique.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/unique.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/unique_by_key.h" "$(@D)/cuda/include/thrust/system/tbb/detail/unique_by_key.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/unique_by_key.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/unique_by_key.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/detail/vector.inl" "$(@D)/cuda/include/thrust/system/tbb/detail/vector.inl" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/execution_policy.h" "$(@D)/cuda/include/thrust/system/tbb/execution_policy.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/memory.h" "$(@D)/cuda/include/thrust/system/tbb/memory.h" && cp "/usr/local/cuda-9.0/include/thrust/system/tbb/vector.h" "$(@D)/cuda/include/thrust/system/tbb/vector.h" && cp "/usr/local/cuda-9.0/include/thrust/system_error.h" "$(@D)/cuda/include/thrust/system_error.h" && cp "/usr/local/cuda-9.0/include/thrust/tabulate.h" "$(@D)/cuda/include/thrust/tabulate.h" && cp "/usr/local/cuda-9.0/include/thrust/transform.h" "$(@D)/cuda/include/thrust/transform.h" && cp "/usr/local/cuda-9.0/include/thrust/transform_reduce.h" "$(@D)/cuda/include/thrust/transform_reduce.h" && cp "/usr/local/cuda-9.0/include/thrust/transform_scan.h" "$(@D)/cuda/include/thrust/transform_scan.h" && cp "/usr/local/cuda-9.0/include/thrust/tuple.h" "$(@D)/cuda/include/thrust/tuple.h" && cp "/usr/local/cuda-9.0/include/thrust/uninitialized_copy.h" "$(@D)/cuda/include/thrust/uninitialized_copy.h" && cp "/usr/local/cuda-9.0/include/thrust/uninitialized_fill.h" "$(@D)/cuda/include/thrust/uninitialized_fill.h" && cp "/usr/local/cuda-9.0/include/thrust/unique.h" "$(@D)/cuda/include/thrust/unique.h" && cp "/usr/local/cuda-9.0/include/thrust/version.h" "$(@D)/cuda/include/thrust/version.h" && cp "/usr/local/cuda-9.0/include/vector_functions.h" "$(@D)/cuda/include/vector_functions.h" && cp "/usr/local/cuda-9.0/include/vector_functions.hpp" "$(@D)/cuda/include/vector_functions.hpp" && cp "/usr/local/cuda-9.0/include/vector_types.h" "$(@D)/cuda/include/vector_types.h"
+ """,
+)
+
+genrule(
+ name = "cuda-nvvm",
+ outs = [
+ "cuda/nvvm/libdevice/libdevice.10.bc",
+ ],
+ cmd = """
+if [ -d "$(@D)/extras" ]; then rm $(@D)/extras -drf; fi && if [ -d "$(@D)/include" ]; then rm $(@D)/include -drf; fi && if [ -d "$(@D)/lib" ]; then rm $(@D)/lib -drf; fi && if [ -d "$(@D)/nvvm" ]; then rm $(@D)/nvvm -drf; fi && cp "/usr/local/cuda-9.0/nvvm/libdevice/libdevice.10.bc" "$(@D)//libdevice.10.bc"
+ """,
+)
+
+genrule(
+ name = "cuda-extras",
+ outs = [
+ "cuda/extras/CUPTI/include/GL/gl.h",
+ "cuda/extras/CUPTI/include/GL/glew.h",
+ "cuda/extras/CUPTI/include/GL/glext.h",
+ "cuda/extras/CUPTI/include/GL/glu.h",
+ "cuda/extras/CUPTI/include/GL/glut.h",
+ "cuda/extras/CUPTI/include/GL/glx.h",
+ "cuda/extras/CUPTI/include/GL/glxext.h",
+ "cuda/extras/CUPTI/include/GL/wglew.h",
+ "cuda/extras/CUPTI/include/GL/wglext.h",
+ "cuda/extras/CUPTI/include/cuda_stdint.h",
+ "cuda/extras/CUPTI/include/cupti.h",
+ "cuda/extras/CUPTI/include/cupti_activity.h",
+ "cuda/extras/CUPTI/include/cupti_callbacks.h",
+ "cuda/extras/CUPTI/include/cupti_driver_cbid.h",
+ "cuda/extras/CUPTI/include/cupti_events.h",
+ "cuda/extras/CUPTI/include/cupti_metrics.h",
+ "cuda/extras/CUPTI/include/cupti_nvtx_cbid.h",
+ "cuda/extras/CUPTI/include/cupti_result.h",
+ "cuda/extras/CUPTI/include/cupti_runtime_cbid.h",
+ "cuda/extras/CUPTI/include/cupti_version.h",
+ "cuda/extras/CUPTI/include/generated_cudaGL_meta.h",
+ "cuda/extras/CUPTI/include/generated_cudaVDPAU_meta.h",
+ "cuda/extras/CUPTI/include/generated_cuda_gl_interop_meta.h",
+ "cuda/extras/CUPTI/include/generated_cuda_meta.h",
+ "cuda/extras/CUPTI/include/generated_cuda_runtime_api_meta.h",
+ "cuda/extras/CUPTI/include/generated_cuda_vdpau_interop_meta.h",
+ "cuda/extras/CUPTI/include/generated_nvtx_meta.h",
+ "cuda/extras/CUPTI/include/openacc/cupti_openacc.h",
+ ],
+ cmd = """
+if [ -d "$(@D)/extras" ]; then rm $(@D)/extras -drf; fi && if [ -d "$(@D)/include" ]; then rm $(@D)/include -drf; fi && if [ -d "$(@D)/lib" ]; then rm $(@D)/lib -drf; fi && if [ -d "$(@D)/nvvm" ]; then rm $(@D)/nvvm -drf; fi && cp "/usr/local/cuda-9.0/extras/CUPTI/include/GL/gl.h" "$(@D)/cuda/extras/CUPTI/include/GL/gl.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/GL/glew.h" "$(@D)/cuda/extras/CUPTI/include/GL/glew.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/GL/glext.h" "$(@D)/cuda/extras/CUPTI/include/GL/glext.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/GL/glu.h" "$(@D)/cuda/extras/CUPTI/include/GL/glu.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/GL/glut.h" "$(@D)/cuda/extras/CUPTI/include/GL/glut.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/GL/glx.h" "$(@D)/cuda/extras/CUPTI/include/GL/glx.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/GL/glxext.h" "$(@D)/cuda/extras/CUPTI/include/GL/glxext.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/GL/wglew.h" "$(@D)/cuda/extras/CUPTI/include/GL/wglew.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/GL/wglext.h" "$(@D)/cuda/extras/CUPTI/include/GL/wglext.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/cuda_stdint.h" "$(@D)/cuda/extras/CUPTI/include/cuda_stdint.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/cupti.h" "$(@D)/cuda/extras/CUPTI/include/cupti.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/cupti_activity.h" "$(@D)/cuda/extras/CUPTI/include/cupti_activity.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/cupti_callbacks.h" "$(@D)/cuda/extras/CUPTI/include/cupti_callbacks.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/cupti_driver_cbid.h" "$(@D)/cuda/extras/CUPTI/include/cupti_driver_cbid.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/cupti_events.h" "$(@D)/cuda/extras/CUPTI/include/cupti_events.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/cupti_metrics.h" "$(@D)/cuda/extras/CUPTI/include/cupti_metrics.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/cupti_nvtx_cbid.h" "$(@D)/cuda/extras/CUPTI/include/cupti_nvtx_cbid.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/cupti_result.h" "$(@D)/cuda/extras/CUPTI/include/cupti_result.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/cupti_runtime_cbid.h" "$(@D)/cuda/extras/CUPTI/include/cupti_runtime_cbid.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/cupti_version.h" "$(@D)/cuda/extras/CUPTI/include/cupti_version.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/generated_cudaGL_meta.h" "$(@D)/cuda/extras/CUPTI/include/generated_cudaGL_meta.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/generated_cudaVDPAU_meta.h" "$(@D)/cuda/extras/CUPTI/include/generated_cudaVDPAU_meta.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/generated_cuda_gl_interop_meta.h" "$(@D)/cuda/extras/CUPTI/include/generated_cuda_gl_interop_meta.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/generated_cuda_meta.h" "$(@D)/cuda/extras/CUPTI/include/generated_cuda_meta.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/generated_cuda_runtime_api_meta.h" "$(@D)/cuda/extras/CUPTI/include/generated_cuda_runtime_api_meta.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/generated_cuda_vdpau_interop_meta.h" "$(@D)/cuda/extras/CUPTI/include/generated_cuda_vdpau_interop_meta.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/generated_nvtx_meta.h" "$(@D)/cuda/extras/CUPTI/include/generated_nvtx_meta.h" && cp "/usr/local/cuda-9.0/extras/CUPTI/include/openacc/cupti_openacc.h" "$(@D)/cuda/extras/CUPTI/include/openacc/cupti_openacc.h"
+ """,
+)
+
+genrule(
+ name = "cuda-lib",
+ outs = [
+ "cuda/lib/libcuda.so",
+ "cuda/lib/libcudart.so.9.0",
+ "cuda/lib/libcudart_static.a",
+ "cuda/lib/libcublas.so.9.0",
+ "cuda/lib/libcusolver.so.9.0",
+ "cuda/lib/libcurand.so.9.0",
+ "cuda/lib/libcufft.so.9.0",
+ "cuda/lib/libcudnn.so.7",
+ "cuda/lib/libcupti.so.9.0",
+ ],
+ cmd = """
+if [ -d "$(@D)/extras" ]; then rm $(@D)/extras -drf; fi && if [ -d "$(@D)/include" ]; then rm $(@D)/include -drf; fi && if [ -d "$(@D)/lib" ]; then rm $(@D)/lib -drf; fi && if [ -d "$(@D)/nvvm" ]; then rm $(@D)/nvvm -drf; fi && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/stubs/libcuda.so" "$(@D)/cuda/lib/libcuda.so" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudart.so.9.0.176" "$(@D)/cuda/lib/libcudart.so.9.0" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudart_static.a" "$(@D)/cuda/lib/libcudart_static.a" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcublas.so.9.0.480" "$(@D)/cuda/lib/libcublas.so.9.0" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcusolver.so.9.0.176" "$(@D)/cuda/lib/libcusolver.so.9.0" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcurand.so.9.0.176" "$(@D)/cuda/lib/libcurand.so.9.0" && cp "/usr/local/cuda-9.0/targets/x86_64-linux/lib/libcufft.so.9.0.176" "$(@D)/cuda/lib/libcufft.so.9.0" && cp "/usr/lib/x86_64-linux-gnu/libcudnn.so.7.2.1" "$(@D)/cuda/lib/libcudnn.so.7" && cp "/usr/local/cuda-9.0/extras/CUPTI/lib64/libcupti.so.9.0.176" "$(@D)/cuda/lib/libcupti.so.9.0"
+ """,
+)
+
+genrule(
+ name = "cudnn-include",
+ outs = [
+ "cuda/include/cudnn.h",
+ ],
+ cmd = """
+if [ -d "$(@D)/extras" ]; then rm $(@D)/extras -drf; fi && if [ -d "$(@D)/include" ]; then rm $(@D)/include -drf; fi && if [ -d "$(@D)/lib" ]; then rm $(@D)/lib -drf; fi && if [ -d "$(@D)/nvvm" ]; then rm $(@D)/nvvm -drf; fi && cp "/usr/include/cudnn.h" "$(@D)/cudnn.h"
+ """,
+)
diff --git a/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/build_defs.bzl b/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/build_defs.bzl
new file mode 100755
index 0000000000..5c6703aab4
--- /dev/null
+++ b/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/build_defs.bzl
@@ -0,0 +1,33 @@
+# Macros for building CUDA code.
+def if_cuda(if_true, if_false = []):
+ """Shorthand for select()'ing on whether we're building with CUDA.
+
+ Returns a select statement which evaluates to if_true if we're building
+ with CUDA enabled. Otherwise, the select statement evaluates to if_false.
+
+ """
+ return select({
+ "@local_config_cuda//cuda:using_nvcc": if_true,
+ "@local_config_cuda//cuda:using_clang": if_true,
+ "//conditions:default": if_false
+ })
+
+
+def cuda_default_copts():
+ """Default options for all CUDA compilations."""
+ return if_cuda(["-x", "cuda", "-DGOOGLE_CUDA=1"] + [])
+
+
+def cuda_is_configured():
+ """Returns true if CUDA was enabled during the configure process."""
+ return True
+
+def if_cuda_is_configured(x):
+ """Tests if the CUDA was enabled during the configure process.
+
+ Unlike if_cuda(), this does not require that we are building with
+ --config=cuda. Used to allow non-CUDA code to depend on CUDA libraries.
+ """
+ if cuda_is_configured():
+ return x
+ return []
diff --git a/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/cuda/cuda_config.h b/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/cuda/cuda_config.h
new file mode 100755
index 0000000000..5d0d3013a9
--- /dev/null
+++ b/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/cuda/cuda_config.h
@@ -0,0 +1,26 @@
+/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+#ifndef CUDA_CUDA_CONFIG_H_
+#define CUDA_CUDA_CONFIG_H_
+
+#define TF_CUDA_CAPABILITIES CudaVersion("3.0")
+
+#define TF_CUDA_VERSION "9.0"
+#define TF_CUDNN_VERSION "7"
+
+#define TF_CUDA_TOOLKIT_PATH "/usr/local/cuda-9.0"
+
+#endif // CUDA_CUDA_CONFIG_H_
diff --git a/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/BUILD b/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/BUILD
new file mode 100755
index 0000000000..a56b4513fb
--- /dev/null
+++ b/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/BUILD
@@ -0,0 +1,73 @@
+licenses(["restricted"])
+
+package(default_visibility = ["//visibility:public"])
+
+cc_toolchain_suite(
+ name = "toolchain",
+ toolchains = {
+ "local|compiler": ":cc-compiler-local",
+ "darwin|compiler": ":cc-compiler-darwin",
+ "x64_windows|msvc-cl": ":cc-compiler-windows",
+ },
+)
+
+cc_toolchain(
+ name = "cc-compiler-local",
+ all_files = ":crosstool_wrapper_driver_is_not_gcc",
+ compiler_files = ":empty",
+ cpu = "local",
+ dwp_files = ":empty",
+ dynamic_runtime_libs = [":empty"],
+ linker_files = ":crosstool_wrapper_driver_is_not_gcc",
+ objcopy_files = ":empty",
+ static_runtime_libs = [":empty"],
+ strip_files = ":empty",
+ # To support linker flags that need to go to the start of command line
+ # we need the toolchain to support parameter files. Parameter files are
+ # last on the command line and contain all shared libraries to link, so all
+ # regular options will be left of them.
+ supports_param_files = 1,
+)
+
+cc_toolchain(
+ name = "cc-compiler-darwin",
+ all_files = ":crosstool_wrapper_driver_is_not_gcc",
+ compiler_files = ":empty",
+ cpu = "darwin",
+ dwp_files = ":empty",
+ dynamic_runtime_libs = [":empty"],
+ linker_files = ":crosstool_wrapper_driver_is_not_gcc",
+ objcopy_files = ":empty",
+ static_runtime_libs = [":empty"],
+ strip_files = ":empty",
+ supports_param_files = 0,
+)
+
+cc_toolchain(
+ name = "cc-compiler-windows",
+ all_files = ":windows_msvc_wrapper_files",
+ compiler_files = ":empty",
+ cpu = "x64_windows",
+ dwp_files = ":empty",
+ dynamic_runtime_libs = [":empty"],
+ linker_files = ":windows_msvc_wrapper_files",
+ objcopy_files = ":empty",
+ static_runtime_libs = [":empty"],
+ strip_files = ":empty",
+ supports_param_files = 1,
+)
+
+filegroup(
+ name = "empty",
+ srcs = [],
+)
+
+filegroup(
+ name = "crosstool_wrapper_driver_is_not_gcc",
+ srcs = ["clang/bin/crosstool_wrapper_driver_is_not_gcc"],
+)
+
+filegroup(
+ name = "windows_msvc_wrapper_files",
+ srcs = glob(["windows/msvc_*"]),
+)
diff --git a/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/CROSSTOOL b/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/CROSSTOOL
new file mode 100755
index 0000000000..a14eceacbb
--- /dev/null
+++ b/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/CROSSTOOL
@@ -0,0 +1,1410 @@
+major_version: "local"
+minor_version: ""
+default_target_cpu: "same_as_host"
+
+default_toolchain {
+ cpu: "k8"
+ toolchain_identifier: "local_linux"
+}
+default_toolchain {
+ cpu: "piii"
+ toolchain_identifier: "local_linux"
+}
+default_toolchain {
+ cpu: "arm"
+ toolchain_identifier: "local_linux"
+}
+default_toolchain {
+ cpu: "darwin"
+ toolchain_identifier: "local_darwin"
+}
+default_toolchain {
+ cpu: "ppc"
+ toolchain_identifier: "local_linux"
+}
+default_toolchain {
+ cpu: "x64_windows"
+ toolchain_identifier: "local_windows"
+}
+
+toolchain {
+ abi_version: "local"
+ abi_libc_version: "local"
+ compiler: "compiler"
+ host_system_name: "local"
+ needsPic: true
+ target_libc: "local"
+ target_cpu: "local"
+ target_system_name: "local"
+ toolchain_identifier: "local_linux"
+
+ feature {
+ name: "c++11"
+ flag_set {
+ action: "c++-compile"
+ flag_group {
+ flag: "-std=c++11"
+ }
+ }
+ }
+
+ feature {
+ name: "stdlib"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "-lstdc++"
+ }
+ }
+ }
+
+ feature {
+ name: "determinism"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # Make C++ compilation deterministic. Use linkstamping instead of these
+ # compiler symbols.
+ flag: "-Wno-builtin-macro-redefined"
+ flag: "-D__DATE__=\"redacted\""
+ flag: "-D__TIMESTAMP__=\"redacted\""
+ flag: "-D__TIME__=\"redacted\""
+ }
+ }
+ }
+
+ feature {
+ name: "alwayslink"
+ flag_set {
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "c++-link-executable"
+ flag_group {
+ flag: "-Wl,-no-as-needed"
+ }
+ }
+ }
+
+ # This feature will be enabled for builds that support pic by bazel.
+ feature {
+ name: "pic"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ expand_if_all_available: "pic"
+ flag: "-fPIC"
+ }
+ flag_group {
+ expand_if_none_available: "pic"
+ flag: "-fPIE"
+ }
+ }
+ }
+
+ # Security hardening on by default.
+ feature {
+ name: "hardening"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
+ # We need to undef it before redefining it as some distributions now
+ # have it enabled by default.
+ flag: "-U_FORTIFY_SOURCE"
+ flag: "-D_FORTIFY_SOURCE=1"
+ flag: "-fstack-protector"
+ }
+ }
+ flag_set {
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "-Wl,-z,relro,-z,now"
+ }
+ }
+ flag_set {
+ action: "c++-link-executable"
+ flag_group {
+ flag: "-pie"
+ flag: "-Wl,-z,relro,-z,now"
+ }
+ }
+ }
+
+ feature {
+ name: "warnings"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # All warnings are enabled. Maybe enable -Werror as well?
+ flag: "-Wall"
+
+ }
+ }
+ }
+
+ # Keep stack frames for debugging, even in opt mode.
+ feature {
+ name: "frame-pointer"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-fno-omit-frame-pointer"
+ }
+ }
+ }
+
+ feature {
+ name: "build-id"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ # Stamp the binary with a unique identifier.
+ flag: "-Wl,--build-id=md5"
+ flag: "-Wl,--hash-style=gnu"
+ }
+ }
+ }
+
+ feature {
+ name: "no-canonical-prefixes"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag:"-no-canonical-prefixes"
+ }
+ }
+ }
+
+ feature {
+ name: "disable-assertions"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-DNDEBUG"
+ }
+ }
+ }
+
+ feature {
+ name: "linker-bin-path"
+
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "-B/usr/bin"
+ }
+ }
+ }
+
+ feature {
+ name: "common"
+ implies: "stdlib"
+ implies: "c++11"
+ implies: "determinism"
+ implies: "alwayslink"
+ implies: "hardening"
+ implies: "warnings"
+ implies: "frame-pointer"
+ implies: "build-id"
+ implies: "no-canonical-prefixes"
+ implies: "linker-bin-path"
+ }
+
+ feature {
+ name: "opt"
+ implies: "common"
+ implies: "disable-assertions"
+
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # No debug symbols.
+ # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt
+ # or even generally? However, that can't happen here, as it requires
+ # special handling in Bazel.
+ flag: "-g0"
+
+ # Conservative choice for -O
+ # -O3 can increase binary size and even slow down the resulting binaries.
+ # Profile first and / or use FDO if you need better performance than this.
+ flag: "-O2"
+
+ # Removal of unused code and data at link time (can this increase binary size in some cases?).
+ flag: "-ffunction-sections"
+ flag: "-fdata-sections"
+ }
+ }
+ flag_set {
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "c++-link-executable"
+ flag_group {
+ flag: "-Wl,--gc-sections"
+ }
+ }
+ }
+
+ feature {
+ name: "fastbuild"
+ implies: "common"
+ }
+
+ feature {
+ name: "dbg"
+ implies: "common"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-g"
+ }
+ }
+ }
+
+ # Set clang as a C/C++ compiler.
+ tool_path { name: "gcc" path: "clang/bin/crosstool_wrapper_driver_is_not_gcc" }
+
+ # Use the default system toolchain for everything else.
+ tool_path { name: "ar" path: "/usr/bin/ar" }
+ tool_path { name: "compat-ld" path: "/usr/bin/ld" }
+ tool_path { name: "cpp" path: "/usr/bin/cpp" }
+ tool_path { name: "dwp" path: "/usr/bin/dwp" }
+ tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ tool_path { name: "ld" path: "/usr/bin/ld" }
+ tool_path { name: "nm" path: "/usr/bin/nm" }
+ tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
+ tool_path { name: "objdump" path: "/usr/bin/objdump" }
+ tool_path { name: "strip" path: "/usr/bin/strip" }
+
+ # Enabled dynamic linking.
+ linking_mode_flags { mode: DYNAMIC }
+
+
+ cxx_builtin_include_directory: "/"
+}
+
+toolchain {
+ abi_version: "local"
+ abi_libc_version: "local"
+ compiler: "compiler"
+ host_system_name: "local"
+ needsPic: true
+ target_libc: "macosx"
+ target_cpu: "darwin"
+ target_system_name: "local"
+ toolchain_identifier: "local_darwin"
+ feature {
+ name: "c++11"
+ flag_set {
+ action: "c++-compile"
+ flag_group {
+ flag: "-std=c++11"
+ }
+ }
+ }
+
+ feature {
+ name: "stdlib"
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "-lc++"
+ }
+ }
+ }
+
+ feature {
+ name: "determinism"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # Make C++ compilation deterministic. Use linkstamping instead of these
+ # compiler symbols.
+ flag: "-Wno-builtin-macro-redefined"
+ flag: "-D__DATE__=\"redacted\""
+ flag: "-D__TIMESTAMP__=\"redacted\""
+ flag: "-D__TIME__=\"redacted\""
+ }
+ }
+ }
+
+ # This feature will be enabled for builds that support pic by bazel.
+ feature {
+ name: "pic"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ expand_if_all_available: "pic"
+ flag: "-fPIC"
+ }
+ flag_group {
+ expand_if_none_available: "pic"
+ flag: "-fPIE"
+ }
+ }
+ }
+
+ # Security hardening on by default.
+ feature {
+ name: "hardening"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
+ # We need to undef it before redefining it as some distributions now
+ # have it enabled by default.
+ flag: "-U_FORTIFY_SOURCE"
+ flag: "-D_FORTIFY_SOURCE=1"
+ flag: "-fstack-protector"
+ }
+ }
+ flag_set {
+ action: "c++-link-executable"
+ flag_group {
+ flag: "-pie"
+ }
+ }
+ }
+
+ feature {
+ name: "warnings"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # All warnings are enabled. Maybe enable -Werror as well?
+ flag: "-Wall"
+
+ }
+ }
+ }
+
+ # Keep stack frames for debugging, even in opt mode.
+ feature {
+ name: "frame-pointer"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-fno-omit-frame-pointer"
+ }
+ }
+ }
+
+ feature {
+ name: "no-canonical-prefixes"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag:"-no-canonical-prefixes"
+ }
+ }
+ }
+
+ feature {
+ name: "disable-assertions"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-DNDEBUG"
+ }
+ }
+ }
+
+ feature {
+ name: "linker-bin-path"
+
+ flag_set {
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "-B/usr/bin"
+ }
+ }
+ }
+
+ feature {
+ name: "undefined-dynamic"
+ flag_set {
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "c++-link-executable"
+ flag_group {
+ flag: "-undefined"
+ flag: "dynamic_lookup"
+ }
+ }
+ }
+
+ feature {
+ name: "common"
+ implies: "stdlib"
+ implies: "c++11"
+ implies: "determinism"
+ implies: "hardening"
+ implies: "warnings"
+ implies: "frame-pointer"
+ implies: "no-canonical-prefixes"
+ implies: "linker-bin-path"
+ implies: "undefined-dynamic"
+ }
+
+ feature {
+ name: "opt"
+ implies: "common"
+ implies: "disable-assertions"
+
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ # No debug symbols.
+ # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt
+ # or even generally? However, that can't happen here, as it requires
+ # special handling in Bazel.
+ flag: "-g0"
+
+ # Conservative choice for -O
+ # -O3 can increase binary size and even slow down the resulting binaries.
+ # Profile first and / or use FDO if you need better performance than this.
+ flag: "-O2"
+
+ # Removal of unused code and data at link time (can this increase binary size in some cases?).
+ flag: "-ffunction-sections"
+ flag: "-fdata-sections"
+ }
+ }
+ }
+
+ feature {
+ name: "fastbuild"
+ implies: "common"
+ }
+
+ feature {
+ name: "dbg"
+ implies: "common"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ flag_group {
+ flag: "-g"
+ }
+ }
+ }
+
+ # Set clang as a C/C++ compiler.
+ tool_path { name: "gcc" path: "clang/bin/crosstool_wrapper_driver_is_not_gcc" }
+
+ # Use the default system toolchain for everything else.
+ tool_path { name: "ar" path: "/usr/bin/libtool" }
+ tool_path { name: "compat-ld" path: "/usr/bin/ld" }
+ tool_path { name: "cpp" path: "/usr/bin/cpp" }
+ tool_path { name: "dwp" path: "/usr/bin/dwp" }
+ tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ tool_path { name: "ld" path: "/usr/bin/ld" }
+ tool_path { name: "nm" path: "/usr/bin/nm" }
+ tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
+ tool_path { name: "objdump" path: "/usr/bin/objdump" }
+ tool_path { name: "strip" path: "/usr/bin/strip" }
+
+ # Enabled dynamic linking.
+ linking_mode_flags { mode: DYNAMIC }
+
+
+ cxx_builtin_include_directory: "/"
+}
+
+toolchain {
+ toolchain_identifier: "local_windows"
+ host_system_name: "local"
+ target_system_name: "local"
+
+ abi_version: "local"
+ abi_libc_version: "local"
+ target_cpu: "x64_windows"
+ compiler: "msvc-cl"
+ target_libc: "msvcrt"
+
+
+
+ tool_path {
+ name: "ar"
+ path: ""
+ }
+ tool_path {
+ name: "ml"
+ path: ""
+ }
+ tool_path {
+ name: "cpp"
+ path: ""
+ }
+ tool_path {
+ name: "gcc"
+ path: ""
+ }
+ tool_path {
+ name: "gcov"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ tool_path {
+ name: "ld"
+ path: ""
+ }
+ tool_path {
+ name: "nm"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ tool_path {
+ name: "objcopy"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ tool_path {
+ name: "objdump"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ tool_path {
+ name: "strip"
+ path: "wrapper/bin/msvc_nop.bat"
+ }
+ supports_interface_shared_objects: true
+
+ # TODO(pcloudy): Review those flags below, they should be defined by cl.exe
+ compiler_flag: "/DCOMPILER_MSVC"
+
+ # Don't define min/max macros in windows.h.
+ compiler_flag: "/DNOMINMAX"
+
+ # Platform defines.
+ compiler_flag: "/D_WIN32_WINNT=0x0600"
+ # Turn off warning messages.
+ compiler_flag: "/D_CRT_SECURE_NO_DEPRECATE"
+ compiler_flag: "/D_CRT_SECURE_NO_WARNINGS"
+ compiler_flag: "/D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS"
+
+ # Useful options to have on for compilation.
+ # Increase the capacity of object files to 2^32 sections.
+ compiler_flag: "/bigobj"
+ # Allocate 500MB for precomputed headers.
+ compiler_flag: "/Zm500"
+ # Use unsigned char by default.
+ compiler_flag: "/J"
+ # Use function level linking.
+ compiler_flag: "/Gy"
+ # Use string pooling.
+ compiler_flag: "/GF"
+ # Catch C++ exceptions only and tell the compiler to assume that functions declared
+ # as extern "C" never throw a C++ exception.
+ compiler_flag: "/EHsc"
+
+ # Globally disabled warnings.
+ # Don't warn about elements of array being be default initialized.
+ compiler_flag: "/wd4351"
+ # Don't warn about no matching delete found.
+ compiler_flag: "/wd4291"
+ # Don't warn about diamond inheritance patterns.
+ compiler_flag: "/wd4250"
+ # Don't warn about insecure functions (e.g. non _s functions).
+ compiler_flag: "/wd4996"
+
+ linker_flag: "/MACHINE:X64"
+
+ feature {
+ name: "no_legacy_features"
+ }
+
+ # Suppress startup banner.
+ feature {
+ name: "nologo"
+ flag_set {
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-module-compile"
+ action: "c++-module-codegen"
+ action: "c++-header-parsing"
+ action: "assemble"
+ action: "preprocess-assemble"
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "c++-link-static-library"
+ flag_group {
+ flag: "/nologo"
+ }
+ }
+ }
+
+ feature {
+ name: 'has_configured_linker_path'
+ }
+
+ # This feature indicates strip is not supported, building stripped binary will just result a copy of orignial binary
+ feature {
+ name: 'no_stripping'
+ }
+
+ # This feature indicates this is a toolchain targeting Windows.
+ feature {
+ name: 'targets_windows'
+ implies: 'copy_dynamic_libraries_to_binary'
+ enabled: true
+ }
+
+ feature {
+ name: 'copy_dynamic_libraries_to_binary'
+ }
+
+ action_config {
+ config_name: 'assemble'
+ action_name: 'assemble'
+ tool {
+ tool_path: ''
+ }
+ implies: 'compiler_input_flags'
+ implies: 'compiler_output_flags'
+ implies: 'nologo'
+ implies: 'msvc_env'
+ implies: 'sysroot'
+ }
+
+ action_config {
+ config_name: 'preprocess-assemble'
+ action_name: 'preprocess-assemble'
+ tool {
+ tool_path: ''
+ }
+ implies: 'compiler_input_flags'
+ implies: 'compiler_output_flags'
+ implies: 'nologo'
+ implies: 'msvc_env'
+ implies: 'sysroot'
+ }
+
+ action_config {
+ config_name: 'c-compile'
+ action_name: 'c-compile'
+ tool {
+ tool_path: ''
+ }
+ implies: 'compiler_input_flags'
+ implies: 'compiler_output_flags'
+ implies: 'legacy_compile_flags'
+ implies: 'nologo'
+ implies: 'msvc_env'
+ implies: 'parse_showincludes'
+ implies: 'user_compile_flags'
+ implies: 'sysroot'
+ implies: 'unfiltered_compile_flags'
+ }
+
+ action_config {
+ config_name: 'c++-compile'
+ action_name: 'c++-compile'
+ tool {
+ tool_path: ''
+ }
+ implies: 'compiler_input_flags'
+ implies: 'compiler_output_flags'
+ implies: 'legacy_compile_flags'
+ implies: 'nologo'
+ implies: 'msvc_env'
+ implies: 'parse_showincludes'
+ implies: 'user_compile_flags'
+ implies: 'sysroot'
+ implies: 'unfiltered_compile_flags'
+ }
+
+ action_config {
+ config_name: 'c++-link-executable'
+ action_name: 'c++-link-executable'
+ tool {
+ tool_path: ''
+ }
+ implies: 'nologo'
+ implies: 'linkstamps'
+ implies: 'output_execpath_flags'
+ implies: 'input_param_flags'
+ implies: 'user_link_flags'
+ implies: 'legacy_link_flags'
+ implies: 'linker_subsystem_flag'
+ implies: 'linker_param_file'
+ implies: 'msvc_env'
+ implies: 'no_stripping'
+ }
+
+ action_config {
+ config_name: 'c++-link-dynamic-library'
+ action_name: 'c++-link-dynamic-library'
+ tool {
+ tool_path: ''
+ }
+ implies: 'nologo'
+ implies: 'shared_flag'
+ implies: 'linkstamps'
+ implies: 'output_execpath_flags'
+ implies: 'input_param_flags'
+ implies: 'user_link_flags'
+ implies: 'legacy_link_flags'
+ implies: 'linker_subsystem_flag'
+ implies: 'linker_param_file'
+ implies: 'msvc_env'
+ implies: 'no_stripping'
+ implies: 'has_configured_linker_path'
+ implies: 'def_file'
+ }
+
+ action_config {
+ config_name: 'c++-link-nodeps-dynamic-library'
+ action_name: 'c++-link-nodeps-dynamic-library'
+ tool {
+ tool_path: ''
+ }
+ implies: 'nologo'
+ implies: 'shared_flag'
+ implies: 'linkstamps'
+ implies: 'output_execpath_flags'
+ implies: 'input_param_flags'
+ implies: 'user_link_flags'
+ implies: 'legacy_link_flags'
+ implies: 'linker_subsystem_flag'
+ implies: 'linker_param_file'
+ implies: 'msvc_env'
+ implies: 'no_stripping'
+ implies: 'has_configured_linker_path'
+ implies: 'def_file'
+ }
+
+ action_config {
+ config_name: 'c++-link-static-library'
+ action_name: 'c++-link-static-library'
+ tool {
+ tool_path: ''
+ }
+ implies: 'nologo'
+ implies: 'archiver_flags'
+ implies: 'input_param_flags'
+ implies: 'linker_param_file'
+ implies: 'msvc_env'
+ }
+
+ # TODO(b/65151735): Remove legacy_compile_flags feature when legacy fields are
+ # not used in this crosstool
+ feature {
+ name: 'legacy_compile_flags'
+ flag_set {
+ expand_if_all_available: 'legacy_compile_flags'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ iterate_over: 'legacy_compile_flags'
+ flag: '%{legacy_compile_flags}'
+ }
+ }
+ }
+
+ feature {
+ name: "msvc_env"
+ env_set {
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-module-compile"
+ action: "c++-module-codegen"
+ action: "c++-header-parsing"
+ action: "assemble"
+ action: "preprocess-assemble"
+ action: "c++-link-executable"
+ action: "c++-link-dynamic-library"
+ action: "c++-link-nodeps-dynamic-library"
+ action: "c++-link-static-library"
+ env_entry {
+ key: "PATH"
+ value: ""
+ }
+ env_entry {
+ key: "INCLUDE"
+ value: ""
+ }
+ env_entry {
+ key: "LIB"
+ value: ""
+ }
+ env_entry {
+ key: "TMP"
+ value: ""
+ }
+ env_entry {
+ key: "TEMP"
+ value: ""
+ }
+ }
+ }
+
+ feature {
+ name: 'include_paths'
+ flag_set {
+ action: "assemble"
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ flag_group {
+ iterate_over: 'quote_include_paths'
+ flag: '/I%{quote_include_paths}'
+ }
+ flag_group {
+ iterate_over: 'include_paths'
+ flag: '/I%{include_paths}'
+ }
+ flag_group {
+ iterate_over: 'system_include_paths'
+ flag: '/I%{system_include_paths}'
+ }
+ }
+ }
+
+ feature {
+ name: "preprocessor_defines"
+ flag_set {
+ action: "assemble"
+ action: "preprocess-assemble"
+ action: "c-compile"
+ action: "c++-compile"
+ action: "c++-header-parsing"
+ action: "c++-module-compile"
+ flag_group {
+ flag: "/D%{preprocessor_defines}"
+ iterate_over: "preprocessor_defines"
+ }
+ }
+ }
+
+ # Tell Bazel to parse the output of /showIncludes
+ feature {
+ name: 'parse_showincludes'
+ flag_set {
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-module-compile'
+ action: 'c++-header-parsing'
+ flag_group {
+ flag: "/showIncludes"
+ }
+ }
+ }
+
+
+ feature {
+ name: 'generate_pdb_file'
+ requires: {
+ feature: 'dbg'
+ }
+ requires: {
+ feature: 'fastbuild'
+ }
+ }
+
+ feature {
+ name: 'shared_flag'
+ flag_set {
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: '/DLL'
+ }
+ }
+ }
+
+ feature {
+ name: 'linkstamps'
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ expand_if_all_available: 'linkstamp_paths'
+ flag_group {
+ iterate_over: 'linkstamp_paths'
+ flag: '%{linkstamp_paths}'
+ }
+ }
+ }
+
+ feature {
+ name: 'output_execpath_flags'
+ flag_set {
+ expand_if_all_available: 'output_execpath'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: '/OUT:%{output_execpath}'
+ }
+ }
+ }
+
+ feature {
+ name: 'archiver_flags'
+ flag_set {
+ expand_if_all_available: 'output_execpath'
+ action: 'c++-link-static-library'
+ flag_group {
+ flag: '/OUT:%{output_execpath}'
+ }
+ }
+ }
+
+ feature {
+ name: 'input_param_flags'
+ flag_set {
+ expand_if_all_available: 'interface_library_output_path'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/IMPLIB:%{interface_library_output_path}"
+ }
+ }
+ flag_set {
+ expand_if_all_available: 'libopts'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ iterate_over: 'libopts'
+ flag: '%{libopts}'
+ }
+ }
+ flag_set {
+ expand_if_all_available: 'libraries_to_link'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ action: 'c++-link-static-library'
+ flag_group {
+ iterate_over: 'libraries_to_link'
+ flag_group {
+ expand_if_equal: {
+ variable: 'libraries_to_link.type'
+ value: 'object_file_group'
+ }
+ iterate_over: 'libraries_to_link.object_files'
+ flag_group {
+ flag: '%{libraries_to_link.object_files}'
+ }
+ }
+ flag_group {
+ expand_if_equal: {
+ variable: 'libraries_to_link.type'
+ value: 'object_file'
+ }
+ flag_group {
+ flag: '%{libraries_to_link.name}'
+ }
+ }
+ flag_group {
+ expand_if_equal: {
+ variable: 'libraries_to_link.type'
+ value: 'interface_library'
+ }
+ flag_group {
+ flag: '%{libraries_to_link.name}'
+ }
+ }
+ flag_group {
+ expand_if_equal: {
+ variable: 'libraries_to_link.type'
+ value: 'static_library'
+ }
+ flag_group {
+ expand_if_false: 'libraries_to_link.is_whole_archive'
+ flag: '%{libraries_to_link.name}'
+ }
+ flag_group {
+ expand_if_true: 'libraries_to_link.is_whole_archive'
+ flag: '/WHOLEARCHIVE:%{libraries_to_link.name}'
+ }
+ }
+ }
+ }
+ }
+
+ # Since this feature is declared earlier in the CROSSTOOL than
+ # "user_link_flags", this feature will be applied prior to it anwyhere they
+ # are both implied. And since "user_link_flags" contains the linkopts from
+ # the build rule, this allows the user to override the /SUBSYSTEM in the BUILD
+ # file.
+ feature {
+ name: 'linker_subsystem_flag'
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: '/SUBSYSTEM:CONSOLE'
+ }
+ }
+ }
+
+ # The "user_link_flags" contains user-defined linkopts (from build rules)
+ # so it should be defined after features that declare user-overridable flags.
+ # For example the "linker_subsystem_flag" defines a default "/SUBSYSTEM" flag
+ # but we want to let the user override it, therefore "link_flag_subsystem" is
+ # defined earlier in the CROSSTOOL file than "user_link_flags".
+ feature {
+ name: 'user_link_flags'
+ flag_set {
+ expand_if_all_available: 'user_link_flags'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ iterate_over: 'user_link_flags'
+ flag: '%{user_link_flags}'
+ }
+ }
+ }
+ feature {
+ name: 'legacy_link_flags'
+ flag_set {
+ expand_if_all_available: 'legacy_link_flags'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ iterate_over: 'legacy_link_flags'
+ flag: '%{legacy_link_flags}'
+ }
+ }
+ }
+
+ feature {
+ name: 'linker_param_file'
+ flag_set {
+ expand_if_all_available: 'linker_param_file'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ action: 'c++-link-static-library'
+ flag_group {
+ flag: '@%{linker_param_file}'
+ }
+ }
+ }
+
+ feature {
+ name: 'static_link_msvcrt'
+ }
+
+ feature {
+ name: 'static_link_msvcrt_no_debug'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/MT"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEFAULTLIB:libcmt.lib"
+ }
+ }
+ requires: { feature: 'fastbuild'}
+ requires: { feature: 'opt'}
+ }
+
+ feature {
+ name: 'dynamic_link_msvcrt_no_debug'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/MD"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEFAULTLIB:msvcrt.lib"
+ }
+ }
+ requires: { feature: 'fastbuild'}
+ requires: { feature: 'opt'}
+ }
+
+ feature {
+ name: 'static_link_msvcrt_debug'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/MTd"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEFAULTLIB:libcmtd.lib"
+ }
+ }
+ requires: { feature: 'dbg'}
+ }
+
+ feature {
+ name: 'dynamic_link_msvcrt_debug'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/MDd"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEFAULTLIB:msvcrtd.lib"
+ }
+ }
+ requires: { feature: 'dbg'}
+ }
+
+ feature {
+ name: 'dbg'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/Od"
+ flag: "/Z7"
+ flag: "/DDEBUG"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEBUG:FULL"
+ flag: "/INCREMENTAL:NO"
+ }
+ }
+ implies: 'generate_pdb_file'
+ }
+
+ feature {
+ name: 'fastbuild'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/Od"
+ flag: "/Z7"
+ flag: "/DDEBUG"
+ }
+ }
+ flag_set {
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEBUG:FASTLINK"
+ flag: "/INCREMENTAL:NO"
+ }
+ }
+ implies: 'generate_pdb_file'
+ }
+
+ feature {
+ name: 'opt'
+ flag_set {
+ action: 'c-compile'
+ action: 'c++-compile'
+ flag_group {
+ flag: "/O2"
+ flag: "/DNDEBUG"
+ }
+ }
+ }
+
+ feature {
+ name: 'user_compile_flags'
+ flag_set {
+ expand_if_all_available: 'user_compile_flags'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ iterate_over: 'user_compile_flags'
+ flag: '%{user_compile_flags}'
+ }
+ }
+ }
+
+ feature {
+ name: 'sysroot'
+ flag_set {
+ expand_if_all_available: 'sysroot'
+ action: 'assemble'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ iterate_over: 'sysroot'
+ flag: '--sysroot=%{sysroot}'
+ }
+ }
+ }
+
+ feature {
+ name: 'unfiltered_compile_flags'
+ flag_set {
+ expand_if_all_available: 'unfiltered_compile_flags'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ iterate_over: 'unfiltered_compile_flags'
+ flag: '%{unfiltered_compile_flags}'
+ }
+ }
+ }
+
+ feature {
+ name: 'compiler_output_flags'
+ flag_set {
+ action: 'assemble'
+ flag_group {
+ expand_if_all_available: 'output_file'
+ expand_if_none_available: 'output_assembly_file'
+ expand_if_none_available: 'output_preprocess_file'
+ flag: '/Fo%{output_file}'
+ flag: '/Zi'
+ }
+ }
+ flag_set {
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ expand_if_all_available: 'output_file'
+ expand_if_none_available: 'output_assembly_file'
+ expand_if_none_available: 'output_preprocess_file'
+ flag: '/Fo%{output_file}'
+ }
+ flag_group {
+ expand_if_all_available: 'output_file'
+ expand_if_all_available: 'output_assembly_file'
+ flag: '/Fa%{output_file}'
+ }
+ flag_group {
+ expand_if_all_available: 'output_file'
+ expand_if_all_available: 'output_preprocess_file'
+ flag: '/P'
+ flag: '/Fi%{output_file}'
+ }
+ }
+ }
+
+ feature {
+ name: 'compiler_input_flags'
+ flag_set {
+ action: 'assemble'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ flag_group {
+ expand_if_all_available: 'source_file'
+ flag: '/c'
+ flag: '%{source_file}'
+ }
+ }
+ }
+
+ feature {
+ name : 'def_file',
+ flag_set {
+ expand_if_all_available: 'def_file_path'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ action: "c++-link-nodeps-dynamic-library"
+ flag_group {
+ flag: "/DEF:%{def_file_path}"
+ # We can specify a different DLL name in DEF file, /ignore:4070 suppresses
+ # the warning message about DLL name doesn't match the default one.
+ # See https://msdn.microsoft.com/en-us/library/sfkk2fz7.aspx
+ flag: "/ignore:4070"
+ }
+ }
+ }
+
+ feature {
+ name: 'windows_export_all_symbols'
+ }
+
+ feature {
+ name: 'no_windows_export_all_symbols'
+ }
+
+ linking_mode_flags { mode: DYNAMIC }
+}
diff --git a/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/clang/bin/crosstool_wrapper_driver_is_not_gcc b/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/clang/bin/crosstool_wrapper_driver_is_not_gcc
new file mode 100755
index 0000000000..63893d3722
--- /dev/null
+++ b/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/clang/bin/crosstool_wrapper_driver_is_not_gcc
@@ -0,0 +1,264 @@
+#!/usr/bin/env python
+# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ==============================================================================
+
+"""Crosstool wrapper for compiling CUDA programs.
+
+SYNOPSIS:
+ crosstool_wrapper_is_not_gcc [options passed in by cc_library()
+ or cc_binary() rule]
+
+DESCRIPTION:
+ This script is expected to be called by the cc_library() or cc_binary() bazel
+ rules. When the option "-x cuda" is present in the list of arguments passed
+ to this script, it invokes the nvcc CUDA compiler. Most arguments are passed
+ as is as a string to --compiler-options of nvcc. When "-x cuda" is not
+ present, this wrapper invokes hybrid_driver_is_not_gcc with the input
+ arguments as is.
+
+NOTES:
+ Changes to the contents of this file must be propagated from
+ //third_party/gpus/crosstool/crosstool_wrapper_is_not_gcc to
+ //third_party/gpus/crosstool/v*/*/clang/bin/crosstool_wrapper_is_not_gcc
+"""
+
+from __future__ import print_function
+
+__author__ = 'keveman@google.com (Manjunath Kudlur)'
+
+from argparse import ArgumentParser
+import os
+import subprocess
+import re
+import sys
+import pipes
+
+# Template values set by cuda_autoconf.
+CPU_COMPILER = ('/usr/bin/gcc')
+GCC_HOST_COMPILER_PATH = ('/usr/bin/gcc')
+
+NVCC_PATH = '/usr/local/cuda-9.0/bin/nvcc'
+PREFIX_DIR = os.path.dirname(GCC_HOST_COMPILER_PATH)
+NVCC_VERSION = '9.0'
+
+def Log(s):
+ print('gpus/crosstool: {0}'.format(s))
+
+
+def GetOptionValue(argv, option):
+ """Extract the list of values for option from the argv list.
+
+ Args:
+ argv: A list of strings, possibly the argv passed to main().
+ option: The option whose value to extract, without the leading '-'.
+
+ Returns:
+ A list of values, either directly following the option,
+ (eg., -opt val1 val2) or values collected from multiple occurrences of
+ the option (eg., -opt val1 -opt val2).
+ """
+
+ parser = ArgumentParser()
+ parser.add_argument('-' + option, nargs='*', action='append')
+ args, _ = parser.parse_known_args(argv)
+ if not args or not vars(args)[option]:
+ return []
+ else:
+ return sum(vars(args)[option], [])
+
+
+def GetHostCompilerOptions(argv):
+ """Collect the -isystem, -iquote, and --sysroot option values from argv.
+
+ Args:
+ argv: A list of strings, possibly the argv passed to main().
+
+ Returns:
+ The string that can be used as the --compiler-options to nvcc.
+ """
+
+ parser = ArgumentParser()
+ parser.add_argument('-isystem', nargs='*', action='append')
+ parser.add_argument('-iquote', nargs='*', action='append')
+ parser.add_argument('--sysroot', nargs=1)
+ parser.add_argument('-g', nargs='*', action='append')
+ parser.add_argument('-fno-canonical-system-headers', action='store_true')
+
+ args, _ = parser.parse_known_args(argv)
+
+ opts = ''
+
+ if args.isystem:
+ opts += ' -isystem ' + ' -isystem '.join(sum(args.isystem, []))
+ if args.iquote:
+ opts += ' -iquote ' + ' -iquote '.join(sum(args.iquote, []))
+ if args.g:
+ opts += ' -g' + ' -g'.join(sum(args.g, []))
+ if args.fno_canonical_system_headers:
+ opts += ' -fno-canonical-system-headers'
+ if args.sysroot:
+ opts += ' --sysroot ' + args.sysroot[0]
+
+ return opts
+
+def _update_options(nvcc_options):
+ if NVCC_VERSION in ("7.0",):
+ return nvcc_options
+
+ update_options = { "relaxed-constexpr" : "expt-relaxed-constexpr" }
+ return [ update_options[opt] if opt in update_options else opt
+ for opt in nvcc_options ]
+
+def GetNvccOptions(argv):
+ """Collect the -nvcc_options values from argv.
+
+ Args:
+ argv: A list of strings, possibly the argv passed to main().
+
+ Returns:
+ The string that can be passed directly to nvcc.
+ """
+
+ parser = ArgumentParser()
+ parser.add_argument('-nvcc_options', nargs='*', action='append')
+
+ args, _ = parser.parse_known_args(argv)
+
+ if args.nvcc_options:
+ options = _update_options(sum(args.nvcc_options, []))
+ return ' '.join(['--'+a for a in options])
+ return ''
+
+
+def InvokeNvcc(argv, log=False):
+ """Call nvcc with arguments assembled from argv.
+
+ Args:
+ argv: A list of strings, possibly the argv passed to main().
+ log: True if logging is requested.
+
+ Returns:
+ The return value of calling os.system('nvcc ' + args)
+ """
+
+ host_compiler_options = GetHostCompilerOptions(argv)
+ nvcc_compiler_options = GetNvccOptions(argv)
+ opt_option = GetOptionValue(argv, 'O')
+ m_options = GetOptionValue(argv, 'm')
+ m_options = ''.join([' -m' + m for m in m_options if m in ['32', '64']])
+ include_options = GetOptionValue(argv, 'I')
+ out_file = GetOptionValue(argv, 'o')
+ depfiles = GetOptionValue(argv, 'MF')
+ defines = GetOptionValue(argv, 'D')
+ defines = ''.join([' -D' + define for define in defines])
+ undefines = GetOptionValue(argv, 'U')
+ undefines = ''.join([' -U' + define for define in undefines])
+ std_options = GetOptionValue(argv, 'std')
+ # currently only c++11 is supported by Cuda 7.0 std argument
+ nvcc_allowed_std_options = ["c++11"]
+ std_options = ''.join([' -std=' + define
+ for define in std_options if define in nvcc_allowed_std_options])
+
+ # The list of source files get passed after the -c option. I don't know of
+ # any other reliable way to just get the list of source files to be compiled.
+ src_files = GetOptionValue(argv, 'c')
+
+ # Pass -w through from host to nvcc, but don't do anything fancier with
+ # warnings-related flags, since they're not necessarily the same across
+ # compilers.
+ warning_options = ' -w' if '-w' in argv else ''
+
+ if len(src_files) == 0:
+ return 1
+ if len(out_file) != 1:
+ return 1
+
+ opt = (' -O2' if (len(opt_option) > 0 and int(opt_option[0]) > 0)
+ else ' -g -G')
+
+ includes = (' -I ' + ' -I '.join(include_options)
+ if len(include_options) > 0
+ else '')
+
+ # Unfortunately, there are other options that have -c prefix too.
+ # So allowing only those look like C/C++ files.
+ src_files = [f for f in src_files if
+ re.search('\.cpp$|\.cc$|\.c$|\.cxx$|\.C$', f)]
+ srcs = ' '.join(src_files)
+ out = ' -o ' + out_file[0]
+
+ supported_cuda_compute_capabilities = [ "3.0" ]
+ nvccopts = '-D_FORCE_INLINES '
+ for capability in supported_cuda_compute_capabilities:
+ capability = capability.replace('.', '')
+ nvccopts += r'-gencode=arch=compute_%s,\"code=sm_%s,compute_%s\" ' % (
+ capability, capability, capability)
+ nvccopts += ' ' + nvcc_compiler_options
+ nvccopts += undefines
+ nvccopts += defines
+ nvccopts += std_options
+ nvccopts += m_options
+ nvccopts += warning_options
+
+ if depfiles:
+ # Generate the dependency file
+ depfile = depfiles[0]
+ cmd = (NVCC_PATH + ' ' + nvccopts +
+ ' --compiler-options "' + host_compiler_options + '"' +
+ ' --compiler-bindir=' + GCC_HOST_COMPILER_PATH +
+ ' -I .' +
+ ' -x cu ' + opt + includes + ' ' + srcs + ' -M -o ' + depfile)
+ if log: Log(cmd)
+ exit_status = os.system(cmd)
+ if exit_status != 0:
+ return exit_status
+
+ cmd = (NVCC_PATH + ' ' + nvccopts +
+ ' --compiler-options "' + host_compiler_options + ' -fPIC"' +
+ ' --compiler-bindir=' + GCC_HOST_COMPILER_PATH +
+ ' -I .' +
+ ' -x cu ' + opt + includes + ' -c ' + srcs + out)
+
+ # TODO(zhengxq): for some reason, 'gcc' needs this help to find 'as'.
+ # Need to investigate and fix.
+ cmd = 'PATH=' + PREFIX_DIR + ':$PATH ' + cmd
+ if log: Log(cmd)
+ return os.system(cmd)
+
+
+def main():
+ parser = ArgumentParser()
+ parser.add_argument('-x', nargs=1)
+ parser.add_argument('--cuda_log', action='store_true')
+ args, leftover = parser.parse_known_args(sys.argv[1:])
+
+ if args.x and args.x[0] == 'cuda':
+ if args.cuda_log: Log('-x cuda')
+ leftover = [pipes.quote(s) for s in leftover]
+ if args.cuda_log: Log('using nvcc')
+ return InvokeNvcc(leftover, log=args.cuda_log)
+
+ # Strip our flags before passing through to the CPU compiler for files which
+ # are not -x cuda. We can't just pass 'leftover' because it also strips -x.
+ # We not only want to pass -x to the CPU compiler, but also keep it in its
+ # relative location in the argv list (the compiler is actually sensitive to
+ # this).
+ cpu_compiler_flags = [flag for flag in sys.argv[1:]
+ if not flag.startswith(('--cuda_log'))]
+
+ return subprocess.call([CPU_COMPILER] + cpu_compiler_flags)
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/windows/msvc_wrapper_for_nvcc.bat b/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/windows/msvc_wrapper_for_nvcc.bat
new file mode 100755
index 0000000000..e896e654fd
--- /dev/null
+++ b/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/windows/msvc_wrapper_for_nvcc.bat
@@ -0,0 +1,20 @@
+:: Copyright 2015 The TensorFlow Authors. All Rights Reserved.
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+:: http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+:: =============================================================================
+
+:: Invoke msvc_wrapper_for_nvcc.py, which is located in the same directory.
+@echo OFF
+set arg0=%~0
+for %%F in ("%arg0%") do set DRIVER_BIN=%%~dpF
+"/usr/bin/python3" -B "%DRIVER_BIN%\msvc_wrapper_for_nvcc.py" %*
diff --git a/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/windows/msvc_wrapper_for_nvcc.py b/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/windows/msvc_wrapper_for_nvcc.py
new file mode 100755
index 0000000000..859b3196d5
--- /dev/null
+++ b/third_party/toolchains/preconfig/ubuntu14.04/gcc-nvcc/windows/msvc_wrapper_for_nvcc.py
@@ -0,0 +1,192 @@
+#!/usr/bin/env python
+# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ==============================================================================
+
+"""Crosstool wrapper for compiling CUDA programs with nvcc on Windows.
+
+DESCRIPTION:
+ This script is the Windows version of //third_party/gpus/crosstool/crosstool_wrapper_is_not_gcc
+"""
+
+from __future__ import print_function
+
+from argparse import ArgumentParser
+import os
+import subprocess
+import re
+import sys
+import pipes
+
+# Template values set by cuda_autoconf.
+CPU_COMPILER = ('/usr/bin/gcc')
+GCC_HOST_COMPILER_PATH = ('/usr/bin/gcc')
+
+NVCC_PATH = '/usr/local/cuda-9.0/bin/nvcc'
+NVCC_VERSION = '9.0'
+NVCC_TEMP_DIR = "C:\\Windows\\Temp\\nvcc_inter_files_tmp_dir"
+supported_cuda_compute_capabilities = [ "3.0" ]
+
+def Log(s):
+ print('gpus/crosstool: {0}'.format(s))
+
+
+def GetOptionValue(argv, option):
+ """Extract the list of values for option from options.
+
+ Args:
+ option: The option whose value to extract, without the leading '/'.
+
+ Returns:
+ 1. A list of values, either directly following the option,
+ (eg., /opt val1 val2) or values collected from multiple occurrences of
+ the option (eg., /opt val1 /opt val2).
+ 2. The leftover options.
+ """
+
+ parser = ArgumentParser(prefix_chars='/')
+ parser.add_argument('/' + option, nargs='*', action='append')
+ args, leftover = parser.parse_known_args(argv)
+ if args and vars(args)[option]:
+ return (sum(vars(args)[option], []), leftover)
+ return ([], leftover)
+
+def _update_options(nvcc_options):
+ if NVCC_VERSION in ("7.0",):
+ return nvcc_options
+
+ update_options = { "relaxed-constexpr" : "expt-relaxed-constexpr" }
+ return [ update_options[opt] if opt in update_options else opt
+ for opt in nvcc_options ]
+
+def GetNvccOptions(argv):
+ """Collect the -nvcc_options values from argv.
+
+ Args:
+ argv: A list of strings, possibly the argv passed to main().
+
+ Returns:
+ 1. The string that can be passed directly to nvcc.
+ 2. The leftover options.
+ """
+
+ parser = ArgumentParser()
+ parser.add_argument('-nvcc_options', nargs='*', action='append')
+
+ args, leftover = parser.parse_known_args(argv)
+
+ if args.nvcc_options:
+ options = _update_options(sum(args.nvcc_options, []))
+ return (['--' + a for a in options], leftover)
+ return ([], leftover)
+
+
+def InvokeNvcc(argv, log=False):
+ """Call nvcc with arguments assembled from argv.
+
+ Args:
+ argv: A list of strings, possibly the argv passed to main().
+ log: True if logging is requested.
+
+ Returns:
+ The return value of calling os.system('nvcc ' + args)
+ """
+
+ src_files = [f for f in argv if
+ re.search('\.cpp$|\.cc$|\.c$|\.cxx$|\.C$', f)]
+ if len(src_files) == 0:
+ raise Error('No source files found for cuda compilation.')
+
+ out_file = [ f for f in argv if f.startswith('/Fo') ]
+ if len(out_file) != 1:
+ raise Error('Please sepecify exactly one output file for cuda compilation.')
+ out = ['-o', out_file[0][len('/Fo'):]]
+
+ nvcc_compiler_options, argv = GetNvccOptions(argv)
+
+ opt_option, argv = GetOptionValue(argv, 'O')
+ opt = ['-g', '-G']
+ if (len(opt_option) > 0 and opt_option[0] != 'd'):
+ opt = ['-O2']
+
+ include_options, argv = GetOptionValue(argv, 'I')
+ includes = ["-I " + include for include in include_options]
+
+ defines, argv = GetOptionValue(argv, 'D')
+ defines = ['-D' + define for define in defines]
+
+ undefines, argv = GetOptionValue(argv, 'U')
+ undefines = ['-U' + define for define in undefines]
+
+ # The rest of the unrecongized options should be passed to host compiler
+ host_compiler_options = [option for option in argv if option not in (src_files + out_file)]
+
+ m_options = ["-m64"]
+
+ nvccopts = ['-D_FORCE_INLINES']
+ for capability in supported_cuda_compute_capabilities:
+ capability = capability.replace('.', '')
+ nvccopts += [r'-gencode=arch=compute_%s,"code=sm_%s,compute_%s"' % (
+ capability, capability, capability)]
+ nvccopts += nvcc_compiler_options
+ nvccopts += undefines
+ nvccopts += defines
+ nvccopts += m_options
+ nvccopts += ['--compiler-options="' + " ".join(host_compiler_options) + '"']
+ nvccopts += ['-x', 'cu'] + opt + includes + out + ['-c'] + src_files
+ # If we don't specify --keep-dir, nvcc will generate intermediate files under TEMP
+ # Put them under NVCC_TEMP_DIR instead, then Bazel can ignore files under NVCC_TEMP_DIR during dependency check
+ # http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#options-for-guiding-compiler-driver
+ # Different actions are sharing NVCC_TEMP_DIR, so we cannot remove it if the directory already exists.
+ if os.path.isfile(NVCC_TEMP_DIR):
+ os.remove(NVCC_TEMP_DIR)
+ if not os.path.exists(NVCC_TEMP_DIR):
+ os.makedirs(NVCC_TEMP_DIR)
+ nvccopts += ['--keep', '--keep-dir', NVCC_TEMP_DIR]
+ cmd = [NVCC_PATH] + nvccopts
+ if log:
+ Log(cmd)
+ proc = subprocess.Popen(cmd,
+ stdout=sys.stdout,
+ stderr=sys.stderr,
+ env=os.environ.copy(),
+ shell=True)
+ proc.wait()
+ return proc.returncode
+
+def main():
+ parser = ArgumentParser()
+ parser.add_argument('-x', nargs=1)
+ parser.add_argument('--cuda_log', action='store_true')
+ args, leftover = parser.parse_known_args(sys.argv[1:])
+
+ if args.x and args.x[0] == 'cuda':
+ if args.cuda_log: Log('-x cuda')
+ leftover = [pipes.quote(s) for s in leftover]
+ if args.cuda_log: Log('using nvcc')
+ return InvokeNvcc(leftover, log=args.cuda_log)
+
+ # Strip our flags before passing through to the CPU compiler for files which
+ # are not -x cuda. We can't just pass 'leftover' because it also strips -x.
+ # We not only want to pass -x to the CPU compiler, but also keep it in its
+ # relative location in the argv list (the compiler is actually sensitive to
+ # this).
+ cpu_compiler_flags = [flag for flag in sys.argv[1:]
+ if not flag.startswith(('--cuda_log'))
+ and not flag.startswith(('-nvcc_options'))]
+
+ return subprocess.call([CPU_COMPILER] + cpu_compiler_flags)
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/third_party/toolchains/preconfig/ubuntu14.04/nccl2/BUILD b/third_party/toolchains/preconfig/ubuntu14.04/nccl2/BUILD
new file mode 100755
index 0000000000..96ed60d3cf
--- /dev/null
+++ b/third_party/toolchains/preconfig/ubuntu14.04/nccl2/BUILD
@@ -0,0 +1,25 @@
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "nccl",
+ srcs = ["libnccl.so.2"],
+ hdrs = ["nccl.h"],
+ include_prefix = "third_party/nccl",
+ visibility = ["//visibility:public"],
+ deps = [
+ "@local_config_cuda//cuda:cuda_headers",
+ ],
+)
+
+genrule(
+ name = "nccl-files",
+ outs = [
+ "libnccl.so.2",
+ "nccl.h",
+ ],
+ cmd = """cp "/usr/include/nccl.h" "$(@D)/nccl.h" &&
+ cp "/usr/lib/libnccl.so.2" "$(@D)/libnccl.so.2" """,
+)
diff --git a/third_party/toolchains/preconfig/ubuntu14.04/nccl2/WORKSPACE b/third_party/toolchains/preconfig/ubuntu14.04/nccl2/WORKSPACE
new file mode 100644
index 0000000000..1e6662ac91
--- /dev/null
+++ b/third_party/toolchains/preconfig/ubuntu14.04/nccl2/WORKSPACE
@@ -0,0 +1,2 @@
+# DO NOT EDIT: automatically generated WORKSPACE file for nccl_configure rule
+workspace(name = "local_config_nccl")
diff --git a/third_party/toolchains/preconfig/ubuntu14.04/py3/BUILD b/third_party/toolchains/preconfig/ubuntu14.04/py3/BUILD
new file mode 100755
index 0000000000..e021df9e1e
--- /dev/null
+++ b/third_party/toolchains/preconfig/ubuntu14.04/py3/BUILD
@@ -0,0 +1,176 @@
+licenses(["restricted"])
+
+package(default_visibility = ["//visibility:public"])
+
+# To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib
+# See https://docs.python.org/3/extending/windows.html
+cc_import(
+ name = "python_lib",
+ interface_library = select({
+ ":windows": ":python_import_lib",
+ # A placeholder for Unix platforms which makes --no_build happy.
+ "//conditions:default": "not-existing.lib",
+ }),
+ system_provided = 1,
+)
+
+cc_library(
+ name = "python_headers",
+ hdrs = [":python_include"],
+ includes = ["python_include"],
+ deps = select({
+ ":windows": [":python_lib"],
+ "//conditions:default": [],
+ }),
+)
+
+cc_library(
+ name = "numpy_headers",
+ hdrs = [":numpy_include"],
+ includes = ["numpy_include"],
+)
+
+config_setting(
+ name = "windows",
+ values = {"cpu": "x64_windows"},
+ visibility = ["//visibility:public"],
+)
+
+genrule(
+ name = "python_include",
+ outs = [
+ "python_include/Python-ast.h",
+ "python_include/Python.h",
+ "python_include/abstract.h",
+ "python_include/accu.h",
+ "python_include/asdl.h",
+ "python_include/ast.h",
+ "python_include/bitset.h",
+ "python_include/bltinmodule.h",
+ "python_include/boolobject.h",
+ "python_include/bytearrayobject.h",
+ "python_include/bytes_methods.h",
+ "python_include/bytesobject.h",
+ "python_include/cellobject.h",
+ "python_include/ceval.h",
+ "python_include/classobject.h",
+ "python_include/code.h",
+ "python_include/codecs.h",
+ "python_include/compile.h",
+ "python_include/complexobject.h",
+ "python_include/datetime.h",
+ "python_include/descrobject.h",
+ "python_include/dictobject.h",
+ "python_include/dtoa.h",
+ "python_include/dynamic_annotations.h",
+ "python_include/enumobject.h",
+ "python_include/errcode.h",
+ "python_include/eval.h",
+ "python_include/fileobject.h",
+ "python_include/fileutils.h",
+ "python_include/floatobject.h",
+ "python_include/frameobject.h",
+ "python_include/funcobject.h",
+ "python_include/genobject.h",
+ "python_include/graminit.h",
+ "python_include/grammar.h",
+ "python_include/import.h",
+ "python_include/intrcheck.h",
+ "python_include/iterobject.h",
+ "python_include/listobject.h",
+ "python_include/longintrepr.h",
+ "python_include/longobject.h",
+ "python_include/marshal.h",
+ "python_include/memoryobject.h",
+ "python_include/metagrammar.h",
+ "python_include/methodobject.h",
+ "python_include/modsupport.h",
+ "python_include/moduleobject.h",
+ "python_include/namespaceobject.h",
+ "python_include/node.h",
+ "python_include/object.h",
+ "python_include/objimpl.h",
+ "python_include/opcode.h",
+ "python_include/osdefs.h",
+ "python_include/parsetok.h",
+ "python_include/patchlevel.h",
+ "python_include/pgen.h",
+ "python_include/pgenheaders.h",
+ "python_include/py_curses.h",
+ "python_include/pyarena.h",
+ "python_include/pyatomic.h",
+ "python_include/pycapsule.h",
+ "python_include/pyconfig.h",
+ "python_include/pyctype.h",
+ "python_include/pydebug.h",
+ "python_include/pyerrors.h",
+ "python_include/pyexpat.h",
+ "python_include/pyfpe.h",
+ "python_include/pygetopt.h",
+ "python_include/pyhash.h",
+ "python_include/pymacconfig.h",
+ "python_include/pymacro.h",
+ "python_include/pymath.h",
+ "python_include/pymem.h",
+ "python_include/pyport.h",
+ "python_include/pystate.h",
+ "python_include/pystrcmp.h",
+ "python_include/pystrtod.h",
+ "python_include/pythonrun.h",
+ "python_include/pythread.h",
+ "python_include/pytime.h",
+ "python_include/rangeobject.h",
+ "python_include/setobject.h",
+ "python_include/sliceobject.h",
+ "python_include/structmember.h",
+ "python_include/structseq.h",
+ "python_include/symtable.h",
+ "python_include/sysmodule.h",
+ "python_include/token.h",
+ "python_include/traceback.h",
+ "python_include/tupleobject.h",
+ "python_include/typeslots.h",
+ "python_include/ucnhash.h",
+ "python_include/unicodeobject.h",
+ "python_include/warnings.h",
+ "python_include/weakrefobject.h",
+ ],
+ cmd = """
+cp "/usr/include/python3.4m/Python-ast.h" "$(@D)/python_include/Python-ast.h" && cp "/usr/include/python3.4m/Python.h" "$(@D)/python_include/Python.h" && cp "/usr/include/python3.4m/abstract.h" "$(@D)/python_include/abstract.h" && cp "/usr/include/python3.4m/accu.h" "$(@D)/python_include/accu.h" && cp "/usr/include/python3.4m/asdl.h" "$(@D)/python_include/asdl.h" && cp "/usr/include/python3.4m/ast.h" "$(@D)/python_include/ast.h" && cp "/usr/include/python3.4m/bitset.h" "$(@D)/python_include/bitset.h" && cp "/usr/include/python3.4m/bltinmodule.h" "$(@D)/python_include/bltinmodule.h" && cp "/usr/include/python3.4m/boolobject.h" "$(@D)/python_include/boolobject.h" && cp "/usr/include/python3.4m/bytearrayobject.h" "$(@D)/python_include/bytearrayobject.h" && cp "/usr/include/python3.4m/bytes_methods.h" "$(@D)/python_include/bytes_methods.h" && cp "/usr/include/python3.4m/bytesobject.h" "$(@D)/python_include/bytesobject.h" && cp "/usr/include/python3.4m/cellobject.h" "$(@D)/python_include/cellobject.h" && cp "/usr/include/python3.4m/ceval.h" "$(@D)/python_include/ceval.h" && cp "/usr/include/python3.4m/classobject.h" "$(@D)/python_include/classobject.h" && cp "/usr/include/python3.4m/code.h" "$(@D)/python_include/code.h" && cp "/usr/include/python3.4m/codecs.h" "$(@D)/python_include/codecs.h" && cp "/usr/include/python3.4m/compile.h" "$(@D)/python_include/compile.h" && cp "/usr/include/python3.4m/complexobject.h" "$(@D)/python_include/complexobject.h" && cp "/usr/include/python3.4m/datetime.h" "$(@D)/python_include/datetime.h" && cp "/usr/include/python3.4m/descrobject.h" "$(@D)/python_include/descrobject.h" && cp "/usr/include/python3.4m/dictobject.h" "$(@D)/python_include/dictobject.h" && cp "/usr/include/python3.4m/dtoa.h" "$(@D)/python_include/dtoa.h" && cp "/usr/include/python3.4m/dynamic_annotations.h" "$(@D)/python_include/dynamic_annotations.h" && cp "/usr/include/python3.4m/enumobject.h" "$(@D)/python_include/enumobject.h" && cp "/usr/include/python3.4m/errcode.h" "$(@D)/python_include/errcode.h" && cp "/usr/include/python3.4m/eval.h" "$(@D)/python_include/eval.h" && cp "/usr/include/python3.4m/fileobject.h" "$(@D)/python_include/fileobject.h" && cp "/usr/include/python3.4m/fileutils.h" "$(@D)/python_include/fileutils.h" && cp "/usr/include/python3.4m/floatobject.h" "$(@D)/python_include/floatobject.h" && cp "/usr/include/python3.4m/frameobject.h" "$(@D)/python_include/frameobject.h" && cp "/usr/include/python3.4m/funcobject.h" "$(@D)/python_include/funcobject.h" && cp "/usr/include/python3.4m/genobject.h" "$(@D)/python_include/genobject.h" && cp "/usr/include/python3.4m/graminit.h" "$(@D)/python_include/graminit.h" && cp "/usr/include/python3.4m/grammar.h" "$(@D)/python_include/grammar.h" && cp "/usr/include/python3.4m/import.h" "$(@D)/python_include/import.h" && cp "/usr/include/python3.4m/intrcheck.h" "$(@D)/python_include/intrcheck.h" && cp "/usr/include/python3.4m/iterobject.h" "$(@D)/python_include/iterobject.h" && cp "/usr/include/python3.4m/listobject.h" "$(@D)/python_include/listobject.h" && cp "/usr/include/python3.4m/longintrepr.h" "$(@D)/python_include/longintrepr.h" && cp "/usr/include/python3.4m/longobject.h" "$(@D)/python_include/longobject.h" && cp "/usr/include/python3.4m/marshal.h" "$(@D)/python_include/marshal.h" && cp "/usr/include/python3.4m/memoryobject.h" "$(@D)/python_include/memoryobject.h" && cp "/usr/include/python3.4m/metagrammar.h" "$(@D)/python_include/metagrammar.h" && cp "/usr/include/python3.4m/methodobject.h" "$(@D)/python_include/methodobject.h" && cp "/usr/include/python3.4m/modsupport.h" "$(@D)/python_include/modsupport.h" && cp "/usr/include/python3.4m/moduleobject.h" "$(@D)/python_include/moduleobject.h" && cp "/usr/include/python3.4m/namespaceobject.h" "$(@D)/python_include/namespaceobject.h" && cp "/usr/include/python3.4m/node.h" "$(@D)/python_include/node.h" && cp "/usr/include/python3.4m/object.h" "$(@D)/python_include/object.h" && cp "/usr/include/python3.4m/objimpl.h" "$(@D)/python_include/objimpl.h" && cp "/usr/include/python3.4m/opcode.h" "$(@D)/python_include/opcode.h" && cp "/usr/include/python3.4m/osdefs.h" "$(@D)/python_include/osdefs.h" && cp "/usr/include/python3.4m/parsetok.h" "$(@D)/python_include/parsetok.h" && cp "/usr/include/python3.4m/patchlevel.h" "$(@D)/python_include/patchlevel.h" && cp "/usr/include/python3.4m/pgen.h" "$(@D)/python_include/pgen.h" && cp "/usr/include/python3.4m/pgenheaders.h" "$(@D)/python_include/pgenheaders.h" && cp "/usr/include/python3.4m/py_curses.h" "$(@D)/python_include/py_curses.h" && cp "/usr/include/python3.4m/pyarena.h" "$(@D)/python_include/pyarena.h" && cp "/usr/include/python3.4m/pyatomic.h" "$(@D)/python_include/pyatomic.h" && cp "/usr/include/python3.4m/pycapsule.h" "$(@D)/python_include/pycapsule.h" && cp "/usr/include/python3.4m/pyconfig.h" "$(@D)/python_include/pyconfig.h" && cp "/usr/include/python3.4m/pyctype.h" "$(@D)/python_include/pyctype.h" && cp "/usr/include/python3.4m/pydebug.h" "$(@D)/python_include/pydebug.h" && cp "/usr/include/python3.4m/pyerrors.h" "$(@D)/python_include/pyerrors.h" && cp "/usr/include/python3.4m/pyexpat.h" "$(@D)/python_include/pyexpat.h" && cp "/usr/include/python3.4m/pyfpe.h" "$(@D)/python_include/pyfpe.h" && cp "/usr/include/python3.4m/pygetopt.h" "$(@D)/python_include/pygetopt.h" && cp "/usr/include/python3.4m/pyhash.h" "$(@D)/python_include/pyhash.h" && cp "/usr/include/python3.4m/pymacconfig.h" "$(@D)/python_include/pymacconfig.h" && cp "/usr/include/python3.4m/pymacro.h" "$(@D)/python_include/pymacro.h" && cp "/usr/include/python3.4m/pymath.h" "$(@D)/python_include/pymath.h" && cp "/usr/include/python3.4m/pymem.h" "$(@D)/python_include/pymem.h" && cp "/usr/include/python3.4m/pyport.h" "$(@D)/python_include/pyport.h" && cp "/usr/include/python3.4m/pystate.h" "$(@D)/python_include/pystate.h" && cp "/usr/include/python3.4m/pystrcmp.h" "$(@D)/python_include/pystrcmp.h" && cp "/usr/include/python3.4m/pystrtod.h" "$(@D)/python_include/pystrtod.h" && cp "/usr/include/python3.4m/pythonrun.h" "$(@D)/python_include/pythonrun.h" && cp "/usr/include/python3.4m/pythread.h" "$(@D)/python_include/pythread.h" && cp "/usr/include/python3.4m/pytime.h" "$(@D)/python_include/pytime.h" && cp "/usr/include/python3.4m/rangeobject.h" "$(@D)/python_include/rangeobject.h" && cp "/usr/include/python3.4m/setobject.h" "$(@D)/python_include/setobject.h" && cp "/usr/include/python3.4m/sliceobject.h" "$(@D)/python_include/sliceobject.h" && cp "/usr/include/python3.4m/structmember.h" "$(@D)/python_include/structmember.h" && cp "/usr/include/python3.4m/structseq.h" "$(@D)/python_include/structseq.h" && cp "/usr/include/python3.4m/symtable.h" "$(@D)/python_include/symtable.h" && cp "/usr/include/python3.4m/sysmodule.h" "$(@D)/python_include/sysmodule.h" && cp "/usr/include/python3.4m/token.h" "$(@D)/python_include/token.h" && cp "/usr/include/python3.4m/traceback.h" "$(@D)/python_include/traceback.h" && cp "/usr/include/python3.4m/tupleobject.h" "$(@D)/python_include/tupleobject.h" && cp "/usr/include/python3.4m/typeslots.h" "$(@D)/python_include/typeslots.h" && cp "/usr/include/python3.4m/ucnhash.h" "$(@D)/python_include/ucnhash.h" && cp "/usr/include/python3.4m/unicodeobject.h" "$(@D)/python_include/unicodeobject.h" && cp "/usr/include/python3.4m/warnings.h" "$(@D)/python_include/warnings.h" && cp "/usr/include/python3.4m/weakrefobject.h" "$(@D)/python_include/weakrefobject.h"
+ """,
+)
+
+genrule(
+ name = "numpy_include",
+ outs = [
+ "numpy_include/numpy/__multiarray_api.h",
+ "numpy_include/numpy/__ufunc_api.h",
+ "numpy_include/numpy/_neighborhood_iterator_imp.h",
+ "numpy_include/numpy/_numpyconfig.h",
+ "numpy_include/numpy/arrayobject.h",
+ "numpy_include/numpy/arrayscalars.h",
+ "numpy_include/numpy/halffloat.h",
+ "numpy_include/numpy/multiarray_api.txt",
+ "numpy_include/numpy/ndarrayobject.h",
+ "numpy_include/numpy/ndarraytypes.h",
+ "numpy_include/numpy/noprefix.h",
+ "numpy_include/numpy/npy_1_7_deprecated_api.h",
+ "numpy_include/numpy/npy_3kcompat.h",
+ "numpy_include/numpy/npy_common.h",
+ "numpy_include/numpy/npy_cpu.h",
+ "numpy_include/numpy/npy_endian.h",
+ "numpy_include/numpy/npy_interrupt.h",
+ "numpy_include/numpy/npy_math.h",
+ "numpy_include/numpy/npy_no_deprecated_api.h",
+ "numpy_include/numpy/npy_os.h",
+ "numpy_include/numpy/numpyconfig.h",
+ "numpy_include/numpy/old_defines.h",
+ "numpy_include/numpy/oldnumeric.h",
+ "numpy_include/numpy/ufunc_api.txt",
+ "numpy_include/numpy/ufuncobject.h",
+ "numpy_include/numpy/utils.h",
+ ],
+ cmd = """
+cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/__multiarray_api.h" "$(@D)/numpy_include/numpy/__multiarray_api.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/__ufunc_api.h" "$(@D)/numpy_include/numpy/__ufunc_api.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/_neighborhood_iterator_imp.h" "$(@D)/numpy_include/numpy/_neighborhood_iterator_imp.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/_numpyconfig.h" "$(@D)/numpy_include/numpy/_numpyconfig.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/arrayobject.h" "$(@D)/numpy_include/numpy/arrayobject.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/arrayscalars.h" "$(@D)/numpy_include/numpy/arrayscalars.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/halffloat.h" "$(@D)/numpy_include/numpy/halffloat.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/multiarray_api.txt" "$(@D)/numpy_include/numpy/multiarray_api.txt" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/ndarrayobject.h" "$(@D)/numpy_include/numpy/ndarrayobject.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/ndarraytypes.h" "$(@D)/numpy_include/numpy/ndarraytypes.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/noprefix.h" "$(@D)/numpy_include/numpy/noprefix.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_1_7_deprecated_api.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/npy_3kcompat.h" "$(@D)/numpy_include/numpy/npy_3kcompat.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/npy_common.h" "$(@D)/numpy_include/numpy/npy_common.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/npy_cpu.h" "$(@D)/numpy_include/numpy/npy_cpu.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/npy_endian.h" "$(@D)/numpy_include/numpy/npy_endian.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/npy_interrupt.h" "$(@D)/numpy_include/numpy/npy_interrupt.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/npy_math.h" "$(@D)/numpy_include/numpy/npy_math.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/npy_no_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_no_deprecated_api.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/npy_os.h" "$(@D)/numpy_include/numpy/npy_os.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/numpyconfig.h" "$(@D)/numpy_include/numpy/numpyconfig.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/old_defines.h" "$(@D)/numpy_include/numpy/old_defines.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/oldnumeric.h" "$(@D)/numpy_include/numpy/oldnumeric.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/ufunc_api.txt" "$(@D)/numpy_include/numpy/ufunc_api.txt" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/ufuncobject.h" "$(@D)/numpy_include/numpy/ufuncobject.h" && cp "/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/utils.h" "$(@D)/numpy_include/numpy/utils.h"
+ """,
+)
diff --git a/third_party/toolchains/preconfig/ubuntu14.04/py3/WORKSPACE b/third_party/toolchains/preconfig/ubuntu14.04/py3/WORKSPACE
new file mode 100644
index 0000000000..1d298fefa3
--- /dev/null
+++ b/third_party/toolchains/preconfig/ubuntu14.04/py3/WORKSPACE
@@ -0,0 +1,2 @@
+# DO NOT EDIT: automatically generated WORKSPACE file for python_configure rule
+workspace(name = "local_config_python")
diff --git a/third_party/zlib.BUILD b/third_party/zlib.BUILD
index d164ee719c..33694eaaae 100644
--- a/third_party/zlib.BUILD
+++ b/third_party/zlib.BUILD
@@ -2,18 +2,6 @@ package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # BSD/MIT-like license (for zlib)
-config_setting(
- name = "windows",
- values = {"cpu": "x64_windows"},
- visibility = ["//visibility:public"],
-)
-
-config_setting(
- name = "windows_msvc",
- values = {"cpu": "x64_windows_msvc"},
- visibility = ["//visibility:public"],
-)
-
cc_library(
name = "zlib",
srcs = [
@@ -45,8 +33,7 @@ cc_library(
],
hdrs = ["zlib.h"],
copts = select({
- ":windows": [],
- ":windows_msvc": [],
+ "@org_tensorflow//tensorflow:windows": [],
"//conditions:default": [
"-Wno-shift-negative-value",
"-DZ_HAVE_UNISTD_H",