1
0
mirror of https://github.com/gsi-upm/soil synced 2024-11-14 15:32:29 +00:00
soil/benchmarks/run.py
J. Fernando Sánchez 5e93399d58 Initial benchmarking
2023-05-03 12:07:55 +02:00

20 lines
593 B
Python
Executable File

#!/bin/env python
import sys
import os
import subprocess
import argparse
parser = argparse.ArgumentParser(
prog='Profiler for soil')
parser.add_argument('--suffix', default=None)
parser.add_argument('files', nargs="+")
args = parser.parse_args()
for fname in args.files:
suffix = ("_" + args.suffix) if args.suffix else ""
simname = f"{fname.replace('/', '-')}{suffix}"
profpath = os.path.join("profs", simname + ".prof")
print(f"Running {fname} and saving profile to {profpath}")
subprocess.call(["python", "-m", "cProfile", "-o", profpath, fname])