Skip to content

Commit

Permalink
Merge branch 'next_release'
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffamstutz committed Jan 10, 2025
2 parents 02f9c1d + 572d91c commit e7d5b0b
Show file tree
Hide file tree
Showing 863 changed files with 1,308 additions and 53,739 deletions.
49 changes: 45 additions & 4 deletions .github/workflows/anari_sdk_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest]
config: [Release, Debug]

steps:
Expand All @@ -26,10 +26,11 @@ jobs:

- name: Configure CMake
run: >
cmake -LA -B ${{github.workspace}}/build
cmake -LA -B ${{ github.workspace }}/build
-DCMAKE_BUILD_TYPE=${{ matrix.config }}
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install
-DBUILD_SHARED_LIBS=ON
-DBUILD_CTS=ON
-DBUILD_EXAMPLES=ON
-DBUILD_HDANARI=OFF
-DBUILD_HELIDE_DEVICE=ON
Expand All @@ -41,7 +42,7 @@ jobs:
run: cmake --build ${{github.workspace}}/build --config ${{ matrix.config }} --target install

- name: Unit Tests
working-directory: ${{github.workspace}}/build
working-directory: ${{ github.workspace }}/build
run: ctest -R unit_test -C ${{ matrix.config }}

- name: Render Tests
Expand All @@ -51,3 +52,43 @@ jobs:
- name: Tutorial Tests
working-directory: ${{github.workspace}}/build
run: ctest -R anariTutorial -C ${{ matrix.config }}

build-macos:
# iOS is 10x expensive to run on GitHub machines, so only run if we know something else passed as well
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
config: [Release]

steps:
- uses: actions/checkout@v3

- name: Configure CMake
run: >
cmake -LA -B ${{ github.workspace }}/build
-DCMAKE_BUILD_TYPE=${{ matrix.config }}
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install
-DBUILD_SHARED_LIBS=ON
-DBUILD_EXAMPLES=ON
-DBUILD_HDANARI=OFF
-DBUILD_HELIDE_DEVICE=ON
-DBUILD_REMOTE_DEVICE=OFF
-DBUILD_TESTING=ON
-DBUILD_VIEWER=OFF
- name: Build
run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.config }} --target install

- name: Unit Tests
working-directory: ${{ github.workspace }}/build
run: ctest -R unit_test -C ${{ matrix.config }}

- name: Render Tests
working-directory: ${{ github.workspace }}/build
run: ctest -R render_test -C ${{ matrix.config }}

- name: Tutorial Tests
working-directory: ${{ github.workspace }}/build
run: ctest -R anariTutorial -C ${{ matrix.config }}
24 changes: 9 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
## Establish project

set(ANARI_SDK_VERSION_MAJOR 0)
set(ANARI_SDK_VERSION_MINOR 11)
set(ANARI_SDK_VERSION_PATCH 1)
set(ANARI_SDK_VERSION_MINOR 12)
set(ANARI_SDK_VERSION_PATCH 0)
set(ANARI_SDK_VERSION
${ANARI_SDK_VERSION_MAJOR}.${ANARI_SDK_VERSION_MINOR}.${ANARI_SDK_VERSION_PATCH}
)

project(anari VERSION ${ANARI_SDK_VERSION} LANGUAGES C CXX)
project(anari-sdk VERSION ${ANARI_SDK_VERSION} LANGUAGES C CXX)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
Expand Down Expand Up @@ -79,12 +79,6 @@ cmake_dependent_option(BUILD_VIEWER
"BUILD_EXAMPLES"
OFF
)
cmake_dependent_option(BUILD_SCENES_LIB
"Enable anari_test_scenes library"
ON
"NOT BUILD_TESTING;NOT BUILD_EXAMPLES;NOT BUILD_CTS"
ON
)
option(INSTALL_VIEWER_LIBRARY "Install anari::anari_viewer library target" ON)
option(INSTALL_VIEWER "Install anariViewer app" OFF)
mark_as_advanced(INSTALL_VIEWER)
Expand Down Expand Up @@ -141,7 +135,7 @@ include(cmake/mark_cache_variables_as_advanced.cmake)
## Configure CMake find_package() config files ##

set(ANARI_CMAKE_INSTALL_DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${PROJECT_VERSION}
${CMAKE_INSTALL_LIBDIR}/cmake/anari-${PROJECT_VERSION}
)

install(EXPORT anari_Exports
Expand All @@ -152,21 +146,21 @@ install(EXPORT anari_Exports
include(CMakePackageConfigHelpers)

configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${PROJECT_SOURCE_DIR}/cmake/anariConfig.cmake.in"
"${PROJECT_BINARY_DIR}/anariConfig.cmake"
INSTALL_DESTINATION
${ANARI_CMAKE_INSTALL_DESTINATION}
)

write_basic_package_version_file(
"${PROJECT_NAME}ConfigVersion.cmake"
"anariConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/anariConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/anariConfigVersion.cmake
DESTINATION
${ANARI_CMAKE_INSTALL_DESTINATION}
)
Expand Down
74 changes: 52 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This repository contains the source for the ANARI API SDK. This includes:

- [Front-end library + implementation guide](src/anari)
- [Device implementation utilties for implementations](src/helium)
- [Example device implementation](src/helide) (not intended for production use)
- [Example device implementation](src/devices/helide) (not intended for production use)
- [Example applications](examples/)
- [Interactive sample viewer](examples/viewer)
- [Render tests](tests/render)
Expand Down Expand Up @@ -71,21 +71,26 @@ CMake. This can be invoked from your build directory with (on any platform):
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
- `anari::anari` : dynamically link the main ANARI API library target
- `anari::anari_static` : statically link the main ANARI API library target
- `anari::helium` : library containing base device implementation abstractions (static)

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](examples/simple).

The follwoing additional helper library components can be requested by listing
Note that `anari::helium` will still require linking either `anari::anari` or
`anari::anari_static` to give consumers the option whether to link the ANARI
API dynamically or statically.

The following 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
Both of these libraries are 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`:

```cmake
Expand Down Expand Up @@ -120,26 +125,26 @@ 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
## Available implementations

### SDK provided example implementation

An example device implementation [helide](src/helide) is provided as a
An example device implementation [helide](src/devices/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)
API might be implemented. It implements a very simple 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)

### Using the debug device layer

The ANARI-SDK ships with a [debug layer](src/debug_device) implemented as an ordinary
`ANARIDevice` which wraps a device (set as the `wrappedDevice` parameter on the
debug device). This device uses the object queries reported by the wrapped
device to validate correct usage of object subtypes, parameters, and properties,
as well as validate correct object lifetimes. The wrapped device is then used
to actually implement the ANARI API to allow applications to still function
normally.
The ANARI-SDK ships with a [debug layer](src/devices/debug) implemented as an
ordinary `ANARIDevice` which wraps a device (set as the `wrappedDevice`
parameter on the debug device). This device uses the object queries reported by
the wrapped device to validate correct usage of object subtypes, parameters, and
properties, as well as validate correct object lifetimes. The wrapped device is
then used to actually implement the ANARI API to allow applications to still
function normally.

The device can be created by using the normal library loading mechanics using
`anariLoadLibrary("debug", ...)`, creating a the debug device instances with,
Expand Down Expand Up @@ -173,16 +178,41 @@ variables:
- `ANARI_DEBUG_TRACE_MODE` sets the tracing mode, only `code` is supported for now.
- `ANARI_DEBUG_TRACE_DIR` set the folder where the trace will be dumped.

### Unofficial list of publically available implementaions

Below is a list of available ANARI implemenations compatible with this SDK:
### (Unofficial) list of available ANARI implementations

- [AMD RadeonProRender](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderANARI)
- [Barney](https://github.com/ingowald/barney) (experimental MPI distributed renderer)
- [Cycles](https://github.com/jeffamstutz/cycles)
- [Intel OSPRay](https://github.com/ospray/anari-ospray)
- [NVIDIA USD](https://github.com/NVIDIA-Omniverse/AnariUsdDevice)
- [NVIDIA VisRTX + VisGL](https://github.com/NVIDIA/VisRTX)
- [Visionaray](https://github.com/szellmann/anari-visionaray)
- [VTK-m](https://github.com/dpugmire/anari-library-vtkm)

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

## ANARI-enabled applications

### Publicly available applications + libraries using ANARI

- [Blender](https://www.blender.org/) (via [plugin](examples/blender))
- [COVISE](https://www.hlrs.de/solutions/types-of-computing/visualization/covise)
- [HayStack](https://github.com/ingowald/hayStack)
- [OVITO](https://www.ovito.org/)
- [OpenUSD](https://openusd.org/release/index.html) (via [hdAnari](src/hdanari) plugin)
- [pynari](https://github.com/ingowald/pynari)
- [TSD](https://github.com/NVIDIA/VisRTX/tree/next_release/tsd)
- [Vistle](https://vistle.io/)
- [VMD](https://www.ks.uiuc.edu/Research/vmd/)
- [VTK](https://vtk.org/)
- [VTK-m](https://m.vtk.org/)

### Integrations in-progress

- [Ascent](https://ascent.readthedocs.io/en/latest/)
- [ParaView](https://www.paraview.org/)
- [VisIt](https://visit-dav.github.io/visit-website/index.html)

If you integrate ANARI into your application, please open a PR to add it to this
list!
35 changes: 14 additions & 21 deletions cmake/Findanari.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,19 @@ if (TARGET anari::anari)
return()
endif()

add_library(anari::anari INTERFACE IMPORTED)
set_target_properties(anari::anari PROPERTIES
INTERFACE_LINK_LIBRARIES
"anari"
set(ANARI_LOCAL_TARGETS
anari_headers
anari_backend
anari
anari_static
anari_test_scenes
helium
)

add_library(anari::anari_static INTERFACE IMPORTED)
set_target_properties(anari::anari_static PROPERTIES
INTERFACE_LINK_LIBRARIES
"anari_static"
)

add_library(anari::anari_test_scenes INTERFACE IMPORTED)
set_target_properties(anari::anari_test_scenes PROPERTIES
INTERFACE_LINK_LIBRARIES
"anari_test_scenes"
)

add_library(anari::helium INTERFACE IMPORTED)
set_target_properties(anari::helium PROPERTIES
INTERFACE_LINK_LIBRARIES
"helium"
)
foreach(TARGET ${ANARI_LOCAL_TARGETS})
add_library(anari::${TARGET} INTERFACE IMPORTED)
set_target_properties(anari::${TARGET} PROPERTIES
INTERFACE_LINK_LIBRARIES
"${TARGET}"
)
endforeach()
2 changes: 1 addition & 1 deletion cmake/anariConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (@VIEWER_ENABLE_KTX@)
find_dependency(Ktx)
endif()

include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@_Exports.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/anari_Exports.cmake)

if (NOT TARGET anari::anari)
message(FATAL_ERROR "CMAKE_PREFIX_PATH or anari_DIR are pointing to an \
Expand Down
26 changes: 20 additions & 6 deletions cmake/anari_generate_codegen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,49 @@ function(anari_generate_queries)
# options
""
# single-arg options
"PREFIX;NAME;CPP_NAMESPACE;JSON_DEFINITIONS_FILE;JSON_ROOT_LOCATION"
"CPP_NAMESPACE;JSON_DEFINITIONS_FILE;JSON_ROOT_LOCATION;JSON_EXTENSION_FILES;DEVICE_TARGET"
# multi-arg options
""
# string to parse
${ARGN}
)

file(GLOB_RECURSE CORE_JSONS ${ANARI_CODE_GEN_ROOT}/api/*.json)

find_package(Python3 OPTIONAL_COMPONENTS Interpreter)
if (NOT TARGET Python3::Interpreter)
message(WARNING "Unable to find python interpreter, skipping code-gen targets")
return()
endif()

if (NOT DEFINED GENERATE_DEVICE_TARGET)
message(FATAL_ERROR "DEVICE_TARGET option required for anari_generate_queries()")
endif()

set(GENERATE_PREFIX "${GENERATE_DEVICE_TARGET}")

if (DEFINED GENERATE_JSON_ROOT_LOCATION)
set(EXTRA_JSON_OPTION --json ${GENERATE_JSON_ROOT_LOCATION})
endif()

add_custom_target(generate_${GENERATE_NAME}
set(OUTPUT_LOC ${CMAKE_CURRENT_BINARY_DIR})
set(OUTPUT_H ${OUTPUT_LOC}/${GENERATE_PREFIX}_queries.h)
set(OUTPUT_CPP ${OUTPUT_LOC}/${GENERATE_PREFIX}_queries.cpp)

add_custom_command(
OUTPUT ${OUTPUT_H} ${OUTPUT_CPP}
COMMAND ${Python3_EXECUTABLE} ${ANARI_CODE_GEN_ROOT}/generate_queries.py
--json ${ANARI_CODE_GEN_ROOT}
${EXTRA_JSON_OPTION}
--prefix ${GENERATE_PREFIX}
--device ${GENERATE_JSON_DEFINITIONS_FILE}
--namespace ${GENERATE_CPP_NAMESPACE}
--output ${OUTPUT_LOC}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${GENERATE_JSON_DEFINITIONS_FILE}
DEPENDS ${CORE_JSONS} ${GENERATE_JSON_DEFINITIONS_FILE} ${GENERATE_JSON_EXTENSION_FILES}
)

if (TARGET generate_all)
add_dependencies(generate_all generate_${GENERATE_NAME})
endif()
set_source_files_properties(${OUTPUT_H} ${OUTPUT_CPP} PROPERTIES GENERATED ON)
target_sources(${GENERATE_DEVICE_TARGET} PRIVATE ${OUTPUT_CPP})
target_include_directories(${GENERATE_DEVICE_TARGET} PRIVATE ${OUTPUT_LOC})
endfunction()
5 changes: 5 additions & 0 deletions code_gen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ add_custom_target(generate_headers DEPENDS

add_dependencies(generate_all generate_headers)

if (NOT TARGET Python3::Module)
message(WARNING "Unable to find python Module, skipping python bindings")
return()
endif()

if (INSTALL_PYTHON_BINDINGS)
set(BUILD_PYTHON_BINDINGS_BY_DEFAULT ALL)
endif()
Expand Down
Loading

0 comments on commit e7d5b0b

Please sign in to comment.