Skip to content

Commit

Permalink
Add profiling and update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
al-ro committed Jan 18, 2024
1 parent dab68e9 commit 3bad0bf
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 10 deletions.
51 changes: 41 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ Multithreaded C++ path tracer with bounding volume hierarchy (BVH) based on [the

[CUDA version for Nvidia GPUs](https://github.com/al-ro/path-tracer)

### Test scenes

<table width="100%">
<thead>
<tr>
<th width="50%">Scene 0: 3 instances</th>
<th width="50%">BVH heat map (max 267) 0.08 s</th>
<th width="50%">BVH heat map (max 267)</th>
</tr>
</thead>
<tbody>
Expand All @@ -25,7 +27,7 @@ Multithreaded C++ path tracer with bounding volume hierarchy (BVH) based on [the
<thead>
<tr>
<th width="50%">Scene 1: 10,000 instances</th>
<th width="50%">BVH heat map (max 600) 0.26 s</th>
<th width="50%">BVH heat map (max 600)</th>
</tr>
</thead>
<tbody>
Expand All @@ -40,7 +42,7 @@ Multithreaded C++ path tracer with bounding volume hierarchy (BVH) based on [the
<thead>
<tr>
<th width="50%">Scene 2: Model with vertex attributes</th>
<th width="50%">BVH heat map (max 123) 0.07 s</th>
<th width="50%">BVH heat map (max 123)</th>
</tr>
</thead>
<tbody>
Expand All @@ -51,17 +53,46 @@ Multithreaded C++ path tracer with bounding volume hierarchy (BVH) based on [the
</tbody>
</table>

|| triangles per mesh | BLAS | time (s) | TLAS | total triangles | max tests
:---:|:---:|:---:|:---:|:---:|:---:|:---:|
Scene 0 | 505,848 | 792,591 | 0.88 | 5 | 1,517,544 | 267
Scene 1 | 505,848 | 792,591 | 0.88 | 19,819 | 5,058,480,000 | 600
Scene 2 | 3,828 | 4,899 | 0.0049 | 1 | 3,828 | 123

### Performance

- Resolution: 1500 x 800
- Samples: 320
- Threads: 10
- Samples: 100
- Max bounces: 6
- CPU: 13th Gen Intel Core i7-13700H × 20
- GPU: NVIDIA GeForce RTX 3050 6GB

Scene | Render | BVH build | TLAS nodes | Triangles (per model) | BLAS nodes (per model)
:---:|:---:|:---:|:---:|:---:|:---:|
0 | 36 s | 0.88 s | 5 | 505,848 | 792,591
1 | 269 s | 0.88 s | 19,819 | 505,848 | 792,591
2 | 107 s | 0.005 s | 1 | 3,828 | 4899
<table width="100%">
<tbody>
<tr>
<td width="50%"><img src="images/bvh_0.png"/></td>
<td width="50%"><img src="images/render_0.png"/></td>
</tr>
</tbody>
</table>

<table width="100%">
<tbody>
<tr>
<td width="50%"><img src="images/bvh_1.png"/></td>
<td width="50%"><img src="images/render_1.png"/></td>
</tr>
</tbody>
</table>

<table width="100%">
<tbody>
<tr>
<td width="50%"><img src="images/bvh_2.png"/></td>
<td width="50%"><img src="images/render_2.png"/></td>
</tr>
</tbody>
</table>

["Bust of Menelaus"](https://www.myminifactory.com/object/3d-print-bust-of-menelaus-32197) by Scan The World

Expand Down
Binary file added images/bvh_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bvh_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bvh_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/render_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/render_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/render_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions profile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
echo "Running profiling..."

threads=(10 8 4 2 1)

width=1500
height=800
samples=100

echo -e "width: $width \theight: $height \tsamples: $samples \tthreads: ${threads[*]}"

prefix="Render time:"

function cancel {
echo "Received SIGQUIT. Exiting."
exit 0;
}

trap cancel SIGQUIT

for scene in `seq 0 2`
do
echo -n "GPU BVH $scene..."
file="GPU_BVH"$scene".out"
./PathTracer -w $width -h $height -p $scene -d 0 -a 1>$file
timing="$(grep "$prefix" $file)"
echo "$timing" | sed -e "s/^$prefix//"
done

for scene in `seq 0 2`
do
echo -n "GPU scene $scene..."
file="GPU_scene"$scene".out"
./PathTracer -w $width -h $height -s $samples -p $scene -d 0 1>$file
timing="$(grep "$prefix" $file)"
echo "$timing" | sed -e "s/^$prefix//"
done

for scene in `seq 0 2`
do
for i in ${threads[@]}
do
echo -n "CPU BVH $scene threads $i..."
file="CPU_BVH_"$scene"_threads_"$i".out"
./PathTracer -w $width -h $height -p $scene -d 1 -t $i -a 1>$file
timing="$(grep "$prefix" $file)"
echo "$timing" | sed -e "s/^$prefix//"
done
done

for scene in `seq 0 2`
do
for i in ${threads[@]}
do
echo -n "CPU scene $scene threads $i..."
file="CPU_scene_"$scene"_threads_"$i".out"
./PathTracer -w $width -h $height -s $samples -p $scene -d 1 -t $i 1>$file
timing="$(grep "$prefix" $file)"
echo "$timing" | sed -e "s/^$prefix//"
done
done

0 comments on commit 3bad0bf

Please sign in to comment.