Return select() statement from if_cuda_is_configured().
PiperOrigin-RevId: 247196015
This commit is contained in:
parent
d58b53e19c
commit
66b193faee
@ -3326,7 +3326,7 @@ tf_cuda_library(
|
|||||||
name = "device_tracer",
|
name = "device_tracer",
|
||||||
srcs = tf_additional_device_tracer_srcs(),
|
srcs = tf_additional_device_tracer_srcs(),
|
||||||
copts = tf_copts(),
|
copts = tf_copts(),
|
||||||
cuda_deps = if_cuda_is_configured(tf_additional_cupti_wrapper_deps() + tf_additional_device_tracer_cuda_deps()),
|
cuda_deps = tf_additional_cupti_wrapper_deps() + tf_additional_device_tracer_cuda_deps(),
|
||||||
visibility = [
|
visibility = [
|
||||||
"//tensorflow:internal",
|
"//tensorflow:internal",
|
||||||
],
|
],
|
||||||
|
@ -198,12 +198,22 @@ cc_library(
|
|||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
alias(
|
||||||
|
name = "cublas_lib",
|
||||||
|
actual = if_static(
|
||||||
|
"@local_config_cuda//cuda:cublas",
|
||||||
|
":cublas_stub",
|
||||||
|
),
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "cublas_plugin",
|
name = "cublas_plugin",
|
||||||
srcs = if_cuda_is_configured(["cuda_blas.cc"]),
|
srcs = if_cuda_is_configured(["cuda_blas.cc"]),
|
||||||
hdrs = if_cuda_is_configured(["cuda_blas.h"]),
|
hdrs = if_cuda_is_configured(["cuda_blas.h"]),
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = if_cuda_is_configured([
|
deps = if_cuda_is_configured([
|
||||||
|
":cublas_lib",
|
||||||
":cuda_activation",
|
":cuda_activation",
|
||||||
":cuda_gpu_executor",
|
":cuda_gpu_executor",
|
||||||
":cuda_platform_id",
|
":cuda_platform_id",
|
||||||
@ -223,10 +233,7 @@ cc_library(
|
|||||||
"//tensorflow/stream_executor/gpu:gpu_helpers_header",
|
"//tensorflow/stream_executor/gpu:gpu_helpers_header",
|
||||||
"//tensorflow/stream_executor/lib",
|
"//tensorflow/stream_executor/lib",
|
||||||
"//tensorflow/stream_executor/platform",
|
"//tensorflow/stream_executor/platform",
|
||||||
] + if_static(
|
]) + [
|
||||||
["@local_config_cuda//cuda:cublas"],
|
|
||||||
[":cublas_stub"],
|
|
||||||
)) + [
|
|
||||||
"@com_google_absl//absl/strings:str_format",
|
"@com_google_absl//absl/strings:str_format",
|
||||||
"@com_google_absl//absl/synchronization",
|
"@com_google_absl//absl/synchronization",
|
||||||
],
|
],
|
||||||
@ -244,6 +251,15 @@ cc_library(
|
|||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
alias(
|
||||||
|
name = "cufft_lib",
|
||||||
|
actual = if_static(
|
||||||
|
"@local_config_cuda//cuda:cufft",
|
||||||
|
":cufft_stub",
|
||||||
|
),
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "cufft_plugin",
|
name = "cufft_plugin",
|
||||||
srcs = if_cuda_is_configured(["cuda_fft.cc"]),
|
srcs = if_cuda_is_configured(["cuda_fft.cc"]),
|
||||||
@ -255,6 +271,7 @@ cc_library(
|
|||||||
":cuda_platform_id",
|
":cuda_platform_id",
|
||||||
":cuda_stream",
|
":cuda_stream",
|
||||||
":cuda_helpers",
|
":cuda_helpers",
|
||||||
|
":cufft_lib",
|
||||||
"@local_config_cuda//cuda:cuda_headers",
|
"@local_config_cuda//cuda:cuda_headers",
|
||||||
"//tensorflow/stream_executor:event",
|
"//tensorflow/stream_executor:event",
|
||||||
"//tensorflow/stream_executor:fft",
|
"//tensorflow/stream_executor:fft",
|
||||||
@ -264,10 +281,7 @@ cc_library(
|
|||||||
"//tensorflow/stream_executor/lib",
|
"//tensorflow/stream_executor/lib",
|
||||||
"//tensorflow/stream_executor/platform",
|
"//tensorflow/stream_executor/platform",
|
||||||
"//tensorflow/stream_executor/platform:dso_loader",
|
"//tensorflow/stream_executor/platform:dso_loader",
|
||||||
] + if_static(
|
]),
|
||||||
["@local_config_cuda//cuda:cufft"],
|
|
||||||
[":cufft_stub"],
|
|
||||||
)),
|
|
||||||
alwayslink = True,
|
alwayslink = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -282,6 +296,15 @@ cc_library(
|
|||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
alias(
|
||||||
|
name = "cudnn_lib",
|
||||||
|
actual = if_static(
|
||||||
|
"@local_config_cuda//cuda:cudnn",
|
||||||
|
":cudnn_stub",
|
||||||
|
),
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "cudnn_plugin",
|
name = "cudnn_plugin",
|
||||||
srcs = if_cuda_is_configured(["cuda_dnn.cc"]),
|
srcs = if_cuda_is_configured(["cuda_dnn.cc"]),
|
||||||
@ -296,6 +319,7 @@ cc_library(
|
|||||||
":cuda_stream",
|
":cuda_stream",
|
||||||
":cuda_timer",
|
":cuda_timer",
|
||||||
":cudnn_version",
|
":cudnn_version",
|
||||||
|
":cudnn_lib",
|
||||||
"@com_google_absl//absl/strings",
|
"@com_google_absl//absl/strings",
|
||||||
"//third_party/eigen3",
|
"//third_party/eigen3",
|
||||||
"@local_config_cuda//cuda:cuda_headers",
|
"@local_config_cuda//cuda:cuda_headers",
|
||||||
@ -309,10 +333,7 @@ cc_library(
|
|||||||
"//tensorflow/stream_executor:temporary_device_memory",
|
"//tensorflow/stream_executor:temporary_device_memory",
|
||||||
"//tensorflow/stream_executor/lib",
|
"//tensorflow/stream_executor/lib",
|
||||||
"//tensorflow/stream_executor/platform",
|
"//tensorflow/stream_executor/platform",
|
||||||
]) + tf_additional_cudnn_plugin_deps() + if_cuda_is_configured(if_static(
|
]) + tf_additional_cudnn_plugin_deps() + ["@com_google_absl//absl/synchronization"],
|
||||||
["@local_config_cuda//cuda:cudnn"],
|
|
||||||
[":cudnn_stub"],
|
|
||||||
)) + ["@com_google_absl//absl/synchronization"],
|
|
||||||
alwayslink = True,
|
alwayslink = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -327,6 +348,15 @@ cc_library(
|
|||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
alias(
|
||||||
|
name = "curand_lib",
|
||||||
|
actual = if_static(
|
||||||
|
"@local_config_cuda//cuda:curand",
|
||||||
|
":curand_stub",
|
||||||
|
),
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "curand_plugin",
|
name = "curand_plugin",
|
||||||
srcs = if_cuda_is_configured(["cuda_rng.cc"]),
|
srcs = if_cuda_is_configured(["cuda_rng.cc"]),
|
||||||
@ -337,6 +367,7 @@ cc_library(
|
|||||||
":cuda_platform_id",
|
":cuda_platform_id",
|
||||||
":cuda_stream",
|
":cuda_stream",
|
||||||
":cuda_helpers",
|
":cuda_helpers",
|
||||||
|
":curand_lib",
|
||||||
"@local_config_cuda//cuda:cuda_headers",
|
"@local_config_cuda//cuda:cuda_headers",
|
||||||
"//tensorflow/stream_executor:event",
|
"//tensorflow/stream_executor:event",
|
||||||
"//tensorflow/stream_executor:plugin_registry",
|
"//tensorflow/stream_executor:plugin_registry",
|
||||||
@ -346,10 +377,7 @@ cc_library(
|
|||||||
"//tensorflow/stream_executor/lib",
|
"//tensorflow/stream_executor/lib",
|
||||||
"//tensorflow/stream_executor/platform",
|
"//tensorflow/stream_executor/platform",
|
||||||
"//tensorflow/stream_executor/platform:dso_loader",
|
"//tensorflow/stream_executor/platform:dso_loader",
|
||||||
] + if_static(
|
]),
|
||||||
["@local_config_cuda//cuda:curand"],
|
|
||||||
[":curand_stub"],
|
|
||||||
)),
|
|
||||||
alwayslink = True,
|
alwayslink = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
4
third_party/gpus/cuda/build_defs.bzl.tpl
vendored
4
third_party/gpus/cuda/build_defs.bzl.tpl
vendored
@ -29,5 +29,5 @@ def if_cuda_is_configured(x):
|
|||||||
--config=cuda. Used to allow non-CUDA code to depend on CUDA libraries.
|
--config=cuda. Used to allow non-CUDA code to depend on CUDA libraries.
|
||||||
"""
|
"""
|
||||||
if cuda_is_configured():
|
if cuda_is_configured():
|
||||||
return x
|
return select({"//conditions:default": x})
|
||||||
return []
|
return select({"//conditions:default": []})
|
||||||
|
@ -27,5 +27,5 @@ def if_cuda_is_configured(x):
|
|||||||
--config=cuda. Used to allow non-CUDA code to depend on CUDA libraries.
|
--config=cuda. Used to allow non-CUDA code to depend on CUDA libraries.
|
||||||
"""
|
"""
|
||||||
if cuda_is_configured():
|
if cuda_is_configured():
|
||||||
return x
|
return select({"//conditions:default": x})
|
||||||
return []
|
return select({"//conditions:default": []})
|
||||||
|
Loading…
Reference in New Issue
Block a user