Don't forget to execute the last loop in `compute_beam_diffusion_bssrdf()` in parallel:
wahn opened this issue · 3 comments
wahn commented
Don't forget to execute the last loop in compute_beam_diffusion_bssrdf()
in parallel:
pub fn compute_beam_diffusion_bssrdf(g: Float, eta: Float, t: &mut BSSRDFTable) {
...
// ParallelFor([&](int i) {
for i in 0..t.n_rho_samples as usize {
// TODO: execute in parallel
...
}
// }, t.n_rho_samples);
}
Originally posted by @wahn in #84 (comment)
wahn commented
Don't expect a big performance impact by running that loop in parallel. The only time that function gets called is in the constructor of SubsurfaceMaterial
:
impl SubsurfaceMaterial {
pub fn new(
scale: Float,
kr: Arc<Texture<Spectrum> + Sync + Send>,
kt: Arc<Texture<Spectrum> + Sync + Send>,
sigma_a: Arc<Texture<Spectrum> + Sync + Send>,
sigma_s: Arc<Texture<Spectrum> + Sync + Send>,
g: Float,
eta: Float,
u_roughness: Arc<Texture<Float> + Sync + Send>,
v_roughness: Arc<Texture<Float> + Sync + Send>,
bump_map: Option<Arc<Texture<Float> + Sync + Send>>,
remap_roughness: bool,
) -> Self {
let mut table: BssrdfTable = BssrdfTable::new(100, 64);
compute_beam_diffusion_bssrdf(g, eta, &mut table);
...
}
...
}
wahn commented
After 5988adb commit we can measure the exact time for SubsurfaceMaterial::new()
:
> pwd
/mill3d/users/jan/git/gitlab/rs-pbrt-test-scenes/pbrt/sss_dragon
> time ~/git/github/rs_pbrt/target/release/rs_pbrt -i sss-dragon.pbrt
pbrt version 0.6.2 [Detected 8 cores]
Copyright (c) 2016-2019 Jan Douglas Bert Walter.
Rust code based on C++ code by Matt Pharr, Greg Humphreys, and Wenzel Jakob.
Integrator "path"
"integer maxdepth" [5]
Sampler "halton"
"integer pixelsamples" [16]
Film "image"
"integer xresolution" [1366]
"integer yresolution" [1024]
"float scale" [2]
PT0.233061136S seconds for SubsurfaceMaterial::new() ...
Rendering with 8 thread(s) ...
...
Let's see which time we will measure afterwards ...
wahn commented
Not really worth doing ... unless there is a test scene which states otherwise ...