Skip to content

Commit

Permalink
Update opt to use stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre.delaunay committed Jul 24, 2024
1 parent bae0e11 commit ab4a055
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 2 deletions.
10 changes: 8 additions & 2 deletions benchmarks/accelerate_opt/benchfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ def build_prepare_plan(self):
str(self.dirs.cache)
)

def build_run_plan(self):
plan = super().build_run_plan()
def build_run_plan(self):
from milabench.commands import PackCommand, VoirCommand
main = self.dirs.code / self.main_script
plan = PackCommand(self, *self.argv, lazy=True)

if False:
plan = VoirCommand(pack, cwd=main.parent)

return AccelerateAllNodes(plan).use_stdout()


Expand Down
34 changes: 34 additions & 0 deletions benchmarks/accelerate_opt/voirfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from dataclasses import dataclass

from voir import configurable
from voir.phase import StopProgram


@dataclass
class Config:
"""voir configuration"""

# Whether to display the dash or not
dash: bool = False

# How often to log the rates
interval: str = "1s"

# Number of rates to skip before logging
skip: int = 5

# Number of rates to log before stopping
stop: int = 20

# Number of seconds between each gpu poll
gpu_poll: int = 3


@configurable
def instrument_main(ov, options: Config):
yield ov.phases.init

try:
yield ov.phases.run_script
except StopProgram:
print("early stopped")
34 changes: 34 additions & 0 deletions benchmarks/lightning/voirfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from dataclasses import dataclass

from voir import configurable
from voir.phase import StopProgram


@dataclass
class Config:
"""voir configuration"""

# Whether to display the dash or not
dash: bool = False

# How often to log the rates
interval: str = "1s"

# Number of rates to skip before logging
skip: int = 5

# Number of rates to log before stopping
stop: int = 20

# Number of seconds between each gpu poll
gpu_poll: int = 3


@configurable
def instrument_main(ov, options: Config):
yield ov.phases.init

try:
yield ov.phases.run_script
except StopProgram:
print("early stopped")
4 changes: 4 additions & 0 deletions benchmarks/torchvision_ddp/voirfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from voir.phase import StopProgram

from voir import configurable
from voir.phase import StopProgram



@configurable
def instrument_main(ov):
Expand Down

0 comments on commit ab4a055

Please sign in to comment.