Skip to content

Commit 12e873b

Browse files
authored
Merge pull request #11160 from typhoonzero/fix_release_013_dist_bug
Fix release 013 dist bug
2 parents e5fc9a1 + 5e85384 commit 12e873b

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

cmake/external/grpc.cmake

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,18 @@ ELSE()
3333
SET(BUILD_CMD make HAS_SYSTEM_PROTOBUF=false -s -j ${NUM_OF_PROCESSOR} static grpc_cpp_plugin)
3434
ENDIF()
3535

36+
# FIXME(wuyi): do not build zlib cares protobuf twice, find a way to build grpc with them
3637
ExternalProject_Add(
3738
extern_grpc
3839
DEPENDS protobuf zlib
39-
URL "http://paddlepaddledeps.bj.bcebos.com/grpc.tar.xz"
40+
# NOTE(wuyi):
41+
# this package is generated by following steps:
42+
# 1. git clone -b v1.8.x https://github.com/grpc/grpc.git
43+
# 2. submodule update --init
44+
# 3. keep only zlib, cares, protobuf, boringssl under "third_party",
45+
# checkout and clean other dirs under third_party
46+
# 4. remove .git, and package the directory.
47+
URL "http://paddlepaddledeps.bj.bcebos.com/grpc-v1.8.x.tar.gz"
4048
PREFIX ${GRPC_SOURCES_DIR}
4149
UPDATE_COMMAND ""
4250
CONFIGURE_COMMAND ""
@@ -49,7 +57,6 @@ ExternalProject_Add(
4957
INSTALL_COMMAND make prefix=${GRPC_INSTALL_DIR} install
5058
)
5159

52-
# FIXME(typhoonzero): hack to get static lib path, try a better way like merge them.
5360
ADD_LIBRARY(grpc++_unsecure STATIC IMPORTED GLOBAL)
5461
SET_PROPERTY(TARGET grpc++_unsecure PROPERTY IMPORTED_LOCATION
5562
"${GRPC_INSTALL_DIR}/lib/libgrpc++_unsecure.a")

python/paddle/fluid/transpiler/distribute_transpiler.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,17 @@ def _init_splited_vars(self, split_method):
186186

187187
param_list = []
188188
grad_list = []
189+
param_grad_set = set()
189190
for p, g in self.params_grads:
190191
# skip parameter marked not trainable
191192
if type(p) == Parameter and p.trainable == False:
192193
continue
193-
param_list.append(p)
194-
grad_list.append(g)
194+
if p.name not in param_grad_set:
195+
param_list.append(p)
196+
param_grad_set.add(p.name)
197+
if g.name not in param_grad_set:
198+
grad_list.append(g)
199+
param_grad_set.add(g.name)
195200

196201
self._update_dist_lookup_table_vars(param_list, grad_list,
197202
self.params_grads)
@@ -802,6 +807,9 @@ def _create_vars_from_blocklist(self,
802807
if not block_map.has_key(varname):
803808
block_map[varname] = []
804809
block_map[varname].append((long(offset), long(size)))
810+
# Do not remove this important debug message:
811+
print("block map: %s" % block_map)
812+
805813
for varname, splited in block_map.iteritems():
806814
orig_var = program.global_block().var(varname)
807815
if len(splited) == 1:

0 commit comments

Comments
 (0)