-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable epoch time logging for tutorial
- Loading branch information
1 parent
003a683
commit e50bd19
Showing
9 changed files
with
48 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,14 @@ | |
# | ||
# Credit: | ||
# - Matteo Bunino <[email protected]> - CERN | ||
# - Jarl Sondre Sæther <[email protected]> - CERN | ||
# -------------------------------------------------------------------------------------- | ||
|
||
"""Scaling test of Microsoft Deepspeed on Imagenet using Resnet.""" | ||
|
||
import os | ||
from timeit import default_timer as timer | ||
from pathlib import Path | ||
|
||
import deepspeed | ||
import torch | ||
|
@@ -98,12 +100,15 @@ def main(): | |
# Start training loop | ||
if global_rank == 0: | ||
num_nodes = os.environ.get("SLURM_NNODES", "1") | ||
save_dir = Path("scalability-metrics") | ||
save_path = save_dir / f"epochtime_deepspeed-bl_{num_nodes}N.csv" | ||
epoch_time_tracker = EpochTimeTracker( | ||
strategy_name="deepspeed-bl", | ||
save_path=f"epochtime_deepspeed-bl_{num_nodes}N.csv", | ||
save_path=save_path, | ||
num_nodes=int(num_nodes), | ||
) | ||
|
||
start_time = timer() | ||
start_epoch = 1 | ||
for epoch_idx in range(start_epoch, args.epochs + 1): | ||
epoch_start_time = timer() | ||
|
@@ -123,11 +128,14 @@ def main(): | |
epoch_time_tracker.add_epoch_time(epoch_idx, epoch_elapsed_time) | ||
print(f"[{epoch_idx}/{args.epochs}] - time: {epoch_elapsed_time:.2f}s") | ||
|
||
if is_distributed: | ||
dist.barrier() | ||
if global_rank == 0: | ||
total_time = timer() - start_time | ||
print(f"Training finished - took {total_time:.2f}s") | ||
epoch_time_tracker.save() | ||
|
||
# Clean-up | ||
if is_distributed: | ||
dist.barrier() | ||
deepspeed.sys.exit() | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
# | ||
# Credit: | ||
# - Matteo Bunino <[email protected]> - CERN | ||
# - Jarl Sondre Sæther <[email protected]> - CERN | ||
# -------------------------------------------------------------------------------------- | ||
|
||
"""Show how to use DDP, Horovod and DeepSpeed strategies interchangeably | ||
|
@@ -16,7 +17,7 @@ | |
import os | ||
import sys | ||
from timeit import default_timer as timer | ||
# from typing import Optional | ||
from pathlib import Path | ||
|
||
# import deepspeed | ||
import horovod.torch as hvd | ||
|
@@ -137,9 +138,11 @@ def main(): | |
if strategy.is_main_worker: | ||
num_nodes = os.environ.get("SLURM_NNODES", 1) | ||
strategy_name = f"{args.strategy}-it" | ||
save_dir = Path("scalability-metrics") | ||
save_path = save_dir / f"epochtime_{strategy_name}_{num_nodes}N.csv" | ||
epoch_time_tracker = EpochTimeTracker( | ||
strategy_name=strategy_name, | ||
save_path=f"epochtime_{strategy_name}_{num_nodes}N.csv", | ||
save_path=save_path, | ||
num_nodes=int(num_nodes), | ||
) | ||
|
||
|
@@ -165,6 +168,7 @@ def main(): | |
if global_rank == 0: | ||
total_time = timer() - start_time | ||
print(f"Training finished - took {total_time:.2f}s") | ||
epoch_time_tracker.save() | ||
|
||
# Clean-up | ||
if is_distributed: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters