Skip to content

Commit

Permalink
[Fix] Fix various issues.
Browse files Browse the repository at this point in the history
- Support NCCL separated compilation.
- Support graceful exit of gRPC servers.
- Fix double output of tf.logging.
- Fix build break caused by multiple definition of zlib.
- Remove deprecation messages.
  • Loading branch information
2sin18 committed Jun 23, 2021
1 parent 17a04a9 commit 63471ea
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 13 deletions.
9 changes: 9 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ workspace(name = "org_tensorflow")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")

http_archive(
name="io_bazel_rules_docker",
sha256="e2674bb36d5c39e3dfd28c18fb6f0568083c98209f0c5a0ee8eaf35ab4766f1d",
strip_prefix="rules_docker-251f6a68b439744094faff800cd029798edf9faa",
urls=[
"https://github.com/bazelbuild/rules_docker/archive/251f6a68b439744094faff800cd029798edf9faa.tar.gz"
],
)

http_archive(
name = "io_bazel_rules_closure",
sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
Expand Down
3 changes: 2 additions & 1 deletion tensorflow/core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ filegroup(
cc_library(
name = "platform_port",
srcs = [
"//tensorflow/core/platform:cpu_info.cc",
"//tensorflow/core/platform:cpu_info",
"//tensorflow/core/platform:legacy_platform_port_srcs",
],
hdrs = [
Expand Down Expand Up @@ -889,6 +889,7 @@ tf_cuda_library(
"framework/ops_util.h",
"framework/partial_tensor_shape.h",
"framework/queue_interface.h",
"framework/reader_base.h",
"framework/reader_interface.h",
"framework/reader_op_kernel.h",
"framework/register_types.h",
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace {
class NoReusePortOption : public ::grpc::ServerBuilderOption {
public:
void UpdateArguments(::grpc::ChannelArguments* args) override {
args->SetInt(GRPC_ARG_ALLOW_REUSEPORT, 0);
args->SetInt(GRPC_ARG_ALLOW_REUSEPORT, 1);
}

void UpdatePlugins(std::vector<std::unique_ptr<::grpc::ServerBuilderPlugin>>*
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/core/util/gpu_device_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ limitations under the License.

#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
#if GOOGLE_CUDA
#include "third_party/gpus/cuda/include/cuComplex.h"
#include "third_party/gpus/cuda/include/cuda.h"
#include <cuComplex.h>
#include <cuda.h>
#endif
#include "tensorflow/core/platform/types.h"
#include "tensorflow/core/util/gpu_cuda_alias.h"
Expand Down
1 change: 1 addition & 0 deletions tensorflow/python/platform/tf_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def get_logger():
_handler.setFormatter(_logging.Formatter(_logging.BASIC_FORMAT, None))
logger.addHandler(_handler)

logger.propagate = False
_logger = logger
return _logger

Expand Down
4 changes: 1 addition & 3 deletions tensorflow/python/training/server_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ def __del__(self):
# we leak instead of calling c_api.TF_DeleteServer here.
# See:
# https://github.com/tensorflow/tensorflow/blob/0495317a6e9dd4cac577b9d5cf9525e62b571018/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h#L73
except errors.UnimplementedError:
pass
except AttributeError:
except: # pylint: disable=bare-except
# At shutdown, `c_api` may have been garbage collected.
pass
self._server = None
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/python/util/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@


# Allow deprecation warnings to be silenced temporarily with a context manager.
_PRINT_DEPRECATION_WARNINGS = True
_PRINT_DEPRECATION_WARNINGS = False

# Remember which deprecation warnings have been printed already.
_PRINTED_WARNING = {}
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/python/util/module_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from tensorflow.tools.compatibility import all_renames_v2


_PER_MODULE_WARNING_LIMIT = 1
_PER_MODULE_WARNING_LIMIT = 0


def get_rename_v2(name):
Expand Down
8 changes: 5 additions & 3 deletions tensorflow/tensorflow.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ def tf_copts(
(if_not_windows(["-fno-exceptions"]) if not allow_exceptions else []) +
if_cuda(["-DGOOGLE_CUDA=1"]) +
if_tensorrt(["-DGOOGLE_TENSORRT=1"]) +
if_nccl(["-DGOOGLE_NCCL=1"]) +
if_mkl(["-DINTEL_MKL=1", "-DEIGEN_USE_VML"]) +
if_mkl_open_source_only(["-DINTEL_MKL_DNN_ONLY"]) +
if_mkl_v1_open_source_only(["-DENABLE_MKLDNN_V1"]) +
Expand Down Expand Up @@ -1351,7 +1352,8 @@ def tf_gpu_library(deps = None, cuda_deps = None, copts = tf_copts(), **kwargs):
- The cuda runtime is added as a dependency (if necessary).
- The library additionally passes -DGOOGLE_CUDA=1 to the list of copts.
- In addition, when the library is also built with TensorRT enabled, it
additionally passes -DGOOGLE_TENSORRT=1 to the list of copts.
additionally passes -DGOOGLE_TENSORRT=1 to the list of copts. Likewise
for NCCL and -DGOOGLE_NCCL=1.
Args:
- cuda_deps: BUILD dependencies which will be linked if and only if:
Expand All @@ -1373,7 +1375,7 @@ def tf_gpu_library(deps = None, cuda_deps = None, copts = tf_copts(), **kwargs):
]) + if_rocm_is_configured(cuda_deps + [
"@local_config_rocm//rocm:rocm_headers",
]),
copts = (copts + if_cuda(["-DGOOGLE_CUDA=1"]) + if_rocm(["-DTENSORFLOW_USE_ROCM=1"]) + if_mkl(["-DINTEL_MKL=1"]) + if_mkl_open_source_only(["-DINTEL_MKL_DNN_ONLY"]) + if_enable_mkl(["-DENABLE_MKL"]) + if_tensorrt(["-DGOOGLE_TENSORRT=1"])),
copts = (copts + if_cuda(["-DGOOGLE_CUDA=1"]) + if_rocm(["-DTENSORFLOW_USE_ROCM=1"]) + if_mkl(["-DINTEL_MKL=1"]) + if_mkl_open_source_only(["-DINTEL_MKL_DNN_ONLY"]) + if_enable_mkl(["-DENABLE_MKL"]) + if_tensorrt(["-DGOOGLE_TENSORRT=1"]) + if_nccl(["-DGOOGLE_NCCL=1"])),
**kwargs
)

Expand Down Expand Up @@ -1794,7 +1796,7 @@ def tf_custom_op_library(name, srcs = [], gpu_srcs = [], deps = [], linkopts = [
native.cc_library(
name = basename + "_gpu",
srcs = gpu_srcs,
copts = copts + _cuda_copts() + if_tensorrt(["-DGOOGLE_TENSORRT=1"]),
copts = copts + _cuda_copts() + if_tensorrt(["-DGOOGLE_TENSORRT=1"]) + if_nccl(["-DGOOGLE_NCCL=1"]),
features = if_cuda(["-use_header_modules"]),
deps = deps + if_cuda_is_configured_compat(cuda_deps) + if_rocm_is_configured(rocm_deps),
**kwargs
Expand Down
1 change: 0 additions & 1 deletion third_party/llvm/llvm.autogenerated.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3404,7 +3404,6 @@ cc_library(
deps = [
":config",
":demangle",
"@zlib_archive//:zlib",
],
)

Expand Down

0 comments on commit 63471ea

Please sign in to comment.