1 # Description: 2 # Verbs RDMA communication interfaces and implementations for TensorFlow. 3 4 package(default_visibility = [ 5 "//tensorflow:__subpackages__", 6 ]) 7 8 licenses(["notice"]) # Apache 2.0 9 10 load("//tensorflow:tensorflow.bzl", "tf_cuda_library") 11 12 exports_files(["LICENSE"]) 13 14 filegroup( 15 name = "all_files", 16 srcs = glob( 17 ["**/*"], 18 exclude = [ 19 "**/METADATA", 20 "**/OWNERS", 21 ], 22 ), 23 visibility = ["//tensorflow:__subpackages__"], 24 ) 25 26 filegroup( 27 name = "c_srcs", 28 data = glob([ 29 "**/*.cc", 30 "**/*.h", 31 ]), 32 ) 33 34 # For platform specific build config 35 load( 36 "//tensorflow/core:platform/default/build_config.bzl", 37 "tf_proto_library_cc", 38 ) 39 40 tf_proto_library_cc( 41 name = "verbs_service_proto", 42 srcs = ["verbs_service.proto"], 43 has_services = 1, 44 cc_api_version = 2, 45 visibility = [ 46 "//tensorflow:__subpackages__", 47 ], 48 ) 49 50 cc_library( 51 name = "verbs_util", 52 srcs = ["verbs_util.cc"], 53 hdrs = ["verbs_util.h"], 54 deps = [ 55 "//tensorflow/core:framework", 56 "//tensorflow/core:lib", 57 ], 58 ) 59 60 cc_library( 61 name = "grpc_verbs_service", 62 srcs = ["grpc_verbs_service.cc"], 63 hdrs = ["grpc_verbs_service.h"], 64 deps = [ 65 ":grpc_verbs_service_impl", 66 ":rdma_mgr", 67 ":verbs_service_proto_cc", 68 "//tensorflow/core:lib_internal", 69 "//tensorflow/core/distributed_runtime:session_mgr", 70 "//tensorflow/core/distributed_runtime/rpc:async_service_interface", 71 "//tensorflow/core/distributed_runtime/rpc:grpc_call", 72 "//tensorflow/core/distributed_runtime/rpc:grpc_util", 73 "@grpc//:grpc++_unsecure", 74 ], 75 alwayslink = 1, 76 ) 77 78 cc_library( 79 name = "grpc_verbs_service_impl", 80 srcs = ["grpc_verbs_service_impl.cc"], 81 hdrs = ["grpc_verbs_service_impl.h"], 82 deps = [ 83 ":verbs_service_proto_cc", 84 "@grpc//:grpc++_unsecure", 85 ], 86 ) 87 88 cc_library( 89 name = "grpc_verbs_client", 90 srcs = ["grpc_verbs_client.cc"], 91 hdrs = ["grpc_verbs_client.h"], 92 deps = [ 93 ":grpc_verbs_service_impl", 94 ":verbs_service_proto_cc", 95 "//tensorflow/core:lib", 96 "//tensorflow/core/distributed_runtime:call_options", 97 "//tensorflow/core/distributed_runtime/rpc:grpc_util", 98 ], 99 alwayslink = 1, 100 ) 101 102 cc_library( 103 name = "rdma_rendezvous_mgr", 104 srcs = ["rdma_rendezvous_mgr.cc"], 105 hdrs = ["rdma_rendezvous_mgr.h"], 106 deps = [ 107 ":rdma_mgr", 108 ":verbs_util", 109 "//tensorflow/core:core_cpu_internal", 110 "//tensorflow/core:gpu_runtime", 111 "//tensorflow/core:lib", 112 "//tensorflow/core/distributed_runtime:base_rendezvous_mgr", 113 "//tensorflow/core/distributed_runtime:worker_env", 114 ], 115 ) 116 117 tf_cuda_library( 118 name = "rdma_mgr", 119 srcs = ["rdma_mgr.cc"], 120 hdrs = ["rdma_mgr.h"], 121 deps = [ 122 ":grpc_verbs_client", 123 ":rdma", 124 ":verbs_service_proto_cc", 125 "//tensorflow/core:core_cpu_internal", 126 "//tensorflow/core:lib", 127 "//tensorflow/core:lib_internal", 128 "//tensorflow/core/distributed_runtime:session_mgr", 129 "//tensorflow/core/distributed_runtime:worker_env", 130 "//tensorflow/core/distributed_runtime/rpc:grpc_channel", 131 "//tensorflow/core/distributed_runtime/rpc:grpc_worker_cache", 132 ], 133 ) 134 135 tf_cuda_library( 136 name = "rdma", 137 srcs = ["rdma.cc"], 138 hdrs = ["rdma.h"], 139 linkopts = select({ 140 "//tensorflow:with_verbs_support": ["-libverbs"], 141 "//conditions:default": [], 142 }), 143 deps = [ 144 ":grpc_verbs_client", 145 ":verbs_service_proto_cc", 146 ":verbs_util", 147 "//tensorflow/core:core_cpu_internal", 148 "//tensorflow/core:framework", 149 "//tensorflow/core:framework_internal", 150 "//tensorflow/core:gpu_runtime", 151 "//tensorflow/core:lib", 152 "//tensorflow/core:lib_internal", 153 "//tensorflow/core/distributed_runtime:rendezvous_mgr_interface", 154 "//tensorflow/core/distributed_runtime:session_mgr", 155 "//tensorflow/core/distributed_runtime:worker_env", 156 ], 157 ) 158 159 cc_library( 160 name = "verbs_server_lib", 161 srcs = ["verbs_server_lib.cc"], 162 hdrs = ["verbs_server_lib.h"], 163 linkstatic = 1, # Seems to be needed since alwayslink is broken in bazel 164 deps = [ 165 ":grpc_verbs_service", 166 ":rdma_mgr", 167 ":rdma_rendezvous_mgr", 168 "//tensorflow/core:lib", 169 "//tensorflow/core/distributed_runtime:server_lib", 170 "//tensorflow/core/distributed_runtime/rpc:grpc_server_lib", 171 ], 172 alwayslink = 1, 173 ) 174