Skip to content

Commit

Permalink
sync_shared added
Browse files Browse the repository at this point in the history
  • Loading branch information
ReyhaneAskari committed Aug 28, 2017
1 parent 188ddba commit 7ec9167
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions example/synchronous_resnet/resnet_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ def pred_error(f_pred, data, iterator):
x = [data[0][t] for t in valid_index]
y = [data[1][t] for t in valid_index]
valid_err += f_pred(x, y)
f_pred.sync_shared()

This comment has been minimized.

Copy link
@nouiz

nouiz Aug 28, 2017

Contributor

As there is no updates in that fct, this isn't useful I think.

This comment has been minimized.

Copy link
@ReyhaneAskari

ReyhaneAskari Aug 28, 2017

Author Member

I see. Done.

i += 1

return valid_err / i
Expand Down Expand Up @@ -524,7 +525,9 @@ def train_iter():
x, y = next(train_it)
func_time = time.time()
cost = f_grad_shared(x, y)
cost.sync_shared()
f_update(lrate)
f_update.sync_shared()

This comment has been minimized.

Copy link
@nouiz

nouiz Aug 28, 2017

Contributor

To allow some parallelism between the 2 fct, I would do the 2 sync together at the end.

This comment has been minimized.

Copy link
@ReyhaneAskari

ReyhaneAskari Aug 28, 2017

Author Member

You mean at the end of the for loop, right?

This comment has been minimized.

Copy link
@nouiz

nouiz Aug 28, 2017

Contributor

Your new commit look good.

print("Func call time", time.time() - func_time)
overhead_time = time.time()
asgd()
Expand Down

0 comments on commit 7ec9167

Please sign in to comment.