Skip to content

Commit

Permalink
add clean-up flag for benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrit committed Jan 13, 2024
1 parent 58d1b3e commit 22e828b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion SeeSharp/Experiments/Benchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ void RunScene(SceneConfig sceneConfig, string format, bool skipReference) {

experiment.OnStartScene(scene, dir, sceneConfig.MinDepth, sceneConfig.MaxDepth);
var methods = experiment.MakeMethods();
foreach (var method in methods) {
for (int i = 0; i < methods.Count; ++i) {
var method = methods[i];

string path = Path.Join(dir, method.Name);

Logger.Log($"Rendering {sceneConfig.Name} with {method.Name}");
Expand All @@ -78,6 +80,11 @@ void RunScene(SceneConfig sceneConfig, string format, bool skipReference) {
scene.FrameBuffer.MetaData["RayStats"] = scene.Raytracer.Stats;
scene.FrameBuffer.MetaData["ShadeStats"] = ShadingStats.Current;
scene.FrameBuffer.WriteToFile();

if (experiment.DeleteMethodAfterRun) {
methods.RemoveAt(i);
i--;
}
}
experiment.OnDoneScene(scene, dir, sceneConfig.MinDepth, sceneConfig.MaxDepth);
}
Expand Down
6 changes: 6 additions & 0 deletions SeeSharp/Experiments/Experiment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public Method(string name, Integrator integrator) {
}
}

/// <summary>
/// If true, the Benchmark will drop the method reference after execution. This allows costly integrator
/// data to be freed as soon as possible. Disadvantage: all integrator state will be lost. The default is false.
/// </summary>
public virtual bool DeleteMethodAfterRun => false;

/// <summary>
/// Factory function for the methods.
/// </summary>
Expand Down

0 comments on commit 22e828b

Please sign in to comment.