1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# Ops that communicate with other processes via MPI.
package(default_visibility = [
"//tensorflow:__subpackages__",
])
licenses(["notice"]) # Apache 2.0
load(
"//tensorflow/core:platform/default/build_config.bzl",
"tf_additional_mpi_lib_defines",
"tf_proto_library_cc",
)
tf_proto_library_cc(
name = "mpi_message_proto",
srcs = ["mpi_message.proto"],
cc_api_version = 2,
protodeps = ["//tensorflow/core:protos_all"],
visibility = [
"//tensorflow:__subpackages__",
],
)
cc_library(
name = "mpi_defines",
defines = tf_additional_mpi_lib_defines(),
)
load(
"//tensorflow:tensorflow.bzl",
"tf_custom_op_py_library",
"tf_custom_op_library",
"tf_gen_op_wrapper_py",
"tf_gen_op_libs",
"tf_kernel_library",
"tf_py_test",
)
tf_custom_op_library(
name = "python/ops/_mpi_ops.so",
srcs = [
"kernels/mpi_ops.cc",
"kernels/ring.cc",
"kernels/ring.h",
"ops/mpi_ops.cc",
],
gpu_srcs = [
"kernels/ring.cu.cc",
"kernels/ring.h",
],
deps = [
":mpi_defines",
":mpi_message_proto_cc",
"//third_party/mpi",
],
)
tf_kernel_library(
name = "mpi_ops_kernels",
srcs = [
"kernels/mpi_ops.cc",
"kernels/ring.cc",
],
hdrs = [
"kernels/ring.h",
],
gpu_srcs = [
"kernels/ring.cu.cc",
],
deps = [
":mpi_defines",
"//tensorflow/core:core_cpu",
"//tensorflow/core:framework",
"//tensorflow/core:gpu_headers_lib",
"//tensorflow/core:lib",
"//tensorflow/core:proto_text",
"//tensorflow/core:stream_executor",
],
# TODO: Include? alwayslink = 1,
)
tf_gen_op_libs(
op_lib_names = ["mpi_ops"],
)
tf_gen_op_wrapper_py(
name = "mpi_ops",
deps = [":mpi_ops_op_lib"],
)
tf_custom_op_py_library(
name = "mpi_collectives_py",
srcs = [
"__init__.py",
"python/ops/mpi_ops.py",
],
dso = [
":python/ops/_mpi_ops.so",
],
kernels = [
":mpi_ops_kernels",
":mpi_ops_op_lib",
],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
":mpi_ops",
"//tensorflow/contrib/util:util_py",
"//tensorflow/python:device",
"//tensorflow/python:framework_ops",
"//tensorflow/python:platform",
"//tensorflow/python:util",
],
)
tf_py_test(
name = "mpi_ops_test",
srcs = ["mpi_ops_test.py"],
additional_deps = [
"//tensorflow:tensorflow_py",
"//tensorflow/python:platform",
],
data = [
":python/ops/_mpi_ops.so",
],
tags = ["manual"],
)
filegroup(
name = "all_files",
srcs = glob(
["**/*"],
exclude = [
"**/METADATA",
"**/OWNERS",
],
),
visibility = ["//tensorflow:__subpackages__"],
)
|