Replies: 3 comments 6 replies
-
Hello @aantg, Indeed, it's weird that it would get stuck after 1600+ iterations. One random idea (unlikely to work) would be to pass |
Beta Was this translation helpful? Give feedback.
-
Hi @aantg, Orthogonal to the hanging issue, freezing kernels should save us a lot of time when rendering a scene thousands of times.
import mitsuba as mi
import drjit as dr
import numpy as np
import time
mi.set_variant('cuda_ad_rgb')
freezing = True
dr.set_flag(dr.JitFlag.KernelHistory, True)
dr.set_flag(dr.JitFlag.KernelFreezing, freezing)
class kernel_timer:
def start(self, name):
self.name = name
dr.kernel_history_clear()
self.start_time = time.time()
def stop(self):
dr.eval()
dr.sync_thread()
hist = dr.kernel_history()
kernel_time = sum(
item.get('execution_time', 0.0) for item in hist)
elapsed_time = time.time() - self.start_time
print(f"{self.name} took {elapsed_time:.2f} seconds," +
f" {kernel_time / 1e3:.2f} seconds in kernels.")
@dr.freeze
def render_once(image_res: mi.TensorXf):
image = mi.render(scene, spp=64)
image_res += image
dr.eval(image_res)
# --------------------------------------------------------------
scene = mi.load_dict(mi.cornell_box())
params = mi.traverse(scene)
key = 'light.to_world'
init_param = mi.Transform4f(params[key])
image_res = dr.zeros(mi.TensorXf, shape=(256, 256, 3))
timer = kernel_timer()
timer.start(f'Rendering with kernel freezing {freezing} ')
n_repeats = 1024
for theta in np.linspace(0, 2 * np.pi, n_repeats, endpoint=False):
params[key] = (mi.Transform4f().translate(
mi.ScalarVector3f(np.cos(theta) * 0.5, 0, np.sin(theta) * 0.5)) @
init_param
)
params.update()
render_once(image_res)
image_res /= n_repeats
mi.Bitmap(image_res).write('average_cbox.exr')
timer.stop() |
Beta Was this translation helpful? Give feedback.
-
Hello again. After all, I made scene modification via |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello.
I need to make multiple rendering of a scene with changes in shapes' transformations and accumulate resulting radiance. See my naive python code for this below.
My python code
The problem is my for loop stucks at 1638 iteration. It makes all iterations if I fix orientation (pass the same parameter) in load_scene() function call, like
or if I remove (comment-out)
cyl
ornzl
orrcv
or bothcap-z
,cap+z
shapes.My
rcv.ply
file contains surface with only 80 triangles and 82 vertices. Andnzl.dat
defines one simple curve:I don't get what is going on, why loop stucks and how to overcome this. Doesn't seem like memory issue as it only takes about 2.5 of 4 GB of dedicated VRAM. So, I need help. Thx.
Beta Was this translation helpful? Give feedback.
All reactions