Skip to content

Commit

Permalink
Modify codes for pr 36744
Browse files Browse the repository at this point in the history
  • Loading branch information
aoyulong committed Oct 27, 2021
1 parent 950ed88 commit c819435
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion python/paddle/distributed/auto_parallel/process_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def ndim(self):
return len(self._topology)

def __eq__(self, other):
assert other and isinstance(other, ProcessMesh)
if not isinstance(other, ProcessMesh):
return False
if self.topology != other.topology or self.processes != other.processes:
return False
return True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,20 @@ def is_valid_completed_program(dist_context, program):
if op_dist_attrs.process_mesh == None:
return False

if None in op_dist_attrs._dims_mapping.values():
return False
for tensor_dist_attr in op_dist_attrs.inputs_dist_attrs.values():
if None == tensor_dist_attr.dims_mapping:
return False
for tensor_dist_attr in op_dist_attrs.outputs_dist_attrs.values():
if None == tensor_dist_attr.dims_mapping:
return False

for var in vars_:
var_dist_attrs = dist_context.get_tensor_dist_attr_for_program(var)
if var_dist_attrs == None:
return False
elif var_dist_attrs.process_mesh == None:
return False
elif var_dist_attrs.get_dims_mapping == None:
elif var_dist_attrs.dims_mapping == None:
return False

return True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def test_mlp_dpmppp(self):
dist_main_prog, dist_startup_prog = get_dist_prog(
train_program, startup_program, dist_context, rank_id)
reshard(dist_main_prog, dist_startup_prog, rank_id, dist_context)
print_program_with_dist_attr(dist_main_prog, dist_context)
# print_program_with_dist_attr(dist_main_prog, dist_context)
# check send and recv result
self.assertTrue(check_send_recv_result(dist_main_prog, rank_id))

Expand Down

0 comments on commit c819435

Please sign in to comment.