mitsuba3 icon indicating copy to clipboard operation
mitsuba3 copied to clipboard

load_dict failed due to OptiX freezing and silently exiting under cuda_ad_rgb

Open mtang398 opened this issue 7 months ago • 6 comments

Apologies if this turns out to be a trivial issue, but I'm encountering a problem when running the following simple code (under cuda_ad_rgb only):

import mitsuba as mi

mi.set_variant('cuda_ad_rgb')
mi.set_log_level(mi.LogLevel.Trace)

scene_dict = {
        'type': 'scene',
            # 'integrator': {
            #     'type': 'path',
            #     # Indirect visibility effects aren't that important here
            #     # let's turn them off and save some computation time
            #     # 'spp': 1,
            # },
        # 'emitter': {
        #     'type': 'envmap',
        #     'filename': "../scenes/textures/envmap2.exr",
        # },
        'A': {
            'id': 'A',
            'type': 'obj',
            # 'to_world': mi.ScalarTransform4f().translate([0.0, 0.0, 0.0]),
            'filename': "C:/Users/maosen/INT-main/scene/torusA.obj",
            'bsdf': {'type': 'diffuse'}
        },
        'B': {
            'id': 'B',
            'type': 'obj',
            # 'to_world': mi.ScalarTransform4f().translate([-0.5, 0.0, 0.0]),
            'filename': "C:/Users/maosen/INT-main/scene/torusB.obj",
            'bsdf': {'type': 'diffuse'}
        },
    }

scene = mi.load_dict(scene_dict)
print("Load Successfully!")

I got the following error message:

2025-04-17 04:14:00 DEBUG main  [PluginManager] Loading plugin "plugins\obj.dll" ..
2025-04-17 04:14:00 DEBUG main  [PluginManager] Loading plugin "plugins\diffuse.dll" ..
2025-04-17 04:14:00 DEBUG main  [PluginManager] Loading plugin "plugins\uniform.dll" ..
2025-04-17 04:14:00 DEBUG wrk24 [OBJMesh] Loading mesh from "torusA.obj" ..
2025-04-17 04:14:00 DEBUG wrk24 [OBJMesh] "torusA.obj": read 2000 faces, 1071 vertices (56.9 KiB in 2ms)
2025-04-17 04:14:00 DEBUG wrk29 [OBJMesh] Loading mesh from "torusB.obj" ..
2025-04-17 04:14:00 DEBUG wrk29 [OBJMesh] "torusB.obj": read 2000 faces, 1071 vertices (56.9 KiB in 2ms)
2025-04-17 04:14:00 INFO  main  [Scene] Building scene in OptiX ..

Then it freezes for a while, and exits without any error message. It doesn’t crash or throw exceptions — it just stops.

I'm on NVIDIA driver version 576.02 and using OptiX 7.4.0, but I’ve tested several driver/OptiX combinations and nothing seems to work.

Is there anything obvious I should be checking or debugging to figure out what’s going wrong?

mtang398 avatar Apr 17 '25 01:04 mtang398

You don't need to install OptiX -- Mitsuba will use the OptiX version provided by your graphics driver. Are you using WSL, by any chance?

Are you able to get a backtrace (e.g. with MSVC) when running a debug build when the program freezes?

wjakob avatar Apr 17 '25 02:04 wjakob

Similar issue here, except on windows 10 (python 3.13, mitsuba 3.6.4). This code

import mitsuba as mi

def main():

    # Set the variant of the renderer
    mi.set_variant("scalar_rgb")
    mi.set_log_level(mi.LogLevel.Trace)
    # Load a scene
    scene = mi.load_dict(mi.cornell_box())
    print("here")
    # Render the scene
    img = mi.render(scene)
    # Write the rendered image to an EXR file
    mi.Bitmap(img).write("cbox.exr")


if __name__ == "__main__":
    main()

exits silently at load_dict. Complete output is

2025-04-25 14:34:29 DEBUG main  [PluginManager] Loading plugin "plugins\path.dll" ..
2025-04-25 14:34:29 DEBUG main  [PluginManager] Loading plugin "plugins\perspective.dll" ..
2025-04-25 14:34:29 DEBUG main  [PluginManager] Loading plugin "plugins\independent.dll" ..
2025-04-25 14:34:29 DEBUG main  [PluginManager] Loading plugin "plugins\hdrfilm.dll" ..
2025-04-25 14:34:29 DEBUG main  [PluginManager] Loading plugin "plugins\gaussian.dll" ..
2025-04-25 14:34:29 DEBUG main  [PluginManager] Loading plugin "plugins\diffuse.dll" ..
2025-04-25 14:34:29 DEBUG main  [PluginManager] Loading plugin "plugins\srgb.dll" ..
2025-04-25 14:34:29 DEBUG main  [PluginManager] Loading plugin "plugins\rectangle.dll" ..
2025-04-25 14:34:29 DEBUG main  [PluginManager] Loading plugin "plugins\area.dll" ..
2025-04-25 14:34:29 DEBUG main  [PluginManager] Loading plugin "plugins\d65.dll" ..
2025-04-25 14:34:29 DEBUG main  [PluginManager] Loading plugin "plugins\regular.dll" ..
2025-04-25 14:34:29 DEBUG main  [PluginManager] Loading plugin "plugins\cube.dll" ..

cheind avatar Apr 25 '25 12:04 cheind

For me, the issue was fixed by upgrading Visual C++ Runtime.

https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170

@mtang398 maybe give it a try if you are on Windows.

cheind avatar Apr 25 '25 12:04 cheind

@cheind Thanks for providing this information, but it seems I faced a different issue. My code work perfectly with scalar_rgb, it only freeze when cuda_ad_rgb is used.

mtang398 avatar May 27 '25 16:05 mtang398

@wjakob Thanks for the respond!

I am not using WSL (Instead I uses window developer powershell for cmake, but building Mitsuba didn't work better than the version I pip install) and I am not able to get any meaningful back trace when the program freezes.

Also, Optix itself seems to be working, I did some test for OptiX without using mitsuba3 and they all seems to be fine.

mtang398 avatar May 27 '25 16:05 mtang398

@mtang398

Hi, what GPU are you using? I have been tracking down some similar behaviors on my system, and haven't yet pinpointed the cause.

pshagneaAV avatar Jun 06 '25 14:06 pshagneaAV