Git Product home page Git Product logo

anari-sdk's Introduction

logo

ANARI-SDK

This repository contains the source for the ANARI API SDK. This includes:

The 1.0 ANARI specification can be found on the Khronos website here.

The SDK is tested on Linux, but is also intended to be usable on other operating systems such as macOS and Windows.

If you find any problems with the SDK, please do not hesitate to open an issue on this project!

Getting the SDK from vcpkg

The ANARI-SDK is available as the anari package in vcpkg. Simply follow these instructions for setting up your environment to use vcpkg, then run the following to get ANARI:

% vcpkg install anari

Building the SDK from source

The repository uses CMake 3.11+ to build the library, example implementation, sample apps, and tests. For example, to build (must be in a separate directory from the source directory), you can do:

% cd /path/to/anari
% mkdir build
% cd build
% cmake ..

Using a tool like ccmake or cmake-gui will let you see which options are available to enable. The following CMake options are offered:

  • BUILD_SHARED_LIBS : build everything as shared libraries or static libraries
  • BUILD_CTS : build the conformance test suite
  • BUILD_TESTING : build unit and regression test binaries
  • BUILD_HELIDE_DEVICE : build the provided example helide device implementation
  • BUILD_REMOTE_DEVICE : build the provided experimental remote device implementation
  • BUILD_EXAMPLES : build example applications
  • BUILD_VIEWER : build viewer too (needs glfw3) if building examples

Once built, the library can be installed via the install target created by CMake. This can be invoked from your build directory with (on any platform):

% cmake --build . -t install

Using the SDK after install with CMake

The ANARI SDK exports CMake targets for the main front-end library and utilities helper library. The targets which are exported are as follows:

  • anari::anari : main library target to link with libanari
  • anari::helium : (static) library target containing base device implementation abstractions

These targets can be found with CMake via find_package(anari). The examples are written such that they can be built stand alone from the SDK source tree. The simplest usage can be found here.

The follwoing additional helper library components can be requested by listing them under find_pacakge(anari):

  • viewer : Source library target anari::anari_viewer for building small viewer apps
  • code_gen : Enable the use of code generation CMake functions downstream

Both of these libraries are both optionally installed and are not available to downstream projects unless they are explicitly requested. To request one of these components, simply add them to the COMPONENTS portion of find_package:

find_package(anari COMPONENTS viewer code_gen)

Running the examples

The basic tutorial app (built by default) uses the helide device as an example, which can be run with:

% ./anariTutorial

Note that running the tutorial will require that the helide device is enabled in your build with the CMake option BUILD_HELIDE_DEVICE=ON.

The viewer application (enabled with BUILD_VIEWER=ON) by default uses the environment library, which reads ANARI_LIBRARY as an environment variable to get the library to load. For example it can be run with:

% export ANARI_LIBRARY=helide
% ./anariViewer

Alternatively, either --library or -l can be used on the viewer's command line to override the ANARI library to be loaded.

The regression test binary (anariRenderTests) used to render the test scenes without a window (results saved out as PNG images) uses the same mechanisms as the viewer to select/override which library is loaded at runtime.

Available Implementations

SDK provided ExampleDevice implementation

An example device implementation helide is provided as a starting point for users exploring the SDK and for implementors to see how the API might be implemented. It implements a very simple, geometry-only ray tracing implementation using Embree for intersection. Users should look to use vendor provided, hardware-optimized ANARI implementations which are shipped independently from the SDK. (see below)

List of publically available implementaions

Below is a list of available ANARI implemenations compatible with this SDK:

If you implement a backend to the ANARI SDK, please open a PR to add it to this list!

anari-sdk's People

Contributors

goodbadwolf avatar griffin28 avatar inobelar avatar jeffamstutz avatar johguenther avatar khronoswebservices avatar kvankooten avatar ldeakin avatar pangao-h avatar player1537 avatar progschj avatar szellmann avatar ux3d-haertl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anari-sdk's Issues

Windows cmake 3.21.4 build fails

Hello,

When compiling the Anari SDK on Windows 11 Visual Studio 2019 I get this build error:

8>Generating Code... 8>Done building project "anari_library_example.vcxproj" -- FAILED. 12>------ Build started: Project: anariTutorialDirectLink, Configuration: Release x64 ------ 12>Building Custom Rule C:/Users/Cameron/Downloads/ANARI-SDK/examples/direct_linking/CMakeLists.txt 12>anariTutorialDirectLink.c 12>LINK : fatal error LNK1181: cannot open input file '..\..\Release\anari_library_example.lib' 12>Done building project "anariTutorialDirectLink.vcxproj" -- FAILED. 13>------ Build started: Project: ALL_BUILD, Configuration: Release x64 ------ 13>Building Custom Rule C:/Users/Cameron/Downloads/ANARI-SDK/CMakeLists.txt ========== Build: 8 succeeded, 5 failed, 0 up-to-date, 0 skipped ==========
I attempt to continue the build:

1>C:\Users\Cameron\Downloads\ANARI-SDK\examples\example_device\scene\bvh/SweepSAHBuilder.h(294,3): error C2059: syntax error: '{' 1>C:\Users\Cameron\Downloads\ANARI-SDK\examples\example_device\scene\bvh/SweepSAHBuilder.h(294,3): error C2143: syntax error: missing ';' before '{' 1>C:\Users\Cameron\Downloads\ANARI-SDK\examples\example_device\scene\bvh/SweepSAHBuilder.h(301,31): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data 1>C:\Users\Cameron\Downloads\ANARI-SDK\examples\example_device\scene\volume\../SceneObject.h(84,9): error C3001: 'declare': expected an OpenMP directive name 1>C:\Users\Cameron\Downloads\ANARI-SDK\examples\example_device\scene\volume\../SceneObject.h(88,9): error C3036: 'bbox_extend': invalid operator token in OpenMP 'reduction' clause 1>C:\Users\Cameron\Downloads\ANARI-SDK\examples\example_device\scene\volume\../SceneObject.h(88,1): error C3016: 'i': index variable in OpenMP 'for' statement must have signed integral type 1>Generating Code... 1>Done building project "anari_library_example.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========

Am I missing prerequisites? I hope this is helpful.

Kind regards,

Cameron

Building helide device fails for CMake 3.18

When building the latest ANARI SDK with BUILD_HELIDE_DEVICE:BOOL=ON and using CMake 3.18 I get the error below with curl (which does support the required protocols and was manually tested and successfully downloaded the embree file).

However, when using CMake 3.25.1 the ANARI SDK builds successfully. VisIt's automated build scripts currently use CMake 3.18 and are generally several CMake releases behind the current.

embree_error

Compiling on Windows - Visual Studio 2019

Is the code ported to Windows ?

I tried building it but came across this error

3>Generating Code...
3>   Creating library C:/Users/yueni/projects/ANARI-SDK/build/Release/anari_library_example.lib and object C:/Users/yueni/projects/ANARI-SDK/build/Release/anari_library_example.exp
3>ExampleDeviceDebugFactory.obj : error LNK2019: unresolved external symbol "public: void __cdecl anari::debug_device::GenericDebugObject::unknown_parameter(struct ANARIDataType,char const *,char const *,struct ANARIDataType)" (?unknown_parameter@GenericDebugObject@debug_device@anari@@QEAAXUANARIDataType@@PEBD10@Z) referenced in function "public: virtual void __cdecl anari::debug_device::`anonymous namespace'::array1d::setParameter(char const *,struct ANARIDataType,void const *)" (?setParameter@array1d@?A0x220b2aa9@debug_device@anari@@UEAAXPEBDUANARIDataType@@PEBX@Z)
3>ExampleDeviceDebugFactory.obj : error LNK2019: unresolved external symbol "public: void __cdecl anari::debug_device::GenericDebugObject::check_type(struct ANARIDataType,char const *,char const *,struct ANARIDataType,struct ANARIDataType *)" (?check_type@GenericDebugObject@debug_device@anari@@QEAAXUANARIDataType@@PEBD10PEAU4@@Z) referenced in function "public: virtual void __cdecl anari::debug_device::`anonymous namespace'::array1d::setParameter(char const *,struct ANARIDataType,void const *)" (?setParameter@array1d@?A0x220b2aa9@debug_device@anari@@UEAAXPEBDUANARIDataType@@PEBX@Z)
3>ExampleDeviceDebugFactory.obj : error LNK2019: unresolved external symbol "public: void __cdecl anari::debug_device::ObjectFactory::unkown_subtype(struct anari::debug_device::DebugDevice *,struct ANARIDataType,char const *)" (?unkown_subtype@ObjectFactory@debug_device@anari@@QEAAXPEAUDebugDevice@23@UANARIDataType@@PEBD@Z) referenced in function "public: virtual struct anari::debug_device::DebugObjectBase * __cdecl anari::debug_device::ExampleDeviceDebugFactory::new_camera(char const *,struct anari::debug_device::DebugDevice *,struct anari::api::Object *,struct anari::api::Object *)" (?new_camera@ExampleDeviceDebugFactory@debug_device@anari@@UEAAPEAUDebugObjectBase@23@PEBDPEAUDebugDevice@23@PEAUObject@api@3@2@Z)
3>C:\Users\yueni\projects\ANARI-SDK\build\Release\anari_library_example.dll : fatal error LNK1120: 3 unresolved externals
3>Done building project "anari_library_example.vcxproj" -- FAILED.
16>------ Build started: Project: anariTutorialDirectLink, Configuration: Release x64 ------
16>anariTutorialDirectLink.c
16>anariTutorialDirectLink.vcxproj -> C:\Users\yueni\projects\ANARI-SDK\build\Release\anariTutorialDirectLink.exe
17>------ Skipped Build: Project: INSTALL, Configuration: Release x64 ------
17>Project not selected to build for this solution configuration 
========== Build: 9 succeeded, 1 failed, 15 up-to-date, 7 skipped ==========

json syntax error

There seem to be two syntax errors in the file "herder_gen/anari_core_objects_1_0.json".
In my editor, the commas in lines 829 and 833 are displayed as incorrect.

Missed typefor specialization for ANARI_FLOAT32_MAT4

Now user can't use glm matrix or float[16] as ANARI_FLOAT32_MAT4 type parameter. This case produces compilation error.

Looks like there's a missed ANARI_TYPEFOR_SPECIALIZATION for glm vectors and float arrays

Comparing ANARIDataType in c++20

Comparing ANARIDataType for equality used to work in c++17 but leads to compiler errors in c++20 using MSVC. This can be observed in the following code example:

#include "anari_enums.h"
bool isFloat(ANARIDataType anariDataType)
{
    bool isFloat = anariDataType == ANARI_FLOAT32;
    return isFloat
}

While this compiles fine using c++17 but gives the following errors in c++20 (shortend):

[build] ~\AnariDevice.cpp(171): error C2666: 'ANARIDataType::operator ==': overloaded functions have similar conversions
[build] ~\include\anari\frontend/anari_enums.h(14): note: could be 'bool ANARIDataType::operator ==(int) noexcept const'
[build] ~\include\anari\frontend/anari_enums.h(14): note: or 'bool ANARIDataType::operator ==(int) noexcept const' [synthesized expression 'y == x']
[build] ~\AnariDevice.cpp(171): note: or       'built-in C++ operator==(int, int)'
[build] ~/DataOORef.h(315): note: or       'bool Ovito::operator ==(std::nullptr_t,const Ovito::DataOORef<T> &) noexcept'
[build] ~\AnariDevice.cpp(171): note: 'bool Ovito::operator ==(std::nullptr_t,const Ovito::DataOORef<T> &) noexcept': could not deduce template argument for 'const Ovito::DataOORef<T> &' from 'ANARIDataType'
[build] ~/DataOORef.h(310): note: or       'bool Ovito::operator ==(const Ovito::DataOORef<T> &,std::nullptr_t) noexcept'
...
[build] ~/DataOORef.h(310): note: or 'bool Ovito::operator ==(const Ovito::DataOORef<T> &,std::nullptr_t) noexcept' [synthesized expression 'y == x']
...
[build] ninja: build stopped: subcommand failed.
...

This issue can solved in multiple ways:

  1. Explicitly casting the ANARIDataType to an int compilation works.
    bool isFloat(ANARIDataType anariDataType)
    {
        bool isFloat = (int)anariDataType == ANARI_FLOAT32;
        return isFloat
    }
    
  2. Adding a new specialized overload for equality to struct ANARIDataType
    constexpr bool operator==(ANARIDataType v) const noexcept { return v == value; }
    
  3. Adding a new explicit != operator for int to struct ANARIDataType
    constexpr bool operator!=(int v) const noexcept { return v != value; }
    

So the issue can be solved complety client side, however, i thought you might want to know about the issue and maybe consider a library side fix as well.

System Information

  • Windows 11
  • MSVC: 14.37.32822:
    Microsoft (R) C/C++ Optimizing Compiler Version 19.37.32825 for x64
    Copyright (C) Microsoft Corporation.  All rights reserved.
    

Static builds + install target broken on Unix

When building the project statically and then installing to CMAKE_INSTALL_PREFIX, on Unix the anchoring logic that determines where to search for libanari_device_XXX.so will base the search path off the folder that the executables are located in (i.e., bin) and thus won't find the actual device library (which is installed to lib). Therefore, static builds currently only work when being used from the build tree.

Create an offline version for the build

Please make it possible to build the package in cases where no internet access is available. Now one has to copy all the .zip files. Also the pybind11 cloning is not possible.

How can I replace the fetch with a local copy?

THanks

Offline render back end : Learning route

Hi,

I'd like to learn more about developing back end for ANARI with a specific interest in targeting offline CPU renderers.

I have built ANARI and toy around with the viewer.

My main development environment will be Ubuntu.

What example code should I start focusing on ? I have watched the OSPray back end development video from the ANARI Webinar 2022

Cheers

Build error when BUILD_TESTING is false but BUILD_EXAMPLES is true

#16 added support for only including the glm dependency when BUILD_TESTING is on, but I believe it also needs to be enabled when BUILD_EXAMPLES is on.

I believe that in external/CMakeLists.txt then the if statement for whether to download glm should read:

if (BUILD_TESTING OR BUILD_EXAMPLES)

I've tested this by verifying that the following succeeds:

$ cmake -DBUILD_TESTING:BOOL=ON -DBUILD_EXAMPLES:BOOL=ON

The following fails:

$ cmake -DBUILD_TESTING:BOOL=OFF -DBUILD_EXAMPLES:BOOL=ON

And that command succeeds after changing external/CMakeLists.txt:

-if (BUILD_TESTING)
+if (BUILD_TESTING OR BUILD_EXAMPLES)

Need to move anariGetObjectFeatures definition to the API.cpp implementation file

Need to move the anariGetObjectFeatures and anariGetInstanceFeatures definitions from the header file (anari_feature_utility.h) to the appropriate implementation file (API.cpp??). Having the definitions in the header file causes a multiple definition error when trying to #include <anari/anari_cpp.hpp> as the definitions will appear in multiple places and the linker doesn't like it.

Building GL Viewer on macOS fails due to missing GLES

Compiling on macOS fails, when building only the GL viewer but not the GLES viewer.

This can be reproduced with a fresh checkout of the recent main branch (commit f5ae12a) and configuring with:

cmake .. -DBUILD_VIEWER=ON -DBUILD_GLES_VIEWER=OFF

On make, the compiler produces the following error message:

#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV))
                            ^
/Users/stefan/ANARI-SDK/build-test/imgui/backends/imgui_impl_opengl3.cpp:93:46: warning: 'TARGET_OS_TV' is not defined, evaluates to 0 [-Wundef-prefix=TARGET_OS_]
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV))
                                             ^
/Users/stefan/ANARI-SDK/build-test/imgui/backends/imgui_impl_opengl3.cpp:96:10: fatal error: 'GLES3/gl3.h' file not found
#include <GLES3/gl3.h>          // Use GL ES 3
         ^~~~~~~~~~~~~
2 warnings and 1 error generated.
make[2]: *** [external/CMakeFiles/imgui_glfw_gles2.dir/__/imgui/backends/imgui_impl_opengl3.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....

My compiler is Apple clang version 13.1.6 (clang-1316.0.21.2.5). I'm on macOS 12.5.1.

git-bisect suggests that the regression was introduced by this commit: 6991cbf

Ambiguous overloads in anari::newArray

anari::newArray contains defaulted arguments that can cause ambiguity between overloads when used. The best remedy is to simply add 1/2/3D suffixes to each collection of functions.

`primitive.index` not used for indexing into `vertex.color`

I am using Helide to render a sub-set of spheres. I've set the geometry's primitive.index parameter to an ARRAY1D of UINT32. Positions and radii turn out correctly (they are obtained from indexing into vertex.position and vertex.radius) but not the spheres' colors. Their colors seem to be taken from the vertex.color array without indexing.

The ANARI spec claims:

Each element of primitive.index defines one sphere, indexing into the vertex.* arrays.

I am wondering whether I am observing a limitation (or bug) of the helide renderer or doing something wrong on the application side.

NULL pointer dereference in anariLoadLibrary if ANARI_LIBRARY is not set

The getenv function will return a NULL pointer if the environment variable is not set on the line:

char *libraryFromEnv = getenv("ANARI_LIBRARY");

which will be stored in the variable libraryName (and the reference name) in the line:
libraryName = libraryFromEnv;

then it will be used in string concatenation in the line:
lib = anari::loadANARILibrary(std::string("anari_library_") + name);

Suggestion: example device

Hi @jeffamstutz and @szellmann,

It may be useful to mention somewhere in the README that the example device is based on OpenMP and as such early adopters should expect hardware optimized ANARI implementations will be provided by the corresponding vendor.

What do you think?

New device documentation

Is there documentation somewhere regarding implementing a new device ?

I'm working on a Vulkan device and I'm having a hard time grokking what should be in the device.json file, as well as setting up the skeleton of the device implementation.

I am working with C and don't intend to use helium.

Thanks.

Mistake in cornell box scene

In cornell box scene (cornell_box.cpp) there's a possible mistake. There's a check of ANARI_KHR_DEVICE_SYNCHRONIZATION feature (line 275), but it looks like that it should check ANARI_KHR_AREA_LIGHTS

Test fail with SIGILL

Hello there,

I'm trying to package the SDK for Alpine Linux 1, and I encounter a failure when running the unit test

Internal ctest changing into directory: /home/simon/src/aports/testing/anari-sdk/src/ANARI-SDK-0.3.0/build-shared
Test project /home/simon/src/aports/testing/anari-sdk/src/ANARI-SDK-0.3.0/build-shared
      Start  1: unit_test::Any
      Start  2: unit_test::Optional
      Start  3: unit_test::ParameterizedObject
      Start  4: unit_test::RefCounted
      Start  5: unit_test::helium::AnariAny
      Start  6: unit_test::helium::ParameterizedObject
      Start  7: unit_test::helium::RefCounted
      Start  8: render_test::cornell_box
      Start  9: render_test::gravity_spheres_volume
      Start 10: render_test::instanced_cubes
      Start 11: render_test::textured_cube
      Start 12: render_test::random_spheres
 1/12 Test  #1: unit_test::Any ...........................   Passed    0.00 sec
 2/12 Test  #2: unit_test::Optional ......................   Passed    0.00 sec
 3/12 Test  #3: unit_test::ParameterizedObject ...........   Passed    0.00 sec
 4/12 Test  #4: unit_test::RefCounted ....................   Passed    0.00 sec
 5/12 Test  #5: unit_test::helium::AnariAny ..............***Exception: Illegal  0.00 sec
Filters: [helium_AnariAny]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
anariUnitTests is a Catch v2.13.7 host application.
Run with -? for options

-------------------------------------------------------------------------------
helium::AnariAny 'bool' type behavior
  Can make valid by C construction
-------------------------------------------------------------------------------
/home/simon/src/aports/testing/anari-sdk/src/ANARI-SDK-0.3.0/tests/unit/test_helium_AnariAny.cpp:65
...............................................................................

/home/simon/src/aports/testing/anari-sdk/src/ANARI-SDK-0.3.0/tests/unit/test_helium_AnariAny.cpp:65: FAILED:
  {Unknown expression after the reported line}
due to a fatal error condition:
  SIGILL - Illegal instruction signal

===============================================================================
test cases:  3 |  2 passed | 1 failed
assertions: 52 | 51 passed | 1 failed


 6/12 Test  #6: unit_test::helium::ParameterizedObject ...   Passed    0.00 sec
 7/12 Test  #8: render_test::cornell_box .................***Exception: SegFault  0.00 sec
CONFIGURATION:
[FATAL] 'environment' library selected but ANARI_LIBRARY is not set

 8/12 Test  #7: unit_test::helium::RefCounted ............   Passed    0.00 sec
 9/12 Test  #9: render_test::gravity_spheres_volume ......***Exception: SegFault  0.00 sec
CONFIGURATION:
[FATAL] 'environment' library selected but ANARI_LIBRARY is not set

10/12 Test #10: render_test::instanced_cubes .............***Exception: SegFault  0.00 sec
CONFIGURATION:
[FATAL] 'environment' library selected but ANARI_LIBRARY is not set

11/12 Test #11: render_test::textured_cube ...............***Exception: SegFault  0.00 sec
CONFIGURATION:
[FATAL] 'environment' library selected but ANARI_LIBRARY is not set

12/12 Test #12: render_test::random_spheres ..............***Exception: SegFault  0.00 sec
CONFIGURATION:
[FATAL] 'environment' library selected but ANARI_LIBRARY is not set

Also, the there's no way to disable the render test, nor running them without installing the example device. It would be nice to either be able to disable them, or run the tests with the example device in the build folder.

Thanks

Conflicting anari::Device definitions

The base type used for implementations is called anari::Device, but the C++ bindings also use the symbol name anari::Device which causes a conflict by redefining the type.

Fails to build with Intel compilers.

Hi there,
Building with intel compilers generates a whole lotta errors related to glm.
For example:

[  6%] Building CXX object libs/anari/CMakeFiles/anari.dir/anari_cpp_glm_defs.cpp.o
In file included from /work2/01197/semeraro/frontera/ANARI/external/glm/include/glm/./ext/../detail/type_mat2x2.hpp(6),
                 from /work2/01197/semeraro/frontera/ANARI/external/glm/include/glm/./ext/matrix_double2x2.hpp(5),
                 from /work2/01197/semeraro/frontera/ANARI/external/glm/include/glm/mat2x2.hpp(5),
                 from /work2/01197/semeraro/frontera/ANARI/libs/anari/include/anari/anari_cpp/ext/glm.h(7),
                 from /work2/01197/semeraro/frontera/ANARI/libs/anari/anari_cpp_glm_defs.cpp(5):
/work2/01197/semeraro/frontera/ANARI/external/glm/include/glm/./ext/../detail/type_vec2.hpp(93): error: cannot overload functions distinguished by return type alone
                GLM_FUNC_DECL GLM_CONSTEXPR T const& operator[](length_type i) const;

Using the compiler:

login4.frontera(1091)$ which icc
/opt/intel/compilers_and_libraries_2020.1.217/linux/bin/intel64/icc 

Builds under gcc/9.1.0. (Ya I know, then use gcc...)

Anari Python Bindings, Arrays of Arrays

Hi,
I'm trying to use the Python bindings, with an AMR spatial field extension. That extension requires the block data to be specified as a ANARI_ARRAY1D of ANARI_ARRAY1D (of ANARI_FLOAT32). Myself being an absolute Python newbie, and with very little experience with the pyanari bindings, I wonder if someone could give me a pointer how to do this. For reference, some work in progress code that currently fails for me with memory access violations (upon setting those arrays) can be found here in this file:

https://github.com/szellmann/yt/blob/anari/yt/visualization/volume_rendering/anari_volume_rendering.py#L271

Perhaps someone can point me to some example code showing how this is done. I'm currently working off the tutorial as well as the blender plug-in.

Missing CMake target for the debug backend layer

After installation of the SDK, the CMake config module exports targets anari::anari, anari::helium, and anari::anari_test_scenes, but a corresponding target for the debug backend (anary_library_debug) seems to be missing.

A CMake target anari::anari_library_debug for the debug layer would be useful because it would allow querying the install location of anary_library_debug.dll. On the Windows platform, an application typically must copy all Anari DLLs to the application's runtime directory (where the .exe is located) so that they will be found at runtime. Having a CMake target for the debug lib would simplify this deployment step - even if the application does not link to this backend directly.

Mistakes in test scenes

Hello. I found some some issues in ANARI test scenes:

  1. In textured_cube.cpp, line 99, there's an incorrect subtype name ("texture2d", but correct name in documentation is a "image2D")

  2. In random_spheres.cpp there's no release of surface. In line 49 anari:setParameter is used instead of anari:setAndReleaseParameter. Destructor of surface won't be called because surface have one reference.

  3. In file_obj.cpp there's a undocumented parameter using ("vertex.texcoord") (line 139)

build failing, v0.3.0 and latest main

Trying to build, I attempted a few variations similar to the github workflow to get it working, but I always get the following syntax error:

[ 68%] Building CXX object libs/debug_device/CMakeFiles/anari_library_debug.dir/DebugBasics.cpp.o
cd /workspace/srcdir/ANARI-SDK/build/libs/debug_device && /opt/bin/x86_64-linux-gnu-libgfortran5-cxx11/x86_64-linux-gnu-g++ --sysroot=/opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/ -Danari_library_debug_EXPORTS -I/workspace/srcdir/ANARI-SDK/livice/include -I/workspace/srcdir/ANARI-SDK/build/libs/anari/include/anari -I/workspace/srcdir/ANARI-SDK/libs/anari/include -I/workspace/srcdir/ANARI-SDK/libs/anari -I/workspace/srcdir/ANARI-SDK/libs/anari_utilities/include -O3 -DNDEBUG -fPIC -st -MT libs/debug_device/CMakeFiles/anari_library_debug.dir/DebugBasics.cpp.o -MF CMakeFiles/anari_library_debug.dir/DebugBasics.cpp.o.d -o CMakeFiles/anari_library_debug.dir/DebugBasics.cpp.o -c /workspace/srcdir/ANARI-SDK/libs/debug_device/Debug
/workspace/srcdir/ANARI-SDK/libs/debug_device/DebugBasics.cpp: In member function ‘virtual void anari::debug_device::DebugBasics::anariGetProperty(ANARIDevice, ANARIObject, const char*, ANARIDataType, void*, uint64_t, ANARIWaitMask)’:
/workspace/srcdir/ANARI-SDK/libs/debug_device/DebugBasics.cpp:272:36: error: expected ‘)’ before ‘PRIu64’
  272 |             "%s: buffer of size %" PRIu64 " is to small for property of type %s.", DEBUG_FUNCTION_NAME, size, toString(type));
      |                                    ^~~~~~
/workspace/srcdir/ANARI-SDK/libs/debug_device/DebugBasics.cpp:51:17: note: in definition of macro ‘DEBUG_REPORT’
   51 |         STATUS, __VA_ARGS__);
      |                 ^~~~~~~~~~~
/workspace/srcdir/ANARI-SDK/libs/debug_device/DebugBasics.cpp:47:21: note: to match this ‘(’
   47 |     td->reportStatus(\
      |                     ^~
   48 |         DEBUG_SOURCE_OBJECT,\
      |                      
/workspace/srcdir/ANARI-SDK/libs/debug_device/DebugBasics.cpp:47:21: note: in definition of macro ‘DEBUG_REPORT’
   47 |     td->reportStatus(\
      |                     ^~
   48 |         DEBUG_SOURCE_OBJECT,\
      |                      
/workspace/srcdir/ANARI-SDK/libs/debug_device/DebugBasics.cpp:6:1: note: ‘PRIu64’ is defined in header ‘<cinttypes>’; did you forget to ‘#include <cinttypes>’?
    5 | #include <inttypes.h>
  +++ |+#include <cinttypes>
    6 | 
make[2]: *** [libs/debug_device/CMakeFiles/anari_library_debug.dir/build.make:104: libs/debug_device/CMakeFiles/anari_library_debug.dir/DebugBasics.cpp.o] Error 1

I have tried this on g++ versions 11 and 12, but get identical errors.

I am building with

mkdir build && cd build
cmake .. \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_BUILD_PARALLEL_LEVEL=$nproc \
    -DCMAKE_INSTALL_PREFIX=${prefix} \
    -DCMAKE_TOOLCHAIN_FILE=$CMAKE_TARGET_TOOLCHAIN \
    -DBUILD_SHARED_LIBS=ON \
    -DBUILD_EXAMPLES=OFF \
    -DBUILD_HELIDE_DEVICE=OFF \
    -DBUILD_TESTING=OFF \
    -DBUILD_VIEWER=OFF \
    -DBUILD_CTS=OFF
cmake --build . -t install

cmake gives the following configuration dialogue

-- The C compiler identification is GNU 12.1.0
-- The CXX compiler identification is GNU 12.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/bin/x86_64-linux-gnu-libgfortran5-cxx11/x86_64-linux-gnu-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/bin/x86_64-linux-gnu-libgfortran5-cxx11/x86_64-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Found Python3: /usr/bin/python3.9 (found version "3.9.7") found components: Interpreter 
-- Configuring done
-- Generating done

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.