Immersive Visualization / IQ-Station Wiki

This site hosts information on virtual reality systems that are geared toward scientific visualization, and as such often toward VR on Linux-based systems. Thus, pages here cover various software (and sometimes hardware) technologies that enable virtual reality operation on Linux.

The original IQ-station effort was to create low-cost (for the time) VR systems making use of 3DTV displays to produce CAVE/Fishtank-style VR displays. That effort pre-dated the rise of the consumer HMD VR systems, however, the realm of midrange-cost large-fishtank systems is still important, and has transitioned from 3DTV-based systems to short-throw projectors.

Difference between revisions of "BuildingANARI"

From IQ-Station Wiki
Jump to navigation Jump to search
(Adding new section for building the VisRTX/VisGL backends)
m (Adding module list to the build section)
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:
This is the basic ANARI, independent of VR capabilities, which will be documented separately.
This is the basic ANARI, independent of VR capabilities, which will be documented separately.


==Building ANARI on Linux==
=Building ANARI on Linux=
The generic ANARI SDK has minimal system requirements to build.
The generic ANARI SDK has minimal system requirements to build.
However, for the GPU-accelerated backends, there generally will be additional
However, for the GPU-accelerated backends, there generally will be additional
Line 10: Line 10:
When building ANARI, there is a choice between downloading/cloning the reference ANARI-SDK, and separately obtaining the GPU accelerated backends, or it is possible to download the pseudo-Superbuild that will download selected backends, and do a complete build.
When building ANARI, there is a choice between downloading/cloning the reference ANARI-SDK, and separately obtaining the GPU accelerated backends, or it is possible to download the pseudo-Superbuild that will download selected backends, and do a complete build.


===Prerequisites===
This documentation last tested with ANARI-SDK version 0.10.1.
 
==Prerequisites==
ANARI makes use of the CMake build system.  You should have at least version 3.11 of CMake.
ANARI makes use of the CMake build system.  You should have at least version 3.11 of CMake.




===Cloning ANARI===
==Cloning ANARI==
Clone from the [https://github.com/KhronosGroup/ANARI-SDK Khronos Github ANARI reposoitory]:
Clone from the [https://github.com/KhronosGroup/ANARI-SDK Khronos Github ANARI reposoitory].
 
NOTE: Because ''ANARI'' is still in flux, I always add the current date (YYYYMMDD) and Version as a postfix of my cloned directory name.
<syntaxhighlight>
% git clone -b next_release --single-branch https://github.com/KhronosGroup/ANARI-SDK.git anari-sdk-<date>nr
</syntaxhighlight>
or for the master branch:
<syntaxhighlight>
<syntaxhighlight>
% git clone https://github.com/KhronosGroup/ANARI-SDK.git
% git clone https://github.com/KhronosGroup/ANARI-SDK.git
</syntaxhighlight>
</syntaxhighlight>


===Configuring the Build and Installing ===
==Configuring the Build and Installing ==
Configuring and compiling the build:
Configuring and compiling the build:
<syntaxhighlight>
<syntaxhighlight>
% module load optix cuda jpeg-turbo tbb
% mkdir ANARI-SDK/Build
% mkdir ANARI-SDK/Build
% cd ANARI-SDK/Build
% cd ANARI-SDK/Build
% cmake -DCMAKE_INSTALL_PREFIX=... -DCMAKE_BUILD_TYPE:STRING=Debug -DBUILD_CTS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DBUILD_VIEWER:BOOL=ON ..
% cmake -DCMAKE_INSTALL_PREFIX=... -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_CTS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DBUILD_REMOTE_DEVICE:BOOL=ON -DINSTALL_VIEWER:BOOL=ON ..
% make
% make
% make install
% make install
% cp -p anariViewer INSTALL_PREFIX/bin
</syntaxhighlight>
</syntaxhighlight>
 
<!-- (I don't think this is a concern any longer, but I'm just commenting it out for now)
* NOTE: As of ANARI version 0.8.0, I've had to modify the file "imgui_impl_glfw.cpp" to remove three GLFW function calls that are not part of my version of that library:
* NOTE: As of ANARI version 0.8.0, I've had to modify the file "imgui_impl_glfw.cpp" to remove three GLFW function calls that are not part of my version of that library:
** <TT>glfwGetError</TT>
** <TT>glfwGetError</TT>
** <TT>glfwGetMonitorWorkarea</TT>
** <TT>glfwGetMonitorWorkarea</TT>
** <TT>glfwGetMonitorContentScale</TT>
** <TT>glfwGetMonitorContentScale</TT>
-->


==Running ANARI==
=Running ANARI=
The ANARI build process includes a simple tutorial application that will render a scene
The ANARI build process includes a simple tutorial application that will render a scene
consisting of a pair of triangles into two image files (one with the first pass of the
consisting of a pair of triangles into two image files (one with the first pass of the
render, and one with a later pass).
render, and one with a later pass).
An optional "anariViewer" may also be built which contains a handful of reference scenes,
An optional "anariViewer" may also be built (and the above instructions will build it)
along with an OBJ viewer.
which contains a handful of reference scenes, along with an OBJ viewer.


===Running the ANARI backend info tool===
==Running the ANARI backend info tool==
<syntaxhighlight>
<syntaxhighlight>
% ./anariInfo -helide
% ./anariInfo -l helide
</syntaxhighlight>
</syntaxhighlight>


This will then output a slew of information about the backend, including what version of
This will then output a slew of information about the backend, including what version of
ANARI it was built for, and what Parameters and Extensions it handles.
ANARI it was built for, and what Parameters and Extensions it handles.
'''In some respect, it can be considered a quick summary of the ANARI specification, insofar as how that particular library implements the spec.'''


===Running the ANARI tutorial example===
==Running the ANARI tutorial example==
Note that the "anariTutorial" executable (without code changes) will always use the ''helide'' backend.
<syntaxhighlight>
<syntaxhighlight>
% ./anariTutorial
% ./anariTutorial
% display *.ppm
% display *.ppm
</syntaxhighlight>
</syntaxhighlight>
===Running the ANARI viewer example===
 
==Running the ANARI viewer example==
The choice of ANARI backend for ''anarViewer'' is controlled by the '''<TT>ANARI_LIBRARY</TT>''' environment variable
<syntaxhighlight>
<syntaxhighlight>
% export ANARI_LIBRARY=helide
% ./anariViewer
% ./anariViewer
</syntaxhighlight>
</syntaxhighlight>


==Build/Install the VisRTX &amp; VisGL ANARI backends==
=Build/Install additional ANARI backends=
Once the base ANARI SDK is built, additional backends can be compiled and added to the overall ANARI installation:
Once the base ANARI SDK is built, additional backends can be compiled and added to the overall ANARI installation.
 
Some of the available backends include:
* The "'''helide'''" backend, which is a basic CPU-based rendered, compiled with ANARI
* '''OSPRay'''
* '''VisRTX''' / '''VisGL''' ''(see below)''
* '''[[Barney]]''' ANARI backend (''BANARI'')
* [https://github.com/szellmann/anari-visionaray '''Visionaray''' ANARI backend]
* The "'''remote'''" rendering backend ''(see below)''
* The "'''OSD'''" backend
* The "'''debug'''" backend, which is a pass-through backend that does extra sanity checking
* The "'''sink'''" backend, which is a NULL-renderer for testing
 
==VisRTX &amp; VisGL ANARI backends (building/installing)==
<syntaxhighlight>
<syntaxhighlight>
% module load optix cuda anari
% module load optix cuda anari
Line 68: Line 95:
% mkdir visrtx2_version/Build
% mkdir visrtx2_version/Build
% cd visrtx2_version/Build
% cd visrtx2_version/Build
% cmake -DCMAKE_INSTALL_PREFIX=&LT;same-as-ANARI-base&GT;  ..
% cmake .. -DCMAKE_INSTALL_PREFIX=$ANARI_DIR(<same-as-ANARI-base>) -DCMAKE_BUILD_TYPE:STRING=Release
% make
% make
% make install
% make install
Line 78: Line 105:
</syntaxhighlight>
</syntaxhighlight>


==Suggestions for improving the ANARI build process==
 
==Building/using the "remote" ANARI backend==
The <TT>remote</TT> ANARI backend allows an application to be rendered on
one computer but displayed on another.
Unlike some remote graphics viewers that require the data to be on
the remote computer, for the '''ANARI <TT>remote</TT>''' backend operates
such that all the graphical data be first sent from the local computer
to the remote computer before rendering.
 
Note that there are a couple additional system package dependency required
to compile the <TT>remote</TT> backend:
* The Boost "system" package
* JPEG-turbo
* Snappy &mdash; the libsnappy.so library may exist without the package, but on Rocky-8, I've found that the "SnappyConfig.cmake" file has an error (the details of which are too gory to post here).
 
And to build you must add to the <TT>cmake</TT> (or <TT>ccmake</TT> operation:
* <TT>BUILD_REMOTE_DEVICE=ON</TT>
And that works best when <TT>jpeg-turbo</TT> and <TT>snappy</TT> can be found.
: NOTE: a word of caution (at least for Rocky-8/Centos-8), the "Snappy" package has an error in the ".cmake" file that can be overcome, but it's a bit of a hassle.
: NOTE: a second word of caution when building the remote-server &mdash; you may have to add <CODE>-lboost_system</CODE> to the <TT>link.txt</TT> file for <TT>anariRemoteServer</TT>. <!-- See my ANARI_info journal notes for the gory details -->
 
====Running on the remote server====
To use the <TT>remote</TT> server:
 
* On the '''remote''' computer:
*: <CODE>% ANARI_LIBRARY=helide anariRemoteServer [--port &LT;number&GT;]</CODE>
*:: (or whatever backend you want to use in place of <TT>helide</TT>)
 
* on the '''local''' computer:
*: <CODE>% export ANARI_REMOTE_SERVER_HOSTNAME=&LT;remost-host&GT;</CODE>
*: <CODE>% export ANARI_REMOTE_SERVER_PORT=31050</CODE>
*: <CODE>% export ANARI_LIBRARY=remote</CODE>
*: <CODE>% anariViewer</CODE>
*: (or whatever application you want to run)
 
====Tunneling to the remote computer====
Sometimes firewalls can make it difficult to access non-standard ports
on organizational computing systems.
The general solution to this is to use ssh-tunneling, whereby a local
port becomes an access point to a port on the remote computer.
Of course in this case, when setting the '''hostname''' that should now
point to <TT>localhost</TT> since that is now where the port can be found.
 
: <CODE>% ssh -L 31050:localhost:31050 &LT;remote-host&GT;</CODE>
 
=Suggestions for improving ANARI=
I have a few things that I need to pass along to the ANARI working group that could/should
I have a few things that I need to pass along to the ANARI working group that could/should
be fixed in future versions -- especially by the time we get to version 1.0.0.
be fixed in future versions -- especially by the time we get to SDK version 1.0.0.
* <TT>anariViewer</TT> should be copied to <TT>INSTALL_PREFIX/bin</TT>
* <TT>anariViewer</TT> should have a command-line-argument (and/or interactive widget) to set the '''samples-per-pixel''' and '''unit-distance''' values.
* CMake should be fixed to not produce an erroneous GLFW library for <TT>anariViewer</TT>
* <TT>anariTutorial</TT> should honor the <TT>ANARI_LIBRARY</TT> flag.
* Running <TT>anariTutorial</TT> shouldn't seg-fault
** Also anariTutorial should honor the <TT>ANARI_LIBRARY</TT> flag.
* Running <TT>anariInfo -l visgl</TT> shouldn't seg-fault
* Running <TT>anariInfo -l visgl</TT> shouldn't seg-fault
* Running <TT>anariInfo -l &LT;non-existant backend&GT;</TT> shouldn't seg-fault
* When running <TT>anariInfo -l visrtx</TT> there appear to be some spaces in parameter names that are bugs &mdash; e.g. " transform" & " transferFunction1D"
** Probably <TT>anariInfo</TT> should put quotes around subtype and parameter names to make these errors more obvious


==Other issues that I am personally experiencing==
=Other issues that I am personally experiencing=
* My ANARI-VR test programs crash when running with the <TT>helide</TT> backend, apparently because it doesn't have ''directional lights''
* My ANARI-VR test programs render incorrectly when running with the <TT>visgl</TT> backend
* When running <TT>anariInfo -l visrtx</TT> there appear to be some spaces in parameter names that are bugs &mdash; e.g. " transform"
* My ANARI-VR test program (anari_ex8) crashes when running with the any backend
** There are other odd inconsistencies between the output of <TT>anariInfo</TT> for the backends that I've built
* The file <TT>anari_feature_utility.h</TT> seems to no longer exist &mdash; likely I missed a meeting when a change was discussed
** So no call to <TT>anariGetDeviceFeatureStruct()</TT> is available
* There is some code in the installed <TT>share/anari</TT> directory that I'm not sure what it does/is-for
* There is some code in the installed <TT>share/anari</TT> directory that I'm not sure what it does/is-for
* The "SnappyConfig.cmake" file on Rocky-8 has an error, so I had to copy that file to where I could edit it and correct the path to the library file
* Sometimes when doing a parallel <CODE>make -j 8</CODE> I get an error in the build process, but a single-threaded <CODE>make</CODE> works fine.
=ANARI Applications=
Here are some other applications that are using ANARI:
* [https://www.khronos.org/blog/kitware-adds-anari-support-to-vtk-to-simplify-access-to-accelerated-3d-rendering-engines VTK]
** [https://vtk.org/doc/nightly/html/classvtkAnariPass.html vtkAnariPass Class]
** [https://github.com/jeffamstutz/vtkAnariApps Amstutz' VTK ANARI examples] (C++ &amp; [https://www.kitware.com/trame Trame])
* ParaView
** [https://discourse.paraview.org/t/building-paraview-with-anari-support/15176 Building ParaView with ANARI support] (Discourse conversation)
** [https://gitlab.kitware.com/paraview/paraview/-/issues/22556 Dynamic GUI for ANARI devices] (Discourse conversation)
* [https://github.com/vtvamr/anari-volume-viewer ANARI Volume Viewer] (on Github.com)
* [https://github.com/NVIDIA/VTK-m-graph VTK-m Graph tool]
** Uses: [https://github.com/Kitware/VTK-m VTK-m]

Latest revision as of 22:23, 20 October 2024

Instructions for how to build ANARI on Linux. This is the basic ANARI, independent of VR capabilities, which will be documented separately.

Building ANARI on Linux

The generic ANARI SDK has minimal system requirements to build. However, for the GPU-accelerated backends, there generally will be additional required features (such as Cuda or Optix).

When building ANARI, there is a choice between downloading/cloning the reference ANARI-SDK, and separately obtaining the GPU accelerated backends, or it is possible to download the pseudo-Superbuild that will download selected backends, and do a complete build.

This documentation last tested with ANARI-SDK version 0.10.1.

Prerequisites

ANARI makes use of the CMake build system. You should have at least version 3.11 of CMake.


Cloning ANARI

Clone from the Khronos Github ANARI reposoitory.

NOTE: Because ANARI is still in flux, I always add the current date (YYYYMMDD) and Version as a postfix of my cloned directory name.

% git clone -b next_release --single-branch https://github.com/KhronosGroup/ANARI-SDK.git anari-sdk-<date>nr

or for the master branch:

% git clone https://github.com/KhronosGroup/ANARI-SDK.git

Configuring the Build and Installing

Configuring and compiling the build:

% module load optix cuda jpeg-turbo tbb
% mkdir ANARI-SDK/Build
% cd ANARI-SDK/Build
% cmake -DCMAKE_INSTALL_PREFIX=... -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_CTS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DBUILD_REMOTE_DEVICE:BOOL=ON -DINSTALL_VIEWER:BOOL=ON ..
% make
% make install

Running ANARI

The ANARI build process includes a simple tutorial application that will render a scene consisting of a pair of triangles into two image files (one with the first pass of the render, and one with a later pass). An optional "anariViewer" may also be built (and the above instructions will build it) which contains a handful of reference scenes, along with an OBJ viewer.

Running the ANARI backend info tool

% ./anariInfo -l helide

This will then output a slew of information about the backend, including what version of ANARI it was built for, and what Parameters and Extensions it handles. In some respect, it can be considered a quick summary of the ANARI specification, insofar as how that particular library implements the spec.

Running the ANARI tutorial example

Note that the "anariTutorial" executable (without code changes) will always use the helide backend.

% ./anariTutorial
% display *.ppm

Running the ANARI viewer example

The choice of ANARI backend for anarViewer is controlled by the ANARI_LIBRARY environment variable

% export ANARI_LIBRARY=helide
% ./anariViewer

Build/Install additional ANARI backends

Once the base ANARI SDK is built, additional backends can be compiled and added to the overall ANARI installation.

Some of the available backends include:

  • The "helide" backend, which is a basic CPU-based rendered, compiled with ANARI
  • OSPRay
  • VisRTX / VisGL (see below)
  • Barney ANARI backend (BANARI)
  • Visionaray ANARI backend
  • The "remote" rendering backend (see below)
  • The "OSD" backend
  • The "debug" backend, which is a pass-through backend that does extra sanity checking
  • The "sink" backend, which is a NULL-renderer for testing

VisRTX & VisGL ANARI backends (building/installing)

% module load optix cuda anari
% git clone -b next_release --single-branch https://github.com/NVIDIA/VisRTX visrtx2_version
% mkdir visrtx2_version/Build
% cd visrtx2_version/Build
% cmake .. -DCMAKE_INSTALL_PREFIX=$ANARI_DIR(<same-as-ANARI-base>) -DCMAKE_BUILD_TYPE:STRING=Release
% make
% make install

Then:

% export ANARI_LIBRARY=visrtx
% anariViewer


Building/using the "remote" ANARI backend

The remote ANARI backend allows an application to be rendered on one computer but displayed on another. Unlike some remote graphics viewers that require the data to be on the remote computer, for the ANARI remote backend operates such that all the graphical data be first sent from the local computer to the remote computer before rendering.

Note that there are a couple additional system package dependency required to compile the remote backend:

  • The Boost "system" package
  • JPEG-turbo
  • Snappy — the libsnappy.so library may exist without the package, but on Rocky-8, I've found that the "SnappyConfig.cmake" file has an error (the details of which are too gory to post here).

And to build you must add to the cmake (or ccmake operation:

  • BUILD_REMOTE_DEVICE=ON

And that works best when jpeg-turbo and snappy can be found.

NOTE: a word of caution (at least for Rocky-8/Centos-8), the "Snappy" package has an error in the ".cmake" file that can be overcome, but it's a bit of a hassle.
NOTE: a second word of caution when building the remote-server — you may have to add -lboost_system to the link.txt file for anariRemoteServer.

Running on the remote server

To use the remote server:

  • On the remote computer:
    % ANARI_LIBRARY=helide anariRemoteServer [--port <number>]
    (or whatever backend you want to use in place of helide)
  • on the local computer:
    % export ANARI_REMOTE_SERVER_HOSTNAME=<remost-host>
    % export ANARI_REMOTE_SERVER_PORT=31050
    % export ANARI_LIBRARY=remote
    % anariViewer
    (or whatever application you want to run)

Tunneling to the remote computer

Sometimes firewalls can make it difficult to access non-standard ports on organizational computing systems. The general solution to this is to use ssh-tunneling, whereby a local port becomes an access point to a port on the remote computer. Of course in this case, when setting the hostname that should now point to localhost since that is now where the port can be found.

% ssh -L 31050:localhost:31050 <remote-host>

Suggestions for improving ANARI

I have a few things that I need to pass along to the ANARI working group that could/should be fixed in future versions -- especially by the time we get to SDK version 1.0.0.

  • anariViewer should have a command-line-argument (and/or interactive widget) to set the samples-per-pixel and unit-distance values.
  • anariTutorial should honor the ANARI_LIBRARY flag.
  • Running anariInfo -l visgl shouldn't seg-fault
  • Running anariInfo -l <non-existant backend> shouldn't seg-fault
  • When running anariInfo -l visrtx there appear to be some spaces in parameter names that are bugs — e.g. " transform" & " transferFunction1D"
    • Probably anariInfo should put quotes around subtype and parameter names to make these errors more obvious

Other issues that I am personally experiencing

  • My ANARI-VR test programs render incorrectly when running with the visgl backend
  • My ANARI-VR test program (anari_ex8) crashes when running with the any backend
  • There is some code in the installed share/anari directory that I'm not sure what it does/is-for
  • The "SnappyConfig.cmake" file on Rocky-8 has an error, so I had to copy that file to where I could edit it and correct the path to the library file
  • Sometimes when doing a parallel make -j 8 I get an error in the build process, but a single-threaded make works fine.

ANARI Applications

Here are some other applications that are using ANARI: