Copying cuBLAS and cuDNN headers into separate directories.

Make {CUDA|cuDNN} headers available under third_party/gpus/{cuda|cudnn}/ instead of cuda/

PiperOrigin-RevId: 247177891
This commit is contained in:
A. Unique TensorFlower 2019-05-08 02:36:07 -07:00 committed by TensorFlower Gardener
parent 5309596211
commit d58b53e19c
60 changed files with 203 additions and 270 deletions

View File

@ -57,7 +57,7 @@ limitations under the License.
#if GOOGLE_CUDA
#if GOOGLE_TENSORRT
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
#include "tensorrt/include/NvInfer.h"
namespace tensorflow {
namespace tensorrt {

View File

@ -50,8 +50,8 @@ limitations under the License.
#if GOOGLE_CUDA
#if GOOGLE_TENSORRT
#include "cuda/include/cuda.h"
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
#include "tensorrt/include/NvInfer.h"
namespace tensorflow {

View File

@ -41,7 +41,7 @@ limitations under the License.
#if GOOGLE_CUDA
#if GOOGLE_TENSORRT
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
#include "tensorrt/include/NvInfer.h"
namespace tensorflow {

View File

@ -32,7 +32,7 @@ limitations under the License.
#if GOOGLE_CUDA
#if GOOGLE_TENSORRT
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
namespace tensorflow {
namespace tensorrt {

View File

@ -20,8 +20,8 @@ limitations under the License.
#if GOOGLE_CUDA
#if GOOGLE_TENSORRT
#include "cuda/include/cuda.h"
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
#include "tensorrt/include/NvInfer.h"
namespace tensorflow {

View File

@ -19,7 +19,7 @@ limitations under the License.
#if GOOGLE_CUDA
#if GOOGLE_TENSORRT
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
#endif // GOOGLE_TENSORRT
#endif // GOOGLE_CUDA

View File

@ -22,7 +22,7 @@ limitations under the License.
#if GOOGLE_CUDA
#if GOOGLE_TENSORRT
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
namespace tensorflow {
namespace tensorrt {

View File

@ -25,7 +25,7 @@ limitations under the License.
#if GOOGLE_CUDA
#if GOOGLE_TENSORRT
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
#include "tensorrt/include/NvInfer.h"
namespace tensorflow {

View File

@ -18,8 +18,8 @@ limitations under the License.
#include <complex>
#include "cuda/include/cublas_v2.h"
#include "cuda/include/cusolverDn.h"
#include "third_party/gpus/cuda/include/cublas_v2.h"
#include "third_party/gpus/cuda/include/cusolverDn.h"
#include "tensorflow/compiler/xla/statusor.h"
#include "tensorflow/compiler/xla/types.h"
#include "tensorflow/compiler/xla/util.h"

View File

@ -42,7 +42,7 @@ limitations under the License.
#if GOOGLE_CUDA
#include "google/protobuf/duration.pb.h"
#include "absl/time/time.h"
#include "cuda/include/cudnn.h"
#include "third_party/gpus/cudnn/cudnn.h"
#include "tensorflow/core/kernels/conv_ops_gpu.h"
#include "tensorflow/core/platform/logger.h"
#include "tensorflow/core/platform/stream_executor.h"

View File

@ -21,7 +21,7 @@ limitations under the License.
#include <vector>
#define EIGEN_USE_GPU
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/platform/stream_executor.h"
#include "tensorflow/core/util/gpu_launch_config.h"

View File

@ -18,7 +18,7 @@ limitations under the License.
#if GOOGLE_CUDA
#if GOOGLE_TENSORRT
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
namespace tensorflow {
namespace tensorrt {

View File

@ -50,8 +50,8 @@ limitations under the License.
#include "tensorflow/core/util/device_name_utils.h"
#ifdef GOOGLE_CUDA
#include "cuda/include/cuda.h"
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
#endif // GOOGLE_CUDA
namespace tensorflow {

View File

@ -14,7 +14,7 @@ limitations under the License.
==============================================================================*/
#ifdef GOOGLE_CUDA
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include "tensorflow/stream_executor/cuda/cuda_activation.h"
#endif // GOOGLE_CUDA

View File

@ -78,7 +78,7 @@ limitations under the License.
#if !defined(PLATFORM_GOOGLE)
#if GOOGLE_CUDA
#include "cuda/cuda_config.h"
#include "third_party/gpus/cuda/cuda_config.h"
#endif
#endif

View File

@ -14,7 +14,7 @@ limitations under the License.
==============================================================================*/
#ifdef GOOGLE_CUDA
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda.h"
#define EIGEN_USE_GPU
#endif

View File

@ -34,8 +34,8 @@ limitations under the License.
#include "tensorflow/core/public/version.h"
#ifdef GOOGLE_CUDA
#include "cuda/include/cuda.h"
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
#endif // GOOGLE_CUDA
namespace tensorflow {

View File

@ -18,9 +18,9 @@ limitations under the License.
#include "third_party/eigen3/Eigen/Core"
#if GOOGLE_CUDA
#include "cuda/include/cuda.h"
#include "cuda/include/cuda_runtime_api.h"
#include "cuda/include/cudnn.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cudnn/cudnn.h"
#endif
#if TENSORFLOW_USE_ROCM

View File

@ -22,7 +22,7 @@ limitations under the License.
#if GOOGLE_CUDA
// Needed for CUDA_VERSION macro.
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda.h"
#endif // GOOGLE_CUDA
namespace tensorflow {

View File

@ -16,7 +16,7 @@ limitations under the License.
#include "tensorflow/core/kernels/batch_matmul_op_impl.h"
#if GOOGLE_CUDA
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda.h"
#endif // GOOGLE_CUDA
namespace tensorflow {

View File

@ -25,7 +25,7 @@ limitations under the License.
#include <limits>
#include <utility>
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include "tensorflow/core/framework/register_types.h"
#include "tensorflow/core/kernels/conv_2d.h"
#include "tensorflow/core/lib/math/math_util.h"

View File

@ -57,7 +57,7 @@ limitations under the License.
#include "tensorflow/core/util/use_cudnn.h"
#if GOOGLE_CUDA
#include "cuda/include/cudnn.h"
#include "third_party/gpus/cudnn/cudnn.h"
#include "tensorflow/core/kernels/conv_ops_gpu.h"
#include "tensorflow/core/platform/stream_executor.h"
#include "tensorflow/core/util/proto/proto_utils.h"

View File

@ -21,8 +21,8 @@
#include <unordered_map>
#include <vector>
#include "cuda/include/cublas_v2.h"
#include "cuda/include/cusolverDn.h"
#include "third_party/gpus/cuda/include/cublas_v2.h"
#include "third_party/gpus/cuda/include/cusolverDn.h"
#include "tensorflow/core/common_runtime/gpu/gpu_event_mgr.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/types.h"

View File

@ -26,8 +26,8 @@ limitations under the License.
#include <functional>
#include <vector>
#include "cuda/include/cublas_v2.h"
#include "cuda/include/cusolverDn.h"
#include "third_party/gpus/cuda/include/cublas_v2.h"
#include "third_party/gpus/cuda/include/cusolverDn.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/lib/core/status.h"

View File

@ -22,7 +22,7 @@
#include <utility>
#include <vector>
#include "cuda/include/cusparse.h"
#include "third_party/gpus/cuda/include/cusparse.h"
#include "tensorflow/core/common_runtime/gpu/gpu_event_mgr.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/types.h"

View File

@ -25,7 +25,7 @@ limitations under the License.
#include <functional>
#include <vector>
#include "cuda/include/cusparse.h"
#include "third_party/gpus/cuda/include/cusparse.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/framework/tensor_types.h"

View File

@ -38,7 +38,7 @@ limitations under the License.
#include "tensorflow/core/util/work_sharder.h"
#if GOOGLE_CUDA
#include "cuda/include/cudnn.h"
#include "third_party/gpus/cudnn/cudnn.h"
#include "tensorflow/core/platform/stream_executor.h"
#endif // GOOGLE_CUDA

View File

@ -39,7 +39,7 @@ limitations under the License.
#include "tensorflow/core/util/work_sharder.h"
#if GOOGLE_CUDA
#include "cuda/include/cudnn.h"
#include "third_party/gpus/cudnn/cudnn.h"
#include "tensorflow/core/platform/stream_executor.h"
#endif // GOOGLE_CUDA

View File

@ -15,7 +15,7 @@ limitations under the License.
#if GOOGLE_CUDA
#define EIGEN_USE_GPU
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include "tensorflow/core/kernels/fused_batch_norm_op.h"
#include "tensorflow/core/util/gpu_kernel_helper.h"

View File

@ -35,7 +35,7 @@ limitations under the License.
#endif
#if GOOGLE_CUDA
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include "tensorflow/core/platform/stream_executor.h"
#include "tensorflow/core/util/stream_executor_util.h"
#endif // GOOGLE_CUDA

View File

@ -25,7 +25,7 @@ limitations under the License.
#include "tensorflow/core/kernels/fill_functor.h"
#include "tensorflow/core/util/matmul_autotune.h"
#if GOOGLE_CUDA
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include "tensorflow/core/kernels/gpu_utils.h"
#include "tensorflow/core/platform/stream_executor.h"
#endif // GOOGLE_CUDA

View File

@ -41,7 +41,7 @@ limitations under the License.
#include "tensorflow/core/util/use_cudnn.h"
#if GOOGLE_CUDA
#include "cuda/include/cudnn.h"
#include "third_party/gpus/cudnn/cudnn.h"
#include "tensorflow/core/kernels/maxpooling_op_gpu.h"
#include "tensorflow/core/kernels/pooling_ops_common_gpu.h"
#include "tensorflow/core/platform/stream_executor.h"

View File

@ -21,7 +21,7 @@ limitations under the License.
#include "tensorflow/core/framework/tensor.h"
#if GOOGLE_CUDA
#include "cuda/include/cudnn.h"
#include "third_party/gpus/cudnn/cudnn.h"
#include "tensorflow/core/kernels/conv_2d.h"
#include "tensorflow/core/kernels/pooling_ops_common_gpu.h"
#include "tensorflow/core/platform/stream_executor.h"

View File

@ -28,7 +28,7 @@ limitations under the License.
#include "third_party/cub/iterator/counting_input_iterator.cuh"
#include "third_party/cub/iterator/transform_input_iterator.cuh"
#include "third_party/cub/warp/warp_reduce.cuh"
#include "cuda/include/cuComplex.h"
#include "third_party/gpus/cuda/include/cuComplex.h"
#include "tensorflow/core/kernels/reduction_ops.h"
#include "tensorflow/core/lib/core/bits.h"
#include "tensorflow/core/util/gpu_device_functions.h"

View File

@ -29,7 +29,7 @@ limitations under the License.
#include "third_party/cub/block/block_store.cuh"
#include "third_party/cub/iterator/counting_input_iterator.cuh"
#include "third_party/cub/iterator/transform_input_iterator.cuh"
#include "cuda/include/cuComplex.h"
#include "third_party/gpus/cuda/include/cuComplex.h"
#include "tensorflow/core/framework/numeric_types.h"
#include "tensorflow/core/framework/register_types.h"
#include "tensorflow/core/kernels/scan_ops.h"

View File

@ -19,7 +19,7 @@ limitations under the License.
#include <vector>
#if !defined(PLATFORM_GOOGLE)
#include "cuda/cuda_config.h"
#include "third_party/gpus/cuda/cuda_config.h"
#endif
#include "tensorflow/core/platform/logging.h"

View File

@ -25,7 +25,7 @@ limitations under the License.
#include "absl/strings/ascii.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "cuda/extras/CUPTI/include/cupti.h"
#include "third_party/gpus/cuda/extras/CUPTI/include/cupti.h"
#include "tensorflow/core/common_runtime/step_stats_collector.h"
#include "tensorflow/core/framework/step_stats.pb.h"
#include "tensorflow/core/lib/core/errors.h"

View File

@ -31,8 +31,8 @@ limitations under the License.
#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
#if GOOGLE_CUDA
#include "cuda/include/cuComplex.h"
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuComplex.h"
#include "third_party/gpus/cuda/include/cuda.h"
#endif
#include "tensorflow/core/platform/types.h"

View File

@ -19,7 +19,7 @@ limitations under the License.
#if GOOGLE_CUDA || TENSORFLOW_USE_ROCM
#if GOOGLE_CUDA
#include "cuda/include/cuda_fp16.h"
#include "third_party/gpus/cuda/include/cuda_fp16.h"
#endif
#include "tensorflow/core/util/gpu_device_functions.h"
#include "tensorflow/core/util/gpu_launch_config.h"

View File

@ -12,8 +12,8 @@ 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.
==============================================================================*/
#include "cuda/include/cublas.h"
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cublas.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include "tensorflow/stream_executor/lib/env.h"
#include "tensorflow/stream_executor/platform/dso_loader.h"

View File

@ -13,8 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "cuda/include/cublas_v2.h"
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cublas_v2.h"
#include "third_party/gpus/cuda/include/cuda.h"
#define SE_CUDA_DATA_HALF CUDA_R_16F
@ -40,7 +40,7 @@ limitations under the License.
// TODO(b/73793421): Remove the following code block to switch to the second
// approach when the issue is fixed.
#if CUDA_VERSION < 9000
#include "cuda/include/cuda_fp16.h"
#include "third_party/gpus/cuda/include/cuda_fp16.h"
#define EIGEN_HAS_CUDA_FP16
#endif

View File

@ -43,7 +43,7 @@ limitations under the License.
#include "tensorflow/stream_executor/stream.h"
#include "tensorflow/stream_executor/stream_executor_pimpl.h"
// clang-format off
#include "cuda/include/cudnn.h"
#include "third_party/gpus/cudnn/cudnn.h"
#include "absl/strings/string_view.h"
// clang-format on

View File

@ -31,7 +31,7 @@ limitations under the License.
#include "absl/strings/str_format.h"
#include "absl/synchronization/mutex.h"
#include "absl/synchronization/notification.h"
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
#include "tensorflow/stream_executor/cuda/cuda_diagnostics.h"
#include "tensorflow/stream_executor/lib/env.h"
#include "tensorflow/stream_executor/lib/error.h"

View File

@ -20,7 +20,7 @@ limitations under the License.
#ifndef TENSORFLOW_STREAM_EXECUTOR_CUDA_CUDA_FFT_H_
#define TENSORFLOW_STREAM_EXECUTOR_CUDA_CUDA_FFT_H_
#include "cuda/include/cufft.h"
#include "third_party/gpus/cuda/include/cufft.h"
#include "tensorflow/stream_executor/fft.h"
#include "tensorflow/stream_executor/platform/port.h"
#include "tensorflow/stream_executor/plugin_registry.h"

View File

@ -27,7 +27,7 @@ limitations under the License.
#include "tensorflow/stream_executor/platform/logging.h"
#include "tensorflow/stream_executor/rng.h"
// clang-format off
#include "cuda/include/curand.h"
#include "third_party/gpus/cuda/include/curand.h"
// clang-format on
// Formats curandStatus_t to output prettified values into a log stream.

View File

@ -12,7 +12,7 @@ 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.
==============================================================================*/
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include "tensorflow/stream_executor/lib/env.h"
#include "tensorflow/stream_executor/platform/dso_loader.h"

View File

@ -16,7 +16,7 @@ limitations under the License.
// This file wraps cuda runtime calls with dso loader so that we don't need to
// have explicit linking to libcuda.
#include "cuda/include/cuda_runtime_api.h"
#include "third_party/gpus/cuda/include/cuda_runtime_api.h"
#include "tensorflow/stream_executor/lib/env.h"
#include "tensorflow/stream_executor/platform/dso_loader.h"

View File

@ -12,7 +12,7 @@ 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.
==============================================================================*/
#include "cuda/include/cudnn.h"
#include "third_party/gpus/cudnn/cudnn.h"
#include "tensorflow/stream_executor/lib/env.h"
#include "tensorflow/stream_executor/platform/dso_loader.h"

View File

@ -12,7 +12,7 @@ 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.
==============================================================================*/
#include "cuda/include/cufft.h"
#include "third_party/gpus/cuda/include/cufft.h"
#include "tensorflow/stream_executor/lib/env.h"
#include "tensorflow/stream_executor/platform/dso_loader.h"

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "cuda/extras/CUPTI/include/cupti.h"
#include "third_party/gpus/cuda/extras/CUPTI/include/cupti.h"
// IWYU pragma: no_include "perftools/gputools/executor/stream_executor.h"
#include "tensorflow/stream_executor/lib/env.h"
#include "tensorflow/stream_executor/platform/dso_loader.h"

View File

@ -12,7 +12,7 @@ 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.
==============================================================================*/
#include "cuda/include/curand.h"
#include "third_party/gpus/cuda/include/curand.h"
#include "tensorflow/stream_executor/lib/env.h"
#include "tensorflow/stream_executor/platform/dso_loader.h"

View File

@ -12,7 +12,7 @@ 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.
==============================================================================*/
#include "cuda/include/cusolverDn.h"
#include "third_party/gpus/cuda/include/cusolverDn.h"
#include "tensorflow/stream_executor/lib/env.h"
#include "tensorflow/stream_executor/platform/dso_loader.h"

View File

@ -12,7 +12,7 @@ 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.
==============================================================================*/
#include "cuda/include/cusparse.h"
#include "third_party/gpus/cuda/include/cusparse.h"
#include "tensorflow/stream_executor/lib/env.h"
#include "tensorflow/stream_executor/platform/dso_loader.h"

View File

@ -21,7 +21,7 @@ limitations under the License.
#include <stddef.h>
#include "tensorflow/stream_executor/platform/port.h"
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include "tensorflow/stream_executor/device_options.h"
#include "tensorflow/stream_executor/lib/status.h"
#include "tensorflow/stream_executor/lib/statusor.h"

View File

@ -28,8 +28,8 @@ limitations under the License.
#else // CUDA
#include "cuda/include/cuComplex.h"
#include "cuda/include/cuda.h"
#include "third_party/gpus/cuda/include/cuComplex.h"
#include "third_party/gpus/cuda/include/cuda.h"
// cannot include curand.h here
// because it triggers the #error in cuda/cuda_gpu_executor.cc

View File

@ -18,7 +18,7 @@ limitations under the License.
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "cuda/cuda_config.h"
#include "third_party/gpus/cuda/cuda_config.h"
#include "tensorflow/stream_executor/lib/env.h"
#include "tensorflow/stream_executor/lib/error.h"
#include "tensorflow/stream_executor/lib/path.h"

View File

@ -28,36 +28,37 @@ config_setting(
config_setting(
name = "darwin",
values = {"cpu": "darwin"},
visibility = ["//visibility:public"],
)
config_setting(
name = "freebsd",
values = {"cpu": "freebsd"},
visibility = ["//visibility:public"],
)
# Provides CUDA headers for '#include "third_party/gpus/cuda/include/cuda.h"'
# All clients including TensorFlow should use these directives.
cc_library(
name = "cuda_headers",
name = "cuda_virtual_headers",
hdrs = [
"cuda/cuda_config.h",
%{cuda_headers}
":cuda-include"
],
includes = [
".",
"cuda/include",
"cuda/include/crt",
],
visibility = ["//visibility:public"],
include_prefix = "third_party/gpus",
visibility = ["//visibility:private"],
)
# Provides CUDA headers for '#include <cuda.h>'.
# CUDA itself as well as Eigen use these directives.
cc_library(
name = "cuda_headers",
textual_hdrs = [":cuda-include"],
includes = ["cuda/include"],
deps = [":cuda_virtual_headers"],
)
cc_library(
name = "cudart_static",
srcs = ["cuda/lib/%{cudart_static_lib}"],
includes = [
".",
"cuda/include",
],
linkopts = select({
":freebsd": [],
"//conditions:default": ["-ldl"],
@ -65,104 +66,82 @@ cc_library(
"-lpthread",
%{cudart_static_linkopt}
],
visibility = ["//visibility:public"],
)
cc_library(
name = "cuda_driver",
srcs = ["cuda/lib/%{cuda_driver_lib}"],
includes = [
".",
"cuda/include",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "cudart",
srcs = ["cuda/lib/%{cudart_lib}"],
data = ["cuda/lib/%{cudart_lib}"],
includes = [
".",
"cuda/include",
],
linkstatic = 1,
visibility = ["//visibility:public"],
)
cc_library(
name = "cublas_virtual_headers",
hdrs = [":cublas-include"],
include_prefix = "third_party/gpus/cuda/include",
strip_include_prefix = "cublas/include",
visibility = ["//visibility:private"],
deps = [":cuda_headers"],
)
cc_library(
name = "cublas_headers",
textual_hdrs = [":cublas-include"],
includes = ["cublas/include"],
deps = [":cublas_virtual_headers"],
)
cc_library(
name = "cublas",
srcs = ["cuda/lib/%{cublas_lib}"],
data = ["cuda/lib/%{cublas_lib}"],
includes = [
".",
"cuda/include",
],
linkstatic = 1,
visibility = ["//visibility:public"],
)
cc_library(
name = "cusolver",
srcs = ["cuda/lib/%{cusolver_lib}"],
data = ["cuda/lib/%{cusolver_lib}"],
includes = [
".",
"cuda/include",
],
linkopts = ["-lgomp"],
linkstatic = 1,
visibility = ["//visibility:public"],
)
cc_library(
name = "cudnn",
srcs = ["cuda/lib/%{cudnn_lib}"],
data = ["cuda/lib/%{cudnn_lib}"],
includes = [
".",
"cuda/include",
],
linkstatic = 1,
visibility = ["//visibility:public"],
)
cc_library(
name = "cudnn_header",
includes = [
".",
"cuda/include",
],
visibility = ["//visibility:public"],
hdrs = [":cudnn-include"],
include_prefix = "third_party/gpus/cudnn",
strip_include_prefix = "cudnn/include",
deps = [":cuda_headers"],
)
cc_library(
name = "cufft",
srcs = ["cuda/lib/%{cufft_lib}"],
data = ["cuda/lib/%{cufft_lib}"],
includes = [
".",
"cuda/include",
],
linkstatic = 1,
visibility = ["//visibility:public"],
)
cc_library(
name = "curand",
srcs = ["cuda/lib/%{curand_lib}"],
data = ["cuda/lib/%{curand_lib}"],
includes = [
".",
"cuda/include",
],
linkstatic = 1,
visibility = ["//visibility:public"],
)
cc_library(
name = "cuda",
visibility = ["//visibility:public"],
deps = [
":cublas",
":cuda_headers",
@ -173,46 +152,37 @@ cc_library(
],
)
cc_library(
name = "cupti_virtual_headers",
hdrs = [":cuda-extras"],
include_prefix="third_party/gpus",
visibility = ["//visibility:private"],
deps = [":cuda_headers"],
)
cc_library(
name = "cupti_headers",
hdrs = [
"cuda/cuda_config.h",
":cuda-extras",
],
includes = [
".",
"cuda/extras/CUPTI/include/",
],
visibility = ["//visibility:public"],
textual_hdrs = [":cuda-extras"],
includes = ["cuda/extras/CUPTI/include/"],
deps = [":cupti_virtual_headers"],
)
cc_library(
name = "cupti_dsos",
data = ["cuda/lib/%{cupti_lib}"],
includes = [
".",
"cuda/include",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "cusparse",
srcs = ["cuda/lib/%{cusparse_lib}"],
data = ["cuda/lib/%{cusparse_lib}"],
includes = [
".",
"cuda/include",
],
linkopts = ["-lgomp"],
linkstatic = 1,
visibility = ["//visibility:public"],
)
cc_library(
name = "libdevice_root",
data = [":cuda-nvvm"],
visibility = ["//visibility:public"],
)
%{copy_rules}

View File

@ -784,8 +784,11 @@ def _create_dummy_repository(repository_ctx):
"%{curand_lib}": lib_name("curand", cpu_value),
"%{cupti_lib}": lib_name("cupti", cpu_value),
"%{cusparse_lib}": lib_name("cusparse", cpu_value),
"%{copy_rules}": "",
"%{cuda_headers}": "",
"%{copy_rules}": """
filegroup(name="cuda-include")
filegroup(name="cublas-include")
filegroup(name="cudnn-include")
""",
},
)
@ -983,25 +986,21 @@ def _create_local_cuda_repository(repository_ctx):
out_dir = "cuda/extras/CUPTI/include",
),
]
included_files = _read_dir(repository_ctx, cuda_include_path)
if not any([file.endswith("cublas.h") for file in included_files]):
copy_rules.append(make_copy_files_rule(
repository_ctx,
name = "cublas-include",
srcs = [
cublas_include_path + "/cublas.h",
cublas_include_path + "/cublas_v2.h",
cublas_include_path + "/cublas_api.h",
],
outs = [
"cuda/include/cublas.h",
"cuda/include/cublas_v2.h",
"cuda/include/cublas_api.h",
],
))
else:
copy_rules.append("filegroup(name = 'cublas-include')\n")
copy_rules.append(make_copy_files_rule(
repository_ctx,
name = "cublas-include",
srcs = [
cublas_include_path + "/cublas.h",
cublas_include_path + "/cublas_v2.h",
cublas_include_path + "/cublas_api.h",
],
outs = [
"cublas/include/cublas.h",
"cublas/include/cublas_v2.h",
"cublas/include/cublas_api.h",
],
))
cuda_libs = _find_libs(repository_ctx, cuda_config)
cuda_lib_srcs = []
@ -1023,16 +1022,12 @@ def _create_local_cuda_repository(repository_ctx):
out_dir = "cuda/bin",
))
# Copy cudnn.h if cuDNN was not installed to CUDA_TOOLKIT_PATH.
if not any([file.endswith("cudnn.h") for file in included_files]):
copy_rules.append(make_copy_files_rule(
repository_ctx,
name = "cudnn-include",
srcs = [cudnn_header_dir + "/cudnn.h"],
outs = ["cuda/include/cudnn.h"],
))
else:
copy_rules.append("filegroup(name = 'cudnn-include')\n")
copy_rules.append(make_copy_files_rule(
repository_ctx,
name = "cudnn-include",
srcs = [cudnn_header_dir + "/cudnn.h"],
outs = ["cudnn/include/cudnn.h"],
))
# Set up BUILD file for cuda/
_tpl(
@ -1062,11 +1057,6 @@ def _create_local_cuda_repository(repository_ctx):
"%{cupti_lib}": cuda_libs["cupti"].basename,
"%{cusparse_lib}": cuda_libs["cusparse"].basename,
"%{copy_rules}": "\n".join(copy_rules),
"%{cuda_headers}": (
'":cuda-include",\n' +
' ":cublas-include",' +
' ":cudnn-include",'
),
},
"cuda/BUILD",
)

View File

@ -28,37 +28,37 @@ config_setting(
config_setting(
name = "darwin",
values = {"cpu": "darwin"},
visibility = ["//visibility:public"],
)
config_setting(
name = "freebsd",
values = {"cpu": "freebsd"},
visibility = ["//visibility:public"],
)
# Provides CUDA headers for '#include "third_party/gpus/cuda/include/cuda.h"'
# All clients including TensorFlow should use these directives.
cc_library(
name = "cuda_headers",
name = "cuda_virtual_headers",
hdrs = [
"cuda/cuda_config.h",
":cuda-include",
":cudnn-include",
],
includes = [
".",
"cuda/include",
"cuda/include/crt",
],
visibility = ["//visibility:public"],
include_prefix = "third_party/gpus",
visibility = ["//visibility:private"],
)
# Provides CUDA headers for '#include <cuda.h>'.
# CUDA itself as well as Eigen use these directives.
cc_library(
name = "cuda_headers",
includes = ["cuda/include"],
textual_hdrs = [":cuda-include"],
deps = [":cuda_virtual_headers"],
)
cc_library(
name = "cudart_static",
srcs = ["cuda/lib/libcudart_static.a"],
includes = [
".",
"cuda/include",
],
linkopts = select({
":freebsd": [],
"//conditions:default": ["-ldl"],
@ -66,104 +66,82 @@ cc_library(
"-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.10.0"],
data = ["cuda/lib/libcudart.so.10.0"],
includes = [
".",
"cuda/include",
],
linkstatic = 1,
visibility = ["//visibility:public"],
)
cc_library(
name = "cublas_virtual_headers",
hdrs = [":cublas-include"],
include_prefix = "third_party/gpus/cuda/include",
strip_include_prefix = "cublas/include",
visibility = ["//visibility:private"],
deps = [":cuda_headers"],
)
cc_library(
name = "cublas_headers",
includes = ["cublas/include"],
textual_hdrs = [":cublas-include"],
deps = [":cublas_virtual_headers"],
)
cc_library(
name = "cublas",
srcs = ["cuda/lib/libcublas.so.10.0"],
data = ["cuda/lib/libcublas.so.10.0"],
includes = [
".",
"cuda/include",
],
linkstatic = 1,
visibility = ["//visibility:public"],
)
cc_library(
name = "cusolver",
srcs = ["cuda/lib/libcusolver.so.10.0"],
data = ["cuda/lib/libcusolver.so.10.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"],
hdrs = [":cudnn-include"],
include_prefix = "third_party/gpus/cudnn",
strip_include_prefix = "cudnn/include",
deps = [":cuda_headers"],
)
cc_library(
name = "cufft",
srcs = ["cuda/lib/libcufft.so.10.0"],
data = ["cuda/lib/libcufft.so.10.0"],
includes = [
".",
"cuda/include",
],
linkstatic = 1,
visibility = ["//visibility:public"],
)
cc_library(
name = "curand",
srcs = ["cuda/lib/libcurand.so.10.0"],
data = ["cuda/lib/libcurand.so.10.0"],
includes = [
".",
"cuda/include",
],
linkstatic = 1,
visibility = ["//visibility:public"],
)
cc_library(
name = "cuda",
visibility = ["//visibility:public"],
deps = [
":cublas",
":cuda_headers",
@ -174,46 +152,37 @@ cc_library(
],
)
cc_library(
name = "cupti_virtual_headers",
hdrs = [":cuda-extras"],
include_prefix = "third_party/gpus",
visibility = ["//visibility:private"],
deps = [":cuda_headers"],
)
cc_library(
name = "cupti_headers",
hdrs = [
"cuda/cuda_config.h",
":cuda-extras",
],
includes = [
".",
"cuda/extras/CUPTI/include/",
],
visibility = ["//visibility:public"],
includes = ["cuda/extras/CUPTI/include/"],
textual_hdrs = [":cuda-extras"],
deps = [":cupti_virtual_headers"],
)
cc_library(
name = "cupti_dsos",
data = ["cuda/lib/libcupti.so.10.0"],
includes = [
".",
"cuda/include",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "cusparse",
srcs = ["cuda/lib/libcusparse.so.10.0"],
data = ["cuda/lib/libcusparse.so.10.0"],
includes = [
".",
"cuda/include",
],
linkopts = ["-lgomp"],
linkstatic = 1,
visibility = ["//visibility:public"],
)
cc_library(
name = "libdevice_root",
data = [":cuda-nvvm"],
visibility = ["//visibility:public"],
)
genrule(
@ -1253,6 +1222,16 @@ genrule(
cmd = """cp -rLf "/usr/local/cuda-10.0/extras/CUPTI/include/." "$(@D)/cuda/extras/CUPTI/include/" """,
)
genrule(
name = "cublas-include",
outs = [
"cublas/include/cublas.h",
"cublas/include/cublas_v2.h",
"cublas/include/cublas_api.h",
],
cmd = """cp -f "/usr/local/cuda-10.0/include/cublas.h" $(location cublas/include/cublas.h) && cp -f "/usr/local/cuda-10.0/include/cublas_v2.h" $(location cublas/include/cublas_v2.h) && cp -f "/usr/local/cuda-10.0/include/cublas_api.h" $(location cublas/include/cublas_api.h) """,
)
genrule(
name = "cuda-lib",
outs = [
@ -1267,7 +1246,7 @@ genrule(
"cuda/lib/libcupti.so.10.0",
"cuda/lib/libcusparse.so.10.0",
],
cmd = """cp -f "/usr/local/cuda-10.0/lib64/stubs/libcuda.so" $(location cuda/lib/libcuda.so) && cp -f "/usr/local/cuda-10.0/lib64/libcudart.so.10.0" $(location cuda/lib/libcudart.so.10.0) && cp -f "/usr/local/cuda-10.0/lib64/libcudart_static.a" $(location cuda/lib/libcudart_static.a) && cp -f "/usr/local/cuda-10.0/lib64/libcublas.so.10.0" $(location cuda/lib/libcublas.so.10.0) && cp -f "/usr/local/cuda-10.0/lib64/libcusolver.so.10.0" $(location cuda/lib/libcusolver.so.10.0) && cp -f "/usr/local/cuda-10.0/lib64/libcusparse.so.10.0" $(location cuda/lib/libcusparse.so.10.0) && cp -f "/usr/local/cuda-10.0/lib64/libcurand.so.10.0" $(location cuda/lib/libcurand.so.10.0) && cp -f "/usr/local/cuda-10.0/lib64/libcufft.so.10.0" $(location cuda/lib/libcufft.so.10.0) && cp -f "/usr/lib/x86_64-linux-gnu/libcudnn.so.7" $(location cuda/lib/libcudnn.so.7) && cp -f "/usr/local/cuda-10.0/extras/CUPTI/lib64/libcupti.so.10.0" $(location cuda/lib/libcupti.so.10.0) """,
cmd = """cp -f "/usr/local/cuda-10.0/lib64/stubs/libcuda.so" $(location cuda/lib/libcuda.so) && cp -f "/usr/local/cuda-10.0/lib64/libcudart.so.10.0" $(location cuda/lib/libcudart.so.10.0) && cp -f "/usr/local/cuda-10.0/lib64/libcudart_static.a" $(location cuda/lib/libcudart_static.a) && cp -f "/usr/local/cuda-10.0/lib64/libcublas.so.10.0" $(location cuda/lib/libcublas.so.10.0) && cp -f "/usr/local/cuda-10.0/lib64/libcusolver.so.10.0" $(location cuda/lib/libcusolver.so.10.0) && cp -f "/usr/local/cuda-10.0/lib64/libcurand.so.10.0" $(location cuda/lib/libcurand.so.10.0) && cp -f "/usr/local/cuda-10.0/lib64/libcufft.so.10.0" $(location cuda/lib/libcufft.so.10.0) && cp -f "/usr/lib/x86_64-linux-gnu/libcudnn.so.7" $(location cuda/lib/libcudnn.so.7) && cp -f "/usr/local/cuda-10.0/extras/CUPTI/lib64/libcupti.so.10.0" $(location cuda/lib/libcupti.so.10.0) && cp -f "/usr/local/cuda-10.0/lib64/libcusparse.so.10.0" $(location cuda/lib/libcusparse.so.10.0) """,
)
genrule(
@ -1297,7 +1276,7 @@ genrule(
genrule(
name = "cudnn-include",
outs = [
"cuda/include/cudnn.h",
"cudnn/include/cudnn.h",
],
cmd = """cp -f "/usr/include/cudnn.h" $(location cuda/include/cudnn.h) """,
cmd = """cp -f "/usr/include/cudnn.h" $(location cudnn/include/cudnn.h) """,
)

View File

@ -3,12 +3,12 @@
licenses(["notice"])
exports_files(["LICENSE"])
load("@local_config_cuda//cuda:build_defs.bzl", "cuda_default_copts")
package(default_visibility = ["//visibility:public"])
exports_files(["LICENSE"])
cc_library(
name = "tensorrt_headers",
hdrs = [":tensorrt_include"],
@ -18,15 +18,9 @@ cc_library(
cc_library(
name = "tensorrt",
srcs = [
"tensorrt/lib/libnvinfer.so.5",
"tensorrt/lib/libnvinfer_plugin.so.5",
],
srcs = [":tensorrt_lib"],
copts = cuda_default_copts(),
data = [
"tensorrt/lib/libnvinfer.so.5",
"tensorrt/lib/libnvinfer_plugin.so.5",
],
data = [":tensorrt_lib"],
include_prefix = "",
linkstatic = 1,
visibility = ["//visibility:public"],