Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Delaunay committed Nov 21, 2024
1 parent ecd9214 commit 8148e53
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
8 changes: 3 additions & 5 deletions benchmarks/flops/benchfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ class FlopsBenchmarch(Package):

def build_run_plan(self) -> "Command":
import milabench.commands as cmd

main = self.dirs.code / self.main_script
pack = cmd.PackCommand(self, *self.argv, lazy=True)

use_stdout = True

if use_stdout:
main = self.dirs.code / self.main_script
pack = cmd.PackCommand(self, *self.argv, lazy=True)
return pack.use_stdout()
else:
main = self.dirs.code / self.main_script
pack = cmd.PackCommand(self, *self.argv, lazy=True)
pack = cmd.VoirCommand(pack, cwd=main.parent)
return pack

Expand Down
13 changes: 9 additions & 4 deletions benchmate/benchmate/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,21 @@


def auto_push():
# use_stdout = int(os.getenv("MILABENCH_USE_STDOUT", 0))
mb_managed = int(os.getenv("MILABENCH_MANAGED", 0))

# Milabench managed: we need to push metrics to it
if int(os.getenv("MILABENCH_MANAGED", 0)) == 1:

if mb_managed == 1:
# Using voir, DATA_FD is defined as well
ov = current_overseer.get()
if ov is not None:
return ov.give

# Not using Voir, using structured stdout
return sumggle_push()
if int(os.getenv("MILABENCH_USE_STDOUT", 0)) == 1:
return sumggle_push()

raise RuntimeError("Could not find something to push to")

# Not using milabench; using stdout
return file_push()
Expand Down
3 changes: 3 additions & 0 deletions milabench/commands/executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ async def execute(pack, *args, cwd=None, env={}, external=False, use_stdout=Fals
sized_args = scale_argv(pack, args)
final_args = resolve_argv(pack, sized_args)

if use_stdout:
exec_env["MILABENCH_USE_STDOUT"] = "1"

return await run(
final_args,
**kwargs,
Expand Down
4 changes: 2 additions & 2 deletions milabench/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,12 @@ def pandas_to_string(df, formatters=_formatters):
# Compute column size
col_size = defaultdict(int)
for index, row in df.iterrows():
col_size["bench"] = max(col_size["bench"], len(index))
col_size["bench"] = max(col_size["bench"], len(index), len("bench"))
for col, val in zip(columns, row):
fmt = formatters.get(col)
if fmt is not None:
val = fmt(val)
col_size[col] = max(col_size[col], len(val))
col_size[col] = max(col_size[col], len(val), len(col))

# Generate report
sep = " | "
Expand Down

0 comments on commit 8148e53

Please sign in to comment.