diff --git a/benchmark.py b/benchmark.py index 1153010c..4ea0a57d 100644 --- a/benchmark.py +++ b/benchmark.py @@ -51,8 +51,12 @@ def getExe(): return ["main.exe"], version else: if platform.system() == "Linux": - version = subprocess.check_output(["python3.12", "main.py", "--version"]).decode().strip() - return ["python3.12", "main.py"], version + if os.path.exists("./main"): + version = subprocess.check_output(["./main", "--version"]).decode().strip() + return ["./main"], version + else: + version = subprocess.check_output(["python3.12", "main.py", "--version"]).decode().strip() + return ["python3.12", "main.py"], version else: version = subprocess.check_output(["python", "main.py", "--version"]).decode().strip() return ["python", "main.py"], version @@ -76,6 +80,7 @@ def runUpscaleBenchmark(inputVideo, executor): "--benchmark", "--outpoint", "16" if "-tensorrt" in method else "12" ] + print(f"Running command: {' '.join(cmd)}") # Debugging line subprocess.run(cmd, check=True, cwd=os.path.dirname(os.path.abspath(__file__))) fps = parseFPS() @@ -98,6 +103,7 @@ def runInterpolateBenchmark(inputVideo, executor): "--interpolate_method", method, "--benchmark" ] + print(f"Running command: {' '.join(cmd)}") # Debugging line subprocess.run(cmd, cwd=os.path.dirname(os.path.abspath(__file__))) fps = parseFPS() @@ -117,6 +123,7 @@ def runInterpolateBenchmark(inputVideo, executor): "--ensemble", "--outpoint", "20" ] + print(f"Running command: {' '.join(cmd)}") # Debugging line subprocess.run(cmd, cwd=os.path.dirname(os.path.abspath(__file__))) fps = parseFPS() @@ -240,4 +247,10 @@ def parseSystemInfo(): print(f"Total models to benchmark: {TOTALTESTS}") print(f"Using {' '.join(executor)} version {version}") print("Current working directory:", os.getcwd()) - runAllBenchmarks(executor, version, inputVideo) \ No newline at end of file + + # Check if the executable exists + exe_path = os.path.abspath(executor[0]) + if not os.path.exists(exe_path): + print(f"Error: The executable {exe_path} does not exist.") + else: + runAllBenchmarks(executor, version, inputVideo) \ No newline at end of file diff --git a/build-linux.py b/build-linux.py index 4b9e7afd..e3698acc 100644 --- a/build-linux.py +++ b/build-linux.py @@ -155,6 +155,13 @@ def move_extras(): except Exception as e: print("Error while copying jsx file: ", e) +def clean_up(): + benchmark_dir = os.path.join(base_dir, "dist", "benchmark") + + try: + shutil.rmtree(benchmark_dir) + except Exception as e: + print("Error while deleting benchmark directory: ", e) if __name__ == "__main__": create_venv() @@ -162,3 +169,4 @@ def move_extras(): install_pyinstaller() create_executable() move_extras() + clean_up()