Skip to content

Commit 4096e4e

Browse files
authored
Add log file for performance run outputs
Added logging functionality to capture G4 printouts from the performance run. Including number of Opticks hits
1 parent 3a4bc9c commit 4096e4e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

optiphy/tools/run_performance.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ def main():
5757

5858
geant_file = args.outpath / "timing_geant.txt"
5959
optix_file = args.outpath / "timing_optix.txt"
60+
log_file = args.outpath / "g4logs.txt"
6061

61-
with open(geant_file, "w") as gfile, open(optix_file, "w") as ofile:
62+
with open(geant_file, "w") as gfile, open(optix_file, "w") as ofile, open(log_file, "w") as logfile:
6263
for threads in range(50, 0, -1):
6364
times = {}
6465
sim_time_true = None
@@ -76,6 +77,13 @@ def main():
7677
)
7778
stdout = result.stdout
7879
stderr = result.stderr
80+
# Save full output to log file
81+
logfile.write(f"\n{'='*60}\n")
82+
logfile.write(f"Threads: {threads}, StackPhotons: {flag}\n")
83+
logfile.write(f"{'='*60}\n")
84+
logfile.write(f"--- STDOUT ---\n{stdout}\n")
85+
logfile.write(f"--- STDERR ---\n{stderr}\n")
86+
logfile.flush()
7987

8088
# Save simulation time for true run only
8189
if flag == 'true':

0 commit comments

Comments
 (0)