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

Forward shuffle to trainer server and measure GPU #526

Merged
merged 11 commits into from
Jun 19, 2024
Prev Previous commit
Next Next commit
fix mypy
  • Loading branch information
XianzheMa committed Jun 19, 2024
commit e80800a938ef613237ac98edfc03c9fb219f1fd3
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@


class MaybeMeasureGPUOps:
XianzheMa marked this conversation as resolved.
Show resolved Hide resolved
# type: ignore[no-untyped-def]
def __init__(self, measure: bool, measurement_name: str, device: str, stop_watch: Stopwatch, **kwargs) -> None:
self._device = device
self._measure = measure
self._measurement_name = measurement_name
self._kwargs = kwargs
self._stop_watch = stop_watch

def __enter__(self):
def __enter__(self) -> None:
if self._measure:
torch.cuda.synchronize(device=self._device)
self._stop_watch.start(name=self._measurement_name, **self._kwargs)
Expand Down
Loading