AnariRenderer mode dose not work in python script

I try to compare the different render modes in Ovito, while I find AnariRenderer mode dose not work. It just produces a black picture, but other mode can obtain the right result.

Here is the python script:

import os
os.environ['OVITO_GUI_MODE'] = '1'
import ovito
from ovito.io import *
from ovito.vis import *
from ovito.modifiers import *


pipeline = import_file('test.data')
pipeline.add_to_scene()
vp = Viewport(type=Viewport.Type.Ortho, camera_dir=(-2, -1, -1), preview_mode=True)
vp.zoom_all()

pipeline.modifiers.append(
    ColorCodingModifier(
    property = 'Position.X',
    gradient = ColorCodingModifier.Rainbow()
    )
)

pipeline.compute()

for label, renderer in zip(['opengl', 'tach', 'osp', 'ana'], [OpenGLRenderer(), TachyonRenderer(), OSPRayRenderer(), AnariRenderer()]):
    print(f'Rendering {label}...')
    vp.render_image(filename=f'{label}.png', alpha=False, renderer=renderer, size=(1200, 800), background=(0, 0, 0))

pipeline.remove_from_scene()

I can not upload the data file due to new user limitation, while you can use any other files to reproduce the results.

My system information is as below:

Win 11
python 3.11.8
ovito 3.10.3

GPU information:

NVIDIA-SMI 537.32                 Driver Version: 537.32       CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                     TCC/WDDM  | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M |

Any suggestions are helpful. Thanks a lot.

I’ve just tested your script successfully with a simple data file, on a Windows 11 machine with GeForce graphics card, Python 3.11, and ovito 3.10.3 installed via pip install. All 4 rendering backends produce an image. This shows, at least, that the Anari/VisRTX rendering backend is not generally broken in this ovito distribution.

Something specific on your machine must let the VisRTX renderer silently fail. I am wondering what it is. The fact that you have a machine using the TCC (Tesla Compute Cluster) driver may play a role. That’s something I haven’t seen before, and which OVITO hasn’t been tested with. Unfortunately, I cannot try this configuration myself because TCC doesn’t work with GeForce GPUs.

I will talk to the NVIDIA developer responsible for VisRTX and ask if he has an idea.

I know it’s a lot to ask, but would you be willing and able to compile the VisRTX code yourself using a C++ compiler on your computer? Then we could check more directly why VisRTX doesn’t work. Perhaps you happen to have the necessary experience in using the build tools. I would provide further instructions as needed.

There’s another thing you could do first: You can set the environment variable OVITO_ANARI_DEBUG when executing the Python script. This should let OVITO forward the logging messages from the VisRTX renderer to the console. It would be interesting to see what they say.

set OVITO_ANARI_DEBUG=1
python <your_script.py>

– or add os.environ['OVITO_ANARI_DEBUG'] = '1' to the top of your script.

Thanks for your detailed reply.

I first tried to add os.environ[‘OVITO_ANARI_DEBUG’] = ‘1’ in my script, unforturnately nothing outputs after I run the script.

Secondly, I tried to compile the VisRTX in my WSL2. I install the anari by:

vcpkg install anari

It stopped at


I do not know why.

Finally, I tried to install ovito in my WSL and see if the problems exist.

I install it by:

conda create -n ovi -c https://conda.ovito.org -c conda-forge ovito

When I import ovito, something is wrong:

ImportError: libEGL.so.1: cannot open shared object file: No such file or directory

I try to fix it:

sudo apt-get update
sudo apt-get upgrade
sudo apt install libegl1

Then the error changes to:

ImportError: libOpenGL.so.0: cannot open shared object file: No such file or directory

I try to fix it:

sudo apt install libopengl0

Then the error changes to:

ImportError: ovito_bindings.so: undefined symbol: _Zls6QDebugRK11QDockWidget, version Qt_6

I am not sure what I can do now :rofl: By the way, I can import PySide6.

Updated.

I successfully compile the VisRTX in my WSL and obtain the libanari_library_visgl.so, libanari_library_visrtx.so. No error happens during compling. What the next step now?

Sorry, I forgot: In addition to setting the environment variable OVITO_ANARI_DEBUG, you need to add this call to your Python script:

import ovito
ovito.enable_logging()

You have mentioned WSL2 in your latest posts. Did you run your original Python script in the WSL2 environment or in the native Windows environment? I need to know whether you are using the Windows or the Linux version of the ovito Python module. On our end, we have tested only the Windows version on the Windows platform.

Now regarding your VisRTX build: The idea is to test VisRTX standalone, not in conjunction with OVITO. The VisRTX code repo contains various examples and tutorials, which should get built along with the main library and which can be used for testing. In the build directory, you should see an executable named “tutorial”. When you run it, it should render an offscreen image and produce an output file named “tutorial.png”.

Furthermore, please use the Git branch next_release from the VisRTX repository, because that’s the one we are also using in OVITO.

After adding ovito.enable_logging(), the output is below:

OVITO: Initializing renderer
ovito.anari: [DEBUG] initializing VisRTX device
OVITO: Setting up rendering device - this may take some time
ovito.anari: [DEBUG] running on GPU 0 (NVIDIA GeForce RTX 4060 Laptop GPU)

ovito.anari: [DEBUG] OptiX message [4][KNOBS]:
All knobs on default.

ovito.anari: [DEBUG] OptiX message [4][DISKCACHE]:
Opened database: "C:\Users\herrwu\AppData\Local\NVIDIA\OptixCache\optix7cache.db"
ovito.anari: [DEBUG] OptiX message [4][DISKCACHE]:
    Cache data size: "27.8 MiB"
ovito.anari: [INFO] Compiling OptiX module: 'debug' renderer
ovito.anari: [DEBUG] OptiX message [4][DISKCACHE]:
Cache hit for key: ptx-2974027-key0e44dd2d2bdf64a50f01e59b7ca66fa0-sm_89-rtc1-drv537.32

ovito.anari: [DEBUG] OptiX message [4][COMPILER]:

ovito.anari: [INFO] Compiling OptiX module: 'raycast' renderer
ovito.anari: [DEBUG] OptiX message [4][DISKCACHE]:
Cache hit for key: ptx-4904249-keya1d15de6074d326f535767cd113c91ed-sm_89-rtc1-drv537.32

ovito.anari: [DEBUG] OptiX message [4][COMPILER]:

ovito.anari: [INFO] Compiling OptiX module: 'ao' renderer
ovito.anari: [DEBUG] OptiX message [4][DISKCACHE]:
Cache hit for key: ptx-7344692-keye5094f17d431084074af20f4d9f67d9f-sm_89-rtc1-drv537.32

ovito.anari: [DEBUG] OptiX message [4][COMPILER]:

ovito.anari: [INFO] Compiling OptiX module: 'dpt' renderer
ovito.anari: [DEBUG] OptiX message [4][DISKCACHE]:
Cache hit for key: ptx-4841426-key6f8b7b263d95a0f9cf0cdb27adb8290b-sm_89-rtc1-drv537.32

ovito.anari: [DEBUG] OptiX message [4][COMPILER]:

ovito.anari: [INFO] Compiling OptiX module: 'scivis' renderer
ovito.anari: [DEBUG] OptiX message [4][DISKCACHE]:
Cache hit for key: ptx-7388590-keye0cfc362f937dfb4b0deecc399bc4564-sm_89-rtc1-drv537.32

ovito.anari: [DEBUG] OptiX message [4][COMPILER]:

ovito.anari: [INFO] Compiling OptiX module: 'test' renderer
ovito.anari: [DEBUG] OptiX message [4][DISKCACHE]:
Cache hit for key: ptx-1062328-key093a45b34c1888b820e48b640131ea72-sm_89-rtc1-drv537.32

ovito.anari: [DEBUG] OptiX message [4][COMPILER]:

ovito.anari: [INFO] Compiling OptiX module: custom intersectors
ovito.anari: [DEBUG] OptiX message [4][DISKCACHE]:
Cache hit for key: ptx-1006381-key735291102c125b2012335498d97e19d3-sm_89-rtc1-drv537.32

ovito.anari: [DEBUG] OptiX message [4][COMPILER]:

ovito.anari: [DEBUG] OptiX message [4][DISKCACHE]:
Cache hit for key: ptx-11625-key89d83c506aec34f2be6975e0d38dac3c-sm_89-rtc1-drv537.32

ovito.anari: [DEBUG] OptiX message [4][COMPILER]:

ovito.anari: [DEBUG] committing soup cylinder geometry
ovito.anari: [DEBUG] committing soup sphere geometry
ovito.anari: [DEBUG] committing soup sphere geometry
ovito.anari: [DEBUG] visrtx::World will add zero instance
ovito.anari: [DEBUG] visrtx::World found lights in zero instance
ovito.anari: [DEBUG] visrtx::World rebuilding BLASs
ovito.anari: [DEBUG] visrtx::Group skipping triangle BVH build
ovito.anari: [DEBUG] visrtx::Group skipping curve BVH build
ovito.anari: [DEBUG] visrtx::Group building user BVH
ovito.anari: [DEBUG] visrtx::Group skipping volume BVH build
ovito.anari: [DEBUG] visrtx::Group skipping triangle BVH build
ovito.anari: [DEBUG] visrtx::Group skipping curve BVH build
ovito.anari: [DEBUG] visrtx::Group building user BVH
ovito.anari: [DEBUG] visrtx::Group skipping volume BVH build
ovito.anari: [DEBUG] visrtx::Group skipping triangle BVH build
ovito.anari: [DEBUG] visrtx::Group skipping curve BVH build
ovito.anari: [DEBUG] visrtx::Group building user BVH
ovito.anari: [DEBUG] visrtx::Group skipping volume BVH build
ovito.anari: [DEBUG] visrtx::Group skipping triangle BVH build
ovito.anari: [DEBUG] visrtx::Group skipping curve BVH build
ovito.anari: [DEBUG] visrtx::Group skipping user BVH build
ovito.anari: [DEBUG] visrtx::Group skipping volume BVH build
ovito.anari: [DEBUG] visrtx::World building surface BVH over 3 instances
ovito.anari: [DEBUG] visrtx::World building surface gpu data
ovito.anari: [DEBUG] visrtx::World building volume BVH over 0 instances
ovito.anari: [DEBUG] skipping BVH build
ovito.anari: [DEBUG] visrtx::World building volume gpu data
ovito.anari: [DEBUG] OptiX message [4][DENOISER]:
using cuda device "NVIDIA GeForce RTX 4060 Laptop GPU" (8.9), buffers: fp16, xmma/xmma-jit convolution, rt v12020
ovito.anari: [DEBUG] OptiX message [4][DENOISER]:
using cuda device "NVIDIA GeForce RTX 4060 Laptop GPU" (8.9), buffers: fp16, xmma/xmma-jit convolution, rt v12020
ovito.anari: [DEBUG] OptiX message [4][DENOISER]:
layers created for resolution 1200 800, inp 3, outp 3
ovito.anari: [DEBUG] OptiX message [4][DENOISER]:
layers created for resolution 1200 800, inp 3, outp 3
ovito.anari: [DEBUG] OptiX message [4][COMPILER]:
Info: Pipeline statistics
        module(s)                            :     3
        entry function(s)                    :     7
        trace call(s)                        :     6
        continuation callable call(s)        :     0
        direct callable call(s)              :     0
        basic block(s) in entry functions    : 22261
        instruction(s) in entry functions    : 161837
        non-entry function(s)                :     0
        basic block(s) in non-entry functions:     0
        instruction(s) in non-entry functions:     0
        debug information                    :    no

ovito.anari: [DEBUG] Pipeline Create Log:
Info: Pipeline statistics
        module(s)                            :     3
        entry function(s)                    :     7
        trace call(s)                        :     6
        continuation callable call(s)        :     0
        direct callable call(s)              :     0
        basic block(s) in entry functions    : 22261
        instruction(s) in entry functions    : 161837
        non-entry function(s)                :     0
        basic block(s) in non-entry functions:     0
        instruction(s) in non-entry functions:     0
        debug information                    :    no

ovito.anari: [DEBUG] freeing managed array
ovito.anari: [DEBUG] freeing managed array
ovito.anari: [DEBUG] invoking array deleter
ovito.anari: [DEBUG] freeing managed array
ovito.anari: [DEBUG] freeing managed array
ovito.anari: [DEBUG] invoking array deleter
ovito.anari: [DEBUG] invoking array deleter
OVITO: Rendering frame 0
ovito.anari: [DEBUG] destroying VisRTX device
ovito.anari: [DEBUG] OptiX message [4][DISKCACHE]:
Closed database: "C:\Users\herrwu\AppData\Local\NVIDIA\OptixCache\optix7cache.db"
ovito.anari: [DEBUG] OptiX message [4][DISKCACHE]:
    Cache data size: "27.8 MiB"

I run the script on windows platform, because I failed to install ovito in my wsl, as shown on the above reply.

On the other hand, I run the VisRTX/tutorial, something is wrong:

[FATAL][0x55f7e1953440] Optix call (optixInit()) failed with code OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND (line 574)

New update.

I think the problem comes from the ovito python package. I use ovito-pro desktop (3.10.3) on my Win platform to run the script, producing the right result.

Interesting. Could you please clarify whether you had installed the ovito python package in the WSL environment or a native Python interpreter for Windows? In other words, did you install the Linux or the Windows version of the ovito python package?

I am asking because the VisRTX components in the ovito python package for Windows and in OVITO Pro for Windows are virtually identical. It would be surprising if one works and the other doesn’t. The ovito python package for Linux, on the other hand, is different.

All my tests are run on the Windows platform, including ovito-pro desktop and ovito python package (in native Python interpreter for Win with conda). WSL is only used to compile the VisRTX code. The desktop works well while python package fails.

I see. So you did install the ovito python package by running conda install, not pip install. This is an important difference because the conda package (including VisRTX) is built using the conda-forge toolchain, which is quite different from the toolchain we use to build the pip wheels and OVITO Pro.

Let me check the conda package myself now. So far, I have only tested the pip package from the PyPI repository.

On the other hand, I hope you also check the ovito python package for linux. I install it by conda in my WSL and another native ubuntu computer, facing the same problem:

ImportError: ovito_bindings.so: undefined symbol: _Zls6QDebugRK11QDockWidget, version Qt_6

Thank you very much.

This kind of error should be fixed now:

We’ve rebuilt (almost) all ovito conda packages to use the latest version 6.6.2 of the qt6-main package, which seems to resolve this issue. The updated conda package for Windows is still underway and will become available tomorrow.

Now the windows ovito conda package works well. For linux system (still ovito conda package), the ImportError is fixed, while I meet new problem when rendering by Anari in my WSL and a native linux:

my WSL:

OVITO: Initializing renderer
ovito.anari: [DEBUG] initializing VisRTX device
OVITO: Setting up rendering device - this may take some time
ovito.anari: [FATAL] Optix call (optixInit()) failed with code OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND (line 574)

ovito.anari: [DEBUG] running on GPU 0 (NVIDIA GeForce RTX 4060 Laptop GPU)

Segmentation fault

another linux:

OVITO: Initializing renderer
OVITO: Setting up rendering device - this may take some time
ovito.anari: [DEBUG] initializing VisRTX device
ovito.anari: [FATAL] Optix call (optixInit()) failed with code OPTIX_ERROR_LIBRARY_NOT_FOUND (line 574)

ovito.anari: [DEBUG] running on GPU 0 (Tesla T4)

Segmentation fault

After a discussion with NVIDIA developers, we’ve learned that VisRTX does not currently work in the WSL2 environment. That’s because the VisRTX renderer requires NVIDIA OptiX, which is part of the regular Windows and Linux graphics drivers but not the special driver for the WSL2 environment.

In the latest OVITO release 3.10.4, the VisRTX renderer has been updated to handle this situation more gracefully and not crash the program if OptiX is unavailable.

I haven’t tested this myself, but I saw the following post in the NVIDIA forum, which suggests that it is possible to install OptiX in WSL2 with some extra effort – just in case you want to attempt this.