Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sync_all_reduce to consider update->compute->update case #2803

Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4bde2eb
Fix sync_all_reduce
sadra-barikbin Dec 21, 2022
f174e7d
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Jan 4, 2023
83dd16e
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Jan 5, 2023
f9970d3
Make _is_reduced no-op, add a test and a little improvement
sadra-barikbin Jan 6, 2023
f5b434e
Make _is_reduced no-op, add a test and a little improvement
sadra-barikbin Jan 6, 2023
1bf75bb
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Jan 11, 2023
2f0d9a6
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Jan 11, 2023
ea2474e
Fix Mypy
sadra-barikbin Jan 11, 2023
74515fe
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Jan 18, 2023
319f0f6
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
vfdev-5 Feb 1, 2023
392a191
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Feb 15, 2023
cdc7e5a
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Feb 16, 2023
ca391f9
Remove some asserts from test_loss & test_accuracy
sadra-barikbin Feb 16, 2023
fb8b431
Fix bug
sadra-barikbin Feb 16, 2023
4687414
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Feb 16, 2023
6ba844f
Remove _is_reduced
sadra-barikbin Feb 16, 2023
086fa72
Merge remote-tracking branch 'upstream/Fix-sync_all_reduce-decorator-…
sadra-barikbin Feb 16, 2023
2c0d020
Revert deleted assertions
sadra-barikbin Feb 16, 2023
67d0833
Fix a bug in precision
sadra-barikbin Feb 16, 2023
c048119
Fix a mypy error
sadra-barikbin Feb 16, 2023
3017b8e
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Feb 16, 2023
3c0f305
Update ignite/metrics/metric.py
sadra-barikbin Feb 17, 2023
20690af
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Feb 17, 2023
c9f474e
Revert a change in test_accuracy
sadra-barikbin Feb 17, 2023
ac95fa5
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Feb 17, 2023
af380f5
Revert a change in test_accuracy exactly
sadra-barikbin Feb 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions ignite/metrics/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ def another_wrapper(self: Metric, *args: Any, **kwargs: Any) -> Callable:
"Decorator sync_all_reduce should be used on ignite.metric.Metric class methods only"
)
ws = idist.get_world_size()
unreduced_attrs = {}
if len(attrs) > 0 and not self._is_reduced:
if ws > 1:
for attr in attrs:
Expand All @@ -568,13 +569,18 @@ def another_wrapper(self: Metric, *args: Any, **kwargs: Any) -> Callable:
op_kwargs["op"] = op
t = getattr(self, attr, None)
if t is not None:
t = idist.all_reduce(t, **op_kwargs)
unreduced_attrs[attr] = t
t_reduced = idist.all_reduce(t, **op_kwargs)
self._is_reduced = True
setattr(self, attr, t)
setattr(self, attr, t_reduced)
else:
self._is_reduced = True

return func(self, *args, **kwargs)
result = func(self, *args, **kwargs)

for attr, value in unreduced_attrs.items():
setattr(self, attr, value)
vfdev-5 marked this conversation as resolved.
Show resolved Hide resolved
return result

return another_wrapper

Expand Down