Compare commits

..
Author SHA1 Message Date
Nick Avramoussis e7ec6329dc Auto sign off doc update commits
Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
2022-04-29 13:59:16 +01:00
Nick Avramoussis a28c227175 Testing documentation publishing
Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
2022-04-28 21:57:20 +01:00
Nick Avramoussis 30e59dc432 Testing documentation publishing
Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
2022-04-28 21:48:05 +01:00
Nick Avramoussis 3fff04fa64 Testing documentation publishing
Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
2022-04-28 21:13:42 +01:00
Nick Avramoussis a75b75617b Testing documentation publishing
Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
2022-04-28 20:54:45 +01:00
Nick Avramoussis 9abae44383 Temporarily remove other workflows for testing
Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
2022-04-28 20:32:48 +01:00
Nick Avramoussis 7fffe564ef Minor adjustments to auto doxygen deployment
Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
2022-04-28 20:30:37 +01:00
Nick Avramoussis 375c683456 Minor adjustments to auto doxygen deployment
Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
2022-04-28 20:09:08 +01:00
Nick Avramoussis 960336887b Merge branch 'master' into feature/docs
Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
2022-04-28 18:55:33 +01:00
Dan Bailey 6966d7453d Merge pull request #1252 from Idclip/deploy_docs_to_website
Changed the docs workflow to deploy to the website repo
2021-11-18 14:19:06 -08:00
Nick Avramoussis d0b0556a6c Changed the docs workflow to deploy to the website repo
Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
2021-11-17 20:14:42 +00:00
675 changed files with 29806 additions and 124797 deletions
-165
View File
@@ -1,165 +0,0 @@
name: AX
on:
push:
branches:
- 'master'
- 'feature/**'
- 'pr/**'
paths-ignore:
- 'CHANGES'
- 'CODEOWNERS'
- 'doc/**'
- 'nanovdb/**'
- 'openvdb_maya/**'
- 'openvdb_houdini/**'
- 'pendingchanges/**'
- '**.md'
pull_request:
branches:
- '**'
paths-ignore:
- 'CHANGES'
- 'CODEOWNERS'
- 'doc/**'
- 'nanovdb/**'
- 'openvdb_maya/**'
- 'openvdb_houdini/**'
- 'pendingchanges/**'
- '**.md'
schedule:
# run this workflow every day 7am UTC
- cron: '0 7 * * *'
workflow_dispatch:
inputs:
type:
description: 'The type of CI to run (all, mac, linux, grammar)'
required: true
default: 'all'
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
linux-ax:
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'linux'
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-8c-32g-300h') || 'ubuntu-latest' }}
name: >
linux-ax:${{ matrix.config.image }}-cxx:${{ matrix.config.cxx }}-${{ matrix.config.build }}
container:
image: aswf/ci-openvdb:${{ matrix.config.image }}
env:
CXX: ${{ matrix.config.cxx }}
CCACHE_DIR: /tmp/ccache
strategy:
matrix:
# Only test unified builds (core+ax). weekly CI should test standalone
config:
- { image: '2023-clang15', cxx: 'clang++', build: 'Release', cmake: '' }
- { image: '2023-clang15', cxx: 'g++', build: 'Release', cmake: '' }
- { image: '2023-clang15', cxx: 'clang++', build: 'Debug', cmake: '' }
- { image: '2022-clang11', cxx: 'clang++', build: 'Release', cmake: '' }
- { image: '2022-clang11', cxx: 'g++', build: 'Release', cmake: '' }
- { image: '2021-clang10', cxx: 'clang++', build: 'Release', cmake: '-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON' }
- { image: '2021-clang10', cxx: 'g++', build: 'Release', cmake: '-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON' }
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: pybind11
#if: contains(matrix.config.image, '2023') == false
run: ./ci/install_pybind11.sh 2.10.0
- name: timestamp
id: timestamp
run: echo "timestamp=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: ccache
# don't use ccache for debug builds
if: matrix.config.build == 'Release'
id: ccache
uses: actions/cache@v3
with:
path: /tmp/ccache
key: linux-ax${{ matrix.config.image }}-${{ matrix.config.cxx }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: linux-ax${{ matrix.config.image }}-${{ matrix.config.cxx }}-
- name: build
run: >
./ci/build.sh -v
--build-type=${{ matrix.config.build }}
--components='core,python,bin,axcore,axbin,axtest'
--cargs=\"
${{ matrix.config.cmake }}
-DOPENVDB_AX_TEST_CMD_DOWNLOADS=ON
-DUSE_EXPLICIT_INSTANTIATION=OFF
-DOPENVDB_CXX_STRICT=ON
\"
- name: test
run: cd build && ctest -V
- name: test_doxygen_examples
run: ./ci/extract_test_examples.sh
# Keep ccache light by stripping out any caches not accessed in the last day
- name: ccache_clean
if: matrix.config.build == 'Release'
run: ccache --evict-older-than 1d
macos-ax:
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'mac'
runs-on: ${{ matrix.config.runner }}
name: macos-cxx:${{ matrix.config.cxx }}-llvm:${{ matrix.config.llvm }}-${{ matrix.config.build }}
env:
CXX: ${{ matrix.config.cxx }}
strategy:
matrix:
config:
#@note llvm10 never got its own brew formula...
- { runner: 'macos-latest', cxx: 'clang++', build: 'Release', llvm: '11' }
- { runner: 'macos-latest', cxx: 'clang++', build: 'Release', llvm: '12' }
- { runner: 'macos-latest', cxx: 'clang++', build: 'Release', llvm: '13' }
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: install_deps
run: ./ci/install_macos.sh ${{ matrix.config.llvm }}
- name: build
run: >
./ci/build.sh -v
--build-type=${{ matrix.config.build }}
--components="core,python,bin,axcore,axbin,axtest"
--cargs=\"
-DOPENVDB_AX_TEST_CMD_DOWNLOADS=ON
-DUSE_EXPLICIT_INSTANTIATION=OFF
-DLLVM_DIR=/usr/local/opt/llvm@${{ matrix.config.llvm }}/lib/cmake/llvm
\"
- name: test
run: cd build && ctest -V
- name: test_doxygen_examples
run: ./ci/extract_test_examples.sh
gen-grammar:
if: |
github.event_name == 'workflow_dispatch' &&
github.event.inputs.type == 'grammar'
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-8c-32g-300h') || 'ubuntu-latest' }}
container:
image: aswf/ci-openvdb:2022-clang11
steps:
- uses: actions/checkout@v3
- name: build
run: ./ci/build.sh -v --components=axgr --target=openvdb_ax_grammar --cargs=\"-DOPENVDB_AX_GRAMMAR_NO_LINES=ON\"
- name: upload grammar
uses: actions/upload-artifact@v2
with:
name: ax_grammar
path: ./build/openvdb_ax/openvdb_ax/openvdb_ax/grammar
retention-days: 5
-202
View File
@@ -1,202 +0,0 @@
name: Build
on:
push:
branches:
- 'master'
- 'feature/**'
- 'pr/**'
paths-ignore:
- 'CHANGES'
- 'CODEOWNERS'
- 'doc/**'
- 'openvdb_maya/**'
- 'openvdb_houdini/**'
- 'openvdb_ax/**'
- 'nanovdb/**'
- 'pendingchanges/**'
- '**.md'
pull_request:
branches:
- '**'
paths-ignore:
- 'CHANGES'
- 'CODEOWNERS'
- 'doc/**'
- 'openvdb_maya/**'
- 'openvdb_houdini/**'
- 'openvdb_ax/**'
- 'nanovdb/**'
- 'pendingchanges/**'
- '**.md'
schedule:
# run this workflow every day at 7am UTC except Monday
- cron: '0 7 * * 0,2-6'
# run this workflow Monday 7am UTC
# warning: This pattern is checked in various places below
- cron: '0 7 * * 1'
workflow_dispatch:
inputs:
type:
description: 'The type of CI to run (all, linux, win, mac)'
required: true
default: 'all'
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
linux-vfx:
# VFX platform jobs. These are run on the appropriate CentOS images from
# the provided ASWF docker containers
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'linux'
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-8c-32g-300h') || 'ubuntu-latest' }}
name: >
linux-vfx:${{ matrix.config.image }}-
abi:${{ matrix.config.abi }}-
cxx:${{ matrix.config.cxx }}-
type:${{ matrix.config.build }}
container:
image: aswf/ci-openvdb:${{ matrix.config.image }}
env:
CXX: ${{ matrix.config.cxx }}
CCACHE_DIR: /tmp/ccache
strategy:
matrix:
config:
# @note we specifically use clang15.0 (not clang15) here as the newest
# versions of the clang15.X containers have some issues with the GLFW
# installation
- { cxx: clang++, image: '2023-clang15.0', abi: '11', build: 'Release', cmake: '' }
- { cxx: g++, image: '2023-clang15.0', abi: '11', build: 'Release', cmake: '' }
- { cxx: clang++, image: '2022-clang11', abi: '11', build: 'Debug', cmake: '' }
- { cxx: clang++, image: '2022-clang11', abi: '10', build: 'Release', cmake: '' }
- { cxx: g++, image: '2022-clang11', abi: '10', build: 'Release', cmake: '' }
- { cxx: clang++, image: '2022-clang11', abi: '9', build: 'Release', cmake: '-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON' }
- { cxx: g++, image: '2022-clang11', abi: '9', build: 'Release', cmake: '-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON' }
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: pybind11
#if: contains(matrix.config.image, '2023') == false
run: ./ci/install_pybind11.sh 2.10.0
- name: timestamp
id: timestamp
run: echo "timestamp=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: ccache
# don't use ccache for debug builds
if: matrix.config.build == 'Release'
id: ccache
uses: actions/cache@v3
with:
path: /tmp/ccache
key: linux-vfx${{ matrix.config.image }}-abi${{ matrix.config.abi }}-${{ matrix.config.cxx }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: linux-vfx${{ matrix.config.image }}-abi${{ matrix.config.abi }}-${{ matrix.config.cxx }}-
- name: build
run: >
./ci/build.sh -v
--build-type=${{ matrix.config.build }}
--components=\"core,python,bin,view,render,test\"
--cargs=\"
${{ matrix.config.cmake }}
-DOPENVDB_CXX_STRICT=ON
-DOPENVDB_ABI_VERSION_NUMBER=${{ matrix.config.abi }}
\"
- name: test
# Always run tests on weekly builds but skip Debug on commits as they take a while.
# https://github.community/t/distinct-job-for-each-schedule/17811/2
if: contains(github.event.schedule, '0 7 * * 1') || matrix.config.build == 'Release'
run: |
cd build && ctest -V
cd - && ./ci/test_install.sh
# Keep ccache light by stripping out any caches not accessed in the last day
- name: ccache_clean
if: matrix.config.build == 'Release'
run: ccache --evict-older-than 1d
windows:
# Windows CI. Tests static and dynamic builds with MT and MD respectively.
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'win'
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'windows-2022-8c-32g-300h') || 'windows-latest' }}
name: windows-vc:${{ matrix.config.vc }}-type:${{ matrix.config.build }}
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.config.vc }}
strategy:
matrix:
config:
# static build of blosc from vcpkg does not build internal sources.
# USE_STATIC_DEPENDENCIES is required for IlmBase/OpenEXR defines and
# Boost as both shared and static libs are installed.
# USE_EXPLICIT_INSTANTIATION is disabled for debug static libraries
# due to disk space constraints
# @note Commented out the static debug build due to linker OOM LNK1102
- { vc: 'x64-windows-static', components: 'core,bin,view,render,test', build: 'Release', cmake: '-A x64 -G \"Visual Studio 17 2022\" -DOPENVDB_CORE_SHARED=OFF -DUSE_STATIC_DEPENDENCIES=ON -DBLOSC_USE_EXTERNAL_SOURCES=ON' }
#- { vc: 'x64-windows-static', components: 'core,bin,view,render,test', build: 'Debug', cmake: '-A x64 -G \"Visual Studio 17 2022\" -DOPENVDB_CORE_SHARED=OFF -DUSE_STATIC_DEPENDENCIES=ON -DBLOSC_USE_EXTERNAL_SOURCES=ON -DUSE_EXPLICIT_INSTANTIATION=OFF' }
- { vc: 'x64-windows', components: 'core,bin,view,render,python,test', build: 'Release', cmake: '-A x64 -G \"Visual Studio 17 2022\" -DOPENVDB_CORE_STATIC=OFF' }
- { vc: 'x64-windows', components: 'core,bin,view,render,python,test', build: 'Debug', cmake: '-A x64 -G \"Visual Studio 17 2022\" -DOPENVDB_CORE_STATIC=OFF' }
#- { vc: 'x64-windows', build: 'Release', cmake: '-G \"MinGW Makefiles\" -DOPENVDB_CORE_STATIC=OFF' }
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: path
shell: pwsh
run: |
# note: system path must be modified in a previous step to it's use
echo "$Env:VCPKG_INSTALLATION_ROOT\installed\${{ matrix.config.vc }}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "${{github.workspace}}\build\openvdb\openvdb\${{ matrix.config.build }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: install
run: ./ci/install_windows.sh
- name: build
run: >
./ci/build.sh -v
--config=${{ matrix.config.build }}
--components=${{ matrix.config.components }}
--cargs=\'
${{ matrix.config.cmake }}
-DMSVC_COMPRESS_PDB=ON
-DUSE_EXR=ON
-DUSE_PNG=ON
-DVCPKG_TARGET_TRIPLET=${VCPKG_DEFAULT_TRIPLET}
-DCMAKE_TOOLCHAIN_FILE=\"${VCPKG_INSTALLATION_ROOT}\\scripts\\buildsystems\\vcpkg.cmake\"
\'
- name: size
# Print the build directy size (monitor if we're hitting runner limits)
run: du -h build
- name: test
# Always run tests on weekly builds but skip Debug on commits as they take a while.
# https://github.community/t/distinct-job-for-each-schedule/17811/2
if: contains(github.event.schedule, '0 7 * * 1') || matrix.config.build == 'Release'
run: cd build && ctest -V -C ${{ matrix.config.build }}
macos:
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'mac'
runs-on: macos-latest
env:
CXX: clang++
steps:
- uses: actions/checkout@v3
- name: install
run: ./ci/install_macos.sh
- name: build
run: >
./ci/build.sh -v
--build-type=Release
--components=\"core,python,bin,view,render,test\"
- name: test
run: cd build && ctest -V
+13 -86
View File
@@ -23,14 +23,9 @@ on:
workflow_dispatch:
inputs:
deploy:
description: 'Deploy to openvdb-website (docs/coverage)?'
description: 'Deploy docs?'
required: true
default: 'none'
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
default: 'false'
jobs:
doxygen:
@@ -38,20 +33,17 @@ jobs:
env:
CXX: g++
container:
# @note We can't update this as epydoc doesn't support python3. We'll
# need to re-write the python docs to use sphinx
image: aswf/ci-openvdb:2022
image: aswf/ci-openvdb:2019
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: install_doxygen
run: ./ci/install_doxygen.sh 1_8_11
- name: pybind11
#if: contains(matrix.config.image, '2023') == false
run: ./ci/install_pybind11.sh 2.10.0
# - name: install_epydoc
# run: pip install epydoc
- name: install_epydoc
run: pip install epydoc
- name: install_latex
run: yum -y install texlive-latex-bin texlive-dvips texlive-collection-fontsrecommended texlive-collection-latexrecommended
- name: install_cmake
run: ./ci/install_cmake.sh 3.15.0
- name: build
run: >
./ci/build.sh -v
@@ -64,13 +56,11 @@ jobs:
-DUSE_EXPLICIT_INSTANTIATION=OFF
-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON
\"
# - name: epydoc
# run: |
# epydoc --html -o /usr/local/share/doc/OpenVDB/html/python pyopenvdb
- name: epydoc
run: |
epydoc --html -o /usr/local/share/doc/OpenVDB/html/python pyopenvdb
- name: pre_deploy
# Overwrite global SSH configuration
# https://github.com/peaceiris/actions-gh-pages/issues/719
# https://linuxhint.com/ssh-stricthostkeychecking/
run: >
echo "Host *
StrictHostKeyChecking no
@@ -81,78 +71,15 @@ jobs:
if: |
github.repository_owner == 'AcademySoftwareFoundation' &&
github.event_name == 'workflow_dispatch' &&
github.event.inputs.deploy == 'docs'
github.event.inputs.deploy == 'true'
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: /usr/local/share/doc/OpenVDB/html
destination_dir: documentation/doxygen
external_repository: AcademySoftwareFoundation/openvdb-website
publish_branch: master
publish_branch: doxygen
full_commit_message: "Automatic doxygen documentation update
- Deployed from: AcademySoftwareFoundation/openvdb ${{ github.sha }}
Signed-off-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
#############################################################################
################################ Coverage ###################################
#############################################################################
linux-coverage:
if: |
github.repository_owner == 'AcademySoftwareFoundation' &&
github.event_name == 'workflow_dispatch' &&
github.event.inputs.deploy == 'coverage'
runs-on: ubuntu-latest
container:
image: aswf/ci-openvdb:2023
env:
CXX: g++
steps:
- uses: actions/checkout@v3
- name: install_gcovr
run: pip install gcovr
- name: build
run: >
./ci/build.sh -v
--build-type=coverage
--components="core,axcore,test,axtest"
--cargs=\"-DOPENVDB_CORE_STATIC=OFF -DOPENVDB_AX_STATIC=OFF\"
- name: test_and_gcov
run: |
cd build
ctest -V
make gcov_html
cd -
- name: zip_large_html
# The index.function list is > 100mb. Just zip it and provide it as a
# download (could instead use LFS to host but not really worth it).
run: |
cd build/gcov_html
tar -czvf index.functions.html.tar.gz index.functions.html
sed -i -e 's/index.functions.html/index.functions.html.tar.gz/g' index.html
sed -i -e 's/List of functions/Download function index/g' index.html
rm index.functions.html
cd -
- name: pre_deploy
# Overwrite global SSH configuration
# https://github.com/peaceiris/actions-gh-pages/issues/719
# https://linuxhint.com/ssh-stricthostkeychecking/
run: >
echo "Host *
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
" > /etc/ssh/ssh_config
- name: deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./build/gcov_html
destination_dir: documentation/code_coverage
external_repository: AcademySoftwareFoundation/openvdb-website
publish_branch: master
full_commit_message: "Automatic code coverage update
- Deployed from: AcademySoftwareFoundation/openvdb ${{ github.sha }}
Signed-off-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
-181
View File
@@ -1,181 +0,0 @@
name: Houdini
on:
push:
branches:
- 'master'
- 'feature/**'
- 'pr/**'
paths-ignore:
- 'CHANGES'
- 'CODEOWNERS'
- 'doc/**'
- 'nanovdb/**'
- 'openvdb_maya/**'
- 'pendingchanges/**'
- '**.md'
pull_request:
branches:
- '**'
paths-ignore:
- 'CHANGES'
- 'CODEOWNERS'
- 'doc/**'
- 'nanovdb/**'
- 'openvdb_maya/**'
- 'pendingchanges/**'
- '**.md'
schedule:
# run this workflow every day 7am UTC
- cron: '0 7 * * *'
workflow_dispatch:
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
checksecret:
# Check that valid github secrets have been set. This isn't needed to retrieve
# the cache, but ensures that the job doens't start with an empty cache
name: Verify Houdini Secrets
runs-on: ubuntu-latest
outputs:
HOUDINI_SECRETS: ${{ steps.check.outputs.HOUDINI_SECRETS }}
steps:
- id: check
env:
HOUDINI_CLIENT_ID: ${{ secrets.HOUDINI_CLIENT_ID }}
HOUDINI_SECRET_KEY: ${{ secrets.HOUDINI_SECRET_KEY }}
run: echo "HOUDINI_SECRETS=${{ env.HOUDINI_CLIENT_ID != '' && env.HOUDINI_SECRET_KEY != '' }}" >> $GITHUB_OUTPUT
- name: Skip Next Jobs
if: steps.check.outputs.HOUDINI_SECRETS != 'true'
run: echo "HOUDINI_CLIENT_ID and HOUDINI_SECRET_KEY GitHub Action Secrets needs to be set to install Houdini builds"
linux-vfx-houdini:
needs: [checksecret]
if: >
${{ needs.checksecret.outputs.HOUDINI_SECRETS == 'true' ||
github.repository_owner == 'AcademySoftwareFoundation' }}
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-8c-32g-300h') || 'ubuntu-latest' }}
name: hou:${{ matrix.config.hou_hash }}-vfx:${{ matrix.config.image }}-cxx:${{ matrix.config.cxx }}
container:
image: aswf/ci-base:${{ matrix.config.image }}
env:
CXX: ${{ matrix.config.cxx }}
CCACHE_DIR: /tmp/ccache
strategy:
matrix:
config:
- { cxx: clang++, image: '2023.0', hou_hash: '20_0-newabi', build: 'Release', components: 'core,hou,bin,view,render,python,test,axcore,axbin,axtest' }
- { cxx: clang++, image: '2022', hou_hash: '20_0-oldabi', build: 'Release', components: 'core,hou' }
- { cxx: clang++, image: '2021', hou_hash: '19_5', build: 'Release', components: 'core,hou' }
- { cxx: clang++, image: '2023.0', hou_hash: '20_0-newabi', build: 'Debug', components: 'core,hou,bin,view,render,python,test,axcore,axbin,axtest' }
- { cxx: g++, image: '2023.0', hou_hash: '20_0-newabi', build: 'Release', components: 'core,hou,bin,view,render,python,test,axcore,axbin,axtest' }
- { cxx: g++, image: '2022', hou_hash: '20_0-oldabi', build: 'Release', components: 'core,hou' }
fail-fast: false
steps:
# See note on this step in the Houdini weekly.yml job
# We can remove this when we no longer use < 2023 images
- name: remove zstd
run: yum -y remove zstd
- uses: actions/checkout@v3
- name: pybind11
#if: contains(matrix.config.image, '2023') == false
run: ./ci/install_pybind11.sh 2.10.0
- name: timestamp
id: timestamp
run: echo "timestamp=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: ccache
# don't use ccache for debug builds
if: matrix.config.build == 'Release'
id: ccache
uses: actions/cache@v3
with:
path: /tmp/ccache
key: linux-vfx-hou${{ matrix.config.hou_hash }}-${{ matrix.config.image }}-${{ matrix.config.cxx }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: linux-vfx-hou${{ matrix.config.hou_hash }}-${{ matrix.config.image }}-${{ matrix.config.cxx }}-
- name: fetch_houdini
uses: actions/cache/restore@v3
with:
path: hou
key: dummy-houdini${{ matrix.config.hou_hash }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: vdb-v5-houdini${{ matrix.config.hou_hash }}-
- name: validate_houdini
run: test -f "hou/hou.tar.gz"
# Make sure that the unpacked install is NOT in the root of the OpenVDB checkout
# otherwise CMake's install RPATHs wil not work correctly.
- name: install_houdini
run: |
mkdir $HOME/houdini_install
cp hou/hou.tar.gz $HOME/houdini_install/hou.tar.gz
cd $HOME/houdini_install && tar -xzf hou.tar.gz && cd -
- name: build
run: |
./ci/build.sh -v \
--build-type=Release \
--components="${{ matrix.config.components }}" \
--cargs=\" \
-DHOUDINI_ROOT=$HOME/houdini_install/hou \
-DOPENVDB_BUILD_HOUDINI_ABITESTS=OFF \
-DOPENVDB_HOUDINI_INSTALL_PREFIX=/tmp \
-DDISABLE_CMAKE_SEARCH_PATHS=ON \
-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON \
\"
- name: test
run: cd build && ctest -V
# Keep ccache light by stripping out any caches not accessed in the last day
- name: ccache_clean
if: matrix.config.build == 'Release'
run: ccache --evict-older-than 1d
macos-houdini:
needs: [checksecret]
if: >
${{ needs.checksecret.outputs.HOUDINI_SECRETS == 'true' ||
github.repository_owner == 'AcademySoftwareFoundation' }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: fetch_houdini
uses: actions/cache/restore@v3
with:
path: hou
key: dummy-houdini
restore-keys: vdb-v5-houdini-macos-
- name: validate_houdini
run: test -f "hou/hou.tar.gz"
# Make sure that the unpacked install is NOT in the root of the OpenVDB checkout
# otherwise CMake's install RPATHs wil not work correctly.
- name: install_houdini
run: |
mkdir $HOME/houdini_install
cp hou/hou.tar.gz $HOME/houdini_install/hou.tar.gz
cd $HOME/houdini_install && tar -xzf hou.tar.gz && cd -
- name: install_deps
run: |
brew update
brew install bash gnu-getopt cmake boost glfw googletest openexr pybind11 llvm@15 cppunit
echo "/usr/local/opt/gnu-getopt/bin" >> $GITHUB_PATH
- name: build
run: |
./ci/build.sh -v \
--build-type=Release \
--components="core,hou,bin,view,render,python,test,axcore,axbin,axtest" \
--cargs=\" \
-DHOUDINI_ROOT=$HOME/houdini_install/hou \
-DOPENVDB_BUILD_HOUDINI_ABITESTS=OFF \
-DOPENVDB_HOUDINI_INSTALL_PREFIX=/tmp \
-DDISABLE_CMAKE_SEARCH_PATHS=ON \
-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON \
-DUSE_EXPLICIT_INSTANTIATION=OFF \
-DLLVM_DIR=/usr/local/opt/llvm@15/lib/cmake/llvm \
\"
- name: test
run: cd build && ctest -V
-193
View File
@@ -1,193 +0,0 @@
name: NanoVDB
on:
push:
branches:
- 'master'
- 'feature/**'
- 'pr/**'
paths-ignore:
- 'CHANGES'
- 'CODEOWNERS'
- 'doc/**'
- 'openvdb_ax/**'
- 'openvdb_maya/**'
- 'openvdb_houdini/**'
- 'pendingchanges/**'
- '**.md'
pull_request:
branches:
- '**'
paths-ignore:
- 'CHANGES'
- 'CODEOWNERS'
- 'doc/**'
- 'openvdb_ax/**'
- 'openvdb_maya/**'
- 'openvdb_houdini/**'
- 'pendingchanges/**'
- '**.md'
schedule:
# run this workflow every day 7am UTC
- cron: '0 7 * * *'
workflow_dispatch:
inputs:
type:
description: 'The type of CI to run (all, linux, win, mac)'
required: true
default: 'all'
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
linux-nanovdb:
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'linux'
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-8c-32g-300h') || 'ubuntu-latest' }}
name: >
linux-nanovdb:cxx:${{ matrix.config.cxx }}-${{ matrix.config.build }}
container:
image: aswf/ci-openvdb:${{ matrix.config.image }}
env:
CXX: ${{ matrix.config.cxx }}
strategy:
matrix:
config:
- { cxx: g++, image: '2022-clang11', build: 'Release' }
- { cxx: g++, image: '2022-clang11', build: 'Debug' }
- { cxx: clang++, image: '2022-clang11', build: 'Release' }
- { cxx: clang++, image: '2022-clang11', build: 'Debug' }
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: install_cuda_11
run: |
yum -y install yum-utils
yum-config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo
echo "Installing cuda toolkit"
yum --enablerepo=epel -y install cuda-toolkit-11-6
echo "/usr/local/cuda-11.6/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=/usr/local/cuda-11.6/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: build
run: >
./ci/build.sh -v
--build-type=${{ matrix.config.build }}
--components=core,nano,nanotest,nanoexam,nanobench,nanotool
--cargs=\'
-DUSE_EXPLICIT_INSTANTIATION=OFF
-DNANOVDB_USE_CUDA=ON
-DNANOVDB_USE_OPENVDB=ON
-DCMAKE_INSTALL_PREFIX=`pwd`
-DUSE_BLOSC=OFF
\'
- name: test
run: cd build && sudo ctest -V -E ".*cuda.*"
windows-nanovdb:
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'win'
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'windows-2022-8c-32g-300h') || 'windows-latest' }}
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.config.vc }}
visual_studio: "Visual Studio 17 2022"
cuda: "11.6.2"
strategy:
matrix:
config:
# static build of blosc from vcpkg does not build internal sources.
# USE_STATIC_DEPENDENCIES is required for IlmBase/OpenEXR defines and
# Boost as both shared and static libs are installed.
- { vc: 'x64-windows-static', build: 'Release', cmake: '-A x64 -G \"Visual Studio 17 2022\" -DOPENVDB_CORE_SHARED=OFF -DUSE_STATIC_DEPENDENCIES=ON -DBLOSC_USE_EXTERNAL_SOURCES=ON -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded' }
- { vc: 'x64-windows-static', build: 'Debug', cmake: '-A x64 -G \"Visual Studio 17 2022\" -DOPENVDB_CORE_SHARED=OFF -DUSE_STATIC_DEPENDENCIES=ON -DBLOSC_USE_EXTERNAL_SOURCES=ON -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug' }
- { vc: 'x64-windows', build: 'Release', cmake: '-A x64 -G \"Visual Studio 17 2022\" -DOPENVDB_CORE_STATIC=OFF' }
- { vc: 'x64-windows', build: 'Debug', cmake: '-A x64 -G \"Visual Studio 17 2022\" -DOPENVDB_CORE_STATIC=OFF' }
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: path
run: |
# note: system path must be modified in a previous step to it's use
echo "$Env:VCPKG_INSTALLATION_ROOT\installed\${{ matrix.config.vc }}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "${{github.workspace}}\build\openvdb\openvdb\${{ matrix.config.build }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: install_cuda
shell: powershell
run: .\ci\install_windows_cuda.ps1
- name: install_deps
shell: bash
run: |
vcpkg update
vcpkg install zlib tbb gtest blosc boost-iostreams boost-system boost-any boost-uuid boost-interprocess boost-algorithm
- name: build
shell: bash
run: >
./ci/build.sh -v
--config=${{ matrix.config.build }}
--components=core,nano,nanotest,nanoexam,nanobench,nanotool
--cargs=\'
${{ matrix.config.cmake }}
-DMSVC_COMPRESS_PDB=ON
-DUSE_EXPLICIT_INSTANTIATION=OFF
-DNANOVDB_USE_CUDA=ON
-DNANOVDB_USE_OPENVDB=ON
-DVCPKG_TARGET_TRIPLET=${VCPKG_DEFAULT_TRIPLET}
-DCMAKE_TOOLCHAIN_FILE=\"${VCPKG_INSTALLATION_ROOT}\\scripts\\buildsystems\\vcpkg.cmake\"
\'
- name: test
shell: bash
run: cd build && ctest -V -E ".*cuda.*"
macos-nanovdb:
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'mac'
runs-on: ${{ matrix.config.runner }}
env:
CXX: ${{ matrix.config.cxx }}
strategy:
matrix:
config:
- { runner: 'macos-11', cxx: 'clang++', build: 'Release' }
- { runner: 'macos-11', cxx: 'clang++', build: 'Debug' }
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: install_deps
run: ./ci/install_macos.sh
- name: build
run: >
./ci/build.sh -v
--build-type=${{ matrix.config.build }}
--components=core,nano,nanotest,nanoexam,nanobench,nanotool
--cargs=\'-DUSE_EXPLICIT_INSTANTIATION=OFF -DNANOVDB_USE_CUDA=OFF -DNANOVDB_USE_OPENVDB=ON\'
- name: test
run: cd build && ctest -V -E ".*cuda.*"
nanovdb-lite:
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'linux'
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-8c-32g-300h') || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v3
- name: install_gtest
run: |
sudo apt-get update
sudo apt-get -q install -y libgtest-dev
- name: build_and_test
run: |
cd nanovdb/nanovdb
sudo mkdir .build
cd .build
sudo cmake -DUSE_EXPLICIT_INSTANTIATION=OFF -DNANOVDB_BUILD_UNITTESTS=ON ../
sudo make -j8 install
sudo ctest -V
-486
View File
@@ -1,486 +0,0 @@
# This workflow runs once a week and tests a variety of configurations,
# dependencies and other specific or expensive checkes (sanitizers).
# It also contains the Houdini Cache jobs which update the CI cache
# with new Houdini releases.
name: Weekly
on:
schedule:
# run this workflow Sunday 00:00 UTC
- cron: '0 0 * * 0'
workflow_dispatch:
inputs:
type:
description: 'The type of CI to run (all, houdini, latest, extra, ax, blosc, abi)'
required: true
default: 'all'
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
#############################################################################
################################## Houdini ##################################
#############################################################################
# Check that valid github secrets have been set for the ability to
# download Houdini and cache it. The secrets are used in download_houdini.py
checksecret:
name: Verify Houdini Secrets
runs-on: ubuntu-latest
outputs:
HOUDINI_SECRETS: ${{ steps.check.outputs.HOUDINI_SECRETS }}
steps:
- id: check
env:
HOUDINI_CLIENT_ID: ${{ secrets.HOUDINI_CLIENT_ID }}
HOUDINI_SECRET_KEY: ${{ secrets.HOUDINI_SECRET_KEY }}
run: echo "HOUDINI_SECRETS=${{ env.HOUDINI_CLIENT_ID != '' && env.HOUDINI_SECRET_KEY != '' }}" >> $GITHUB_OUTPUT
- name: Skip Next Jobs
if: steps.check.outputs.HOUDINI_SECRETS != 'true'
run: echo "HOUDINI_CLIENT_ID and HOUDINI_SECRET_KEY GitHub Action Secrets needs to be set to install Houdini builds"
# Explicitly error on the ASWF repo, we expect this secret to always exist
- name: Error ASWF
if: steps.check.outputs.HOUDINI_SECRETS != 'true' && github.repository_owner == 'AcademySoftwareFoundation'
run: exit 1
# download the latest production version of Houdini X, strip out headers,
# libraries and binaries required for building OpenVDB and put it into
# the GitHub Actions cache
linux_houdini:
needs: [checksecret]
if: |
(needs.checksecret.outputs.HOUDINI_SECRETS == 'true') &&
(github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'houdini')
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-8c-32g-300h') || 'ubuntu-latest' }}
name: linux-houdini:${{ matrix.config.hou_hash }}
env:
CXX: clang++
HOUDINI_CLIENT_ID: ${{ secrets.HOUDINI_CLIENT_ID }}
HOUDINI_SECRET_KEY: ${{ secrets.HOUDINI_SECRET_KEY }}
strategy:
matrix:
config:
- { houdini_version: '19.5', platform: 'linux_x86_64_gcc9.3', hou_hash: '19_5' }
- { houdini_version: '20.0', platform: 'linux_x86_64_gcc9.3', hou_hash: '20_0-oldabi' }
- { houdini_version: '20.0', platform: 'linux_x86_64_gcc11.2', hou_hash: '20_0-newabi' }
fail-fast: false
container:
image: aswf/ci-base:2023
steps:
- uses: actions/checkout@v3
# We bumped from the 2021 CI image to 2023 here to fix some OpenSSL issues
# with the Houdini download script. In so doing we broke some of the caching
# between this job and the jobs in houdini.yml which _don't_ use the 2023
# image yet. The issue is that the cache action will use zstd if it's
# available to zip the cache and this causes it to be inserted with a unique
# hash which images without zstd (i.e. the 2021/2022 images don't have
# access to). For now, uninstall zstd here instead of installing it
# everywhere and ask the LF to add zstd to the older base images.
- name: remove zstd
run: yum -y remove zstd
- name: timestamp
id: timestamp
run: echo "timestamp=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: download_houdini
run: ./ci/download_houdini.sh ${{ matrix.config.houdini_version }} ${{ matrix.config.platform }} --prod
- name: install_houdini
run: |
mkdir $HOME/houdini_install
cp hou/hou.tar.gz $HOME/houdini_install/hou.tar.gz
cd $HOME/houdini_install && tar -xzf hou.tar.gz && cd -
- name: write_houdini_cache
uses: actions/cache/save@v3
with:
path: hou
key: vdb-v5-houdini${{ matrix.config.hou_hash }}-${{ steps.timestamp.outputs.timestamp }}
macos_houdini:
needs: [checksecret]
if: |
(needs.checksecret.outputs.HOUDINI_SECRETS == 'true') &&
(github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'houdini')
runs-on: macos-latest
name: macos-houdini-20
env:
HOUDINI_CLIENT_ID: ${{ secrets.HOUDINI_CLIENT_ID }}
HOUDINI_SECRET_KEY: ${{ secrets.HOUDINI_SECRET_KEY }}
steps:
- uses: actions/checkout@v3
- name: timestamp
id: timestamp
run: echo "timestamp=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: download_houdini
run: ./ci/download_houdini.sh 20.0 macosx_x86_64_clang12.0_11 --prod
- name: install_houdini
run: |
mkdir $HOME/houdini_install
cp hou/hou.tar.gz $HOME/houdini_install/hou.tar.gz
cd $HOME/houdini_install && tar -xzf hou.tar.gz && cd -
- name: write_houdini_cache
uses: actions/cache/save@v3
with:
path: hou
key: vdb-v5-houdini-macos-${{ steps.timestamp.outputs.timestamp }}
#############################################################################
########################### Core Library Extras #############################
#############################################################################
# Extra configuration tests for the OpenVDB Core library. These test a
# variety of options with newer compilers.
linux-extra:
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'extra'
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-8c-32g-300h') || 'ubuntu-latest' }}
name: linux-extra:${{ matrix.config.name }}
container:
# @note we specifically use clang15.0 (not clang15) here as the newest
# versions of the clang15.X containers have some issues with the GLFW
# installation
image: aswf/ci-openvdb:2023-clang15.0
env:
CXX: clang++
strategy:
matrix:
config:
- { name: 'all', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_BLOSC=ON -DUSE_ZLIB=ON -DUSE_EXR=ON -DUSE_PNG=ON' }
- { name: 'lite', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_BLOSC=OFF -DUSE_ZLIB=OFF -DUSE_EXR=OFF -DUSE_PNG=OFF -DOPENVDB_USE_DELAYED_LOADING=OFF' }
- { name: 'half', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_BLOSC=OFF -DUSE_IMATH_HALF=ON' }
- { name: 'sse', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DOPENVDB_SIMD=SSE42' }
- { name: 'avx', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DOPENVDB_SIMD=AVX' }
- { name: 'numpy', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_NUMPY=ON -DOPENVDB_PYTHON_WRAP_ALL_GRID_TYPES=ON' }
- { name: 'asan', build: 'asan', components: 'core,test,axcore,axtest', cmake: '-DNANOVDB_USE_OPENVDB=ON -DOPENVDB_AX_STATIC=OFF -DOPENVDB_CORE_STATIC=OFF -DUSE_BLOSC=OFF' } # We never called blosc_destroy(), so disable blosc to silence these errors
- { name: 'ubsan', build: 'ubsan', components: 'core,test,axcore,axtest', cmake: '' }
- { name: 'c++20', build: 'Release', components: 'core,test,axcore,axtest', cmake: '-DCMAKE_CXX_STANDARD=20' }
- { name: 'conf', build: 'Release', components: 'core,python,bin,view,render,test,axcore,axtest', cmake: '-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON' }
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: pybind11
#if: contains(container.image, '2023') == false
run: ./ci/install_pybind11.sh 2.10.0
- name: build
run: >
./ci/build.sh -v
--build-type=${{ matrix.config.build }}
--components="${{ matrix.config.components }}"
--cargs=\"-DOPENVDB_CXX_STRICT=ON ${{ matrix.config.cmake }}\"
- name: test
run: cd build && ctest -V
# Test latest dependencies, latest compilers and options
latest:
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'latest'
runs-on: ${{ matrix.config.runson }}
env:
CXX: ${{ matrix.config.cxx }}
strategy:
matrix:
config:
- { runson: ubuntu-latest, cxx: g++, cmake: '' }
# Disable the clang job for now. See https://github.com/actions/runner-images/issues/8659
# - { runson: ubuntu-latest, cxx: clang++, cmake: '' }
# @todo gcc on macos
- { runson: macos-latest, cxx: '', cmake: '-D CMAKE_CXX_COMPILER=/usr/local/opt/llvm@15/bin/clang++' }
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: install_deps
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get -q install -y libboost-dev libboost-iostreams-dev libtbb-dev libblosc-dev llvm-dev libgtest-dev libcppunit-dev pybind11-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
./ci/install_macos.sh 15
else
echo "$RUNNER_OS not supported"; exit 1
fi
- name: build
run: >
./ci/build.sh -v
--build-type=Release
--components=\"core,axcore,python,bin,render,test,axtest,axbin\"
--cargs=\"-DCMAKE_CXX_STANDARD=20 -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install ${{ matrix.config.cmake }}\"
- name: test
run: cd build && ctest -V
#############################################################################
############################ AX Library Extras ##############################
#############################################################################
linux-ax:
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'ax'
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-8c-32g-300h') || 'ubuntu-latest' }}
name: >
linux-ax:${{ matrix.config.image }}-cxx:${{ matrix.config.cxx }}-${{ matrix.config.build }}
container:
image: aswf/ci-openvdb:${{ matrix.config.image }}
env:
CXX: ${{ matrix.config.cxx }}
strategy:
matrix:
config:
# Unified
- { image: '2022-clang14', cxx: 'clang++', build: 'Release', components: 'core,bin,axcore,axbin,axtest', cmake: '' }
- { image: '2022-clang14', cxx: 'g++', build: 'Release', components: 'core,bin,axcore,axbin,axtest', cmake: '' }
- { image: '2022-clang13', cxx: 'clang++', build: 'Release', components: 'core,bin,axcore,axbin,axtest', cmake: '' }
- { image: '2022-clang13', cxx: 'g++', build: 'Release', components: 'core,bin,axcore,axbin,axtest', cmake: '' }
# Standalone
- { image: '2021-clang10', cxx: 'clang++', build: 'Release', components: 'core', cmake: '-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON' }
- { image: '2022-clang11', cxx: 'clang++', build: 'Debug', components: 'core', cmake: '' }
- { image: '2022-clang11', cxx: 'clang++', build: 'Release', components: 'core', cmake: '' }
- { image: '2022-clang11', cxx: 'g++', build: 'Release', components: 'core', cmake: '' }
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: pybind11
#f: contains(matrix.config.image, '2023') == false
run: ./ci/install_pybind11.sh 2.10.0
- name: build
run: >
./ci/build.sh -v
--build-type=${{ matrix.config.build }}
--components=${{ matrix.config.components }}
--cargs=\"
${{ matrix.config.cmake }}
-DOPENVDB_AX_TEST_CMD_DOWNLOADS=ON
-DUSE_EXPLICIT_INSTANTIATION=OFF
-DOPENVDB_CXX_STRICT=ON
\"
- name: clean
if: matrix.config.components == 'core'
run: rm -rf build
- name: build
if: matrix.config.components == 'core'
run: >
./ci/build.sh -v
--build-type=${{ matrix.config.build }}
--components="bin,axcore,axbin,axtest,python"
--cargs=\"
${{ matrix.config.cmake }}
-DOPENVDB_AX_TEST_CMD_DOWNLOADS=ON
-DUSE_EXPLICIT_INSTANTIATION=OFF
-DOPENVDB_CXX_STRICT=ON
\"
- name: test
run: cd build && ctest -V
- name: test_doxygen_examples
run: ./ci/extract_test_examples.sh
macos-ax:
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'ax'
runs-on: macos-latest
name: macos-cxx:${{ matrix.config.cxx }}-llvm:${{ matrix.config.llvm }}-${{ matrix.config.build }}
env:
CXX: ${{ matrix.config.cxx }}
strategy:
matrix:
config:
- { cxx: 'clang++', build: 'Release', llvm: '14' }
- { cxx: 'clang++', build: 'Release', llvm: '15' }
#- { cxx: 'clang++', build: 'Release', llvm: '16' } - not supported yet
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: install_deps
run: ./ci/install_macos.sh ${{ matrix.config.llvm }}
- name: build
run: >
./ci/build.sh -v
--build-type=${{ matrix.config.build }}
--components="core,python,bin,axcore,axbin,axtest"
--cargs=\"
-DOPENVDB_AX_TEST_CMD_DOWNLOADS=ON
-DUSE_EXPLICIT_INSTANTIATION=OFF
-DLLVM_DIR=/usr/local/opt/llvm@${{ matrix.config.llvm }}/lib/cmake/llvm
\"
- name: test
run: cd build && ctest -V
- name: test_doxygen_examples
run: ./ci/extract_test_examples.sh
windows-ax:
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'ax'
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'windows-2022-8c-32g-300h') || 'windows-latest' }}
name: windows-vc:${{ matrix.config.vc }}-type:${{ matrix.config.build }}
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.config.vc }}
# Export this with '' avoid bash treating \ as escape
VDB_INSTALL_PREFIX: '${{ github.workspace }}\\install'
strategy:
matrix:
config:
# static build of blosc from vcpkg does not build internal sources.
# USE_STATIC_DEPENDENCIES is required for IlmBase/OpenEXR defines and
# Boost as both shared and static libs are installed.
# @todo We don't currently run the axtests with shared builds of ax
# due to symbol issues using LLVM as a static lib (which is the only
# option on Windows).
- { vc: 'x64-windows', crt: 'MD', components: 'core,bin,axcore,axbin,python', build: 'Release', cmake: '-DOPENVDB_CORE_STATIC=OFF -DOPENVDB_AX_STATIC=OFF' }
- { vc: 'x64-windows-static', crt: 'MT', components: 'core,bin,axcore,axbin,axtest', build: 'Release', cmake: '-DOPENVDB_CORE_SHARED=OFF -DOPENVDB_AX_SHARED=OFF -DUSE_STATIC_DEPENDENCIES=ON -DBLOSC_USE_EXTERNAL_SOURCES=ON' }
- { vc: 'x64-windows-static', crt: 'MTd', components: 'core,bin,axcore,axbin,axtest', build: 'Debug', cmake: '-DOPENVDB_CORE_SHARED=OFF -DOPENVDB_AX_SHARED=OFF -DUSE_STATIC_DEPENDENCIES=ON -DBLOSC_USE_EXTERNAL_SOURCES=ON' }
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: llvm
run: ./ci/install_llvm_windows.sh ${{ matrix.config.crt }}
- name: install
run: ./ci/install_windows.sh
- name: build
run: >
./ci/build.sh -v
--config=${{ matrix.config.build }}
--components="${{ matrix.config.components }}"
--cargs=\'
-A x64 -G \"Visual Studio 17 2022\"
-DVCPKG_TARGET_TRIPLET=${VCPKG_DEFAULT_TRIPLET}
-DCMAKE_TOOLCHAIN_FILE=\"${VCPKG_INSTALLATION_ROOT}\\scripts\\buildsystems\\vcpkg.cmake\"
-DMSVC_COMPRESS_PDB=ON
-DOPENVDB_AX_TEST_CMD_DOWNLOADS=ON
-DUSE_EXPLICIT_INSTANTIATION=OFF
-DLLVM_DIR=\"${HOME}\\llvm_install\\lib\\cmake\\llvm\"
-DCMAKE_INSTALL_PREFIX=\"${VDB_INSTALL_PREFIX}\"
${{ matrix.config.cmake }}
\'
- name: runtime_path
shell: pwsh
run: |
# note: system path must be modified in a previous step to it's use
echo "$Env:VCPKG_INSTALLATION_ROOT\installed\${{ matrix.config.vc }}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "$Env:VDB_INSTALL_PREFIX\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: test
run: cd build && ctest -V -C ${{ matrix.config.build }}
#############################################################################
################################## Blosc ####################################
#############################################################################
linux-blosc:
if: |
github.event_name != 'workflow_dispatch' ||
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'blosc'
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-8c-32g-300h') || 'ubuntu-latest' }}
name: linux-blosc:${{ matrix.blosc }}
container:
image: aswf/ci-base:2023
strategy:
matrix:
blosc: ['1.18.0','1.19.0','1.20.0','1.21.0']
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: install_blosc
run: sudo ./ci/install_blosc.sh ${{ matrix.blosc }}
- name: build
run: >
sudo ./ci/build.sh -v
--build-type=Release
--components=\"core,test\"
- name: test
run: cd build && sudo ctest -V
#############################################################################
################################## ABI ######################################
#############################################################################
linux-abi-checker:
if: |
github.event_name == 'workflow_dispatch' &&
(github.event.inputs.type == 'all' ||
github.event.inputs.type == 'abi')
runs-on: ubuntu-22.04
env:
# The 'abicheck' build type sets these, but older versions of the library
# may not have this build type. See OpenVDBCXX.cmake
CXXFLAGS: "-gdwarf-4 -g3 -ggdb -Og"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true
# Compute the latest major version - that is used as our baseline
# note: For CI forks, make sure you have your tags synced
- name: get_major_version
run: |
LATEST_VERSION_TAG=$(git tag --merged | sort --version-sort | tail -n1)
echo "Computed latest VDB tag: ${LATEST_VERSION_TAG}"
VDB_MAJOR_VERSION=$(echo ${LATEST_VERSION_TAG} | cut -f1 -d '.' | tr -d -c 0-9)
echo "Using major version: ${VDB_MAJOR_VERSION}"
echo "VDB_MAJOR_VERSION=${VDB_MAJOR_VERSION}" >> "$GITHUB_ENV"
- name: install_deps
run: sudo apt-get -q install -y libboost-iostreams-dev libtbb-dev libblosc-dev elfutils
- name: install_abi_checker
run: sudo apt-get -q install -y abi-dumper abi-compliance-checker
- name: build_new
run: >
./ci/build.sh -v
--build-dir=build_new
--build-type=abicheck
--target=openvdb_shared
--components=\"core\"
--cargs=\'-DUSE_EXPLICIT_INSTANTIATION=OFF -DDISABLE_DEPENDENCY_VERSION_CHECKS=ON\'
- name: checkout_baseline
run: git checkout v${VDB_MAJOR_VERSION}.0.0
- name: build_old
run: >
./ci/build.sh -v
--build-dir=build_old
--build-type=abicheck
--target=openvdb_shared
--components=\"core\"
--cargs=\'-DUSE_EXPLICIT_INSTANTIATION=OFF -DDISABLE_DEPENDENCY_VERSION_CHECKS=ON\'
- name: abi_dump
run: |
abi-dumper build_new/openvdb/openvdb/libopenvdb.so -o ABI-NEW.dump -lver 1
abi-dumper build_old/openvdb/openvdb/libopenvdb.so -o ABI-OLD.dump -lver 2
# Replace the version namespace in the latest ABI dump with the baseline
# version we're comparing against. We should probably instead build the
# latest with the baseline version number but no CMake/defines allow us to
# do this.
- name: replace_symbols
run: sed -i -E 's/openvdb([^v]*)v[0-9]*_[0-9]/openvdb\1v'${VDB_MAJOR_VERSION}'_0/g' ABI-NEW.dump
- name: abi_check
# -strict treats warnings as errors
# -extended checks all member data
# we check everything _not_ in openvdb::**::internal namespace
run: >
abi-compliance-checker -l OPENVDB
-old ABI-OLD.dump
-new ABI-NEW.dump
-skip-internal-symbols "\d(openvdb.*internal)"
-skip-internal-types "(openvdb.*internal)::"
-strict
-extended
- name: upload_report
uses: actions/upload-artifact@v3
if: always()
with:
name: abi_report
path: ./compat_reports/OPENVDB/2_to_1/compat_report.html
retention-days: 5
-40
View File
@@ -1,40 +0,0 @@
name: Whitespace
on:
push:
paths-ignore:
- 'pendingchanges/**'
- 'tsc/meetings/**'
pull_request:
paths-ignore:
- 'pendingchanges/**'
- 'tsc/meetings/**'
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Search the git repository for any trailing spaces excluding meeting notes and auto-generated wlt files
trailingspaces:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: test
run: |
set +e
git grep -n -I -E '^.+[ ]+$' -- ':!tsc/meetings/*' ':!pendingchanges/*' ':!*.wlt'
test $? -eq 1
# Search for any tabs excluding meeting notes, image files and a few others
spacesnottabs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: test
run: |
set +e
git grep -n " " -- ':!*/whitespace.yml' ':!tsc/meetings/*' ':!*.svg' ':!*.cmd' ':!*.png' ':!pendingchanges/*' ':!*.wlt'
test $? -eq 1
-1
View File
@@ -1,2 +1 @@
/build/*
.DS_Store
+13 -419
View File
@@ -1,442 +1,36 @@
OpenVDB Version History
=======================
Version 11.0.1 - In development
Version 11.0.0 - November 1, 2023
This version introduces ABI changes relative to older major releases,
so to preserve ABI compatibility it might be necessary to define the
macro OPENVDB_ABI_VERSION_NUMBER=N, where, for example, N is 9 for
Houdini 19.5 and 10 for Houdini 20.0.
OpenEXR 2 and Python 2 are no longer supported.
OpenVDB:
Improvements:
- Removed use of boost::any in favor of std::any.
[Contributed by Brian McKinnon]
Bug Fixes:
- Fix potential crash reading corrupt .vdb files with invalid
blosc or zip chunks.
[Contributed by Matthias Ueberheide]
NanoVDB:
Highlights:
- Several new tools to generate and modify NanoVDB grids on the GPU.
- New file format that supports streaming of raw grid buffers.
New Features:
- New memory efficient GridClass::IndexGrid that separates values from tree
- 4 new GridTypes (Index, OnIndex, IndexMask, OnIndexMask) used by IndexGrid
- Added createNanoGrid that replaces older conversion methods in GridBuilder.h,
IndexGridBuilder.h and OpenToNanoVDB.h
- Added cudaPointsToGrid that constructs a point device grid from a list of
points.
- Added cudaVoxelsToGrid that constructs a voxel device grid from a list of
voxels.
- Added cuda/CudaUtils.h with several cuda utility functions.
- Added GpuTimer for timing of kernels in a specific cuda stream.
- Added cudaIndexToGrid that converts IndexGrids into regular Grids.
- Added cudaSignedFloodFill that performs signed-flood filling on the GPU.
- Added cudaAddBlindData that adds blind data to an existing grid on the GPU.
- Added cudaGridChecksum that computes checksums of device grids.
- Added cudaGridHandle that handles grids on the GPU.
- Added cudaNodeManager that constructs a NodeManager on the GPU.
- Added build type Points and GridType::PointIndex for point grids.
- Added GridType::Vec3u16 and GridType::Vec3u8 for compressed coordinates.
- Added PrefixSum.h for concurrent computation of prefix sum on the CPU.
API Changes:
- Version 32.6.0 (ABI is unchanged).
- Transition from C++11 to C++17
- Vec3R is deprecated, please use Vec3d instead.
- nanoToOpenVDB now takes the index of a NanoVDB in a GridHandle.
- GridData, InternalData and LeafData are now public.
- GridMetaData can be copied.
- Improvements to GridBuilder.h that allows construction of grids on CPU.
- GridHandle's move c-tor now requires the GridBuffer to contain a valid grid.
- Moved CudaDeviceBuffer.h to cuda/CudaDeviceBuffer.h.
- New API for acceleration of custom random-access with ValueAccessors.
- Added BitFlags class for convenient bit-mask operations.
- Added Vec2/3::min/maxComponentAtomic GPU methods.
- Added BBox::expandAtomic and BBox::intersectAtomic.
- Added Coord::expandAtomic.
- Added Map constructors.
- Added Mask::DenseIterator, Mask::setOnAtomic, and Mask::setOffAtomic.
- InternalNode::ChildIterator is now const-correct.
- Added several new NanoVDB Build Traits.
- Syncing PNanoVDB.h with NanoVDB.h.
Build:
- Support for OpenEXR 2.X has been removed.
- Better support for building with external package configurations
with CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON.
Python:
- Removed Python 2 support.
[Contributed by Matthew Cong]
- Removed explicit bindings for Math types.
[Contributed by Matthew Cong]
- Improved type casting for TypedMetadata.
[Contributed by Matthew Cong]
Version 10.1.0 - October 11, 2023
Highlights:
- OpenVDB Python bindings are now implemented using pybind11 instead of
Boost.Python.
[Contributed by Matthew Cong]
OpenVDB:
New features:
- Added points::replicate() for the replication of PointDataGrid points
and attributes.
Improvements:
- Upgraded OpenVDBs internal half representation to IMath 3.1.6. Brings
conversion support using F16C instructions (if enabled using -mf16c) and
the removal of the exponent lookup table in favor of bit shifting.
- OpenVDBs copy of Half.h is no longer built with an internal lookup table,
but explicitly selects the non-LUT version and disables the creation of
the LUT. This is required to avoid symbol conflicts with different
namespaced OpenVDB builds.
- Removed boost::uuid from Archive, instead std::random_device is used
directly to generate UUID-like objects.
- Moved all cases of file static/global variables which relied on non-trivial
construction into function scopes as static locals. These would previously
initialize themselves on start-up in a non-deterministic, compiler-dictated
order(static-initialization-order-fiasco). This order is now defined by the
program's execution.
- Fixed the constants used in openvdb::math::Coord::hash() and
nanovdb::Coord::hash() to correctly be prime numbers (note that this
changes the result of these methods).
[Contributed by Benedikt Mersch]
- Updated tools::meshToVolume to take two new optional arguments to provide
an interior test oracle and an interior testing method. These allow the
default outside-flood-fill to be replaced if the actual sidedness can be
known.
[Contributed by Tomas Skrivan]
- LevelSetRebuild now includes example code that demonstrates the intended
use of the new meshToVolume interior testing parameters for the
resampling of level sets, where the original grid is used as the true
sign value. However, due to differences between polygonalization and
trilinear interpolation, this behaviour is disabled and exists as a
reference.
- Introduced openvdb::TupleList to wrap std::tuple and provide interface
interop methods with openvdb::TypeList.
- Added OPENVDB_FORCE_INLINE, OPENVDB_LIKELY and OPENVDB_UNLIKELY macros.
- Introduced openvdb::make_index_sequence to solve clang compilations
issues with compiler built-in index_sequence implementations.
API changes:
- Significant infrastructural change to the ValueAccessor header and
implementation. All ValueAccessor specializations have been consolidated
into a single class which supports all possible ValueAccessor configurations
using index_sequences. Backward compatible declarations have been provided.
The new ValueAccessor implementation is marked as final.
- PagedArray iterators no longer derive from std::iterator
(but remains standard compliant).
Bug Fixes:
- Internal counters in tree::RangeIterator were limited to 32bit precision.
They are now extended to size_t.
[Reported by SpaceX]
- Fixed a bug when compiling with -fvisibility=hidden and GCC 11 which
would cause a crash in openvdb::initialize().
- Fixed a bug with LeafManager which wouldn't correctly
initialize its LeafNode array for single level Tree configurations
i.e. RootNode<LeafNode> (bug introduced in 7.2.0).
[Reported by @lanwatch]
- Fixed a bug with LeafNodeBool Topology constructor with designated
on/off values which wouldn't apply them correctly.
[Reported by @hozhaoea]
OpenVDB AX:
Improvements:
- Added support for LLVM 15.
Bug Fixes:
- Fixed a bug in AX on older X86 hardware which could cause a crash when
accessing point attributes with half compression (bug introduced in 9.1.0).
- Fixed an incorrect option in the `vdb_ax` command line tool where the default
optimization level was set to NONE instead of O3 (issue introduced in 10.0.0).
Houdini:
Improvements:
- Added Preserve Holes option to VDB From Polygons that uses the
fast winding oracle to not collapse holes in polygonal geometry.
Bug Fixes:
- Fix a bug in the projection mode of the Advect Points SOP that was causing
a segfault.
Build:
- Fixed a build issue where Boost was not being pulled in when
OPENVDB_USE_DELAYED_LOADING was set to OFF.
- Fixed a build issue with AX on 32-bit platforms.
[Reported by Mathieu Malaterre]
- Fixed a compilation issue with the min() and max() methods on Stencils
in openvdb/math/Stencils.h.
[Reported by Samuel Mauch]
- Fixed a compilation error that would be encountered when attempting to
enable the SSE4.2 or AVX SIMD options on non-x86 based platforms.
- Improved support for compiling with C++20.
[Contributed by Denys Maletskyy and Jérémie Dumas]
- OpenVDB's CMake no longer modifies the BUILD_SHARED_LIBS variable.
[Reported by Maksim Shabunin]
- Fix int-in-bool-context GCC9+ warnings by switching to use constexpr if.
Version 10.0.1 - November 30, 2022
Bug Fixes:
- Fix uninitialized point flags in tools::VolumeToMesh which could result in
non-deterministic results (bug introduced in 10.0.0).
Build:
- Fixed CXX standard requirement for VDB components in FindOpenVDB.cmake
Version 10.0.0 - October 27, 2022
This version introduces ABI changes relative to older major releases,
so to preserve ABI compatibility it might be necessary to define the
macro OPENVDB_ABI_VERSION_NUMBER=N, where, for example, N is 8 for
Houdini 19.0 and 9 for Houdini 19.5.
Highlights:
- Introducing OpenVDBLink, which provides a Mathematica interface to
OpenVDB. This link ports over access to various grid containers including
level sets, fog volumes, vector grids, integer grids, Boolean grids,
and mask grids. Construction, modification, combinations, visualisations,
queries, import, export, etc. can be achieved over grids too. Any
Mathematica 3D region that's ConstantRegionQ and BoundedRegionQ can
be represented as a level set grid, providing a more seamless integration
with OpenVDB.
- Introducing a new command-line tool, dubbed vdb_tool, that can combine any
number of the high-level tools available in openvdb/tools. For
instance, it can convert a sequence of polygon meshes and particles to
level sets, perform a large number of operations on these level set
surfaces and export them as adaptive polygon meshes.
OpenVDB:
Improvements:
- Significantly improved the performance of all ValueAccessor methods which
access LeafNode value buffer data. This improvement applies to any type
which is delay load compatible (all default types except for bool and mask
grids) and improves the performance of many OpenVDB tools.
- Improved the performance of volumeToMesh by 10-15%.
ABI changes:
- ABI change to openvdb::RootNode, which now has a new member that defines
the origin of the node. For now this origin is set to a default value of
(0,0,0), but in the near future we will allow for offsets to improve
access performance and reduce the memory footprints.
- Removed deprecated virtual methods from AttributeArray.
API changes:
- Removed PagedArray::push_back().
- Removed Tree visitor methods from Tree, RootNode, InternalNode and
LeafNode classes - visit(), visit2(), visitActiveBBox().
- Removed LeafManager::getNodes().
- Removed tools::dilateVoxels() and tools::erodeVoxels() in favor of
tools::dilateActiveValues() and tools::erodeActiveValues().
- Removed tools::FindActiveValues::any() and
tools::FindActiveValues::none().
- StringGrid and StringTrees have been removed.
Bug Fixes:
- Fixed an issue with tools::topologyToLevelSet which would previously
ignore active tiles in the input topology.
[Reported by Tobias Rittig]
- Fixed a bug with ValueAccessor::addLeaf and ValueAccessor::addTile which
wouldn't add the provided leaf nodes to the underlying tree. This bug did
NOT affect the specialized accessors which are used by the default tree
configuration.
[Contributed by Andrey Zakirov]
- Fixed a bug where ValueAccessor::probeNode<NodeT> and
ValueAccessor:probeConstNode<NodeT> would return a nullptr if the NodeT
type was not explicitly being cached by the accessor but the node existed
in the tree.
- Fixed a bug on Windows where math::Abs could truncate 64bit integer values.
[Contributed by Edward Lam]
- Fixed an occurrence of undefined behaviour with math::floatToInt32 and
math::doubleToInt64.
[Reported by Vojtěch Bubník]
- Fixed bugs in the sum merge that produced incorrect merged grids when
deep-copying the input nodes or when non-zero background grids were being
used.
- Fixed a bug in FastSweeping where voxels/tiles are left with min/max float
values.
- Fixed a bug in math/Tuple.h that prevented compilation with VS2017.
OpenVDB AX:
Improvements:
- Major updates to the command line interface of the vdb_ax binary, exposing
more controls such as tile streaming, value iterator types and attribute
bindings.
OpenVDB Houdini:
New Features:
- Add convex hull activation for VDB Activate SOP (requires 19.5).
Improvements:
- Improved SDF activation to use dynamic node manager.
Bug Fixes:
- Fixed a bug in VDB Visualize SOP where color values that exceed
the range wrap around instead of being clamped.
NanoVDB:
New Features:
- Added nanovdb::IndexGrid that allows for arbitrary voxel values and even
multiple channels to be associated with NanoVDB grids. They are more
flexible and memory efficient than regular grids at a small cost of
random-access performance. IndexGrids are constructed with the new
nanovdb::IndexGridBuilder and accessed with the new
nanovdb::ChannelAccessor.
- Added iterators to all tree node classes for visiting inactive, active, or
all values and child nodes.
- NanoVDB.h now includes standalone implementations of reading and writing
uncompressed nanovdb grids buffers.
- Added Stats::getExtrema, which computes the min/max values of all voxels
in a NanoVDB grid that intersects with a user-defined bounding-box.
- Added nanovdb::Mask::countOn(int) which is essential to the new
nanovdb::IndexGrid.
- Added RootNode::probeChild and InternalNode::probeChild.
Improvements:
- Added a new much improved nanovdb::NodeManager, that is both faster and
more memory efficient, and that works on both the CPU and GPU. Note, it
uses a handle for allocation (just like nanovdb::Grid) and replaces the
old nanovdb::LeafManager which is now deprecated.
- NanoToOpenVDB is extended to work with grids templated on Fp4, Fp8, Fp16,
FpN, bool and ValueMask.
- Renamed RootNode::findTile to RootNode::probeTile and made it public.
- Made Mask::getWord return both a const and non-const reference.
- Improved unit-tests to use explicit 32B alignment (see alignment bug-fix
below).
- PNanoVDB.h (a C99 port of NanoVDB.h) has been updated.
Bug Fixes:
- Fixed a bug in nanovdb::HostBuffer that could produce crashes due to
misaligned CPU memory allocations.
- Fixed bug related to uninitialized memory in nanovdb::Grid which could
confuse CRC32 checksum validation.
- Fixed bugs related to the use of intrinsic functions for fast bit-counting
in nanovdb.
- Fixed a potential security vulnerability in NanoVDB.h related to buffer
overflow exploits.
Build:
- Added OPENVDB_USE_DELAYED_LOAD flag that enables delayed loading and
defaults to on.
- Add a placeholder to inject the specific revision and URL used
to build OpenVDB, useful for 3rd party build scripts to publish
their exact versions.
- Fixed an issue where OPENVDB_AX_DLL was not being defined on shared
library builds of AX, resulting in symbols not being exported.
[Reported by Ray Molenkamp]
- Fixed an issue where setting Tbb_INCLUDE_DIR could cause CMake failures.
- Updated FindTBB.cmake to support newer library ABI suffixing in
TBB 2021.5.
- Updated FindBlosc.cmake to better handle cases where blosc is built with
external sources.
- Resolved LLVM deprecation warnings in AX and added support for LLVM 14.
- On Windows (MSVC), OpenVDB is now built with extra compiler options to
ensure stricter C++ conformance: /permissive- /Zc:throwingNew /Zc:inline.
- On Windows (MSVC), the _USE_MATH_DEFINES macro is no longer defined when
including <openvdb/Platform.h> (or any dependent headers). If you were
relying on this in your own project for M_PI, M_PI_2, etc. you can add
-D_USE_MATH_DEFINES to your own project compiler options. See
https://docs.microsoft.com/en-us/cpp/c-runtime-library/math-constants
for more info.
Version 9.1.0 - June 9, 2022
Version 9.0.1 - In development
Bug Fixes:
- Minor fix to move assignment operator in nanovdb/util/HostBuffer.h.
This could potentially be a problem on Windows debug builds (unconfirmed).
- Minor fix to range in openvdb/tools/LevelSetSphere.h. This could result
in data races for multi-threaded execution (unconfirmed)
[Reported by Tommy Hinks]
- Fixed a bug with Tree::combineExtended which wouldn't propagate the
resulting active state when a destination tile overlapped a source child node.
[Reported by @frapit]
in data races for multi-threaded execution (unconfirmed) [Reported by Tommy Hinks]
- Fixed a bug with Tree::combineExtended which wouldn't propagate the resulting active state when a destination tile overlapped a source child node. [Reported by @frapit]
- Fix unit tests failures with Blosc versions >= 1.19.0.
- Fixed a regression in ax::run which wouldn't propagate exceptions
- Fixed a bug where ax::ast::parse could return a partially constructed but
invalid AST on failure
- Fixed AX logger exit handling in ax::Compiler::compile and ax::ast::parse
- Fixed an issue which could result in significant compilation times when
instantiating TypeList<>::Unique<>
New features:
- Added support for AMD's HIP API in NanoVDB
[Contributed by Blender Foundation]
- Added bindings mechanism to AX to allow differing data and AX attribute
names (@) in Point and Volume executables.
- Added support for AMD's HIP API in NanoVDB [Contributed by Blender Foundation]
- Added bindings mechanism to AX to allow differing data and AX attribute names (@) in Point and Volume executables.
- Added support for OpenVDB AX on Windows.
- Added tools::memUsageIfLoaded() which returns the memory consumption of
a deserialized VDB tree, useful if delay-loading is enabled.
- Added points::rasterizeSpheres() and points::rasterizeSmoothSpheres()
variants, new kernels and improved performance for OpenVDB points to
surface rasterization.
- Added points::rasterizeTrilinear() for OpenVDB points, fast staggered
or colocated trilinear rasterization for scalar and vector attributes.
- Exposed TypeList declarations in openvdb.h which denote the default set
of types supported by OpenVDB.
- Added points::FrustumRasterizer for efficient rasterization of OpenVDB
points to frustum volumes with optional motion blur.
Improvements:
- Added a --thread [n] argument to the vdb_ax binary.
- Added a --copy-file-metadata option to vdb_ax. This behaviour is now
off by default.
- Added support for multiple input files with the vdb_ax binary using -i.
Positional arguments as input files are deprecated.
- Added tools::minMax() which supports multithreaded evaluation of active
minimum and maximum values. Grid::evalMinMax() has been deprecated.
[Contributed by Greg Hurst]
- Significant performance improvements to AX point kernels, primarily due to
providing AX access to attribute buffers for superior code generation.
- vdb_print now prints both the in-core memory and total memory usage for
VDB grids.
- Improved build support for MinGW
[Contributed by Mehdi Chinoune]
- Added a new foreach method to TypeList for iterating over types without
constructing them.
- Added TypeList::Transform declaration for transforming TypeLists into new
types.
- Moved Grid::apply implementation to TypeList::apply to allow for other
polymorphic types to invoke it.
- Minor updates to NanoVDB to remove compiler warnings.
- Added a --copy-file-metadata option to vdb_ax. This behaviour is now off by default.
- Added support for multiple input files with the vdb_ax binary using -i. Positional arguments as input files are deprecated.
- Added tools::minMax() which supports multithreaded evaluation of active minimum and maximum values. Grid::evalMinMax() has been deprecated. [Contributed by Greg Hurst]
Build:
- Regenerated AX grammar with Flex 2.6.4 and Bison 3.8.2.
- Improved locating NumPy in CMake when multiple python versions are installed.
- Fixed an issue which could report Python as missing when using CMake 3.18
and later on some systems.
[Reported by Sam James]
- Changed the way boost_python and boost_numpy are located. Both components
must match the major/minor version of python in use. This can be
circumvented by providing Boost_PYTHON_VERSION or
Boost_PYTHON_VERSION_MAJOR.
- Relocated OpenVDB binaries to a new openvdb_cmd root directory.
- FindTBB.cmake now prioritises newer TBB installations.
- Added option to compress PDB data in MSVC debug builds.
- Fixed an issue which could report Python as missing when using CMake 3.18 and later on some systems. [Reported by Sam James]
Houdini:
- Added Attribute Bindings to AX SOP to allow differently named AX
attributes (@) and target point attributes/volumes.
- Fix race condition in OpenVDB Merge SOP that could cause crashes or
merged VDBs to not be deleted.
- VDB Activate SOP no longer stops at the first non-VDB primitive, but
instead just skips such primitives.
- Added VDB Rasterize Frustum SOP for efficient rasterization of OpenVDB
points into frustum volumes with optional motion blur.
- Added Attribute Bindings to AX SOP to allow differently named AX attributes (@) and target point attributes/volumes.
- Fix race condition in OpenVDB Merge SOP that could cause crashes
or merged VDBs to not be deleted.
Version 9.0.0 - October 29, 2021
@@ -828,7 +422,7 @@ Version 8.0.0 - December 23, 2020
providing users with a new way of interacting with OpenVDB data. AX is
tailored towards writing highly parallelizable and customizable OpenVDB
volume and point kernel operations. See the documentation for more:
https://www.openvdb.org/documentation/openvdbax.html
https://academysoftwarefoundation.github.io/openvdb/openvdbax.html
New features:
- Added tools::anyActiveVoxels and tools::anyActiveTiles that check
+59 -58
View File
@@ -18,12 +18,12 @@
and required dependencies are expected. See the dependency documentation
for more information:
https://www.openvdb.org/documentation/doxygen/dependencies.html
https://academysoftwarefoundation.github.io/openvdb/dependencies.html
And the documentation on building OpenVDB for more in depth installation
instructions:
https://www.openvdb.org/documentation/doxygen/build.html
https://academysoftwarefoundation.github.io/openvdb/build.html
This CMakeLists file provides most available options for configuring the
build and installation of all OpenVDB components. By default the core
@@ -42,7 +42,7 @@
# note: cmake_minimum_required must be called before project commands to
# ensure policy scope is set up correctly
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
# CMP0091 allows for MSVC ABI targetting via CMAKE_MSVC_RUNTIME_LIBRARY
# from CMake 3.15 and above. Must come before project().
@@ -52,7 +52,7 @@ endif()
###### Version
set(OpenVDB_MAJOR_VERSION 11)
set(OpenVDB_MAJOR_VERSION 9)
set(OpenVDB_MINOR_VERSION 0)
set(OpenVDB_PATCH_VERSION 1)
set(OpenVDB_VERSION "${OpenVDB_MAJOR_VERSION}.${OpenVDB_MINOR_VERSION}.${OpenVDB_PATCH_VERSION}")
@@ -64,7 +64,7 @@ project(OpenVDB LANGUAGES CXX VERSION ${OpenVDB_VERSION})
include(CMakeDependentOption)
include(GNUInstallDirs)
# Components
# todo epydoc and pdflatex
option(OPENVDB_BUILD_CORE "Enable the core OpenVDB library. Both static and shared versions are enabled by default" ON)
option(OPENVDB_BUILD_BINARIES "Enable the vdb binaries. Only vdb_print is enabled by default" ON)
option(OPENVDB_BUILD_PYTHON_MODULE "Build the pyopenvdb Python module" OFF)
@@ -72,38 +72,24 @@ option(OPENVDB_BUILD_UNITTESTS "Build the OpenVDB unit tests" OFF)
option(OPENVDB_BUILD_DOCS "Build the OpenVDB documentation" OFF)
option(OPENVDB_BUILD_HOUDINI_PLUGIN "Build the Houdini plugin" OFF)
option(OPENVDB_BUILD_HOUDINI_ABITESTS "Build the Houdini ABI tests" OFF)
option(OPENVDB_BUILD_MAYA_PLUGIN "Build the Maya plugin" OFF)
option(OPENVDB_BUILD_AX "Build the OpenVDB AX library. Turns ON if USE_AX is ON." ${USE_AX})
option(OPENVDB_BUILD_AX_UNITTESTS "Build the OpenVDB AX unit tests" OFF)
option(OPENVDB_BUILD_NANOVDB "Build the NanoVDB library. Turns ON if USE_NANOVDB is ON." ${USE_NANOVDB})
# Global options
option(OPENVDB_BUILD_MAYA_PLUGIN "Build the Maya plugin" OFF)
option(OPENVDB_ENABLE_RPATH "Build with RPATH information" ON)
option(OPENVDB_ENABLE_ASSERTS "Build with asserts in OpenVDB code enabled" OFF)
option(OPENVDB_USE_DELAYED_LOADING "Build the core OpenVDB library with delayed-loading." ON)
option(OPENVDB_CXX_STRICT "Enable or disable pre-defined compiler warnings" OFF)
cmake_dependent_option(OPENVDB_INSTALL_CMAKE_MODULES
"Install the provided OpenVDB CMake modules when building the core library"
ON "OPENVDB_BUILD_CORE" OFF)
option(USE_CCACHE "Build using Ccache if found on the path" ON)
# Disable this on Windows due to linker OOM issues:
# LNK1248: image size (XXX) exceeds maximum allowable size (FFFFFFFF)
# https://github.com/AcademySoftwareFoundation/openvdb/issues/1718
# https://github.com/AcademySoftwareFoundation/openvdb/issues/1624
cmake_dependent_option(USE_EXPLICIT_INSTANTIATION "Use explicit instantiation for all supported classes
and methods against a pre-defined list of OpenVDB trees. This makes the core library larger and slower
to compile, but speeds up the compilation of all dependent code by bypassing the expensive template
instantation." ON "NOT WIN32" OFF)
option(OPENVDB_FUTURE_DEPRECATION "Generate messages for upcoming deprecation" ON)
option(OPENVDB_ENABLE_UNINSTALL "Adds a CMake uninstall target." ON)
option(USE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." OFF)
# Component dependency options
cmake_dependent_option(USE_PKGCONFIG "Use pkg-config to search for dependent libraries." ON "NOT WIN32" OFF)
option(USE_HOUDINI [=[
Build the library against a Houdini installation. Turns on automatically if OPENVDB_BUILD_HOUDINI_PLUGIN is enabled.
When enabled, you do not need to provide dependency locations for TBB, Blosc, Imath and OpenEXR. Boost must be
provided. Imath/OpenEXR can optionally be provided.]=] OFF)
When enabled, you do not need to provide dependency locations for TBB, Blosc, IlmBase and OpenEXR. Boost must be
provided. IlmBase/OpenEXR can optionally be provided if Houdini Version >= 17.5.]=] OFF)
option(USE_MAYA [=[
Build the library against a Maya installation. Turns on automatically if OPENVDB_BUILD_MAYA_PLUGIN is enabled.
When enabled, you do not need to provide dependency locations for TBB. All other dependencies must be provided.]=] OFF)
@@ -134,6 +120,7 @@ option(USE_NANOVDB "Use NanoVDB while building openvdb components." ${OPENVDB_BU
cmake_dependent_option(OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING
"Disable the implicit linking of Boost libraries on Windows" ON "WIN32" OFF)
option(USE_CCACHE "Build using Ccache if found on the path" ON)
option(USE_STATIC_DEPENDENCIES [=[
Only search for and use static libraries. If OFF the shared versions of requried libraries are prioritised, falling
back to static libraries. Forcing individual static dependencies can be enabled by setting XXX_USE_STATIC_LIBS
@@ -147,6 +134,17 @@ Disable CMakes default system search paths when locating dependencies. When enab
its default system search routine if it cannot find a dependency with the provided settings. When disabled, only
paths provided through the Xxx_ROOT, supported XXX_INCLUDEDIR/XXX_LIBRARYDIR variables or the SYSTEM_LIBRARY_PATHS
list will be searched.]=] OFF)
option(OPENVDB_USE_DEPRECATED_ABI_7 "Bypass minimum ABI requirement checks" OFF)
option(OPENVDB_USE_DEPRECATED_ABI_8 "Bypass minimum ABI requirement checks" OFF)
option(OPENVDB_USE_FUTURE_ABI_10 "Bypass future ABI check" OFF)
option(OPENVDB_FUTURE_DEPRECATION "Generate messages for upcoming deprecation" ON)
option(OPENVDB_ENABLE_UNINSTALL "Adds a CMake uninstall target." ON)
option(USE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." OFF)
cmake_dependent_option(USE_PKGCONFIG "Use pkg-config to search for dependent libraries." ON "NOT WIN32" OFF)
option(USE_EXPLICIT_INSTANTIATION "Use explicit instantiation for all supported classes and methods against a
pre-defined list of OpenVDB trees. This makes the core library larger and slower to compile, but speeds up
the compilation of all dependent code by bypassing the expensive template instantation." ON)
set(SYSTEM_LIBRARY_PATHS "" CACHE STRING [=[
A global list of library paths to additionally use into when searching for dependencies.]=])
@@ -154,7 +152,6 @@ set(MSVC_MP_THREAD_COUNT "" CACHE STRING [=[
The number of threads to use when invoking MSVC builds with cmake --build. CMake defaults to 1. Note that
cmake --parallel and CMAKE_BUILD_PARALLEL_LEVEL only change the number of PROJECTS that are built in parallel,
NOT the number of TU's ]=])
option(MSVC_COMPRESS_PDB "Whether to attempt to compress PDB symbol data in MSVC debug builds." OFF)
set(_CONCURRENT_MALLOC_OPTIONS None Auto Jemalloc Tbbmalloc)
if(NOT CONCURRENT_MALLOC)
@@ -249,9 +246,11 @@ mark_as_advanced(
OPENVDB_BUILD_HOUDINI_ABITESTS
OPENVDB_CXX_STRICT
OPENVDB_ENABLE_RPATH
OPENVDB_USE_DELAYED_LOADING
OPENVDB_FUTURE_DEPRECATION
OPENVDB_SIMD
OPENVDB_USE_DEPRECATED_ABI_7
OPENVDB_USE_DEPRECATED_ABI_8
OPENVDB_USE_FUTURE_ABI_10
SYSTEM_LIBRARY_PATHS
USE_CCACHE
USE_COLORED_OUTPUT
@@ -259,7 +258,6 @@ mark_as_advanced(
USE_IMATH_HALF
USE_LOG4CPLUS
USE_MAYA
MSVC_COMPRESS_PDB
)
#########################################################################
@@ -268,13 +266,6 @@ mark_as_advanced(
include(cmake/config/OpenVDBVersions.cmake)
foreach(DEPRECATED_ABI ${OPENVDB_DEPRECATED_ABI_LIST})
option(OPENVDB_USE_DEPRECATED_ABI_${DEPRECATED_ABI} "Bypass minimum ABI requirement checks" OFF)
mark_as_advanced(OPENVDB_USE_DEPRECATED_ABI_${DEPRECATED_ABI})
endforeach()
option(OPENVDB_USE_FUTURE_ABI_${FUTURE_OPENVDB_ABI_VERSION} "Bypass future ABI check" OFF)
mark_as_advanced(OPENVDB_USE_FUTURE_ABI_${FUTURE_OPENVDB_ABI_VERSION})
#########################################################################
enable_testing()
@@ -284,11 +275,13 @@ enable_testing()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
# Add cmake modules to installation command
# @todo fix our glew cmake module
if(OPENVDB_INSTALL_CMAKE_MODULES)
set(OPENVDB_CMAKE_MODULES
cmake/FindBlosc.cmake
cmake/FindJemalloc.cmake
cmake/FindIlmBase.cmake
cmake/FindLog4cplus.cmake
cmake/FindOpenEXR.cmake
cmake/FindOpenVDB.cmake
@@ -347,7 +340,8 @@ endif()
if(USE_CCACHE)
find_program(CCACHE_PATH ccache)
if(CCACHE_PATH)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_PATH})
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
message(STATUS "Using ccache: ${CCACHE_PATH}")
endif()
endif()
@@ -360,32 +354,39 @@ include(cmake/config/OpenVDBCXX.cmake)
#########################################################################
# Configure malloc library. Use Jemalloc if available, tbbmalloc otherwise
# Configure malloc library. Use Jemalloc for Linux and non-Maya, otherwise Tbbmalloc.
# * On Mac OSX, linking against Jemalloc < 4.3.0 seg-faults with this error:
# malloc: *** malloc_zone_unregister() failed for 0xaddress
# Houdini 17.5 and older ships with Jemalloc 3.6.0, so we make Tbbmalloc the default
# on Mac OSX (https://github.com/jemalloc/jemalloc/issues/420). Later versions of
# Jemalloc are thought to work, but haven't been tested.
# * On Windows, we follow SideFX's example in using Tbbmalloc due to the challenges
# of injecting into the Windows runtime to replace the system allocator.
if(CONCURRENT_MALLOC STREQUAL "Auto")
find_package(Jemalloc QUIET)
if(NOT TARGET Jemalloc::jemalloc)
message(WARNING "Unable to find Jemalloc, attempting to fall back to TBB malloc.
It is recommended to use Jemalloc for optimum performance.")
if((OPENVDB_BUILD_BINARIES OR OPENVDB_BUILD_UNITTESTS) AND CONCURRENT_MALLOC STREQUAL "Auto")
if(WIN32 OR APPLE OR USE_MAYA)
set(CONCURRENT_MALLOC "Tbbmalloc")
else()
set(CONCURRENT_MALLOC "Jemalloc")
find_package(Jemalloc QUIET)
if(NOT TARGET Jemalloc::jemalloc)
message(WARNING "Unable to find Jemalloc, attempting to fall back to TBB malloc.
It is recommended to use Jemalloc for optimum performance.")
set(CONCURRENT_MALLOC "Tbbmalloc")
else()
set(CONCURRENT_MALLOC "Jemalloc")
endif()
endif()
endif()
# Configure SIMD. AVX implies SSE 4.2.
if(OPENVDB_SIMD STREQUAL "AVX")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-mavx>")
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-msse4.2>")
endif()
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-mavx>")
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-msse4.2>")
add_compile_definitions("$<$<COMPILE_LANGUAGE:CXX>:OPENVDB_USE_AVX>")
add_compile_definitions("$<$<COMPILE_LANGUAGE:CXX>:OPENVDB_USE_SSE42>")
elseif(OPENVDB_SIMD STREQUAL "SSE42")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-msse4.2>")
endif()
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-msse4.2>")
add_compile_definitions("$<$<COMPILE_LANGUAGE:CXX>:OPENVDB_USE_SSE42>")
endif()
@@ -396,6 +397,7 @@ endif()
if(USE_STATIC_DEPENDENCIES)
set(BLOSC_USE_STATIC_LIBS ON)
set(OPENEXR_USE_STATIC_LIBS ON)
set(ILMBASE_USE_STATIC_LIBS ON)
set(TBB_USE_STATIC_LIBS ON)
set(LOG4CPLUS_USE_STATIC_LIBS ON)
set(JEMALLOC_USE_STATIC_LIBS ON)
@@ -481,14 +483,14 @@ if(OpenVDB_ABI LESS MINIMUM_OPENVDB_ABI_VERSION)
"no longer supported.")
endif()
if(OpenVDB_ABI IN_LIST OPENVDB_DEPRECATED_ABI_LIST)
if(FUTURE_MINIMUM_OPENVDB_ABI_VERSION AND OpenVDB_ABI LESS FUTURE_MINIMUM_OPENVDB_ABI_VERSION)
if(NOT OPENVDB_USE_DEPRECATED_ABI_${OpenVDB_ABI})
message(FATAL_ERROR "OpenVDB ABI versions earlier than ${OpenVDB_MAJOR_VERSION} "
message(FATAL_ERROR "OpenVDB ABI versions earlier than ${FUTURE_MINIMUM_OPENVDB_ABI_VERSION} "
"are deprecated. Set CMake option OPENVDB_USE_DEPRECATED_ABI_${OpenVDB_ABI} to ON to "
"suppress this error.")
endif()
message(DEPRECATION "OpenVDB ABI versions earlier than ${OpenVDB_MAJOR_VERSION} "
message(DEPRECATION "OpenVDB ABI versions earlier than ${FUTURE_MINIMUM_OPENVDB_ABI_VERSION} "
"are deprecated and will soon be removed.")
# global target definition
add_definitions(-DOPENVDB_USE_DEPRECATED_ABI_${OpenVDB_ABI})
@@ -525,6 +527,10 @@ if(OPENVDB_BUILD_AX)
add_subdirectory(openvdb_ax/openvdb_ax)
endif()
if(OPENVDB_BUILD_AX_UNITTESTS)
add_subdirectory(openvdb_ax/openvdb_ax/test)
endif()
if(OPENVDB_BUILD_PYTHON_MODULE)
add_subdirectory(openvdb/openvdb/python)
endif()
@@ -537,11 +543,6 @@ if(OPENVDB_BUILD_UNITTESTS)
add_subdirectory(openvdb/openvdb/unittest)
endif()
# Tests the vdb_ax binary so needs to come after openvdb_cmd
if(OPENVDB_BUILD_AX_UNITTESTS)
add_subdirectory(openvdb_ax/openvdb_ax/test)
endif()
if(OPENVDB_BUILD_HOUDINI_PLUGIN)
add_subdirectory(openvdb_houdini/openvdb_houdini)
endif()
+1 -1
View File
@@ -10,7 +10,7 @@ The contributor role is the starting role for anyone participating in the projec
### Process for becoming a contributor
* Review the [coding standards](https://www.openvdb.org/documentation/doxygen/codingStyle.html) to ensure your contribution is in line with the project's coding and styling guidelines.
* Review the [coding standards](https://academysoftwarefoundation.github.io/openvdb/codingStyle.html) to ensure your contribution is in line with the project's coding and styling guidelines.
* Have a signed CLA on file ( see [below](#contributor-license-agreements) )
* Submit your code as a PR with the appropriate [DCO sign-off](#commit-sign-off).
* Have your submission approved by the [committer(s)](#committer) and merged into the codebase.
+2 -2
View File
@@ -12,5 +12,5 @@ The current OpenVDB maintainers are:
| Dan Bailey | danbailey@ilm.com
| Nick Avramoussis | navramoussis@wetafx.co.nz
| Ken Museth | ken.museth@gmail.com
| Andre Pradhana | andre.pradhana@gmail.com
| Richard Jones | richardj@ilm.com
| Andre Pradhana | andre.pradhana@dreamworks.com
| Richard Jones | rhj@dneg.com
+78 -64
View File
@@ -1,74 +1,50 @@
![OpenVDB](doc/img/banner.png)
![OpenVDB](https://www.openvdb.org/images/openvdb_logo.png)
| OpenVDB | AX | Nano | Houdini | License | CII |
| :----: | :----: | :----: | :----: | :-----: | :-: |
| [![core](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/build.yml/badge.svg)](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/build.yml) | [![ax](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/ax.yml/badge.svg)](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/ax.yml) | [![nano](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/nanovdb.yml/badge.svg)](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/nanovdb.yml) | [![hou](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/houdini.yml/badge.svg)](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/houdini.yml) | [![License](https://img.shields.io/github/license/AcademySoftwareFoundation/openvdb)](LICENSE) | [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2774/badge)](https://bestpractices.coreinfrastructure.org/projects/2774) |
[![License](https://img.shields.io/github/license/AcademySoftwareFoundation/openvdb)](LICENSE)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2774/badge)](https://bestpractices.coreinfrastructure.org/projects/2774)
[![Slack](https://slack.aswf.io/badge.svg)](https://slack.aswf.io/)
-------------------------------------------------------------------------------
| OpenVDB | AX | Nano | Houdini |
| :----: | :----: | :----: | :----: |
| [![core](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/build.yml/badge.svg)](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/build.yml) | [![ax](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/ax.yml/badge.svg)](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/ax.yml) | [![nano](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/nanovdb.yml/badge.svg)](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/nanovdb.yml) | [![hou](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/houdini.yml/badge.svg)](https://github.com/AcademySoftwareFoundation/openvdb/actions/workflows/houdini.yml) |
[Website](https://www.openvdb.org) |
[Discussion Forum](https://github.com/AcademySoftwareFoundation/openvdb/discussions) |
[Documentation](https://www.openvdb.org/documentation/doxygen) |
[Releases](https://github.com/AcademySoftwareFoundation/openvdb/releases) |
[License](https://www.mozilla.org/MPL/2.0) |
[Slack](https://slack.aswf.io/)
[Documentation](https://academysoftwarefoundation.github.io/openvdb)
OpenVDB is an open source C++ library comprising a novel hierarchical data structure and a large suite of tools for the efficient storage and manipulation of sparse volumetric data discretized on three-dimensional grids. It was developed by DreamWorks Animation for use in volumetric applications typically encountered in feature film production.
OpenVDB is an open source C++ library comprising a novel hierarchical data
structure and a large suite of tools for the efficient storage and manipulation
of sparse volumetric data discretized on three-dimensional grids. It was
developed by DreamWorks Animation for use in volumetric applications typically
encountered in feature film production.
### Development Repository
This GitHub repository hosts the trunk of the OpenVDB development. This implies
that it is the newest public version with the latest features and bug fixes.
However, it also means that it has not undergone a lot of testing and is
generally less stable than the [production releases](https://github.com/AcademySoftwareFoundation/openvdb/releases).
This GitHub repository hosts the trunk of the OpenVDB development. This implies that it is the newest public version with the latest features and bug fixes. However, it also means that it has not undergone a lot of testing and is generally less stable than the [production releases](https://github.com/AcademySoftwareFoundation/openvdb/releases).
### License
OpenVDB is released under the [Mozilla Public License Version 2.0](https://www.mozilla.org/MPL/2.0/),
which is a free, open source software license developed and maintained by the
Mozilla Foundation.
OpenVDB is released under the [Mozilla Public License Version 2.0](https://www.mozilla.org/MPL/2.0/), which is a free, open source software license developed and maintained by the Mozilla Foundation.
The trademarks of any contributor to this project may not be used in
association with the project without the contributor's express permission.
The trademarks of any contributor to this project may not be used in association with the project without the contributor's express permission.
### Contributing
OpenVDB welcomes contributions to the OpenVDB project. Please refer to the
[contribution guidelines](CONTRIBUTING.md) for details on how to make a
contribution.
-------------------------------------------------------------------------------
OpenVDB welcomes contributions to the OpenVDB project. Please refer to the [contribution guidelines](CONTRIBUTING.md) for details on how to make a contribution.
### Developer Quick Start
The following provides basic installation examples for the core OpenVDB library.
Other components, such as the python module, OpenVDB AX, NanoVDB and various
executables, may require additional dependencies. See the
[build documentation](https://www.openvdb.org/documentation/doxygen/build.html)
for help with installations.
The following provides basic installation examples for the core OpenVDB library. Other components, such as the python module, OpenVDB AX, NanoVDB and various executables, may require additional dependencies. See the [build documentation](https://academysoftwarefoundation.github.io/openvdb/build.html) for help with installations.
##### Linux/MacOS
#### Linux
##### Installing Dependencies (Boost, TBB, Blosc)
```bash
# Linux
# @note If your distribution does not have required versions, consider using
# apt pinning. See the dependency documentation for more details.
apt-get install -y libboost-iostreams-dev
apt-get install -y libtbb-dev
apt-get install -y libblosc-dev
# MacOS
# @note We are using homebrew in this example to install requried dependencies
# https://brew.sh/
brew install boost
brew install tbb
brew install c-blosc
```
##### Building OpenVDB
```bash
git clone git@github.com:AcademySoftwareFoundation/openvdb.git
cd openvdb
@@ -77,16 +53,30 @@ cd build
cmake ..
make -j4 && make install
```
##### Windows
#### macOS
##### Installing Dependencies (Boost, TBB, Blosc)
```bash
brew install boost
brew install tbb
brew install c-blosc
```
##### Building OpenVDB
```bash
git clone git@github.com:AcademySoftwareFoundation/openvdb.git
cd openvdb
mkdir build
cd build
cmake ..
make -j4 && make install
```
#### Windows
##### Installing Dependencies (Boost, TBB, Blosc)
Note that the following commands have only been tested for 64bit systems/libraries.
It is recommended to set the `VCPKG_DEFAULT_TRIPLET` environment variable to
`x64-windows` to use 64-bit libraries by default. You will also require
[Visual Studio](https://visualstudio.microsoft.com/downloads/) (for the MSVC C++
runtime and compiler toolchains), [CMake](https://cmake.org/download/) and optionally
[vcpkg](https://github.com/microsoft/vcpkg) for the installation of OpenVDB's
dependencies.
[Git](https://git-scm.com/downloads), [vcpkg](https://github.com/microsoft/vcpkg)
and [CMake](https://cmake.org/download/) to be installed.
```bash
vcpkg install zlib:x64-windows
@@ -95,9 +85,10 @@ vcpkg install tbb:x64-windows
vcpkg install boost-iostreams:x64-windows
vcpkg install boost-any:x64-windows
vcpkg install boost-algorithm:x64-windows
vcpkg install boost-uuid:x64-windows
vcpkg install boost-interprocess:x64-windows
```
##### Building OpenVDB
```bash
git clone git@github.com:AcademySoftwareFoundation/openvdb.git
cd openvdb
@@ -107,19 +98,42 @@ cmake -DCMAKE_TOOLCHAIN_FILE=<PATH_TO_VCPKG>\scripts\buildsystems\vcpkg.cmake -D
cmake --build . --parallel 4 --config Release --target install
```
#### Building OpenVDB AX and NanoVDB
#### Building OpenVDB AX
OpenVDB AX depends on the core OpenVDB library. NanoVDB can be built with and
without OpenVDB support. Note that NanoVDB has its own build instructions, see
the [NanoVDB build documentation](https://www.openvdb.org/documentation/doxygen/NanoVDB_HowToBuild.html)
for details.
OpenVDB AX depends on the core OpenVDB library. See the [build documentation](https://academysoftwarefoundation.github.io/openvdb/build.html) for all available AX component options:
The following variables can be passed to the `cmake` configure command. There
are more optional VDB components, see the [build documentation](https://www.openvdb.org/documentation/doxygen/build.html)
for a complete list.
```bash
git clone git@github.com:AcademySoftwareFoundation/openvdb.git
cd openvdb
mkdir build
cd build
cmake -DOPENVDB_BUILD_AX=ON ..
make -j4 && make install
```
| Option | Details |
| :---- | :----- |
| `-D OPENVDB_BUILD_AX=ON` | to enable OpenVDB AX |
| `-D OPENVDB_BUILD_NANOVDB=ON` | to enable NanoVDB |
| `-D NANOVDB_USE_OPENVDB=ON` | to use OpenVDB in NanoVDB |
#### Building NanoVDB
NanoVDB can be built with and without OpenVDB support. To see full build instructions
see the [NanoVDB build documentation](https://academysoftwarefoundation.github.io/openvdb/NanoVDB_HowToBuild.html)
#### Building Without OpenVDB Support
```bash
git clone git@github.com:AcademySoftwareFoundation/openvdb.git
cd openvdb/nanovdb/nanovdb # Build from the subdirectory
mkdir build
cd build
cmake ..
make -j4 && make install
```
#### Building With OpenVDB Support
```bash
git clone git@github.com:AcademySoftwareFoundation/openvdb.git
cd openvdb
mkdir build
cd build
cmake -DOPENVDB_BUILD_NANOVDB=ON ..
make -j4 && make install
```
+7 -33
View File
@@ -2,8 +2,6 @@
set -e
CI_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
# print versions
bash --version
if [ ! -z "$CXX" ]; then $CXX -v; fi
@@ -29,20 +27,9 @@ declare -A PARMS
PARMS[--components]=core,bin
PARMS[--target]=install
PARMS[--build-dir]=build
if [[ $RUNNER_NAME == *"8c-32g-300h"* ]]; then
# ASWF github actions runners have 8 threads
PARMS[-j]=8
else
# Github actions runners have 2 threads
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
if [[ $CXX == "g++" ]]; then
# GCC hits memory limits on runners, build in serial
PARMS[-j]=1
else
PARMS[-j]=2
fi
fi
# github actions runners have 2 threads
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
PARMS[-j]=2
# Available options for --components
declare -A COMPONENTS
@@ -121,15 +108,7 @@ if HAS_PARM -v || HAS_PARM --verbose; then
# support older versions of CMake.
CMAKE_EXTRA+=("-DCMAKE_VERBOSE_MAKEFILE=ON")
fi
if HAS_PARM --build-type; then
CMAKE_EXTRA+=("-DCMAKE_BUILD_TYPE=${PARMS[--build-type]}")
build_type="${PARMS[--build-type]}"
debug="Debug"
# Ignore case - if the build-type is Debug, we enable asserts
if [ "${build_type,,}" = "${debug,,}" ]; then
CMAKE_EXTRA+=("-DOPENVDB_ENABLE_ASSERTS=ON")
fi
fi
if HAS_PARM --build-type; then CMAKE_EXTRA+=("-DCMAKE_BUILD_TYPE=${PARMS[--build-type]}"); fi
# Available components. If a component is not provided it is
# explicitly set to OFF.
@@ -153,7 +132,7 @@ done
################################################
# github actions runners have 8 threads
# github actions runners have 2 threads
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
export CMAKE_BUILD_PARALLEL_LEVEL=${PARMS[-j]}
echo "Build using ${CMAKE_BUILD_PARALLEL_LEVEL} threads"
@@ -181,16 +160,11 @@ set -x
# Note:
# - print and lod binary options are always on and can be toggles with: OPENVDB_BUILD_BINARIES=ON/OFF
# - always enabled the python tests with OPENVDB_BUILD_PYTHON_UNITTESTS if the python module is in use,
# regardless of the 'test' component being enabled or not (see the OPENVDB_BUILD_PYTHON_UNITTESTS option).
cmake \
-DOPENVDB_USE_DEPRECATED_ABI_9=ON \
-DOPENVDB_USE_DEPRECATED_ABI_10=ON \
-DOPENVDB_USE_DEPRECATED_ABI_7=ON \
-DOPENVDB_USE_DEPRECATED_ABI_8=ON \
-DOPENVDB_BUILD_VDB_PRINT=ON \
-DOPENVDB_BUILD_VDB_LOD=ON \
-DOPENVDB_BUILD_VDB_TOOL=ON \
-DOPENVDB_TOOL_USE_NANO=OFF \
-DOPENVDB_BUILD_PYTHON_UNITTESTS=ON \
-DMSVC_MP_THREAD_COUNT=${PARMS[-j]} \
"${CMAKE_EXTRA[@]}" \
..
Executable → Regular
+36 -86
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/local/bin/python
#
# Copyright Contributors to the OpenVDB Project
# SPDX-License-Identifier: MPL-2.0
@@ -19,16 +19,16 @@ import base64
import requests
import hashlib
import os
import argparse
import copy
# For progress bar printing
try:
from tqdm import tqdm
has_tqdm = True
except:
has_tqdm = False
pass
# this argument is for the major.minor version of Houdini to download (such as 15.0, 15.5, 16.0)
version = sys.argv[1]
only_production = True if sys.argv[2] == 'ON' else False
user_client_id = os.getenv('HOUDINI_CLIENT_ID')
user_client_secret_key = os.getenv('HOUDINI_SECRET_KEY')
if not re.match('[0-9][0-9]\.[0-9]$', version):
raise IOError('Invalid Houdini Version "%s", expecting in the form "major.minor" such as "16.0"' % version)
# Code that provides convenient Python wrappers to call into the API:
@@ -94,7 +94,7 @@ def get_access_token_and_expiry_time(
),
})
if response.status_code != 200:
raise AuthorizationError(response.status_code, response.text)
raise AuthorizationError(response.status_code, reponse.text)
response_json = response.json()
access_token_expiry_time = time.time() - 2 + response_json["expires_in"]
@@ -138,83 +138,33 @@ class APIError(Exception):
self.http_code = http_code
if __name__ == "__main__":
service = service(
access_token_url="https://www.sidefx.com/oauth2/application_token",
client_id=user_client_id,
client_secret_key=user_client_secret_key,
endpoint_url="https://www.sidefx.com/api/",
)
parser = argparse.ArgumentParser(description='Download a Houdini Installation')
parser.add_argument('version', type=str, help='Major.Minor version of Houdini to download')
parser.add_argument('platform', type=str, help='Platform target')
parser.add_argument('--prod', action='store_true', help='Only download production builds')
parser.add_argument('--list', action='store_true', help='Just list the available builds and exit.')
args = parser.parse_args()
releases_list = service.download.get_daily_builds_list(
product='houdini', version=version, platform='linux', only_production=only_production)
version = args.version
platform = args.platform
only_production = args.prod
latest_release = service.download.get_daily_build_download(
product='houdini', version=version, platform='linux', build=releases_list[0]['build'])
user_client_id = os.getenv('HOUDINI_CLIENT_ID')
user_client_secret_key = os.getenv('HOUDINI_SECRET_KEY')
if not re.match('[0-9][0-9]\.[0-9]$', version):
raise IOError('Invalid Houdini Version "%s", expecting in the form "major.minor" such as "16.0"' % version)
service = service(
access_token_url="https://www.sidefx.com/oauth2/application_token",
client_id=user_client_id,
client_secret_key=user_client_secret_key,
endpoint_url="https://www.sidefx.com/api/",
)
releases_list = service.download.get_daily_builds_list(
product='houdini', version=version, platform=platform, only_production=only_production)
print('Available builds:')
for rel in releases_list:
rel = copy.deepcopy(rel)
if 'third_party_libraries' in rel:
# Don't print these
del rel['third_party_libraries']
print(rel)
if args.list:
sys.exit(0)
print('Selecting build: ' + releases_list[0]['build'])
latest_release = service.download.get_daily_build_download(
product='houdini', version=version, platform=platform, build=releases_list[0]['build'])
print(latest_release)
# Can't do this procedurally as latest_release['filename'] can contain
# multiple periods and may have multiple trailing extensions...
extension = ''
if 'linux' in platform: extension = 'tar.gz'
elif 'macos' in platform: extension = 'dmg'
elif 'win64' in platform: extension = 'exe'
assert(extension in latest_release['filename'])
# Download the file and save it as hou.extension
local_filename = 'hou.' + extension
print('Writing to "' + local_filename + '"')
response = requests.get(latest_release['download_url'], stream=True)
if response.status_code == 200:
# Download the file as hou.tar.gz
local_filename = 'hou.tar.gz'
response = requests.get(latest_release['download_url'], stream=True)
if response.status_code == 200:
with open(local_filename, 'wb') as f:
response.raw.decode_content = True
if has_tqdm:
file_size = int(response.headers.get('Content-Length', 0))
desc = "(Unknown total file size)" if file_size == 0 else ""
with tqdm.wrapattr(response.raw, "read", total=file_size, desc=desc) as r_raw:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r_raw, f)
else:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(response.raw, f)
else:
raise Exception('Error downloading file!')
shutil.copyfileobj(response.raw, f)
else:
raise Exception('Error downloading file!')
# Verify the file checksum is matching
file_hash = hashlib.md5()
with open(local_filename, 'rb') as f:
for chunk in iter(lambda: f.read(4096), b''):
file_hash.update(chunk)
if file_hash.hexdigest() != latest_release['hash']:
raise Exception('Checksum does not match!')
# Verify the file checksum is matching
file_hash = hashlib.md5()
with open(local_filename, 'rb') as f:
for chunk in iter(lambda: f.read(4096), b''):
file_hash.update(chunk)
if file_hash.hexdigest() != latest_release['hash']:
raise Exception('Checksum does not match!')
+36 -104
View File
@@ -3,120 +3,52 @@
set -ex
HOUDINI_MAJOR="$1"
PLATFORM="$2"
OTHER_ARGS="$3"
GOLD="$2"
pip install --user requests
python ci/download_houdini.py $HOUDINI_MAJOR $PLATFORM $OTHER_ARGS
if [[ $PLATFORM =~ "linux" ]]; then
# create dir hierarchy
mkdir -p hou/bin
mkdir -p hou/houdini
mkdir -p hou/toolkit
mkdir -p hou/dsolib
python ci/download_houdini.py $HOUDINI_MAJOR $GOLD
# unpack hou.tar.gz and cleanup
tar -xzf hou.tar.gz
rm -rf hou.tar.gz
cd houdini*
tar -xzf houdini.tar.gz
# create dir hierarchy
mkdir -p hou/bin
mkdir -p hou/houdini
mkdir -p hou/toolkit
mkdir -p hou/dsolib
# copy required files into hou dir
cp houdini_setup* ../hou/.
# unpack hou.tar.gz and cleanup
tar -xzf hou.tar.gz
rm -rf hou.tar.gz
cd houdini*
tar -xzf houdini.tar.gz
# report library names
ls -al dsolib/
# copy required files into hou dir
cp houdini_setup* ../hou/.
cp -r toolkit/cmake ../hou/toolkit/.
cp -r toolkit/include ../hou/toolkit/.
cp -r dsolib/libHoudini* ../hou/dsolib/.
cp -r dsolib/libopenvdb_sesi* ../hou/dsolib/.
cp -r dsolib/libblosc* ../hou/dsolib/.
cp -r dsolib/libhboost* ../hou/dsolib/.
cp -r dsolib/libz* ../hou/dsolib/.
cp -r dsolib/libbz2* ../hou/dsolib/.
cp -r dsolib/libtbb* ../hou/dsolib/.
cp -r dsolib/libHalf* ../hou/dsolib/.
cp -r dsolib/libjemalloc* ../hou/dsolib/.
cp -r dsolib/liblzma* ../hou/dsolib/.
cp -r dsolib/libIex* ../hou/dsolib/.
cp -r dsolib/libImath* ../hou/dsolib/.
cp -r dsolib/libIlmThread* ../hou/dsolib/.
cp -r dsolib/libIlmImf* ../hou/dsolib/.
# copy required libraries
cp -r toolkit/cmake ../hou/toolkit/.
cp -r toolkit/include ../hou/toolkit/.
cp -r dsolib/libHoudini* ../hou/dsolib/.
cp -r dsolib/libopenvdb_sesi* ../hou/dsolib/.
cp -r dsolib/libblosc* ../hou/dsolib/.
cp -r dsolib/libhboost* ../hou/dsolib/.
cp -r dsolib/libz* ../hou/dsolib/.
cp -r dsolib/libbz2* ../hou/dsolib/.
cp -r dsolib/libtbb* ../hou/dsolib/.
cp -r dsolib/libjemalloc* ../hou/dsolib/.
cp -r dsolib/liblzma* ../hou/dsolib/.
cp -r dsolib/libIex* ../hou/dsolib/.
cp -r dsolib/libImath* ../hou/dsolib/.
cp -r dsolib/libIlmThread* ../hou/dsolib/.
cd ..
elif [[ $PLATFORM =~ "macos" ]]; then
# Exract files by mounting the downloaded dmg (we only really want to
# expand Houdini.framework)
hdiutil attach hou.dmg
pkgutil --expand-full /Volumes/Houdini/Houdini.pkg Houdini
hdiutil detach /Volumes/Houdini
rm hou.dmg
# Move the required Frameworks and delete the extracted src
mkdir -p hou/Frameworks
mv Houdini/Framework.pkg/Payload/Houdini.framework hou/Frameworks/Houdini.framework
rm -rf Houdini
# Report library names
ls -al hou/Frameworks/Houdini.framework/Libraries
# Remove unused resources
cd hou/Frameworks/Houdini.framework/Resources/
rm -rf $(ls | grep -e toolkit -v)
cd -
# Handle libraries. On some versions of MacOS with older versions of ld,
# ld will complain (error) if shared libraries contain missing files which
# are referenced with LC_LOAD_DYLIB or LC_RPATH entries (even though they
# are not explicitly required at link time). We still want to delete these
# unused libs as they occupt ~1-2GB. To handle this, we generate a unique
# list of libs that our direct dependencies reference and create an empty
# shared dylib in their place.
cd hou/Frameworks/Houdini.framework/Libraries
# Remove any folders here, they aren't needed
rm -rf $(ls -p | grep /)
# Remove any library that does not match the -e patterns (inverse grep with -v)
unused_libraries=$(ls | \
grep -e libHoudini \
-e libopenvdb_sesi \
-e libblosc \
-e libhboost \
-e libz \
-e libbz2 \
-e libtbb \
-e libjemalloc \
-e liblzma \
-e libIex \
-e libImath \
-e libIlmThread \
-v)
rm -rf ${unused_libraries}
# Create an empty valid shared lib
echo '' | clang -x c -shared -o libempty.dylib -
# Generate a unique list of libs that our remaining libs reference
for i in $(ls); do otool -LX $i >> libnames; done
sort -u libnames | grep @rpath | cut -f1 -d' ' | xargs > rpaths
# Recreate unused libraries that have been deleted as empty shared dylibs
# to keep ld happy
for libpath in $(cat rpaths); do
libpath=${libpath#"@rpath/"}
echo "Checking $libpath"
if [ ! -f $libpath ]; then
echo "Creating empty library at $libpath"
mkdir -p $(dirname $libpath)
cp libempty.dylib $libpath
fi
done
rm libempty.dylib
cd -
# needed for < H18.0 (due to sesitag)
if [ "$HOUDINI_MAJOR" == "17.0" ] || [ "$HOUDINI_MAJOR" == "17.5" ]; then
cp -r bin/app_init* ../hou/bin/.
cp -r bin/sesitag* ../hou/bin/.
cp -r dsolib/lib* ../hou/dsolib/.
fi
# write hou into hou.tar.gz and cleanup
cd ..
tar -czvf hou.tar.gz hou
# move hou.tar.gz into hou subdirectory
+1 -1
View File
@@ -32,5 +32,5 @@ cmake \
"${CMAKE_EXTRA[@]}" \
..
make -j8
make -j4
make install
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -ex
CMAKE_VERSION="$1"
CMAKE_PACKAGE=cmake-${CMAKE_VERSION}-Linux-x86_64
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_PACKAGE}.tar.gz
tar -xf ${CMAKE_PACKAGE}.tar.gz
cp ${CMAKE_PACKAGE}/bin/* /usr/local/bin/
cp -r ${CMAKE_PACKAGE}/share/* /usr/local/share/
rm -rf ${CMAKE_PACKAGE}
rm -rf ${CMAKE_PACKAGE}.tar.gz
+1 -1
View File
@@ -14,5 +14,5 @@ fi
mkdir build
cd build
cmake ../.
make -j8
make -j4
make install
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -ex
GTEST_VERSION="$1"
git clone https://github.com/google/googletest.git
cd googletest
if [ "$GTEST_VERSION" != "latest" ]; then
git checkout release-${GTEST_VERSION} -b v${GTEST_VERSION}
fi
mkdir build
cd build
cmake ../.
make -j4
make install
+3 -2
View File
@@ -11,7 +11,7 @@ mkdir .build
cd .build
# @note currently only test static builds with MT
cmake -B . -S ../llvm -A x64 -G "Visual Studio 17 2022" -Thost=x64 \
cmake -S ../llvm -A x64 -G "Visual Studio 16 2019" -Thost=x64 \
-DCMAKE_INSTALL_PREFIX="${HOME}/llvm_install" \
-DLLVM_TARGETS_TO_BUILD="host" \
-DLLVM_BUILD_TOOLS=OFF \
@@ -19,7 +19,8 @@ cmake -B . -S ../llvm -A x64 -G "Visual Studio 17 2022" -Thost=x64 \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_TOOLS=OFF \
-DLLVM_USE_CRT_RELEASE=${LLVM_CRT}
-DLLVM_USE_CRT_RELEASE=${LLVM_CRT} \
..
cmake --build . --config Release --target install
+17 -19
View File
@@ -4,36 +4,34 @@ set -x
brew update
brew install bash gnu-getopt # for CI scripts
brew install boost
brew install c-blosc
brew install cmake
brew install ilmbase
brew install openexr@2
brew install boost
brew install boost-python3 # also installs the dependent python version
brew install tbb@2020
brew install zlib
brew install glfw
brew install googletest
brew install jq # for trivial parsing of brew json
brew install openexr
brew install pybind11 # also installs the dependent python version
brew install tbb
brew install zlib
brew install jemalloc
# Alias python version installed by pybind11 to path
py_version=$(brew info pybind11 --json | \
# Alias python version installed by boost-python3 to path
py_version=$(brew info boost-python3 --json | \
jq -cr '.[].dependencies[] | select(. | startswith("python"))')
echo "Using python $py_version"
# export for subsequent action steps (note, not exported for this env)
echo "Python_ROOT_DIR=/usr/local/opt/$py_version" >> $GITHUB_ENV
echo "/usr/local/opt/$py_version/bin" >> $GITHUB_PATH
# Export OpenEXR paths which are no longer installed to /usr/local (as v2.x is deprecated)
echo "IlmBase_ROOT=/usr/local/opt/ilmbase" >> $GITHUB_ENV
echo "OpenEXR_ROOT=/usr/local/opt/openexr@2" >> $GITHUB_ENV
echo "/usr/local/opt/openexr@2/bin" >> $GITHUB_PATH
# Export TBB paths which are no longer installed to /usr/local (as v2020 is deprecated)
echo "TBB_ROOT=/usr/local/opt/tbb@2020" >> $GITHUB_ENV
echo "/usr/local/opt/tbb@2020/bin" >> $GITHUB_PATH
# use gnu-getopt
echo "/usr/local/opt/gnu-getopt/bin" >> $GITHUB_PATH
LLVM_VERSION=$1
if [ ! -z "$LLVM_VERSION" ]; then
if [ "$LLVM_VERSION" == "latest" ]; then
brew install llvm
brew install cppunit
else
brew install llvm@$LLVM_VERSION
brew install cppunit
fi
fi
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Download and install deps from homebrew on macos
LLVM_VERSION=$1
if [ -z $LLVM_VERSION ]; then
echo "No LLVM version provided for LLVM installation"
exit -1
fi
brew update
brew install bash gnu-getopt # for CI scripts
brew install cmake
brew install boost
brew install cppunit
brew install c-blosc
brew install tbb@2020
brew install llvm@$LLVM_VERSION
brew install zlib
# Export TBB paths which are no longer installed to /usr/local (as v2020 is deprecated)
echo "TBB_ROOT=/usr/local/opt/tbb@2020" >> $GITHUB_ENV
echo "/usr/local/opt/tbb@2020/bin" >> $GITHUB_PATH
# use gnu-getopt
echo "/usr/local/opt/gnu-getopt/bin" >> $GITHUB_PATH
-28
View File
@@ -1,28 +0,0 @@
#!/usr/bin/env bash
set -ex
PYBIND11_VERSION="$1"
INSTALL_ROOT="$2"
CMAKE_EXTRA=()
if [ ! -z "${INSTALL_ROOT}" ]; then
CMAKE_EXTRA+=("-DCMAKE_INSTALL_PREFIX=${INSTALL_ROOT}")
fi
git clone https://github.com/pybind/pybind11.git
cd pybind11
if [ "$PYBIND11_VERSION" != "latest" ]; then
git checkout tags/v${PYBIND11_VERSION} -b v${PYBIND11_VERSION}
fi
mkdir build
cd build
cmake \
-DPYBIND11_TEST=OFF \
"${CMAKE_EXTRA[@]}" \
..
make -j8
make install
+2 -3
View File
@@ -3,6 +3,5 @@
set -ex
vcpkg update
vcpkg install zlib libpng openexr tbb gtest cppunit blosc glfw3 glew python3 jemalloc \
boost-iostreams boost-interprocess boost-algorithm pybind11 \
--clean-after-build
vcpkg install zlib libpng openexr tbb gtest blosc glfw3 glew \
boost-iostreams boost-any boost-uuid boost-interprocess boost-algorithm
+1 -4
View File
@@ -25,13 +25,11 @@ $CUDA_KNOWN_URLS = @{
"11.2.0" = "https://developer.download.nvidia.com/compute/cuda/11.2.0/network_installers/cuda_11.2.0_win10_network.exe";
"11.2.1" = "https://developer.download.nvidia.com/compute/cuda/11.2.1/network_installers/cuda_11.2.1_win10_network.exe";
"11.2.2" = "https://developer.download.nvidia.com/compute/cuda/11.2.2/network_installers/cuda_11.2.2_win10_network.exe";
"11.3.0" = "https://developer.download.nvidia.com/compute/cuda/11.3.0/network_installers/cuda_11.3.0_win10_network.exe";
"11.6.2" = "https://developer.download.nvidia.com/compute/cuda/11.6.2/network_installers/cuda_11.6.2_windows_network.exe"
"11.3.0" = "https://developer.download.nvidia.com/compute/cuda/11.3.0/network_installers/cuda_11.3.0_win10_network.exe"
}
# @todo - change this to be based on _MSC_VER intead, or invert it to be CUDA keyed instead?
$VISUAL_STUDIO_MIN_CUDA = @{
"2022" = "11.6";
"2019" = "10.1";
"2017" = "10.0"; # Depends on which version of 2017! 9.0 to 10.0 depending on version
"2015" = "8.0"; # might support older, unsure.
@@ -45,7 +43,6 @@ $CUDA_PACKAGES_IN = @(
"curand_dev";
"nvrtc_dev";
"cudart";
"thrust";
)
+1 -1
View File
@@ -8,7 +8,7 @@ set -e
# the expected VDB installation
cmakelists="
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
project(TestInstall LANGUAGES CXX)
find_package(OpenVDB REQUIRED COMPONENTS openvdb)
add_executable(test_vdb_print \"../openvdb_cmd/vdb_print/main.cc\")
+4 -73
View File
@@ -88,7 +88,7 @@ may be provided to tell this module where to look.
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
include(GNUInstallDirs)
mark_as_advanced(
@@ -191,12 +191,10 @@ list(APPEND _BLOSC_LIBRARYDIR_SEARCH_DIRS
# Library suffix handling
set(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES})
if(MSVC)
if(BLOSC_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
set(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES};lib")
endif()
else()
if(BLOSC_USE_STATIC_LIBS)
@@ -249,9 +247,7 @@ endforeach()
# Reset library suffix
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_PREFIXES ${_BLOSC_ORIG_CMAKE_FIND_LIBRARY_PREFIXES})
unset(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
unset(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_PREFIXES)
if(Blosc_LIBRARY_DEBUG AND Blosc_LIBRARY_RELEASE)
# if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
@@ -380,74 +376,9 @@ if(NOT TARGET Blosc::blosc)
set_target_properties(Blosc::blosc PROPERTIES
INTERFACE_LINK_DIRECTORIES
"\$<\$<CONFIG:Release>:${Blosc_RELEASE_LIBRARY_DIRS}>;\$<\$<CONFIG:Debug>:${Blosc_DEBUG_LIBRARY_DIRS}>")
set(BLOSC_EXTERNAL_LIBRARIES lz4 snappy zlib zstd)
foreach(BLOSC_EXTERNAL_LIB ${BLOSC_EXTERNAL_LIBRARIES})
foreach(BUILD_TYPE ${BLOSC_BUILD_TYPES})
set(_BLOSC_CMAKE_IGNORE_PATH ${CMAKE_IGNORE_PATH})
if(VCPKG_TOOLCHAIN)
if(BUILD_TYPE STREQUAL RELEASE)
list(APPEND CMAKE_IGNORE_PATH ${Blosc_DEBUG_LIBRARY_DIRS})
else()
list(APPEND CMAKE_IGNORE_PATH ${Blosc_RELEASE_LIBRARY_DIRS})
endif()
endif()
find_library(${BLOSC_EXTERNAL_LIB}_LIBRARY_${BUILD_TYPE} ${BLOSC_EXTERNAL_LIB}
${_FIND_BLOSC_ADDITIONAL_OPTIONS}
PATHS ${_BLOSC_LIBRARYDIR_SEARCH_DIRS}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} lib64 lib)
if(NOT ${BLOSC_EXTERNAL_LIB}_LIBRARY_${BUILD_TYPE})
if(BUILD_TYPE STREQUAL DEBUG)
find_library(${BLOSC_EXTERNAL_LIB}_LIBRARY_${BUILD_TYPE} "${BLOSC_EXTERNAL_LIB}d"
${_FIND_BLOSC_ADDITIONAL_OPTIONS}
PATHS ${_BLOSC_LIBRARYDIR_SEARCH_DIRS}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} lib64 lib)
endif()
endif()
set(CMAKE_IGNORE_PATH ${_BLOSC_CMAKE_IGNORE_PATH})
endforeach()
if(${BLOSC_EXTERNAL_LIB}_LIBRARY_DEBUG AND ${BLOSC_EXTERNAL_LIB}_LIBRARY_RELEASE)
# if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
# single-config generators, set optimized and debug libraries
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig OR CMAKE_BUILD_TYPE)
set(${BLOSC_EXTERNAL_LIB}_LIBRARY optimized ${${BLOSC_EXTERNAL_LIB}_LIBRARY_RELEASE} debug ${${BLOSC_EXTERNAL_LIB}_LIBRARY_DEBUG})
else()
# For single-config generators where CMAKE_BUILD_TYPE has no value,
# just use the release libraries
set(${BLOSC_EXTERNAL_LIB}_LIBRARY ${${BLOSC_EXTERNAL_LIB}_LIBRARY_RELEASE})
endif()
# FIXME: This probably should be set for both cases
set(${BLOSC_EXTERNAL_LIB}_LIBRARIES optimized ${${BLOSC_EXTERNAL_LIB}_LIBRARY_RELEASE} debug ${${BLOSC_EXTERNAL_LIB}_LIBRARY_DEBUG})
endif()
# if only the release version was found, set the debug variable also to the release version
if(${BLOSC_EXTERNAL_LIB}_LIBRARY_RELEASE AND NOT ${BLOSC_EXTERNAL_LIB}_LIBRARY_DEBUG)
set(${BLOSC_EXTERNAL_LIB}_LIBRARY_DEBUG ${${BLOSC_EXTERNAL_LIB}_LIBRARY_RELEASE})
set(${BLOSC_EXTERNAL_LIB}_LIBRARY ${${BLOSC_EXTERNAL_LIB}_LIBRARY_RELEASE})
set(${BLOSC_EXTERNAL_LIB}_LIBRARIES ${${BLOSC_EXTERNAL_LIB}_LIBRARY_RELEASE})
endif()
# if only the debug version was found, set the release variable also to the debug version
if(${BLOSC_EXTERNAL_LIB}_LIBRARY_DEBUG AND NOT ${BLOSC_EXTERNAL_LIB}_LIBRARY_RELEASE)
set(${BLOSC_EXTERNAL_LIB}_LIBRARY_RELEASE ${${BLOSC_EXTERNAL_LIB}_LIBRARY_DEBUG})
set(${BLOSC_EXTERNAL_LIB}_LIBRARY ${${BLOSC_EXTERNAL_LIB}_LIBRARY_DEBUG})
set(${BLOSC_EXTERNAL_LIB}_LIBRARIES ${${BLOSC_EXTERNAL_LIB}_LIBRARY_DEBUG})
endif()
target_link_libraries(Blosc::blosc INTERFACE
$<$<CONFIG:Release>:${${BLOSC_EXTERNAL_LIB}_LIBRARY_RELEASE}>
$<$<CONFIG:Debug>:${${BLOSC_EXTERNAL_LIB}_LIBRARY_DEBUG}>)
endforeach()
target_link_libraries(Blosc::blosc INTERFACE
$<$<CONFIG:Release>:lz4;snappy;zlib;zstd>
$<$<CONFIG:Debug>:lz4d;snappyd;zlibd;zstd>)
endif()
endif()
+1 -1
View File
@@ -83,7 +83,7 @@ may be provided to tell this module where to look.
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
include(GNUInstallDirs)
+447
View File
@@ -0,0 +1,447 @@
# Copyright Contributors to the OpenVDB Project
# SPDX-License-Identifier: MPL-2.0
#
#[=======================================================================[.rst:
FindIlmBase
-----------
Find IlmBase include dirs and libraries
Use this module by invoking find_package with the form::
find_package(IlmBase
[version] [EXACT] # Minimum or EXACT version
[REQUIRED] # Fail with error if IlmBase is not found
[COMPONENTS <libs>...] # IlmBase libraries by their canonical name
# e.g. "Half" for "libHalf"
)
IMPORTED Targets
^^^^^^^^^^^^^^^^
``IlmBase::Half``
The Half library target.
``IlmBase::Iex``
The Iex library target.
``IlmBase::IexMath``
The IexMath library target.
``IlmBase::IlmThread``
The IlmThread library target.
``IlmBase::Imath``
The Imath library target.
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``IlmBase_FOUND``
True if the system has the IlmBase library.
``IlmBase_VERSION``
The version of the IlmBase library which was found.
``IlmBase_INCLUDE_DIRS``
Include directories needed to use IlmBase.
``IlmBase_RELEASE_LIBRARIES``
Libraries needed to link to the release version of IlmBase.
``IlmBase_RELEASE_LIBRARY_DIRS``
IlmBase release library directories.
``IlmBase_DEBUG_LIBRARIES``
Libraries needed to link to the debug version of IlmBase.
``IlmBase_DEBUG_LIBRARY_DIRS``
IlmBase debug library directories.
``IlmBase_{COMPONENT}_FOUND``
True if the system has the named IlmBase component.
Deprecated - use [RELEASE|DEBUG] variants:
``IlmBase_LIBRARIES``
Libraries needed to link to IlmBase.
``IlmBase_LIBRARY_DIRS``
IlmBase library directories.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``IlmBase_INCLUDE_DIR``
The directory containing ``IlmBase/config-auto.h``.
``IlmBase_{COMPONENT}_LIBRARY``
Individual component libraries for IlmBase. may include target_link_libraries() debug/optimized keywords.
``IlmBase_{COMPONENT}_LIBRARY_RELEASE``
Individual component libraries for IlmBase release
``IlmBase_{COMPONENT}_LIBRARY_DEBUG``
Individual component libraries for IlmBase debug
Hints
^^^^^
Instead of explicitly setting the cache variables, the following variables
may be provided to tell this module where to look.
``IlmBase_ROOT``
Preferred installation prefix.
``ILMBASE_INCLUDEDIR``
Preferred include directory e.g. <prefix>/include
``ILMBASE_LIBRARYDIR``
Preferred library directory e.g. <prefix>/lib
``ILMBASE_DEBUG_SUFFIX``
Suffix of the debug version of ilmbase libs. Defaults to "_d".
``SYSTEM_LIBRARY_PATHS``
Global list of library paths intended to be searched by and find_xxx call
``ILMBASE_USE_STATIC_LIBS``
Only search for static ilmbase libraries
``DISABLE_CMAKE_SEARCH_PATHS``
Disable CMakes default search paths for find_xxx calls in this module
#]=======================================================================]
cmake_minimum_required(VERSION 3.15)
include(GNUInstallDirs)
mark_as_advanced(
IlmBase_INCLUDE_DIR
IlmBase_LIBRARY
)
set(_FIND_ILMBASE_ADDITIONAL_OPTIONS "")
if(DISABLE_CMAKE_SEARCH_PATHS)
set(_FIND_ILMBASE_ADDITIONAL_OPTIONS NO_DEFAULT_PATH)
endif()
set(_ILMBASE_COMPONENT_LIST
Half
Iex
IexMath
IlmThread
Imath
)
if(IlmBase_FIND_COMPONENTS)
set(ILMBASE_COMPONENTS_PROVIDED TRUE)
set(_IGNORED_COMPONENTS "")
foreach(COMPONENT ${IlmBase_FIND_COMPONENTS})
if(NOT ${COMPONENT} IN_LIST _ILMBASE_COMPONENT_LIST)
list(APPEND _IGNORED_COMPONENTS ${COMPONENT})
endif()
endforeach()
if(_IGNORED_COMPONENTS)
message(STATUS "Ignoring unknown components of IlmBase:")
foreach(COMPONENT ${_IGNORED_COMPONENTS})
message(STATUS " ${COMPONENT}")
endforeach()
list(REMOVE_ITEM IlmBase_FIND_COMPONENTS ${_IGNORED_COMPONENTS})
endif()
else()
set(ILMBASE_COMPONENTS_PROVIDED FALSE)
set(IlmBase_FIND_COMPONENTS ${_ILMBASE_COMPONENT_LIST})
endif()
# Set _ILMBASE_ROOT based on a user provided root var. Xxx_ROOT and ENV{Xxx_ROOT}
# are prioritised over the legacy capitalized XXX_ROOT variables for matching
# CMake 3.12 behaviour
# @todo deprecate -D and ENV ILMBASE_ROOT from CMake 3.12
if(IlmBase_ROOT)
set(_ILMBASE_ROOT ${IlmBase_ROOT})
elseif(DEFINED ENV{IlmBase_ROOT})
set(_ILMBASE_ROOT $ENV{IlmBase_ROOT})
elseif(ILMBASE_ROOT)
set(_ILMBASE_ROOT ${ILMBASE_ROOT})
elseif(DEFINED ENV{ILMBASE_ROOT})
set(_ILMBASE_ROOT $ENV{ILMBASE_ROOT})
endif()
# Additionally try and use pkconfig to find IlmBase
if(USE_PKGCONFIG)
if(NOT DEFINED PKG_CONFIG_FOUND)
find_package(PkgConfig)
endif()
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_IlmBase QUIET ilmbase)
endif()
endif()
# ------------------------------------------------------------------------
# Search for IlmBase include DIR
# ------------------------------------------------------------------------
set(_ILMBASE_INCLUDE_SEARCH_DIRS "")
list(APPEND _ILMBASE_INCLUDE_SEARCH_DIRS
${ILMBASE_INCLUDEDIR}
${_ILMBASE_ROOT}
${PC_IlmBase_INCLUDEDIR}
${SYSTEM_LIBRARY_PATHS}
)
# Look for a standard IlmBase header file.
find_path(IlmBase_INCLUDE_DIR IlmBaseConfig.h
${_FIND_ILMBASE_ADDITIONAL_OPTIONS}
PATHS ${_ILMBASE_INCLUDE_SEARCH_DIRS}
PATH_SUFFIXES ${CMAKE_INSTALL_INCLUDEDIR}/OpenEXR include/OpenEXR OpenEXR
)
if(EXISTS "${IlmBase_INCLUDE_DIR}/IlmBaseConfig.h")
# Get the ILMBASE version information from the config header
file(STRINGS "${IlmBase_INCLUDE_DIR}/IlmBaseConfig.h"
_ilmbase_version_major_string REGEX "#define ILMBASE_VERSION_MAJOR "
)
string(REGEX REPLACE "#define ILMBASE_VERSION_MAJOR" ""
_ilmbase_version_major_string "${_ilmbase_version_major_string}"
)
string(STRIP "${_ilmbase_version_major_string}" IlmBase_VERSION_MAJOR)
file(STRINGS "${IlmBase_INCLUDE_DIR}/IlmBaseConfig.h"
_ilmbase_version_minor_string REGEX "#define ILMBASE_VERSION_MINOR "
)
string(REGEX REPLACE "#define ILMBASE_VERSION_MINOR" ""
_ilmbase_version_minor_string "${_ilmbase_version_minor_string}"
)
string(STRIP "${_ilmbase_version_minor_string}" IlmBase_VERSION_MINOR)
unset(_ilmbase_version_major_string)
unset(_ilmbase_version_minor_string)
set(IlmBase_VERSION ${IlmBase_VERSION_MAJOR}.${IlmBase_VERSION_MINOR})
endif()
# ------------------------------------------------------------------------
# Search for ILMBASE lib DIR
# ------------------------------------------------------------------------
if(NOT DEFINED ILMBASE_DEBUG_SUFFIX)
set(ILMBASE_DEBUG_SUFFIX _d)
endif()
set(_ILMBASE_LIBRARYDIR_SEARCH_DIRS "")
# Append to _ILMBASE_LIBRARYDIR_SEARCH_DIRS in priority order
list(APPEND _ILMBASE_LIBRARYDIR_SEARCH_DIRS
${ILMBASE_LIBRARYDIR}
${_ILMBASE_ROOT}
${PC_IlmBase_LIBDIR}
${SYSTEM_LIBRARY_PATHS}
)
set(IlmBase_LIB_COMPONENTS "")
list(APPEND ILM_BUILD_TYPES RELEASE DEBUG)
foreach(COMPONENT ${IlmBase_FIND_COMPONENTS})
foreach(BUILD_TYPE ${ILM_BUILD_TYPES})
set(_TMP_SUFFIX "")
if(BUILD_TYPE STREQUAL DEBUG)
set(_TMP_SUFFIX ${ILMBASE_DEBUG_SUFFIX})
endif()
set(_IlmBase_Version_Suffix "-${IlmBase_VERSION_MAJOR}_${IlmBase_VERSION_MINOR}")
set(_ILMBASE_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(WIN32)
if(ILMBASE_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES "${_TMP_SUFFIX}.lib")
endif()
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_IlmBase_Version_Suffix}${_TMP_SUFFIX}.lib")
else()
if(ILMBASE_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES "${_TMP_SUFFIX}.a")
else()
if(APPLE)
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_IlmBase_Version_Suffix}${_TMP_SUFFIX}.dylib")
else()
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_IlmBase_Version_Suffix}${_TMP_SUFFIX}.so")
endif()
endif()
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_IlmBase_Version_Suffix}${_TMP_SUFFIX}.a")
endif()
# Find the lib
find_library(IlmBase_${COMPONENT}_LIBRARY_${BUILD_TYPE} ${COMPONENT}
${_FIND_ILMBASE_ADDITIONAL_OPTIONS}
PATHS ${_ILMBASE_LIBRARYDIR_SEARCH_DIRS}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} lib64 lib
)
if(EXISTS ${IlmBase_${COMPONENT}_LIBRARY_${BUILD_TYPE}})
list(APPEND IlmBase_LIB_COMPONENTS ${IlmBase_${COMPONENT}_LIBRARY_${BUILD_TYPE}})
list(APPEND IlmBase_LIB_COMPONENTS_${BUILD_TYPE} ${IlmBase_${COMPONENT}_LIBRARY_${BUILD_TYPE}})
endif()
# Reset library suffix
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_ILMBASE_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
unset(_ILMBASE_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
unset(_IlmBase_Version_Suffix)
unset(_TMP_SUFFIX)
endforeach()
if(IlmBase_${COMPONENT}_LIBRARY_DEBUG AND IlmBase_${COMPONENT}_LIBRARY_RELEASE)
# if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
# single-config generators, set optimized and debug libraries
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig OR CMAKE_BUILD_TYPE)
set(IlmBase_${COMPONENT}_LIBRARY optimized ${IlmBase_${COMPONENT}_LIBRARY_RELEASE} debug ${IlmBase_${COMPONENT}_LIBRARY_DEBUG})
else()
# For single-config generators where CMAKE_BUILD_TYPE has no value,
# just use the release libraries
set(IlmBase_${COMPONENT}_LIBRARY ${IlmBase_${COMPONENT}_LIBRARY_RELEASE})
endif()
# FIXME: This probably should be set for both cases
set(IlmBase_${COMPONENT}_LIBRARIES optimized ${IlmBase_${COMPONENT}_LIBRARY_RELEASE} debug ${IlmBase_${COMPONENT}_LIBRARY_DEBUG})
endif()
# if only the release version was found, set the debug variable also to the release version
if(IlmBase_${COMPONENT}_LIBRARY_RELEASE AND NOT IlmBase_${COMPONENT}_LIBRARY_DEBUG)
set(IlmBase_${COMPONENT}_LIBRARY_DEBUG ${IlmBase_${COMPONENT}_LIBRARY_RELEASE})
set(IlmBase_${COMPONENT}_LIBRARY ${IlmBase_${COMPONENT}_LIBRARY_RELEASE})
set(IlmBase_${COMPONENT}_LIBRARIES ${IlmBase_${COMPONENT}_LIBRARY_RELEASE})
endif()
# if only the debug version was found, set the release variable also to the debug version
if(IlmBase_${COMPONENT}_LIBRARY_DEBUG AND NOT IlmBase_${COMPONENT}_LIBRARY_RELEASE)
set(IlmBase_${COMPONENT}_LIBRARY_RELEASE ${IlmBase_${COMPONENT}_LIBRARY_DEBUG})
set(IlmBase_${COMPONENT}_LIBRARY ${IlmBase_${COMPONENT}_LIBRARY_DEBUG})
set(IlmBase_${COMPONENT}_LIBRARIES ${IlmBase_${COMPONENT}_LIBRARY_DEBUG})
endif()
# If the debug & release library ends up being the same, omit the keywords
if("${IlmBase_${COMPONENT}_LIBRARY_RELEASE}" STREQUAL "${IlmBase_${COMPONENT}_LIBRARY_DEBUG}")
set(IlmBase_${COMPONENT}_LIBRARY ${IlmBase_${COMPONENT}_LIBRARY_RELEASE} )
set(IlmBase_${COMPONENT}_LIBRARIES ${IlmBase_${COMPONENT}_LIBRARY_RELEASE} )
endif()
if(IlmBase_${COMPONENT}_LIBRARY)
set(IlmBase_${COMPONENT}_FOUND TRUE)
else()
set(IlmBase_${COMPONENT}_FOUND FALSE)
endif()
endforeach()
# ------------------------------------------------------------------------
# Cache and set ILMBASE_FOUND
# ------------------------------------------------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(IlmBase
FOUND_VAR IlmBase_FOUND
REQUIRED_VARS
IlmBase_INCLUDE_DIR
IlmBase_LIB_COMPONENTS
VERSION_VAR IlmBase_VERSION
HANDLE_COMPONENTS
)
if(NOT IlmBase_FOUND)
if(IlmBase_FIND_REQUIRED)
message(FATAL_ERROR "Unable to find IlmBase")
endif()
return()
endif()
# Partition release/debug lib vars
set(IlmBase_RELEASE_LIBRARIES "")
set(IlmBase_RELEASE_LIBRARY_DIRS "")
set(IlmBase_DEBUG_LIBRARIES "")
set(IlmBase_DEBUG_LIBRARY_DIRS "")
foreach(LIB ${IlmBase_LIB_COMPONENTS_RELEASE})
get_filename_component(_ILM_LIBDIR ${LIB} DIRECTORY)
list(APPEND IlmBase_RELEASE_LIBRARIES ${LIB})
list(APPEND IlmBase_RELEASE_LIBRARY_DIRS ${_ILM_LIBDIR})
endforeach()
foreach(LIB ${IlmBase_LIB_COMPONENTS_DEBUG})
get_filename_component(_ILM_LIBDIR ${LIB} DIRECTORY)
list(APPEND IlmBase_DEBUG_LIBRARIES ${LIB})
list(APPEND IlmBase_DEBUG_LIBRARY_DIRS ${_ILM_LIBDIR})
endforeach()
list(REMOVE_DUPLICATES IlmBase_RELEASE_LIBRARY_DIRS)
list(REMOVE_DUPLICATES IlmBase_DEBUG_LIBRARY_DIRS)
set(IlmBase_LIBRARIES ${IlmBase_RELEASE_LIBRARIES})
set(IlmBase_LIBRARY_DIRS ${IlmBase_RELEASE_LIBRARY_DIRS})
# We have to add both include and include/OpenEXR to the include
# path in case OpenEXR and IlmBase are installed separately.
#
# Make sure we get the absolute path to avoid issues where
# /usr/include/OpenEXR/../ is picked up and passed to gcc from cmake
# which won't correctly compute /usr/include as an implicit system
# dir if the path is relative:
#
# https://github.com/AcademySoftwareFoundation/openvdb/issues/632
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129
set(_IlmBase_Parent_Dir "")
get_filename_component(_IlmBase_Parent_Dir
${IlmBase_INCLUDE_DIR}/../ ABSOLUTE)
set(IlmBase_INCLUDE_DIRS)
list(APPEND IlmBase_INCLUDE_DIRS
${_IlmBase_Parent_Dir}
${IlmBase_INCLUDE_DIR}
)
unset(_IlmBase_Parent_Dir)
# Configure imported targets
foreach(COMPONENT ${IlmBase_FIND_COMPONENTS})
# Configure lib type. If XXX_USE_STATIC_LIBS, we always assume a static
# lib is in use. If win32, we can't mark the import .libs as shared, so
# these are always marked as UNKNOWN. Otherwise, infer from extension.
set(ILMBASE_${COMPONENT}_LIB_TYPE UNKNOWN)
if(ILMBASE_USE_STATIC_LIBS)
set(ILMBASE_${COMPONENT}_LIB_TYPE STATIC)
elseif(UNIX)
get_filename_component(_ILMBASE_${COMPONENT}_EXT ${IlmBase_${COMPONENT}_LIBRARY_RELEASE} EXT)
if(${_ILMBASE_${COMPONENT}_EXT} STREQUAL ".a")
set(ILMBASE_${COMPONENT}_LIB_TYPE STATIC)
elseif(${_ILMBASE_${COMPONENT}_EXT} STREQUAL ".so" OR
${_ILMBASE_${COMPONENT}_EXT} STREQUAL ".dylib")
set(ILMBASE_${COMPONENT}_LIB_TYPE SHARED)
endif()
endif()
set(IlmBase_${COMPONENT}_DEFINITIONS)
# Add the OPENEXR_DLL define if the library is not static on WIN32
if(WIN32)
if(NOT ILMBASE_${COMPONENT}_LIB_TYPE STREQUAL STATIC)
list(APPEND IlmBase_${COMPONENT}_DEFINITIONS OPENEXR_DLL)
endif()
endif()
if(NOT TARGET IlmBase::${COMPONENT})
add_library(IlmBase::${COMPONENT} ${ILMBASE_${COMPONENT}_LIB_TYPE} IMPORTED)
set_target_properties(IlmBase::${COMPONENT} PROPERTIES
INTERFACE_COMPILE_OPTIONS "${PC_IlmBase_CFLAGS_OTHER}"
INTERFACE_COMPILE_DEFINITIONS "${IlmBase_${COMPONENT}_DEFINITIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${IlmBase_INCLUDE_DIRS}")
# Standard location
set_target_properties(IlmBase::${COMPONENT} PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${IlmBase_${COMPONENT}_LIBRARY}")
# Release location
if(EXISTS "${IlmBase_${COMPONENT}_LIBRARY_RELEASE}")
set_property(TARGET IlmBase::${COMPONENT} APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(IlmBase::${COMPONENT} PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${IlmBase_${COMPONENT}_LIBRARY_RELEASE}")
endif()
# Debug location
if(EXISTS "${IlmBase_${COMPONENT}_LIBRARY_DEBUG}")
set_property(TARGET IlmBase::${COMPONENT} APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(IlmBase::${COMPONENT} PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
IMPORTED_LOCATION_DEBUG "${IlmBase_${COMPONENT}_LIBRARY_DEBUG}")
endif()
endif()
endforeach()
+1 -1
View File
@@ -64,7 +64,7 @@ may be provided to tell this module where to look.
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
include(GNUInstallDirs)
+1 -1
View File
@@ -87,7 +87,7 @@ may be provided to tell this module where to look.
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
include(GNUInstallDirs)
+1 -1
View File
@@ -93,7 +93,7 @@ may be provided to tell this module where to look.
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
include(GNUInstallDirs)
+32 -27
View File
@@ -64,8 +64,6 @@ This will define the following variables:
True if the OpenVDB Library has been built with log4cplus support
``OpenVDB_USES_IMATH_HALF``
True if the OpenVDB Library has been built with Imath half support
``OpenVDB_USES_DELAYED_LOADING``
True if the OpenVDB Library has been built with delayed-loading
``OpenVDB_ABI``
Set if this module was able to determine the ABI number the located
OpenVDB Library was built against. Unset otherwise.
@@ -109,7 +107,7 @@ may be provided to tell this module where to look.
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
include(GNUInstallDirs)
@@ -394,9 +392,6 @@ foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS})
elseif(${COMPONENT} STREQUAL "openvdb_je")
# alias to the result of openvdb which should be handled first
set(OpenVDB_${COMPONENT}_LIBRARY ${OpenVDB_openvdb_LIBRARY})
elseif(${COMPONENT} STREQUAL "nanovdb")
# alias to the result of openvdb which should be handled first
set(OpenVDB_${COMPONENT}_LIBRARY ${OpenVDB_openvdb_LIBRARY})
else()
find_library(OpenVDB_${COMPONENT}_LIBRARY ${LIB_NAME}
${_FIND_OPENVDB_ADDITIONAL_OPTIONS}
@@ -491,6 +486,16 @@ endif()
# Add standard dependencies
find_package(TBB REQUIRED COMPONENTS tbb)
if(NOT OPENVDB_USE_STATIC_LIBS AND NOT Boost_USE_STATIC_LIBS)
# @note Both of these must be set for Boost 1.70 (VFX2020) to link against
# boost shared libraries (more specifically libraries built with -fPIC).
# http://boost.2283326.n4.nabble.com/CMake-config-scripts-broken-in-1-70-td4708957.html
# https://github.com/boostorg/boost_install/commit/160c7cb2b2c720e74463865ef0454d4c4cd9ae7c
set(BUILD_SHARED_LIBS ON)
set(Boost_USE_STATIC_LIBS OFF)
endif()
find_package(Boost REQUIRED COMPONENTS iostreams)
# Add deps for pyopenvdb
@@ -550,7 +555,6 @@ set(OpenVDB_USES_BLOSC ${USE_BLOSC})
set(OpenVDB_USES_ZLIB ${USE_ZLIB})
set(OpenVDB_USES_LOG4CPLUS ${USE_LOG4CPLUS})
set(OpenVDB_USES_IMATH_HALF ${USE_IMATH_HALF})
set(OpenVDB_USES_DELAYED_LOADING ${OPENVDB_USE_DELAYED_LOADING})
set(OpenVDB_DEFINITIONS)
if(WIN32)
@@ -583,7 +587,6 @@ if(_OPENVDB_HAS_NEW_VERSION_HEADER)
OPENVDB_GET_VERSION_DEFINE(${_OPENVDB_VERSION_HEADER} "OPENVDB_USE_IMATH_HALF" OpenVDB_USES_IMATH_HALF)
OPENVDB_GET_VERSION_DEFINE(${_OPENVDB_VERSION_HEADER} "OPENVDB_USE_BLOSC" OpenVDB_USES_BLOSC)
OPENVDB_GET_VERSION_DEFINE(${_OPENVDB_VERSION_HEADER} "OPENVDB_USE_ZLIB" OpenVDB_USES_ZLIB)
OPENVDB_GET_VERSION_DEFINE(${_OPENVDB_VERSION_HEADER} "OPENVDB_USE_DELAYED_LOADING" OpenVDB_USES_DELAYED_LOADING)
elseif(NOT OPENVDB_USE_STATIC_LIBS)
# Use GetPrerequisites to see which libraries this OpenVDB lib has linked to
# which we can query for optional deps. This basically runs ldd/otoll/objdump
@@ -630,11 +633,6 @@ elseif(NOT OPENVDB_USE_STATIC_LIBS)
if(NOT ${_HAS_DEP} EQUAL -1)
set(OpenVDB_USES_IMATH_HALF ON)
endif()
string(FIND ${PREREQUISITE} "boost_iostreams" _HAS_DEP)
if(NOT ${_HAS_DEP} EQUAL -1)
set(OpenVDB_USES_DELAYED_LOADING ON)
endif()
endforeach()
unset(_OPENVDB_PREREQUISITE_LIST)
@@ -653,7 +651,19 @@ if(OpenVDB_USES_LOG4CPLUS)
endif()
if(OpenVDB_USES_IMATH_HALF)
find_package(Imath REQUIRED CONFIG)
find_package(Imath CONFIG)
if (NOT TARGET Imath::Imath)
find_package(IlmBase REQUIRED COMPONENTS Half)
endif()
if(WIN32)
# @note OPENVDB_OPENEXR_STATICLIB is old functionality and should be removed
if(OPENEXR_USE_STATIC_LIBS OR
("${ILMBASE_LIB_TYPE}" STREQUAL "STATIC_LIBRARY") OR
("${IMATH_LIB_TYPE}" STREQUAL "STATIC_LIBRARY"))
list(APPEND OpenVDB_DEFINITIONS OPENVDB_OPENEXR_STATICLIB)
endif()
endif()
endif()
if(UNIX)
@@ -661,19 +671,14 @@ if(UNIX)
endif()
# Set deps. Note that the order here is important. If we're building against
# Houdini we must include Imath deps first to ensure the users chosen
# Houdini 17.5 we must include IlmBase deps first to ensure the users chosen
# namespaced headers are correctly prioritized. Otherwise other include paths
# from shared installs (including houdini) may pull in the wrong headers
set(_OPENVDB_VISIBLE_DEPENDENCIES "")
if(OpenVDB_USES_DELAYED_LOADING)
list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES Boost::iostreams)
list(APPEND OpenVDB_DEFINITIONS OPENVDB_USE_DELAYED_LOADING)
endif()
set(_OPENVDB_VISIBLE_DEPENDENCIES Boost::iostreams)
if(OpenVDB_USES_IMATH_HALF)
list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES Imath::Imath)
list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES $<TARGET_NAME_IF_EXISTS:IlmBase::Half> $<TARGET_NAME_IF_EXISTS:Imath::Imath>)
endif()
if(OpenVDB_USES_LOG4CPLUS)
@@ -744,7 +749,7 @@ if(NOT TARGET OpenVDB::openvdb)
INTERFACE_INCLUDE_DIRECTORIES "${OpenVDB_INCLUDE_DIR}"
IMPORTED_LINK_DEPENDENT_LIBRARIES "${_OPENVDB_HIDDEN_DEPENDENCIES}" # non visible deps
INTERFACE_LINK_LIBRARIES "${_OPENVDB_VISIBLE_DEPENDENCIES}" # visible deps (headers)
INTERFACE_COMPILE_FEATURES cxx_std_17
INTERFACE_COMPILE_FEATURES cxx_std_14
)
endif()
@@ -767,7 +772,7 @@ if(OpenVDB_pyopenvdb_LIBRARY)
IMPORTED_LOCATION "${OpenVDB_pyopenvdb_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${OpenVDB_pyopenvdb_INCLUDE_DIR};${PYTHON_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "OpenVDB::openvdb;Boost::${BOOST_PYTHON_LIB};${PYTHON_LIBRARIES}"
INTERFACE_COMPILE_FEATURES cxx_std_17
INTERFACE_COMPILE_FEATURES cxx_std_14
)
endif()
endif()
@@ -781,7 +786,7 @@ if(OpenVDB_openvdb_houdini_LIBRARY)
IMPORTED_LOCATION "${OpenVDB_openvdb_houdini_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${OpenVDB_openvdb_houdini_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "OpenVDB::openvdb;Houdini"
INTERFACE_COMPILE_FEATURES cxx_std_17
INTERFACE_COMPILE_FEATURES cxx_std_14
)
endif()
endif()
@@ -811,7 +816,7 @@ if(OpenVDB_openvdb_ax_LIBRARY)
INTERFACE_INCLUDE_DIRECTORIES "${OpenVDB_openvdb_ax_INCLUDE_DIR}"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${LLVM_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "OpenVDB::openvdb;${LLVM_LIBS}"
INTERFACE_COMPILE_FEATURES cxx_std_17
INTERFACE_COMPILE_FEATURES cxx_std_14
)
endif()
endif()
@@ -825,7 +830,7 @@ if(OpenVDB_nanovdb_LIBRARY)
IMPORTED_LOCATION "${OpenVDB_nanovdb_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${OpenVDB_nanovdb_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "OpenVDB::openvdb;"
INTERFACE_COMPILE_FEATURES cxx_std_17
INTERFACE_COMPILE_FEATURES cxx_std_14
)
endif()
endif()
+30 -67
View File
@@ -34,7 +34,7 @@ This will define the following variables:
``Tbb_FOUND``
True if the system has the Tbb library.
``Tbb_VERSION`` ``TBB_VERSION``
``Tbb_VERSION``
The version of the Tbb library which was found.
``Tbb_INCLUDE_DIRS``
Include directories needed to use Tbb.
@@ -93,7 +93,7 @@ may be provided to tell this module where to look.
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
include(GNUInstallDirs)
@@ -162,72 +162,51 @@ list(APPEND _TBB_INCLUDE_SEARCH_DIRS
${SYSTEM_LIBRARY_PATHS}
)
if(NOT Tbb_INCLUDE_DIR)
# Look for a legacy tbb header file.
find_path(Tbb_LEGACY_INCLUDE_DIR tbb/tbb_stddef.h
${_FIND_TBB_ADDITIONAL_OPTIONS}
PATHS ${_TBB_INCLUDE_SEARCH_DIRS}
PATH_SUFFIXES ${CMAKE_INSTALL_INCLUDEDIR} include
)
else()
set(Tbb_LEGACY_INCLUDE_DIR ${Tbb_INCLUDE_DIR})
endif()
# Look for a new tbb header installation
# From TBB 2021, tbb_stddef is removed and the directory include/tbb is
# simply an alias for include/oneapi/tbb. Try and find the version header
# in oneapi/tbb
find_path(Tbb_INCLUDE_DIR oneapi/tbb/version.h
# Look for a standard tbb header file.
find_path(Tbb_INCLUDE_DIR tbb/tbb_stddef.h
${_FIND_TBB_ADDITIONAL_OPTIONS}
PATHS ${_TBB_INCLUDE_SEARCH_DIRS}
PATH_SUFFIXES ${CMAKE_INSTALL_INCLUDEDIR} include
)
set(_tbb_legacy_version_file "${Tbb_LEGACY_INCLUDE_DIR}/tbb/tbb_stddef.h")
set(_tbb_version_file "${Tbb_INCLUDE_DIR}/oneapi/tbb/version.h")
set(_tbb_version_file "${Tbb_INCLUDE_DIR}/tbb/tbb_stddef.h")
if(EXISTS ${_tbb_legacy_version_file})
if(EXISTS ${_tbb_version_file})
message(WARNING "
FindTBB located both an old and new tbb installation.
old: ${_tbb_legacy_version_file}
new: ${_tbb_version_file}
The NEWER versioned installation will be used. You can set TBB_INCLUDEDIR
to control FindTBB.cmake search, or explicitly set Tbb_INCLUDE_DIR to the
desired location.
")
else()
set(_tbb_version_file "${_tbb_legacy_version_file}")
set(Tbb_INCLUDE_DIR ${Tbb_LEGACY_INCLUDE_DIR} CACHE STRING "" FORCE)
endif()
if(NOT EXISTS ${_tbb_version_file})
# From TBB 2021, tbb_stddef is removed and the directory include/tbb is
# simply an alias for include/oneapi/tbb. Try and find the version header
# in oneapi/tbb
find_path(Tbb_INCLUDE_DIR oneapi/tbb/version.h
${_FIND_TBB_ADDITIONAL_OPTIONS}
PATHS ${_TBB_INCLUDE_SEARCH_DIRS}
PATH_SUFFIXES ${CMAKE_INSTALL_INCLUDEDIR} include
)
set(_tbb_version_file "${Tbb_INCLUDE_DIR}/oneapi/tbb/version.h")
endif()
if(EXISTS ${_tbb_version_file})
file(STRINGS ${_tbb_version_file} _tbb_version_major_string REGEX "#define TBB_VERSION_MAJOR " )
string(REGEX REPLACE "#define TBB_VERSION_MAJOR" "" _tbb_version_major_string "${_tbb_version_major_string}")
file(STRINGS ${_tbb_version_file}
_tbb_version_major_string REGEX "#define TBB_VERSION_MAJOR "
)
string(REGEX REPLACE "#define TBB_VERSION_MAJOR" ""
_tbb_version_major_string "${_tbb_version_major_string}"
)
string(STRIP "${_tbb_version_major_string}" Tbb_VERSION_MAJOR)
file(STRINGS ${_tbb_version_file} _tbb_version_minor_string REGEX "#define TBB_VERSION_MINOR ")
string(REGEX REPLACE "#define TBB_VERSION_MINOR" "" _tbb_version_minor_string "${_tbb_version_minor_string}")
file(STRINGS ${_tbb_version_file}
_tbb_version_minor_string REGEX "#define TBB_VERSION_MINOR "
)
string(REGEX REPLACE "#define TBB_VERSION_MINOR" ""
_tbb_version_minor_string "${_tbb_version_minor_string}"
)
string(STRIP "${_tbb_version_minor_string}" Tbb_VERSION_MINOR)
file(STRINGS ${_tbb_version_file} _tbb_binary_version_string REGEX "#define __TBB_BINARY_VERSION ")
string(REGEX REPLACE "#define __TBB_BINARY_VERSION" "" _tbb_binary_version_string "${_tbb_binary_version_string}")
string(STRIP "${_tbb_binary_version_string}" Tbb_BINARY_VERSION)
unset(_tbb_version_major_string)
unset(_tbb_version_minor_string)
unset(_tbb_binary_version_string)
# Set both for compatibility reasons, TBB's CONFIG files only set the latter
set(Tbb_VERSION ${Tbb_VERSION_MAJOR}.${Tbb_VERSION_MINOR})
set(TBB_VERSION ${Tbb_VERSION})
endif()
unset(_tbb_version_file)
unset(_tbb_legacy_version_file)
unset(Tbb_LEGACY_INCLUDE_DIR)
# ------------------------------------------------------------------------
# Search for TBB lib DIR
@@ -276,22 +255,8 @@ foreach(COMPONENT ${TBB_FIND_COMPONENTS})
find_library(Tbb_${COMPONENT}_LIBRARY_${BUILD_TYPE} ${_TBB_LIB_NAME}
${_FIND_TBB_ADDITIONAL_OPTIONS}
PATHS ${_TBB_LIBRARYDIR_SEARCH_DIRS}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} lib64 lib)
# If we didn't find the library, prepend Tbb_BINARY_VERSION to each possible
# component name and try again. As of TBB 2021, TBB decides to version some
# of its libraries on some of its platforms...
if(NOT Tbb_${COMPONENT}_LIBRARY_${BUILD_TYPE} AND Tbb_BINARY_VERSION)
set(_TBB_LIB_NAME "${COMPONENT}${Tbb_BINARY_VERSION}")
if(BUILD_TYPE STREQUAL DEBUG)
set(_TBB_LIB_NAME "${_TBB_LIB_NAME}${TBB_DEBUG_SUFFIX}")
endif()
find_library(Tbb_${COMPONENT}_LIBRARY_${BUILD_TYPE} ${_TBB_LIB_NAME}
${_FIND_TBB_ADDITIONAL_OPTIONS}
PATHS ${_TBB_LIBRARYDIR_SEARCH_DIRS}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} lib64 lib)
endif()
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} lib64 lib
)
# On Unix, TBB sometimes uses linker scripts instead of symlinks, so parse the linker script
# and correct the library name if so
@@ -461,9 +426,7 @@ foreach(COMPONENT ${TBB_FIND_COMPONENTS})
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(TBB::${COMPONENT} PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${Tbb_${COMPONENT}_LIBRARY_RELEASE}"
MAP_IMPORTED_CONFIG_MINSIZEREL Release
MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release)
IMPORTED_LOCATION_RELEASE "${Tbb_${COMPONENT}_LIBRARY_RELEASE}")
endif()
# Debug location
+1 -8
View File
@@ -47,7 +47,7 @@ The following variables may be provided to tell this module where to look.
# Find the glfw3 installation and use glfw's CMake to initialize
# the glfw lib
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
set(_FIND_GLFW3_ADDITIONAL_OPTIONS "")
if(DISABLE_CMAKE_SEARCH_PATHS)
@@ -121,13 +121,6 @@ if(${CMAKE_VERSION} VERSION_LESS 3.19)
)
endif()
if(OPENVDB_FUTURE_DEPRECATION AND FUTURE_MINIMUM_GLFW_VERSION)
if(glfw3_VERSION VERSION_LESS ${FUTURE_MINIMUM_GLFW_VERSION})
message(DEPRECATION "Support for GLFW versions < ${FUTURE_MINIMUM_GLFW_VERSION} "
"is deprecated and will be removed.")
endif()
endif()
unset(glfw3_FIND_VERSION)
# GLFW 3.1 does not export INTERFACE_LINK_LIBRARIES so detect this
+92 -78
View File
@@ -49,6 +49,8 @@ overwrite user provided values.
``ZLIB_LIBRARY``
``OPENEXR_INCLUDEDIR``
``OPENEXR_LIBRARYDIR``
``ILMBASE_INCLUDEDIR``
``ILMBASE_LIBRARYDIR``
``TBB_INCLUDEDIR``
``TBB_LIBRARYDIR``
``BLOSC_INCLUDEDIR``
@@ -73,7 +75,7 @@ may be provided to tell this module where to look.
# Find the Houdini installation and use Houdini's CMake to initialize
# the Houdini lib
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
# Include utility functions for version information
include(${CMAKE_CURRENT_LIST_DIR}/OpenVDBUtils.cmake)
@@ -288,11 +290,7 @@ endif()
# Jemalloc
# * On Mac OSX, linking against Jemalloc < 4.3.0 seg-faults with this error:
# malloc: *** malloc_zone_unregister() failed for 0xaddress
# As of Houdini 20, it still ships with Jemalloc 3.6.0, so don't expose it
# on Mac OSX (https://github.com/jemalloc/jemalloc/issues/420).
if(NOT APPLE AND NOT JEMALLOC_LIBRARYDIR)
if(NOT JEMALLOC_LIBRARYDIR)
set(JEMALLOC_LIBRARYDIR ${HOUDINI_LIB_DIR})
endif()
@@ -305,10 +303,21 @@ if(NOT OPENEXR_LIBRARYDIR)
set(OPENEXR_LIBRARYDIR ${HOUDINI_LIB_DIR})
endif()
# IlmBase
if(NOT ILMBASE_INCLUDEDIR)
set(ILMBASE_INCLUDEDIR ${HOUDINI_INCLUDE_DIR})
endif()
if(NOT ILMBASE_LIBRARYDIR)
set(ILMBASE_LIBRARYDIR ${HOUDINI_LIB_DIR})
endif()
# Boost - currently must be provided as VDB is not fully configured to
# use Houdini's namespaced hboost
# Versions of Houdini >= 17.5 have some namespaced libraries (IlmBase/OpenEXR).
# Add the required suffix as part of the cmake lib suffix searches
if(APPLE)
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_sidefx.dylib")
elseif(UNIX)
@@ -324,82 +333,87 @@ endif()
# Explicitly configure the OpenVDB ABI version depending on the Houdini
# version.
find_file(_houdini_openvdb_version_file "openvdb/version.h"
PATHS ${HOUDINI_INCLUDE_DIR}
NO_DEFAULT_PATH)
if(_houdini_openvdb_version_file)
OPENVDB_VERSION_FROM_HEADER("${_houdini_openvdb_version_file}"
ABI OPENVDB_HOUDINI_ABI)
endif()
unset(_houdini_openvdb_version_file)
if(NOT OPENVDB_HOUDINI_ABI)
message(WARNING "Unknown version of Houdini, assuming OpenVDB ABI=${OpenVDB_MAJOR_VERSION}, "
"but if this not correct, the CMake flag -DOPENVDB_HOUDINI_ABI=<N> can override this value.")
set(OPENVDB_HOUDINI_ABI ${OpenVDB_MAJOR_VERSION})
endif()
# ------------------------------------------------------------------------
# Configure libstc++ CXX11 ABI
# ------------------------------------------------------------------------
if(UNIX AND NOT APPLE)
# Assume we're using libstdc++
message(STATUS "Configuring CXX11 ABI for Houdini compatibility...")
execute_process(COMMAND echo "#include <string>"
COMMAND ${CMAKE_CXX_COMPILER} "-x" "c++" "-E" "-dM" "-"
COMMAND grep "-F" "_GLIBCXX_USE_CXX11_ABI"
TIMEOUT 10
RESULT_VARIABLE QUERIED_GCC_CXX11_ABI_SUCCESS
OUTPUT_VARIABLE _GCC_CXX11_ABI)
set(GLIBCXX_USE_CXX11_ABI "UNKNOWN")
if(NOT QUERIED_GCC_CXX11_ABI_SUCCESS)
string(FIND ${_GCC_CXX11_ABI} "_GLIBCXX_USE_CXX11_ABI 0" GCC_OLD_CXX11_ABI)
string(FIND ${_GCC_CXX11_ABI} "_GLIBCXX_USE_CXX11_ABI 1" GCC_NEW_CXX11_ABI)
if(NOT (${GCC_OLD_CXX11_ABI} EQUAL -1))
set(GLIBCXX_USE_CXX11_ABI 0)
endif()
if(NOT (${GCC_NEW_CXX11_ABI} EQUAL -1))
set(GLIBCXX_USE_CXX11_ABI 1)
endif()
if(Houdini_VERSION_MAJOR_MINOR VERSION_EQUAL 18.5)
set(OPENVDB_HOUDINI_ABI 7)
else()
find_file(_houdini_openvdb_version_file "openvdb/version.h"
PATHS ${HOUDINI_INCLUDE_DIR}
NO_DEFAULT_PATH)
if(_houdini_openvdb_version_file)
OPENVDB_VERSION_FROM_HEADER("${_houdini_openvdb_version_file}"
ABI OPENVDB_HOUDINI_ABI)
endif()
unset(_houdini_openvdb_version_file)
if(NOT OPENVDB_HOUDINI_ABI)
message(WARNING "Unknown version of Houdini, assuming OpenVDB ABI=${OpenVDB_MAJOR_VERSION}, "
"but if this not correct, the CMake flag -DOPENVDB_HOUDINI_ABI=<N> can override this value.")
set(OPENVDB_HOUDINI_ABI ${OpenVDB_MAJOR_VERSION})
endif()
endif()
# Try and query the Houdini CXX11 ABI. Allow it to be provided by users to
# override this logic should Houdini's CMake ever change
# ------------------------------------------------------------------------
# Configure GCC CXX11 ABI
# ------------------------------------------------------------------------
if(NOT DEFINED HOUDINI_CXX11_ABI)
get_target_property(houdini_interface_compile_options
Houdini INTERFACE_COMPILE_OPTIONS)
set(HOUDINI_CXX11_ABI "UNKNOWN")
if("-D_GLIBCXX_USE_CXX11_ABI=0" IN_LIST houdini_interface_compile_options)
set(HOUDINI_CXX11_ABI 0)
elseif("-D_GLIBCXX_USE_CXX11_ABI=1" IN_LIST houdini_interface_compile_options)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if((CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 5.1) OR
(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.1))
message(STATUS "GCC >= 5.1 detected. Configuring GCC CXX11 ABI for Houdini compatibility...")
execute_process(COMMAND echo "#include <string>"
COMMAND ${CMAKE_CXX_COMPILER} "-x" "c++" "-E" "-dM" "-"
COMMAND grep "-F" "_GLIBCXX_USE_CXX11_ABI"
TIMEOUT 10
RESULT_VARIABLE QUERIED_GCC_CXX11_ABI_SUCCESS
OUTPUT_VARIABLE _GCC_CXX11_ABI)
set(GLIBCXX_USE_CXX11_ABI "UNKNOWN")
if(NOT QUERIED_GCC_CXX11_ABI_SUCCESS)
string(FIND ${_GCC_CXX11_ABI} "_GLIBCXX_USE_CXX11_ABI 0" GCC_OLD_CXX11_ABI)
string(FIND ${_GCC_CXX11_ABI} "_GLIBCXX_USE_CXX11_ABI 1" GCC_NEW_CXX11_ABI)
if(NOT (${GCC_OLD_CXX11_ABI} EQUAL -1))
set(GLIBCXX_USE_CXX11_ABI 0)
endif()
if(NOT (${GCC_NEW_CXX11_ABI} EQUAL -1))
set(GLIBCXX_USE_CXX11_ABI 1)
endif()
endif()
# Try and query the Houdini CXX11 ABI. Allow it to be provided by users to
# override this logic should Houdini's CMake ever change
if(NOT DEFINED HOUDINI_CXX11_ABI)
get_target_property(houdini_interface_compile_options
Houdini INTERFACE_COMPILE_OPTIONS)
set(HOUDINI_CXX11_ABI "UNKNOWN")
if("-D_GLIBCXX_USE_CXX11_ABI=0" IN_LIST houdini_interface_compile_options)
set(HOUDINI_CXX11_ABI 0)
elseif("-D_GLIBCXX_USE_CXX11_ABI=1" IN_LIST houdini_interface_compile_options)
set(HOUDINI_CXX11_ABI 1)
endif()
endif()
message(STATUS " GCC CXX11 ABI : ${GLIBCXX_USE_CXX11_ABI}")
message(STATUS " Houdini CXX11 ABI : ${HOUDINI_CXX11_ABI}")
if(${HOUDINI_CXX11_ABI} STREQUAL "UNKNOWN")
message(WARNING "Unable to determine Houdini CXX11 ABI. Assuming newer ABI "
"has been used.")
set(HOUDINI_CXX11_ABI 1)
endif()
if(${GLIBCXX_USE_CXX11_ABI} EQUAL ${HOUDINI_CXX11_ABI})
message(STATUS " Current CXX11 ABI matches Houdini configuration "
"(_GLIBCXX_USE_CXX11_ABI=${HOUDINI_CXX11_ABI}).")
else()
message(WARNING "A potential mismatch was detected between the CXX11 ABI "
"of GCC and Houdini. The following ABI configuration will be used: "
"-D_GLIBCXX_USE_CXX11_ABI=${HOUDINI_CXX11_ABI}. See: "
"https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html and "
"https://vfxplatform.com/#footnote-gcc6 for more information.")
endif()
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=${HOUDINI_CXX11_ABI})
endif()
message(STATUS " GNU CXX11 ABI : ${GLIBCXX_USE_CXX11_ABI}")
message(STATUS " Houdini CXX11 ABI : ${HOUDINI_CXX11_ABI}")
if(${HOUDINI_CXX11_ABI} STREQUAL "UNKNOWN")
message(WARNING "Unable to determine Houdini CXX11 ABI. Assuming newer ABI "
"has been used.")
set(HOUDINI_CXX11_ABI 1)
endif()
if(${GLIBCXX_USE_CXX11_ABI} EQUAL ${HOUDINI_CXX11_ABI})
message(STATUS " Current CXX11 ABI matches Houdini configuration "
"(_GLIBCXX_USE_CXX11_ABI=${HOUDINI_CXX11_ABI}).")
else()
message(WARNING "A potential mismatch was detected between the CXX11 ABI "
"of libstdc++ and Houdini. The following ABI configuration will be used: "
"-D_GLIBCXX_USE_CXX11_ABI=${HOUDINI_CXX11_ABI}. See: "
"https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html and "
"https://vfxplatform.com/#footnote-gcc6 for more information.")
endif()
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=${HOUDINI_CXX11_ABI})
endif()
+1 -1
View File
@@ -51,7 +51,7 @@ variables may be provided to tell this module where to look.
# Find the Maya installation and use Maya's CMake to initialize
# the Maya lib
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
set(_FIND_MAYA_ADDITIONAL_OPTIONS "")
+1 -1
View File
@@ -57,7 +57,7 @@ The following functions are provided:
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
function(OPENVDB_GET_VERSION_DEFINE HEADER KEY VALUE)
+1 -1
View File
@@ -16,7 +16,7 @@ existing from a previous run of cmake.
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
set(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt")
+4 -98
View File
@@ -7,7 +7,7 @@
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
###############################################################################
@@ -129,10 +129,6 @@ endif()
# Increase the number of sections that an object file can contain
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/bigobj>")
# Enable MSVC options that make it behave like other compilers
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/permissive->")
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/Zc:throwingNew>")
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/Zc:inline>")
# Excludes APIs such as Cryptography, DDE, RPC, Shell, and Windows Sockets
add_compile_definitions("$<$<CXX_COMPILER_ID:MSVC>:WIN32_LEAN_AND_MEAN>")
# Disable non-secure CRT library function warnings
@@ -143,32 +139,9 @@ add_compile_definitions("$<$<CXX_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS>")
# https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/
# compiler-warning-level-3-c4996?view=vs-2019#posix-function-names
add_compile_definitions("$<$<CXX_COMPILER_ID:MSVC>:_CRT_NONSTDC_NO_WARNINGS>")
# If a user has explicitly requested a parallel build, configure this during CMake
if(MSVC_MP_THREAD_COUNT AND MSVC_MP_THREAD_COUNT GREATER 1)
# If a user has explicitly requested a parallel build, configure this during CMake
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/MP${MSVC_MP_THREAD_COUNT}>")
# If building with multiple threads with MSVC, delay generation of PDB files
# until the end of compilation to speed up their generation (invoke mspdbsrv once).
# This assumes /Zi is being used to generate PDBs (CMakes default)
add_compile_options("$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANG_AND_ID:CXX,MSVC>>:/Zf>")
endif()
if(MSVC_COMPRESS_PDB)
# /Zi enables PDBs - CMake seems to default to creating PDBs as the defacto way
# of handling debug symbols. As these PDBs can be very large, we attempt to compress
# them here with various settings. This disable incremental linking and can make
# stack traces more confusing.
# https://devblogs.microsoft.com/cppblog/shrink-my-program-database-pdb-file/
# First, generate comdats to allow the linker to remove unused data
add_compile_options("$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANG_AND_ID:CXX,MSVC>>:/Gy>")
# Remove unreferenced packaged functions and data from comdats
add_link_options("$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANG_AND_ID:CXX,MSVC>>:/OPT:REF>")
# Fold duplicate comdat data (1 iteration)
add_link_options("$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANG_AND_ID:CXX,MSVC>>:/OPT:ICF>")
# Generally compress the generated pdbs as they are being created
add_link_options("$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANG_AND_ID:CXX,MSVC>>:/PDBCOMPRESS>")
endif()
if(OPENVDB_CXX_STRICT)
@@ -178,14 +151,6 @@ if(OPENVDB_CXX_STRICT)
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wall>")
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wextra>")
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wconversion>")
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wnon-virtual-dtor>")
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wover-aligned>")
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wimplicit-fallthrough>")
add_compile_options("$<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,9.3.0>>:-Wimplicit-fallthrough>")
# Only check global constructors for libraries (we should really check for
# executables too but gtest relies on these types of constructors for its
# framework).
add_compile_options("$<$<AND:$<NOT:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>>,$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>>:-Wglobal-constructors>")
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wno-sign-conversion>")
# GNU
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Werror>")
@@ -197,7 +162,6 @@ if(OPENVDB_CXX_STRICT)
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wconversion>")
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wdisabled-optimization>")
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Woverloaded-virtual>")
add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wnon-virtual-dtor>")
else()
# NO OPENVDB_CXX_STRICT, suppress some warnings
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
@@ -245,7 +209,7 @@ if(CMAKE_BUILD_TYPE EQUAL coverage)
endif()
# Note that the thread, address and memory sanitizers are incompatible with each other
set(EXTRA_BUILD_TYPES coverage tsan asan lsan msan ubsan abicheck)
set(EXTRA_BUILD_TYPES coverage tsan asan lsan msan ubsan)
# Set all build flags to empty (unless they have been provided)
@@ -262,18 +226,7 @@ endforeach()
# clang and GCC. Sanitizers are currently only configured for clang and GCC.
# Coverage
# --coverage uses -fprofile-arcs -ftest-coverage (compiling) and -lgcov (linking)
# @note consider -fprofile-abs-path from gcc 10
# @todo consider using clang with source analysis: -fprofile-instr-generate -fcoverage-mapping.
# https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
# note that clang also works with gcov (--coverage)
# @note Ideally we'd use no optimisations (-O0) with --coverage, but a complete
# run of all unit tests takes upwards of a day without them. Thread usage also
# impacts total runtime. -Og implies -O1 but without optimisations "that would
# otherwise interfere with debugging". This still massively effects branch
# coverage tracking compared to -O0 so we should look to improve the speed of
# some of the unit tests and also experiment with clang.
add_compile_options("$<$<AND:$<CONFIG:COVERAGE>,$<COMPILE_LANG_AND_ID:CXX,GNU,Clang,AppleClang>>:--coverage;-Og>")
add_compile_options("$<$<AND:$<CONFIG:COVERAGE>,$<COMPILE_LANG_AND_ID:CXX,GNU,Clang,AppleClang>>:--coverage>")
add_link_options("$<$<AND:$<CONFIG:COVERAGE>,$<COMPILE_LANG_AND_ID:CXX,GNU,Clang,AppleClang>>:--coverage>")
# ThreadSanitizer
@@ -304,57 +257,10 @@ add_link_options("$<$<AND:$<CONFIG:MSAN>,$<COMPILE_LANG_AND_ID:CXX,Clang,AppleCl
add_compile_options("$<$<AND:$<CONFIG:UBSAN>,$<COMPILE_LANG_AND_ID:CXX,GNU,Clang,AppleClang>>:-fsanitize=undefined>")
add_link_options("$<$<AND:$<CONFIG:UBSAN>,$<COMPILE_LANG_AND_ID:CXX,GNU,Clang,AppleClang>>:-fsanitize=undefined>")
# ABI Check. This build type is expected to work with the abi-dumper/abi-compliance-checker
# binaries which expect specific debug information. In particular, for GCC versions >= 11
# we have to explicitly select dwarf versions < 5 as the abi-dumper doesn't support dwarf5
# and will always incorrectly report successful ABI checks
# https://github.com/lvc/abi-dumper/issues/33
add_compile_options("$<$<CONFIG:ABICHECK>:-gdwarf-4;-g3;-ggdb;-Og>")
# CMAKE_BUILD_TYPE is ignored for multi config generators i.e. MSVS
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT _isMultiConfig)
message(STATUS "CMake Build Type: ${CMAKE_BUILD_TYPE}")
endif()
if(OPENVDB_ENABLE_ASSERTS)
message(STATUS "OpenVDB asserts are ENABLED")
endif()
# Intialize extra build type targets where possible
if(NOT TARGET gcov_html)
find_program(GCOVR_PATH gcovr)
if(NOT GCOVR_PATH AND CMAKE_BUILD_TYPE STREQUAL "coverage")
message(WARNING "Unable to initialize gcovr target. coverage build types will still generate gcno files.")
elseif(GCOVR_PATH)
# init gcov commands
set(GCOVR_HTML_FOLDER_CMD ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/gcov_html)
set(GCOVR_HTML_CMD
${GCOVR_PATH} --html --html-details -r ${PROJECT_SOURCE_DIR} --object-directory=${PROJECT_BINARY_DIR}
-o gcov_html/index.html
)
# Add a custom target which converts .gcda files to a html report using gcovr.
# Note that this target does NOT run ctest or any binaries - that is left to
# the implementor of the gcov workflow. Typically, the order of operations
# would be:
# - run CMake with unit tests on
# - ctest
# - make gcov_html
add_custom_target(gcov_html
COMMAND ${GCOVR_HTML_FOLDER_CMD}
COMMAND ${GCOVR_HTML_CMD}
BYPRODUCTS ${PROJECT_BINARY_DIR}/gcov_html/index.html # report directory
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
VERBATIM
COMMENT "Running gcovr to produce HTML code coverage report."
)
# Show info where to find the report
add_custom_command(TARGET gcov_html POST_BUILD
COMMAND ;
COMMENT "Open ./gcov_html/index.html in your browser to view the coverage report."
)
endif()
endif()
+35 -51
View File
@@ -8,78 +8,62 @@
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
###############################################################################
# Configure minimum version requirements - some are treated specially and fall
# outside of the DISABLE_DEPENDENCY_VERSION_CHECKS catch
set(MINIMUM_CXX_STANDARD 17)
set(MINIMUM_CXX_STANDARD 14)
# @note ABI always enforced so the correct deprecation messages are available.
# OPENVDB_USE_DEPRECATED_ABI_<VERSION> should be used to circumvent this
math(EXPR MINIMUM_OPENVDB_ABI_VERSION "${OpenVDB_MAJOR_VERSION}-2")
math(EXPR FUTURE_OPENVDB_ABI_VERSION "${OpenVDB_MAJOR_VERSION}+1")
# List of deprecated but supported OpenVDB ABIs for this version of OpenVDB
math(EXPR _PREV_ABI "${OpenVDB_MAJOR_VERSION}-1")
set(OPENVDB_DEPRECATED_ABI_LIST ${MINIMUM_OPENVDB_ABI_VERSION} ${_PREV_ABI})
unset(_PREV_ABI)
set(MINIMUM_OPENVDB_ABI_VERSION 7)
set(FUTURE_MINIMUM_OPENVDB_ABI_VERSION 9)
set(FUTURE_OPENVDB_ABI_VERSION 10)
if(NOT DISABLE_DEPENDENCY_VERSION_CHECKS)
# @note Currently tracking CY2022 of the VFX platform where available
# @note Currently tracking CY2020 of the VFX platform where available
set(MINIMUM_GCC_VERSION 6.3.1)
set(MINIMUM_CLANG_VERSION 3.8)
set(MINIMUM_ICC_VERSION 17)
set(MINIMUM_MSVC_VERSION 19.10)
# @Note Compiler versions are not really a hard and fast rule, you just need
# a compiler with complete support for our MINIMUM_CXX_STANDARD (currently 17).
# What's usually important is that the version of libstdc++ and glibc in use
# matches. Compilers other than GCC should provide options to ensure this
# targetting e.g. --gcc-toolchain and -fgnuc-version with Clang.
set(MINIMUM_GCC_VERSION 9.3.1)
set(MINIMUM_CLANG_VERSION 5.0)
set(MINIMUM_ICC_VERSION 19)
set(MINIMUM_MSVC_VERSION 19.28) # 1928 (Visual Studio 2019 Version 16.8 + 16.9)
# Should be 1.76 for VFX 22, but only version in apt is 1.73
set(MINIMUM_BOOST_VERSION 1.73)
set(MINIMUM_PYBIND_VERSION 2.9.1)
set(MINIMUM_IMATH_VERSION 3.1)
set(MINIMUM_OPENEXR_VERSION 3.1)
set(MINIMUM_BOOST_VERSION 1.70)
set(MINIMUM_ILMBASE_VERSION 2.4)
set(MINIMUM_OPENEXR_VERSION 2.4)
set(MINIMUM_ZLIB_VERSION 1.2.7)
set(MINIMUM_TBB_VERSION 2020.3)
set(MINIMUM_LLVM_VERSION 10.0.0)
set(MINIMUM_BLOSC_VERSION 1.17.0)
set(MINIMUM_GLFW_VERSION 3.1)
set(MINIMUM_TBB_VERSION 2019.0)
set(MINIMUM_LLVM_VERSION 7.0.0)
set(MINIMUM_BLOSC_VERSION 1.5.0)
set(MINIMUM_PYTHON_VERSION 3.9.1)
set(MINIMUM_NUMPY_VERSION 1.20.0)
set(MINIMUM_PYTHON_VERSION 2.7) # @warning should be 3.7.x, but H18.5+ can still be used with 2.7.x
set(MINIMUM_NUMPY_VERSION 1.17.0)
set(MINIMUM_GOOGLETEST_VERSION 1.10)
set(MINIMUM_GLFW_VERSION 3.1)
set(MINIMUM_LOG4CPLUS_VERSION 1.1.2)
set(MINIMUM_HOUDINI_VERSION 19.5)
set(MINIMUM_HOUDINI_VERSION 18.5)
# These always promote warnings rather than errors
set(MINIMUM_MAYA_VERSION 2017)
set(MINIMUM_DOXYGEN_VERSION 1.8.8)
endif()
# VFX 23 deprecations to transition to MINIMUM_* variables in OpenVDB 12.0.0
# @note At the time of writing, any variables that are commented out don't
# have target transitional versions.
# VFX 21 deprecations to transition to MINIMUM_* variables in OpenVDB 10.0.0
set(FUTURE_MINIMUM_GCC_VERSION 11.2.1)
set(FUTURE_MINIMUM_MSVC_VERSION 19.30) # 1930 (Visual Studio 2022)
# set(FUTURE_MINIMUM_ICC_VERSION 19)
set(FUTURE_MINIMUM_GCC_VERSION 9.3.1)
set(FUTURE_MINIMUM_ICC_VERSION 19)
# set(FUTURE_MINIMUM_MSVC_VERSION 19.10)
# set(FUTURE_MINIMUM_CXX_STANDARD 20)
set(FUTURE_MINIMUM_CMAKE_VERSION 3.20)
# set(FUTURE_MINIMUM_OPENEXR_VERSION 3.1)
set(FUTURE_MINIMUM_BOOST_VERSION 1.80)
set(FUTURE_MINIMUM_GLFW_VERSION 3.3)
set(FUTURE_MINIMUM_LOG4CPLUS_VERSION 2.0)
# set(FUTURE_MINIMUM_BLOSC_VERSION 1.17.0)
# set(FUTURE_MINIMUM_TBB_VERSION 2020.3)
set(FUTURE_MINIMUM_PYTHON_VERSION 3.10)
set(FUTURE_MINIMUM_NUMPY_VERSION 1.23.0)
# set(FUTURE_MINIMUM_HOUDINI_VERSION 20.0)
set(FUTURE_MINIMUM_LLVM_VERSION 13.0.0)
set(FUTURE_MINIMUM_CXX_STANDARD 17)
set(FUTURE_MINIMUM_CMAKE_VERSION 3.18)
#set(FUTURE_MINIMUM_ILMBASE_VERSION 2.4) # Minimum is already 2.4
#set(FUTURE_MINIMUM_OPENEXR_VERSION 2.4) # Minimum is already 2.4
set(FUTURE_MINIMUM_BOOST_VERSION 1.73)
set(FUTURE_MINIMUM_BLOSC_VERSION 1.17.0)
set(FUTURE_MINIMUM_TBB_VERSION 2020.2)
set(FUTURE_MINIMUM_PYTHON_VERSION 3.7)
set(FUTURE_MINIMUM_NUMPY_VERSION 1.19.0)
set(FUTURE_MINIMUM_HOUDINI_VERSION 19.0)
set(FUTURE_MINIMUM_LLVM_VERSION 10.0.0)
-15
View File
@@ -1,15 +0,0 @@
#################################################################################
## This file is loaded by the Leak/Address Sanitizer build for the unit tests. ##
## It can be used to ignore various errors reported by the sanitizer. This is ##
## especially useful with upstream issues (e.g. boost/tbb). For help defining ##
## suppression rules, see: ##
## https://clang.llvm.org/docs/AddressSanitizer.html ##
## The build is configured with CMAKE_BUILD_TYPE=asan or lsan ##
#################################################################################
##### Upstream #####
# Leaks from TBB init which occur due to tbb teardown issues
# https://github.com/oneapi-src/oneTBB/issues/206
# Should be fixed in oneTBB. Ignore them for now
leak:tbb::internal::task_stream<3>::initialize*
+3
View File
@@ -16,6 +16,9 @@ vptr:tbb/task.h
##### OpenVDB #####
# The sOn/sOff static bool data held on the LeaffBuff<bool> objects can be
# initialised to arbitrary true/false values. See the note in LeafBuffer.h
enum:openvdb/tools/Activate.h
# Some 2s complement tests, ignore the negative shifts
# @todo Should address these
shift-base:TestMultiResGrid.cc
+5 -2
View File
@@ -7,7 +7,7 @@
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
project(OpenVDBDocs LANGUAGES NONE)
include(GNUInstallDirs)
@@ -41,7 +41,6 @@ set(DOXY_FILES
openvdb/openvdb/io
openvdb/openvdb/math
openvdb/openvdb/points
openvdb/openvdb/points/impl
openvdb/openvdb/python/pyopenvdb.h
openvdb/openvdb/tools
openvdb/openvdb/tree
@@ -216,6 +215,7 @@ if(OPENVDB_DOXYGEN_AX)
doc/ax/doc.txt
openvdb_ax/openvdb_ax
openvdb_ax/openvdb_ax/ast
openvdb_ax/openvdb_ax/cmd
openvdb_ax/openvdb_ax/codegen
openvdb_ax/openvdb_ax/compiler
openvdb_ax/openvdb_ax/grammar
@@ -235,6 +235,9 @@ if(OPENVDB_DOXYGEN_NANOVDB)
doc/nanovdb/HelloWorld.md
nanovdb/nanovdb
nanovdb/nanovdb/util
nanovdb/nanovdb/cmd/convert
nanovdb/nanovdb/cmd/print
nanovdb/nanovdb/cmd/validate
nanovdb/nanovdb/examples/benchmark
nanovdb/nanovdb/examples/ex_bump_pool_buffer
nanovdb/nanovdb/examples/ex_collide_level_set
+5 -9
View File
@@ -1165,11 +1165,10 @@ operations (if an operation is not listed, it is not supported):
<tr style="text-align:center">
<th>Left Operand Type</th><th>Binary Op(s)</th><th>Right Operand Type</th><th>Description</th>
</tr>
<tr style="text-align:center"><td rowspan="3">@ref axscalars "scalar"</td><td rowspan="1">`== != < > <= >=`</td><td>@ref axscalars "scalar"</td>
<tr style="text-align:center"><td rowspan="3">@ref axscalars "scalar"</td><td rowspan="3">`== != < > <= >=`</td><td>@ref axscalars "scalar"</td>
<td style="text-align:left">Returns the result of the scalar comparison.</td>
</tr>
<tr style="text-align:center">
<td rowspan="2">`== !=`</td>
<td>@ref axvecmats "vector"</td>
<td style="text-align:left" rowspan="2">
Performs per component comparisons (after
@@ -1196,12 +1195,11 @@ for (int i = 1; i < 3; ++i) c &= a[i] == b;
</tr>
<tr style="text-align:center">
<td style="border-top-width: thick" rowspan="2">@ref axvecmats "vector"</td>
<td style="border-top-width: thick; text-align:center" rowspan="1">`== != < > <= >=`</td>
<td style="border-top-width: thick; text-align:center" rowspan="2">`== != < > <= >=`</td>
<td style="border-top-width: thick">@ref axscalars "scalar"</td>
<td style="border-top-width: thick;text-align:left">Same as `scalar op vector`</td>
</tr>
<tr style="text-align:center">
<td rowspan="1">`== !=`</td>
<td>@ref axvecmats "vector"</td>
<td style="text-align:left">
Performs binary comparison operations (after
@@ -1222,13 +1220,11 @@ for (int i = 1; i < 3; ++i) c &= a[i] == b[i];
</tr>
<tr style="text-align:center">
<td style="border-top-width: thick" rowspan="2">@ref axvecmats "matrix"</td>
<td style="border-top-width: thick; text-align:center" rowspan="1">`== != < > <= >=`</td>
<td style="border-top-width: thick; text-align:center" rowspan="2">`== != < > <= >=`</td>
<td style="border-top-width: thick">@ref axscalars "scalar"</td>
<td style="border-top-width: thick;text-align:left">Same as `scalar op matrix`</td>
</tr>
<tr style="text-align:center">
<td rowspan="1">`== !=`</td>
<td>@ref axvecmats "matrix"</td>
<tr style="text-align:center"><td>@ref axvecmats "matrix"</td>
<td style="text-align:left">
Performs binary comparison operations (after
@ref axtypeprecedence "implicit conversion") on each pair corresponding
@@ -1797,7 +1793,7 @@ returned, otherwise @b `c` is evaluated and returned. In this case, @b `a` and @
@anchor axvecmatinit
@par Vector/Matrix Initializer
@ref axvecmats "Vectors and matrices" can be represented as local variables (e.g.
@b `vec3f`), external attributes or parameters (e.g. @b `vec3f\@attrib`) or as
@b `vec3f`), external attributes or parameters (e.g. @b `vec3f@attrib`) or as
temporary values using the vector/matrix initializer syntax. This operator has
the form:
@par
+3 -3
View File
@@ -32,7 +32,7 @@ These examples demonstrate how to use AX on OpenVDB points grids.
Below is a small example which demonstrates working with a few point attributes.
The @ symbol is the identifier for an AX attribute. The type of each attribute
is specified before the @ symbol and the name is specified afterwards. For
example: @b `int\@count` would imply an @b integer attribute called @b count.
example: @b `int@count` would imply an @b integer attribute called @b count.
@par
In this example there are three point attributes: a @b float attribute @b speed,
a @b vec3f float attribute @b velocity and a @b vec3f float attribute @b colour.
@@ -114,7 +114,7 @@ v@P += v@v * dt;
@endcode
@par
The final AX command, `v@P += v@v * dt;` writes to the position attribute of
the points @b `v\@P`. Whenever position is written to in this way, the AX
the points @b `v@P`. Whenever position is written to in this way, the AX
`PointExecutable` will move (re-bucket) points in PointDataGrids.
@subsection axexamplepointcurlnoise Curl Noise
@@ -234,7 +234,7 @@ vec3f@vel += dt * massInverse * vec3f@force;
@par
Here we demonstrate how AX can be used to blend two volumes together. Note that
only the volumes which are written to are executed over. In the below code,
only @b `\@surface_a` is written to. This means that the final blended result,
only @b `@surface_a` is written to. This means that the final blended result,
stored in `surface_a`, will only be updated in `surface_a`'s topology. Should
we want a combined blend of @b non @b overlapping areas of both surface a and b,
we would need to activate a's topology with respect to b first.
+17 -24
View File
@@ -87,7 +87,7 @@ given FindModule e.g. `FindBlosc.cmake`:
- @b Xxx_ROOT - Preferred installation prefix. The given dependency is
expected to follow a folder structure `Xxx_ROOT/include` and `Xxx_ROOT/lib`
exist. Note that unlike the above, this is the case matching name of the
find package .i.e. Blosc_ROOT, TBB_ROOT etc.
find package .i.e. Blosc_ROOT, IlmBase_ROOT, TBB_ROOT etc.
- @b XXX_INCLUDEDIR / @b XXX_LIBRARYDIR - Preferred include and library
directories
- @b SYSTEM_LIBRARY_PATHS - A list of paths appended to all include and lib
@@ -238,8 +238,10 @@ it's a good idea to read the above section on
DCC | Supported Version | OpenVDB ABI |
-------- | ----------------- | ----------- |
Houdini | 19.5 | 9 |
Houdini | 20.0 | 10 |
Houdini | 18.0 | 6 |
Houdini | 18.5 | 7 |
Houdini | 19.0 | 8 |
Maya | 2017 | Any |
Maya | 2018 | Any |
Maya | 2019 | Any |
@@ -256,18 +258,17 @@ OpenVDB components you wish to build.
Package | Description | OpenVDB Components |
-------------- | --------------------------------------------------------------- | ------------------ |
CMake | Cross-platform family of tools designed to help build software | All |
C++17 Compiler | Matching Houdini compiler and version | All |
Boost | Components: iostreams | All |
C++14 Compiler | Matching Houdini compiler and version | All |
Boost | Components: iostreams, python, thread | All |
GoogleTest | A unit testing framework module for C++ | Unit Tests |
CppUnit | A unit testing framework module for C++ | Unit Tests (AX) |
GLFW | Simple API for OpenGL development | OpenVDB View |
Doxygen | Documentation generation from C++ | Documentation |
Log4cplus | An optional dependency for improved OpenVDB Logging | Optional (All) |
PyBind11 | C++/python bindings | Optional (Python) |
NumPy | Scientific computing with Python | Optional (Python) |
LLVM | Target-independent code generation | OpenVDB AX |
At a minimum, boost, a matching C++17 compiler and CMake will be required. See
At a minimum, boost, a matching C++14 compiler and CMake will be required. See
the full [dependency list](@ref dependencies) for help with downloading and
installing the above software. Note that as Blosc and ZLib are provided as part
of the Houdini installation `USE_BLOSC` and `USE_ZLIB` should be left `ON`.
@@ -346,8 +347,8 @@ Supported versions of maya only ship with TBB.
Package | Description | OpenVDB Components |
-------------- | --------------------------------------------------------------- | -------------------------------- |
CMake | Cross-platform family of tools designed to help build software | All |
C++17 Compiler | Matching Houdini compiler and version | All |
Boost | Components: iostreams | All |
C++14 Compiler | Matching Houdini compiler and version | All |
Boost | Components: iostreams, python, thread | All |
ZLIB | Compression library for disk serialization compression | All |
Blosc | Recommended dependency for improved disk compression | All* |
GoogleTest | A unit testing framework module for C++ | Unit Tests |
@@ -355,16 +356,15 @@ CppUnit | A unit testing framework module for C++
GLFW | Simple API for OpenGL development | OpenVDB View |
Doxygen | Documentation generation from C++ | Documentation |
OpenEXR | EXR serialization support | OpenVDB Render |
Imath | Used half precision floating points and EXR serialization support | Optional (All) |
IlmBase | Used half precision floating points and EXR serialization support | Optional (All) |
Log4cplus | An optional dependency for improved OpenVDB Logging | Optional (All) |
PyBind11 | C++/python bindings | Optional (Python) |
NumPy | Scientific computing with Python | Optional (Python) |
LLVM | Target-independent code generation | OpenVDB AX |
* See [blosc support](@ref buildBloscSupport)
At a minimum, boost, a matching C++17 compiler, ZLIB, blosc and CMake will be
At a minimum, boost, a matching C++14 compiler, ZLIB, blosc and CMake will be
required. See the full [dependency list](@ref dependencies) for help with
downloading and installing the above software.
@@ -394,12 +394,14 @@ Optional:
install the Maya plugin to. Defaults to the value of `${CMAKE_INSTALL_PREFIX}/maya${Maya_VERSION}`
- @b BOOST_ROOT =`/path/to/boost/install` # Path to boost. May not be required,
CMake may find it automatically
- @b IlmBase_ROOT =`/path/to/ilmbase/install` # Path to ilmbase.
For example on MacOS and where the build folder has been created inside the
OpenVDB source root:
@code
cmake -D BOOST_ROOT=/path/to/boost/install \
-D IlmBase_ROOT=/path/to/ilmbase/install \
-D Maya_ROOT=/Applications/Autodesk/maya2019/ \
-D USE_MAYA=ON \
../
@@ -514,7 +516,7 @@ You can add the below CMake snippet to your main `CMakeLists.txt` to bring in
OpenVDB as a dependency:
@code{.cmake}
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
list(APPEND CMAKE_MODULE_PATH "/location/of/openvdb/install/lib/cmake/OpenVDB")
find_package(OpenVDB REQUIRED)
target_link_libraries(myapp OpenVDB::openvdb)
@@ -607,17 +609,8 @@ OpenVDB uses [imported targets](https://cmake.org/cmake/help/latest/command/add_
for all its dependencies. For imported Boost compatibility, the following
versions of CMake are required:
- Boost 1.73 requires CMake 3.17.2 or newer.
- Boost 1.74 requires CMake 3.19 or newer.
- Boost 1.75 requires CMake 3.19.5 or newer.
- Boost 1.76 requires CMake 3.20.3 or newer.
- Boost 1.77 requires CMake 3.21.3 or newer.
- Boost 1.78 requires CMake 3.22.2 or newer.
- Boost 1.79 requires CMake 3.23.2 or newer.
- Boost 1.80 requires CMake 3.24.2 or newer.
- Boost 1.81 requires CMake 3.25.2 or newer.
- Boost 1.82 requires CMake 3.27.0 or newer.
- Boost 1.83 requires CMake 3.27.4 or newer.
- Boost 1.68, 1.69 require CMake 3.13 or newer.
- Boost 1.70 requires CMake 3.14 or newer.
Use the above list to identify the version of CMake you require for your version
of Boost. Note that this may be implemented into the OpenVDB CMake in the future.
+44 -476
View File
@@ -2,484 +2,43 @@
@page changes Release Notes
@htmlonly <a name="v11_0_0_changes"></a>@endhtmlonly
@htmlonly <a name="v9_0_1_changes"></a>@endhtmlonly
@par
<B>Version 11.0.0</B> - <I>November 1, 2023</I>
@par
<BLOCKQUOTE>
This version introduces ABI changes relative to older major releases, so to
preserve ABI compatibility it might be necessary to define the macro
<TT>OPENVDB_ABI_VERSION_NUMBER=</TT><I>N</I>.
</BLOCKQUOTE>
@par
<BLOCKQUOTE>
OpenEXR 2 and Python 2 are no longer supported.
</BLOCKQUOTE>
@par
OpenVDB:
- Improvements:
- Removed use of @c boost::any in favor of @c std::any.
<I>[Contributed&nbsp;by&nbsp;Brian&nbsp;McKinnon]</I>
- Bug Fixes:
- Fix potential crash reading corrupt .vdb files with invalid blosc or zip
chunks.
<I>[Contributed&nbsp;by&nbsp;Matthias&nbsp;Ueberheide]</I>
@par
NanoVDB:
- Highlights:
- Several new tools to generate and modify NanoVDB grids on the GPU.
- New file format that supports streaming of raw grid buffers.
- New Features:
- New memory efficient @c GridClass::IndexGrid that separates values from tree
- 4 new GridTypes (@c Index, @c OnIndex, @c IndexMask, @c OnIndexMask) used by
IndexGrid
- Added @c createNanoGrid that replaces older conversion methods in
<TT>GridBuilder.h</TT>, <TT>IndexGridBuilder.h</TT> and
<TT>OpenToNanoVDB.h</TT>
- Added @c cudaPointsToGrid that constructs a point device grid from a list of
points.
- Added @c cudaVoxelsToGrid that constructs a voxel device grid from a list of
voxels.
- Added <TT>cuda/CudaUtils.h</TT> with several cuda utility functions.
- Added @c GpuTimer for timing of kernels in a specific cuda stream.
- Added @c cudaIndexToGrid that converts IndexGrids into regular Grids.
- Added @c cudaSignedFloodFill that performs signed-flood filling on the GPU.
- Added @c cudaAddBlindData that adds blind data to an existing grid on the
GPU.
- Added @c cudaGridChecksum that computes checksums of device grids.
- Added @c cudaGridHandle that handles grids on the GPU.
- Added @c cudaNodeManager that constructs a NodeManager on the GPU.
- Added build type @c Points and @c GridType::PointIndex for point grids.
- Added @c GridType::Vec3u16 and @c GridType::Vec3u8 for compressed
coordinates.
- Added <TT>PrefixSum.h</TT> for concurrent computation of prefix sum on the
CPU.
- API Changes:
- Version 32.6.0 (ABI is unchanged).
- Transition from C++11 to C++17
- Vec3R is deprecated, please use Vec3d instead.
- nanoToOpenVDB now takes the index of a NanoVDB in a GridHandle.
- GridData, InternalData and LeafData are now public.
- GridMetaData can be copied.
- Improvements to <TT>GridBuilder.h</TT> that allows construction of grids on
CPU.
- GridHandle's move c-tor now requires the GridBuffer to contain a valid grid.
- Moved <TT>CudaDeviceBuffer.h</TT> to <TT>cuda/CudaDeviceBuffer.h</TT>.
- New API for acceleration of custom random-access with ValueAccessors.
- Added BitFlags class for convenient bit-mask operations.
- Added Vec2/3 min/maxComponentAtomic GPU methods.
- Added @c BBox::expandAtomic and @c BBox::intersectAtomic.
- Added @c Coord::expandAtomic.
- Added Map constructors.
- Added @c Mask::DenseIterator, @c Mask::setOnAtomic, and
@c Mask::setOffAtomic.
- @c InternalNode::ChildIterator is now const-correct.
- Added several new NanoVDB Build Traits.
- Syncing <TT>PNanoVDB.h</TT> with <TT>NanoVDB.h</TT>.
@par
Build:
- Support for <TT>OpenEXR 2.X</TT> has been removed.
- Better support for building with external package configurations with
<TT>CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON</TT>.
@par
Python:
- Removed Python 2 support.
<I>[Contributed&nbsp;by&nbsp;Matthew&nbsp;Cong]</I>
- Removed explicit bindings for Math types.
<I>[Contributed&nbsp;by&nbsp;Matthew&nbsp;Cong]</I>
- Improved type casting for TypedMetadata.
<I>[Contributed&nbsp;by&nbsp;Matthew&nbsp;Cong]</I>
@htmlonly <a name="v10_1_0_changes"></a>@endhtmlonly
@par
<B>Version 10.1.0</B> - <I>October 11, 2023</I>
@par
Highlights:
- OpenVDB Python bindings are now implemented using pybind11 instead of Boost.Python.
[Contributed by Matthew Cong]
@par
OpenVDB:
- New features:
- Added points::replicate() for the replication of PointDataGrid points
and attributes.
- Improvements:
- Upgraded OpenVDBs internal half representation to IMath 3.1.6. Brings
conversion support using F16C instructions (if enabled using -mf16c) and
the removal of the exponent lookup table in favor of bit shifting.
- OpenVDBs copy of Half.h is no longer built with an internal lookup table,
but explicitly selects the non-LUT version and disables the creation of
the LUT. This is required to avoid symbol conflicts with different
namespaced OpenVDB builds.
- Removed boost::uuid from Archive, instead std::random_device is used
directly to generate UUID-like objects.
- Moved all cases of file static/global variables which relied on non-trivial
construction into function scopes as static locals. These would previously
initialize themselves on start-up in a non-deterministic, compiler-dictated
order(static-initialization-order-fiasco). This order is now defined by the
program's execution.
- Fixed the constants used in openvdb::math::Coord::hash() and
nanovdb::Coord::hash() to correctly be prime numbers (note that this
changes the result of these methods).
[Contributed by Benedikt Mersch]
- Updated tools::meshToVolume to take two new optional arguments to provide
an interior test oracle and an interior testing method. These allow the
default outside-flood-fill to be replaced if the actual sidedness can be
known.
[Contributed by Tomas Skrivan]
- LevelSetRebuild now includes example code that demonstrates the intended
use of the new meshToVolume interior testing parameters for the
resampling of level sets, where the original grid is used as the true
sign value. However, due to differences between polygonalization and
trilinear interpolation, this behaviour is disabled and exists as a
reference.
- Introduced openvdb::TupleList to wrap std::tuple and provide interface
interop methods with openvdb::TypeList.
- Added OPENVDB_FORCE_INLINE, OPENVDB_LIKELY and OPENVDB_UNLIKELY macros.
- Introduced openvdb::make_index_sequence to solve clang compilations
issues with compiler built-in index_sequence implementations.
- API changes:
- Significant infrastructural change to the ValueAccessor header and
implementation. All ValueAccessor specializations have been consolidated
into a single class which supports all possible ValueAccessor configurations
using index_sequences. Backward compatible declarations have been provided.
The new ValueAccessor implementation is marked as final.
- PagedArray iterators no longer derive from std::iterator
(but remains standard compliant).
- Bug Fixes:
- Internal counters in tree::RangeIterator were limited to 32bit precision.
They are now extended to size_t.
[Reported by SpaceX]
- Fixed a bug when compiling with -fvisibility=hidden and GCC 11 which
would cause a crash in openvdb::initialize().
- Fixed a bug with LeafManager which wouldn't correctly
initialize its LeafNode array for single level Tree configurations
i.e. RootNode<LeafNode> (bug introduced in 7.2.0).
[Reported by @lanwatch]
- Fixed a bug with LeafNodeBool Topology constructor with designated
on/off values which wouldn't apply them correctly.
[Reported by @hozhaoea]
@par
OpenVDB AX:
- Improvements:
- Added support for LLVM 15.
- Bug Fixes:
- Fixed a bug in AX on older X86 hardware which could cause a crash when
accessing point attributes with half compression (bug introduced in 9.1.0).
- Fixed an incorrect option in the `vdb_ax` command line tool where the default
optimization level was set to NONE instead of O3 (issue introduced in 10.0.0).
@par
OpenVDB Houdini:
- Improvements:
- Added Preserve Holes option to VDB From Polygons that uses the
fast winding oracle to not collapse holes in polygonal geometry.
- Bug Fixes:
- Fix a bug in the projection mode of the Advect Points SOP that was causing
a segfault.
@par
Build:
- Fixed a build issue where Boost was not being pulled in when
OPENVDB_USE_DELAYED_LOADING was set to OFF.
- Fixed a build issue with AX on 32-bit platforms.
[Reported by Mathieu Malaterre]
- Fixed a compilation issue with the min() and max() methods on Stencils
in openvdb/math/Stencils.h.
[Reported by Samuel Mauch]
- Fixed a compilation error that would be encountered when attempting to
enable the SSE4.2 or AVX SIMD options on non-x86 based platforms.
- Improved support for compiling with C++20.
[Contributed by Denys Maletskyy and Jérémie Dumas]
- OpenVDB's CMake no longer modifies the BUILD_SHARED_LIBS variable.
[Reported by Maksim Shabunin]
- Fix int-in-bool-context GCC9+ warnings by switching to use constexpr if.
@par
@htmlonly <a name="v10_0_1_changes"></a>@endhtmlonly
@par
<B>Version 10.0.1</B> - <I>November 30, 2022</I>
@par
Bug Fixes:
- Fixed uninitialized point flags in tools::VolumeToMesh which could result in
non-deterministic results (bug introduced in 10.0.0).
@par
Build:
- Fixed CXX standard requirement for VDB components in FindOpenVDB.cmake
@htmlonly <a name="v10_0_0_changes"></a>@endhtmlonly
@par
<B>Version 10.0.0</B> - <I>October 27, 2022</I>
@par
<BLOCKQUOTE>
This version introduces ABI changes relative to older major releases, so to
preserve ABI compatibility it might be necessary to define the macro
<TT>OPENVDB_ABI_VERSION_NUMBER=</TT><I>N</I>.
</BLOCKQUOTE>
@par
Highlights:
- Introducing OpenVDBLink, which provides a Mathematica interface to
OpenVDB. This link ports over access to various grid containers including
level sets, fog volumes, vector grids, integer grids, Boolean grids,
and mask grids. Construction, modification, combinations, visualisations,
queries, import, export, etc. can be achieved over grids too. Any
Mathematica 3D region that's ConstantRegionQ and BoundedRegionQ can
be represented as a level set grid, providing a more seamless integration
with OpenVDB.
- Introducing a new command-line tool,
dubbed <A HREF="https://github.com/AcademySoftwareFoundation/openvdb/tree/master/openvdb_cmd/vdb_tool">vdb_tool</A>,
that can combine any number of the high-level tools available
in <A HREF="https://github.com/AcademySoftwareFoundation/openvdb/tree/master/openvdb/openvdb/tools">openvdb/tools</A>.
For instance, it can convert a sequence of polygon meshes and particles to
level sets, perform a large number of operations on these level set
surfaces and export them as adaptive polygon meshes.
@par
OpenVDB:
- Improvements:
- Significantly improved the performance of all ValueAccessor methods which
access LeafNode value buffer data. This improvement applies to any type
which is delay load compatible (all default types except for bool and mask
grids) and improves the performance of many OpenVDB tools.
- Improved the performance of volumeToMesh by 10-15%.
- ABI changes:
- ABI change to openvdb::RootNode, which now has a new member that defines
the origin of the node. For now this origin is set to a default value of
(0,0,0), but in the near future we will allow for offsets to improve
access performance and reduce the memory footprints.
- Removed deprecated virtual methods from AttributeArray.
- API changes:
- Removed PagedArray::push_back().
- Removed Tree visitor methods from Tree, RootNode, InternalNode and
LeafNode classes - visit(), visit2(), visitActiveBBox().
- Removed LeafManager::getNodes().
- Removed tools::dilateVoxels() and tools::erodeVoxels() in favor of
tools::dilateActiveValues() and tools::erodeActiveValues().
- Removed tools::FindActiveValues::any() and
tools::FindActiveValues::none().
- StringGrid and StringTrees have been removed.
- Bug Fixes:
- Fixed an issue with tools::topologyToLevelSet which would previously
ignore active tiles in the input topology.
[Reported by Tobias Rittig]
- Fixed a bug with ValueAccessor::addLeaf and ValueAccessor::addTile which
wouldn't add the provided leaf nodes to the underlying tree. This bug did
NOT affect the specialized accessors which are used by the default tree
configuration.
[Contributed by Andrey Zakirov]
- Fixed a bug where ValueAccessor::probeNode<NodeT> and
ValueAccessor:probeConstNode<NodeT> would return a nullptr if the NodeT
type was not explicitly being cached by the accessor but the node existed
in the tree.
- Fixed a bug on Windows where math::Abs could truncate 64bit integer values.
[Contributed by Edward Lam]
- Fixed an occurrence of undefined behaviour with math::floatToInt32 and
math::doubleToInt64.
[Reported by Vojtěch Bubník]
- Fixed bugs in the sum merge that produced incorrect merged grids when
deep-copying the input nodes or when non-zero background grids were being
used.
- Fixed a bug in FastSweeping where voxels/tiles are left with min/max float
values.
- Fixed a bug in math/Tuple.h that prevented compilation with VS2017.
@par
OpenVDB AX:
- Improvements:
- Major updates to the command line interface of the vdb_ax binary, exposing
more controls such as tile streaming, value iterator types and attribute
bindings.
@par
OpenVDB Houdini:
- New Features:
- Add convex hull activation for VDB Activate SOP (requires 19.5).
- Improvements:
- Improved SDF activation to use dynamic node manager.
- Bug Fixes:
- Fixed a bug in VDB Visualize SOP where color values that exceed
the range wrap around instead of being clamped.
@par
NanoVDB:
- New Features:
- Added nanovdb::IndexGrid that allows for arbitrary voxel values and even
multiple channels to be associated with NanoVDB grids. They are more
flexible and memory efficient than regular grids at a small cost of
random-access performance. IndexGrids are constructed with the new
nanovdb::IndexGridBuilder and accessed with the new
nanovdb::ChannelAccessor.
- Added iterators to all tree node classes for visiting inactive, active, or
all values and child nodes.
- NanoVDB.h now includes standalone implementations of reading and writing
uncompressed nanovdb grids buffers.
- Added Stats::getExtrema, which computes the min/max values of all voxels
in a NanoVDB grid that intersects with a user-defined bounding-box.
- Added nanovdb::Mask::countOn(int) which is essential to the new
nanovdb::IndexGrid.
- Added RootNode::probeChild and InternalNode::probeChild.
- Improvements:
- Added a new much improved nanovdb::NodeManager, that is both faster and
more memory efficient, and that works on both the CPU and GPU. Note, it
uses a handle for allocation (just like nanovdb::Grid) and replaces the
old nanovdb::LeafManager which is now deprecated.
- NanoToOpenVDB is extended to work with grids templated on Fp4, Fp8, Fp16,
FpN, bool and ValueMask.
- Renamed RootNode::findTile to RootNode::probeTile and made it public.
- Made Mask::getWord return both a const and non-const reference.
- Improved unit-tests to use explicit 32B alignment (see alignment bug-fix
below).
- PNanoVDB.h (a C99 port of NanoVDB.h) has been updated.
- Bug Fixes:
- Fixed a bug in nanovdb::HostBuffer that could produce crashes due to
misaligned CPU memory allocations.
- Fixed bug related to uninitialized memory in nanovdb::Grid which could
confuse CRC32 checksum validation.
- Fixed bugs related to the use of intrinsic functions for fast bit-counting
in nanovdb.
- Fixed a potential security vulnerability in NanoVDB.h related to buffer
overflow exploits.
@par
Build:
- Added OPENVDB_USE_DELAYED_LOAD flag that enables delayed loading and
defaults to on.
- Add a placeholder to inject the specific revision and URL used
to build OpenVDB, useful for 3rd party build scripts to publish
their exact versions.
- Fixed an issue where OPENVDB_AX_DLL was not being defined on shared
library builds of AX, resulting in symbols not being exported.
[Reported by Ray Molenkamp]
- Fixed an issue where setting Tbb_INCLUDE_DIR could cause CMake failures.
- Updated FindTBB.cmake to support newer library ABI suffixing in
TBB 2021.5.
- Updated FindBlosc.cmake to better handle cases where blosc is built with
external sources.
- Resolved LLVM deprecation warnings in AX and added support for LLVM 14.
- On Windows (MSVC), OpenVDB is now built with extra compiler options to
ensure stricter C++ conformance: /permissive- /Zc:throwingNew /Zc:inline.
- On Windows (MSVC), the _USE_MATH_DEFINES macro is no longer defined when
including <openvdb/Platform.h> (or any dependent headers). If you were
relying on this in your own project for M_PI, M_PI_2, etc. you can add
-D_USE_MATH_DEFINES to your own project compiler options. See
<A HREF="https://docs.microsoft.com/en-us/cpp/c-runtime-library/math-constants">this page</A>
for more info.
@htmlonly <a name="v9_1_0_changes"></a>@endhtmlonly
@par
<B>Version 9.1.0</B> - <I>June 9, 2022</I>
<B>Version 9.0.1</B> - <I>In Development</I>
@par
Bug Fixes:
- Minor fix to move assignment operator in nanovdb/util/HostBuffer.h.
This could potentially be a problem on Windows debug builds (unconfirmed).
- Minor fix to range in openvdb/tools/LevelSetSphere.h. This could result
in data races for multi-threaded execution (unconfirmed)
[Reported by Tommy Hinks]
- Fixed a bug with Tree::combineExtended which wouldn't propagate the resulting
active state when a destination tile overlapped a source child node.
[Reported by \@frapit]
in data races for multi-threaded execution (unconfirmed) [Reported by Tommy Hinks]
- Fixed a bug with Tree::combineExtended which wouldn't propagate the resulting active state when a destination tile overlapped a source child node. [Reported by @frapit]
- Fix unit tests failures with Blosc versions >= 1.19.0.
- Fixed a regression in ax::run which wouldn't propagate exceptions
- Fixed a bug where ax::ast::parse could return a partially constructed but
invalid AST on failure
- Fixed AX logger exit handling in ax::Compiler::compile and ax::ast::parse
- Fixed an issue which could result in significant compilation times when
instantiating TypeList<>::Unique<>
@par
New features:
- Added support for AMD's HIP API in NanoVDB [Contributed by Blender Foundation]
- Added bindings mechanism to AX to allow differing data and AX attribute names
(@) in Point and Volume executables.
- Added bindings mechanism to AX to allow differing data and AX attribute names (@) in Point and Volume executables.
- Added support for OpenVDB AX on Windows.
- Added tools::memUsageIfLoaded() which returns the memory consumption of a
deserialized VDB tree, useful if delay-loading is enabled.
- Added points::rasterizeSpheres() and points::rasterizeSmoothSpheres()
variants, new kernels and improved performance for OpenVDB points to surface
rasterization.
- Added points::rasterizeTrilinear() for OpenVDB points, fast staggered or
colocated trilinear rasterization for scalar and vector attributes.
- Exposed TypeList declarations in openvdb.h which denote the default set of
types supported by OpenVDB.
- Added points::FrustumRasterizer for efficient rasterization of OpenVDB points
to frustum volumes with optional motion blur.
@par
Improvements:
- Added a --thread [n] argument to the vdb_ax binary.
- Added a --copy-file-metadata option to vdb_ax. This behaviour is now off by
default.
- Added support for multiple input files with the vdb_ax binary using -i.
Positional arguments as input files are deprecated.
- Added tools::minMax() which supports multithreaded evaluation of active
minimum and maximum values. Grid::evalMinMax() has been deprecated.
[Contributed by Greg Hurst]
- Significant performance improvements to AX point kernels, primarily due to
providing AX access to attribute buffers for superior code generation.
- vdb_print now prints both the in-core memory and total memory usage for VDB
grids.
- Improved build support for MinGW [Contributed by Mehdi Chinoune]
- Added a new foreach method to TypeList for iterating over types without
constructing them.
- Added TypeList::Transform declaration for transforming TypeLists into new
types.
- Moved Grid::apply implementation to TypeList::apply to allow for other
polymorphic types to invoke it.
- Minor updates to NanoVDB to remove compiler warnings.
- Added a --copy-file-metadata option to vdb_ax. This behaviour is now off by default.
- Added support for multiple input files with the vdb_ax binary using -i. Positional arguments as input files are deprecated.
- Added tools::minMax() which supports multithreaded evaluation of active minimum and maximum values. Grid::evalMinMax() has been deprecated. [Contributed by Greg Hurst]
@par
Build:
- Regenerated AX grammar with Flex 2.6.4 and Bison 3.8.2.
- Improved locating NumPy in CMake when multiple python versions are installed.
- Fixed an issue which could report Python as missing when using CMake 3.18 and
later on some systems. [Reported by Sam James]
- Changed the way boost_python and boost_numpy are located. Both components must
match the major/minor version of python in use. This can be circumvented by
providing Boost_PYTHON_VERSION or Boost_PYTHON_VERSION_MAJOR.
- Relocated OpenVDB binaries to a new openvdb_cmd root directory.
- FindTBB.cmake now prioritises newer TBB installations.
- Added option to compress PDB data in MSVC debug builds.
- Fixed an issue which could report Python as missing when using CMake 3.18 and later on some systems. [Reported by Sam James]
@par
Houdini:
- Added Attribute Bindings to AX SOP to allow differently named AX attributes
(@) and target point attributes/volumes.
- Added Attribute Bindings to AX SOP to allow differently named AX attributes (@) and target point attributes/volumes.
- Fix race condition in OpenVDB Merge SOP that could cause crashes
or merged VDBs to not be deleted.
- VDB Activate SOP no longer stops at the first non-VDB primitive, but instead
just skips such primitives.
- Added VDB Rasterize Frustum SOP for efficient rasterization of OpenVDB points
into frustum volumes with optional motion blur.
@htmlonly <a name="v9_0_0_changes"></a>@endhtmlonly
@par
@@ -497,7 +56,7 @@ preserve ABI compatibility it might be necessary to define the macro
<BLOCKQUOTE>
Official release of NanoVDB, which for the first time offers GPU support for
static sparse volumes in OpenVDB. See the
<A HREF="https://www.openvdb.org/documentation/doxygen/NanoVDB_MainPage.html">documentation</A>
<A HREF="https://academysoftwarefoundation.github.io/openvdb/NanoVDB_MainPage.html">documentation</A>
for details.
</BLOCKQUOTE>
@@ -799,7 +358,8 @@ API changes:
@vdblink::tools::activate() tools::activate@endlink and
@vdblink::tools::deactivate() tools::deactivate@endlink to a new header,
Activate.h.
- Deprecated tools::dilateVoxels() and tools::erodeVoxels() in favour of
- Deprecated @vdblink::tools::dilateVoxels() tools::dilateVoxels@endlink
and @vdblink::tools::erodeVoxels() tools::erodeVoxels@endlink in favour of
new morphology methods.
- The @vdblink::tools::Film tools::Film@endlink class no longer has a
saveExr method in any build configuration. Sample code for saving exrs
@@ -928,7 +488,7 @@ a domain specific JIT (just-in-time) compiled expression language,
providing users with a new way of interacting with OpenVDB data. AX is
tailored towards writing highly parallelizable and customizable OpenVDB
volume and point kernel operations. See the
<A HREF="https://www.openvdb.org/documentation/openvdbax.html">documentation</A>
<A HREF="https://academysoftwarefoundation.github.io/openvdb/openvdbax.html">documentation</A>
for more.
</BLOCKQUOTE>
@@ -1095,8 +655,10 @@ Houdini:
Bug Fixes:
- Fixed a bug which could cause recursive compile time instantiations of
TypeList objects, manifesting in longer compile times.
- Deprecated util::PagedArray::push_back due to a race condition. Instead use
util::PagedArray::ValueBuffer::push_back which is faster and thread-safe.
- Deprecated @vdblink::util::PagedArray::push_back util::PagedArray::push_back@endlink
due to a race condition. Instead use
@vdblink::util::PagedArray::ValueBuffer::push_back util::PagedArray::ValueBuffer::push_back@endlink
which is faster and thread-safe.
- Fixed various cases of undefined behavior in some LevelSetUtil methods
[Reported&nbsp;by&nbsp;fkemmler]
@@ -1206,7 +768,7 @@ Improvements:
- Removed Boost::thread as a dependency of vdb_view in favour of std::thread.
- Removed usage of boost/integer.hpp and boost/math/constants/constants.hpp,
the latter in favour of new openvdb math constants for pi
- Removed usage of boost/mpl/\*.hpp methods in favour of new template
- Removed usage of boost/mpl/*.hpp methods in favour of new template
meta-programming methods on the @vdblink::TypeList TypeList@endlink struct.
This now supports get, front, back, contains, index, unique, popback, popfront
and range removal of types.
@@ -1418,7 +980,8 @@ API changes:
- @vdblink{tools::VolumeToMesh::pointList(),VolumeToMesh::pointList} and
@vdblink{tools::VolumeToMesh::polygonPoolList(),VolumeToMesh::polygonPoolList}
now return a std::unique_ptr instead of a boost::scoped_array.
- AttributeArray::copyUncompressed is now deprecated.
- @vdblink::points::AttributeArray::copyUncompressed() AttributeArray::copyUncompressed@endlink
is now deprecated.
@par
Python:
@@ -1671,7 +1234,7 @@ Bug fixes:
@par
API changes:
- Moved the @vdblink::CopyConstness CopyConstness@endlink metafunction from
@link tree/TreeIterator.h TreeIterator.h@endlink to @link Types.h Types.h@endlink.
@link tree/TreeIterator.h TreeIterator.h@endlink to @link Types.h@endlink.
@par
Houdini:
@@ -1738,7 +1301,8 @@ New features:
AttributeArray::copyValues@endlink and
@vdblink::points::AttributeArray::copyValuesUnsafe()
AttributeArray::copyValuesUnsafe@endlink that significantly outperform
the older AttributeArray::set() method.
the older @vdblink::points::AttributeArray::set()
AttributeArray::set@endlink method.
@par
Improvements:
@@ -1748,8 +1312,9 @@ Improvements:
@vdblink::points::AttributeArray AttributeArray@endlink now errors.
- Updated point deletion to use faster batch copying for ABI=6+.
- Methods relating to in-memory Blosc compression for
AttributeArray::compress() now do nothing and have been marked deprecated
resulting in memory savings for ABI=6+.
@vdblink::points::AttributeArray::compress() AttributeArray@endlink
now do nothing and have been marked deprecated resulting in memory savings
for ABI=6+.
@par
Bug fixes:
@@ -1770,8 +1335,8 @@ API changes:
- Removed a number of methods that were deprecated in version&nbsp;5.0.0 or
earlier.
- Removed the experimental @b ValueAccessor::newSetValue method.
- Deprecated AttributeArray::compress() methods relating to in-memory Blosc
compression.
- Deprecated @vdblink::points::AttributeArray::compress()
AttributeArray@endlink methods relating to in-memory Blosc compression.
@par
Houdini:
@@ -2634,8 +2199,8 @@ Bug fixes:
- Fixed memory leak in a @vdblink::tools::meshToVolume tools::meshToVolume@endlink
sub-tool (expandNarrowband).
<I>[Reported by K&eacute;vin&nbsp;Dietrich]</I>
- Fixed parameter type inconsistencies in @link math/Stencils.h math/Stencils.h@endlink
and @link tools/RayIntersector.h tools/RayIntersector.h@endlink.
- Fixed parameter type inconsistencies in @link math/Stencils.h@endlink and
@link tools/RayIntersector.h@endlink.
<I>[Contributed by K&eacute;vin&nbsp;Dietrich and Nick&nbsp;Avramoussis]</I>
- Fixed a bug in the @vdblink::tools::VolumeToMesh VolumeToMesh@endlink tool that
produced artifacts for adaptive surface extraction on clipped level sets.
@@ -2886,7 +2451,7 @@ Houdini:
modified or deleted, so for safety,
@vdblink::io::File::open() File::open@endlink automatically makes
private copies of source files that are smaller than a user-specified limit
(see io::File::setCopyMaxBytes()).
(see @vdblink::io::File::setCopyMaxBytes() File::setCopyMaxBytes@endlink).
The limit can be set to zero to disable copying, but if it cannot be
guaranteed that a file will not be modified, then it is best not to enable
delayed loading for that file.
@@ -2949,7 +2514,7 @@ Houdini:
for material color lookups.
- Added @vdblink::getLibraryVersionString()
getLibraryVersionString@endlink and
@link OPENVDB_LIBRARY_VERSION_STRING OPENVDB_LIBRARY_VERSION_STRING@endlink.
@link OPENVDB_LIBRARY_VERSION_STRING@endlink.
- Modified the mesh to volume converter to always set the grid background
value to the exterior narrow-band width, and added finite value checks
to narrow band parameters.
@@ -3656,8 +3221,9 @@ API changes:
the Resample SOP and the Combine SOP now use level set rebuild to correctly
and safely resample level sets. Previously, scaling a level set would
invalidate the signed distance field, leading to holes and other artifacts.
- Added a mask-based topological tools::erodeVoxels() erosion tool and rewrote
and simplified the tools::dilateVoxels() dilation tool.
- Added a mask-based topological
@vdblink::tools::erodeVoxels erosion tool@endlink, and rewrote and
simplified the @vdblink::tools::dilateVoxels dilation tool@endlink.
- The @vdblink::tools::LevelSetAdvection LevelSetAdvection@endlink tool
can now advect forward or backward in time.
- Tree::pruneLevelSet() now replaces each pruned node with a tile having
@@ -3779,7 +3345,8 @@ API changes:
that caused it to translate the output grid incorrectly in some cases.
- Fixed a bug in the tree-level
@vdblink::tree::LeafIteratorBase LeafIterator@endlink that resulted in
intermittent crashes in @c tools::dilateVoxels().
intermittent crashes in
@vdblink::tools::dilateVoxels() tools::dilateVoxels@endlink.
- The @c Hermite data type and Hermite grids are no longer supported.
- Added tools/GridOperators.h, which includes new, cleaner implementations
of the @vdblink::tools::cpt() closest point transform@endlink,
@@ -4063,10 +3630,10 @@ API changes:
@c LeafArray, which will be deprecated in the next release.
- Added a @vdblink::tree::LeafNode::fill() LeafNode::fill@endlink method
to efficiently populate leaf nodes with constant values.
- Added a tree::Tree::visitActiveBBox() method that applies a functor to the
bounding boxes of all active tiles and leaf nodes and that can be used to
improve the performance of ray intersection tests, rendering of bounding
boxes, etc.
- Added a @vdblink::tree::Tree::visitActiveBBox() Tree::visitActiveBBox@endlink
method that applies a functor to the bounding boxes of all active tiles
and leaf nodes and that can be used to improve the performance of
ray intersection tests, rendering of bounding boxes, etc.
- Added a @vdblink::tree::Tree::voxelizeActiveTiles()
Tree::voxelizeActiveTiles@endlink method to densify active tiles.
While convenient and fast, this can produce large dense grids, so use
@@ -4077,7 +3644,8 @@ API changes:
- Added a GridBase::pruneGrid() method.
- Added a @vdblink::Grid::hasUniformVoxels() Grid:hasUniformVoxels@endlink
method.
- Renamed @c tools::dilate to @c tools::dilateVoxels() and improved its
- Renamed @c tools::dilate to
@vdblink::tools::dilateVoxels() dilateVoxels@endlink and improved its
performance. The new name reflects the fact that the current
implementation ignores active tiles.
- Added a @vdblink::tools::resampleToMatch() tools::resampleToMatch@endlink
+75 -59
View File
@@ -9,6 +9,7 @@
- @ref depInstallingDependencies
- @ref depUsingAptGet
- @ref depUsingHomebrew
- @ref depManInstall
<!-- - @ref depContents -->
------------------------------------------------------------------------------
@@ -34,18 +35,18 @@ Reference Platform, but for those that do, their specified versions are
@section depComponents OpenVDB Components
Component | Requirements | Optional
----------------------- | ----------------------------------------------- | --------
OpenVDB Core Library | CMake, C++17 compiler, TBB::tbb, Boost::headers | Blosc, ZLib, Log4cplus, Imath::Imath, Boost::iostream
OpenVDB Print | Core Library dependencies | -
OpenVDB LOD | Core Library dependencies | -
OpenVDB Render | Core Library dependencies | OpenEXR, Imath::Imath, libpng
OpenVDB View | Core Library dependencies, OpenGL, GLFW3, GLEW* | -
OpenVDB Python | Core Library dependencies, Python, PyBind11 | NumPy
OpenVDB AX | Core Library dependencies, LLVM | Bison, Flex
NanoVDB | - | Core Library, CUDA, TBB, Blosc, ZLib
OpenVDB UnitTests | Core Library dependencies, GoogleTest | CppUnit**
OpenVDB Documentation | Doxygen | -
Component | Requirements | Optional
----------------------- | ------------------------------------------------- | --------
OpenVDB Core Library | CMake, C++14 compiler, TBB::tbb, Boost::iostream | Blosc, ZLib, Log4cplus, IlmBase::Half
OpenVDB Print | Core Library dependencies | -
OpenVDB LOD | Core Library dependencies | -
OpenVDB Render | Core Library dependencies | OpenEXR, IlmBase, libpng
OpenVDB View | Core Library dependencies, OpenGL, GLFW3, GLEW* | -
OpenVDB Python | Core Library dependencies, Python, Boost::python | Boost::numpy, NumPy
OpenVDB AX | Core Library dependencies, LLVM | Bison, Flex
NanoVDB | - | Core Library, CUDA, TBB, Blosc, ZLib
OpenVDB UnitTests | Core Library dependencies, GoogleTest | CppUnit**
OpenVDB Documentation | Doxygen | -
- @b * GLEW is only required for building the vdb_view binary on Windows.
- @b ** CppUnit is only required for building the AX unit tests.
@@ -56,51 +57,57 @@ OpenVDB Documentation | Doxygen | -
Package | Minimum | Recommended | Description | apt-get | Homebrew | Source
-------------- | ------- | ----------- | ----------------------------------------------------------------- | ------- | -------- | ------
CMake | 3.18 | Latest | Cross-platform family of tools designed to help build software | Y | Y | https://cmake.org
GCC | 9.3.1 | 11.2.1 | C++ 17 Compiler: The GNU Compiler Collection | Y | Y | https://www.gnu.org/software/gcc
Clang | 5.0 | Latest | C++ 17 Compiler: A C language family frontend for LLVM | Y | Y | https://clang.llvm.org
Intel ICC | 19 | Latest | C++ 17 Compiler: Intels C++ Compiler | Y | Y | https://software.intel.com/en-us/c-compilers
MSVC | 19.28 | 19.30 | C++ 17 Compiler: Microsoft Visual C++ Compiler | Y | Y | https://visualstudio.microsoft.com/vs
Imath | 3.1 | Latest | Half precision floating points | Y | Y | http://www.openexr.com
OpenEXR | 3.1 | Latest | EXR serialization support | Y | Y | http://www.openexr.com
TBB | 2020.2 | 2020.3 | Threading Building Blocks - template library for task parallelism | Y | Y | https://www.threadingbuildingblocks.org
CMake | 3.12 | Latest | Cross-platform family of tools designed to help build software | Y | Y | https://cmake.org
GCC | 6.3.1 | 6.3.1 | C++ 14 Compiler: The GNU Compiler Collection | Y | Y | https://www.gnu.org/software/gcc
Clang | 3.8 | Latest | C++ 14 Compiler: A C language family frontend for LLVM | Y | Y | https://clang.llvm.org
Intel ICC | 17 | Latest | C++ 14 Compiler: Intels C++ Compiler | Y | Y | https://software.intel.com/en-us/c-compilers
MSVC | 19.10 | Latest | C++ 14 Compiler: Microsoft Visual C++ Compiler | Y | Y | https://visualstudio.microsoft.com/vs
IlmBase | 2.2** | 2.3 | Used half precision floating points and EXR serialization support | Y | Y | http://www.openexr.com
OpenEXR | 2.2** | 2.3 | EXR serialization support | Y | Y | http://www.openexr.com
TBB | 2018 | 2018 | Threading Building Blocks - template library for task parallelism | Y | Y | https://www.threadingbuildingblocks.org
ZLIB | 1.2.7 | Latest | Compression library for disk serialization compression | Y | Y | https://www.zlib.net
Boost | 1.73 | 1.80 | Components: headers, iostreams | Y | Y | https://www.boost.org
LLVM | 10.0.0 | 13.0.0* | Target-independent code generation | Y | Y | https://llvm.org/
Bison | 3.0.0 | 3.7.0 | General-purpose parser generator | Y | Y | https://www.gnu.org/software/gcc
Flex | 2.6.0 | 2.6.4 | Fast lexical analyzer generator | Y | Y | https://github.com/westes/flex
Python | 3.9.1 | 3.10 | The python interpreter and libraries | Y | Y | https://www.python.org
PyBind11 | 2.9.1 | Latest | C++/python bindings | Y | Y | https://pybind11.readthedocs.io
NumPy | 1.20.0 | 1.23.0 | Scientific computing with Python | Y | Y | http://www.numpy.org
Boost | 1.66 | 1.66 | Components: iostreams, python, numpy | Y | Y | https://www.boost.org
LLVM | 6.0.0 | 8.0.0 | Target-independent code generation | Y | Y | https://llvm.org/
Bison | 3.0.0 | 3.0.5 | General-purpose parser generator | Y | Y | https://www.gnu.org/software/gcc
Flex | 2.6 | 2.6.4 | Fast lexical analyzer generator | Y | Y | https://github.com/westes/flex
Python | 2.7 | 2.7 | The python interpreter and libraries for C++/python bindings | Y | Y | https://www.python.org
NumPy | 1.14.0 | 1.14.0 | Scientific computing with Python | Y | Y | http://www.numpy.org
GoogleTest | 1.10 | Latest | A unit testing framework module for C++ | Y | Y | https://github.com/google/googletest
CppUnit | 1.10 | Latest | A unit testing framework module for C++ | N | Y | https://freedesktop.org/wiki/Software/cppunit
Blosc | 1.17.0* | 1.17.0 | Recommended dependency for improved disk compression | Y | Y | https://github.com/Blosc/c-blosc/releases
Log4cplus | 1.1.2 | Latest | An optional dependency for improved OpenVDB Logging | Y | Y | https://github.com/log4cplus/log4cplus
libpng | - | Latest | Library for manipulating PNG images | Y | Y | http://www.libpng.org/pub/png/libpng.html
GLFW | 3.1 | > 3.3 | Simple API for OpenGL development | Y | Y | https://www.glfw.org
GLFW | 3.1 | Latest | Simple API for OpenGL development | Y | Y | https://www.glfw.org
OpenGL | 3.2 | Latest | Environment for developing portable graphics applications | Y | Y | https://www.opengl.org
GLEW | 1.0.0 | Latest | A cross-platform OpenGL extension loading library. | Y | Y | http://glew.sourceforge.net
CUDA | - | Latest | Parallel computing platform for graphical processing units. | Y | N | https://developer.nvidia.com/cuda-downloads
Doxygen | 1.8.8 | 1.8.11 | Documentation generation from C++ | Y | Y | http://www.doxygen.nl
- @b * See the note in [known issues](@ref depKnownIssues) regarding supported blosc/llvm versions.
- @b * See the note in [known issues](@ref depKnownIssues) regarding supported blosc versions.
- @b ** IlmBase/OpenEXR 2.2 is supported as Houdini 18.0 is shipped with
VFX Reference Platform 2019, except for using older versions of these
libraries.
@subsection depKnownIssues Known Issues
- @b LLVM >= 15. LLVM has recently changed their IR pointer data types to be
completely opaque. Some support is provided in LLVM 15 but tests with AX show
that this is extremely unstable. AX currently only supports LLVM versions up
until 14.X.X. See https://llvm.org/docs/OpaquePointers.html for more details.
- @b GLFW: Crash with GLFW 3.2.1 when used with EGL on Linux. OpenVDB View may
segfault on closure. Fixed in GLFW 3.3
- @b Boost 1.66/1.67 + @b Python3 + @b NumPy: Known issue on UNIX systems
which can cause the below python runtime error. Consider updating to Boost 1.68
if you require both Python3 and NumPy support:
@code{.sh}
RuntimeError: FATAL: module compiled as little endian, but detected different endianness at runtime.
@endcode
- @b Blosc: OpenVDB has historically used an old version of blosc (1.5.0) to
serialize .vdb files. OpenVDB has moved to a new blosc version minimum of
1.17.0. We have tested a range of blosc versions and found that the following
versions are NOT compatible with OpenVDB caches written using blosc 1.5.0.
Additionally these versions of blosc may generally not be compatible with OpenVDB
itself. Avoid using these versions and upgrade to the new minimum of 1.17.0 where
serialize .vdb files. OpenVDB is moving to a new blosc version minimum of 1.17.0.
We have tested a range of blosc versions and found that the following versions
are NOT compatible with OpenVDB caches written using blosc 1.5.0. Additionally
these versions of blosc may generally not be compatible with OpenVDB itself.
Avoid using these versions and upgrade to the new minimum of 1.17.0 where
possible.
- All versions from 1.11.0 through to, but excluding, 1.14.0.
@@ -119,22 +126,8 @@ required OpenVDB dependencies.
@subsection depUsingAptGet Using UNIX apt-get
You can use apt to automatically install required packages. Note that different
Ubuntu distributions will have different versions available. You can use apt
pinning to request newer versions of specific package from later distributions
if the required version isn't available by default (see
[man apt_preferences](https://linux.die.net/man/5/apt_preferences)). For
example, the below settings will request TBB specifically from Ubuntu 22.04
(Jammy).
@code{.sh}
Package: libtbb-dev
Pin: release n=jammy
Pin-Priority: 990
@endcode
Alternatively you can install any missing dependencies manually or through
other package managers.
@b Note:CppUnit is unavailable using apt-get. See the other package manager
methods or the [manual installation](@ref depManInstall) options.
@code{.sh}
#!/bin/bash
@@ -145,17 +138,18 @@ apt-get install zlibc # zlib
apt-get install libboost-iostreams-dev # Boost::iostream
apt-get install libblosc-dev # Blosc
# AX
apt-get install llvm-10-dev # LLVM
apt-get install llvm-8-dev # LLVM
# Python
apt-get install pybind11-dev # Python
apt-get install libboost-python-dev # Boost::python
apt-get install libboost-numpy-dev # Boost::numpy
apt-get install python-dev # Python
apt-get install python-numpy # NumPy
# Optional
apt-get install libpng-dev # libpng
apt-get install libilmbase-dev # IlmBase
apt-get install libopenexr-dev # OpenEXR
apt-get install liblog4cplus-dev # Log4cplus
apt-get install googletest # GoogleTest
apt-get install libcppunit-dev # CppUnit
# vdb_view
apt-get install libglfw3-dev # GLFW
# Documentation
@@ -180,7 +174,7 @@ brew install c-blosc # blosc
# AX
brew install llvm # LLVM
# Python
brew install pybind11 # PyBind11
brew install boost-python # Boost-python
brew install python # Python
brew install numpy # NumPy
# Unit Tests
@@ -189,10 +183,32 @@ brew install cppunit # CppUnit
# vdb_view
brew install glfw # GLFW
# vdb_render
brew install ilmbase # IlmBase
brew install openexr # OpenEXR
brew install libpng # libpng
# Documentation
brew install doxygen # Doxygen
@endcode
@subsection depManInstall UNIX Manual Installations
Some dependencies may be unavailable using the above package manager methods.
Below are manual installation methods for these packages. Note that you will
have to provide your chosen installation locations to the OpenVDB CMake build
system when building OpenVDB.
@b CppUnit (for AX Unit Tests)
@code{.sh}
#!/bin/bash
wget http://dev-www.libreoffice.org/src/cppunit-1.13.2.tar.gz
tar -xvzf cppunit-1.13.2.tar.gz
cd cppunit-1.13.2
# Install to users home directory - you may customise this location
mkdir -p $HOME/cppunit
./configure --prefix=$HOME/cppunit
make
make install
@endcode
*/
-1
View File
@@ -58,7 +58,6 @@ See @subpage NanoVDB_MainPage "NanoVDB" for the NanoVDB documentation.
Contributors, please familiarize yourselves with our
@subpage codingStyle "coding standards".
<a href="../code_coverage/index.html">Code Coverage</a>
@page overview OpenVDB Overview
+7 -1
View File
@@ -921,7 +921,7 @@ openvdb::Vec3SGrid::Ptr grid = ...;
// Construct the rotation matrix.
openvdb::math::Mat3s rot45 =
openvdb::math::rotation<openvdb::math::Mat3s>(openvdb::math::Y_AXIS, openvdb::math::pi<double>()/4.0);
openvdb::math::rotation<openvdb::math::Mat3s>(openvdb::math::Y_AXIS, M_PI_4);
// Apply the functor to all active values.
openvdb::tools::foreach(grid->beginValueOn(), MatMul(rot45));
@@ -1199,6 +1199,7 @@ void processTypedGrid(openvdb::GridBase::Ptr grid, OpType& op)
else if (grid->isType<openvdb::Vec3IGrid>()) CALL_OP(openvdb::Vec3IGrid);
else if (grid->isType<openvdb::Vec3SGrid>()) CALL_OP(openvdb::Vec3SGrid);
else if (grid->isType<openvdb::Vec3DGrid>()) CALL_OP(openvdb::Vec3DGrid);
else if (grid->isType<openvdb::StringGrid>()) CALL_OP(openvdb::StringGrid);
#undef CALL_OP
}
@@ -1220,6 +1221,11 @@ struct PruneOp {
{
grid->tree().prune(typename GridType::ValueType(tolerance));
}
// Overload to handle string-valued grids
void operator()(openvdb::StringGrid::Ptr grid) const
{
grid->tree().prune();
}
};
// Read all grids from a file.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

+2 -2
View File
@@ -78,7 +78,7 @@ openvdb::math::Transform::Ptr linearTransform =
// Rotate the transform by 90 degrees about the X axis.
// As a result the j-index will now map into the -z physical direction,
// and the k-index will map to the +y physical direction.
linearTransform->preRotate(openvdb::math::pi<double>()/2.0, openvdb::math::X_AXIS);
linearTransform->preRotate(M_PI/2, openvdb::math::X_AXIS);
@endcode
@subsection sFrustumTransforms Frustum Transforms
@@ -302,7 +302,7 @@ convention of right-multiplication of the matrix against a vector:
openvdb::math::Mat4d transform = openvdb::math::Mat4d::identity();
transform.preScale(openvdb::math::Vec3d(2,3,2));
transform.postTranslate(openvdb::math::Vec3d(1,0,0));
transform.postRotate(openvdb::math::X_AXIS, openvdb::math::pi<double>()/3.0);
transform.postRotate(openvdb::math::X_AXIS, M_PI/3.0);
// Location of a point in index space
openvdb::math::Vec3d indexSpace(1,2,3);
+3 -3
View File
@@ -4,7 +4,7 @@
```cpp
#include <openvdb/tools/LevelSetSphere.h> // replace with your own dependencies for generating the OpenVDB grid
#include <nanovdb/util/CreateNanoGrid.h> // converter from OpenVDB to NanoVDB (includes NanoVDB.h and GridManager.h)
#include <nanovdb/util/OpenToNanoVDB.h> // converter from OpenVDB to NanoVDB (includes NanoVDB.h and GridManager.h)
#include <nanovdb/util/IO.h>
// Convert an openvdb level set sphere into a nanovdb, use accessors to print out multiple values from both
@@ -17,7 +17,7 @@ int main()
auto srcGrid = openvdb::tools::createLevelSetSphere<openvdb::FloatGrid>(100.0f, openvdb::Vec3f(0.0f), 1.0f);
// Convert the OpenVDB grid, srcGrid, into a NanoVDB grid handle.
auto handle = nanovdb::createNanoGrid(*srcGrid);
auto handle = nanovdb::openToNanoVDB(*srcGrid);
// Define a (raw) pointer to the NanoVDB grid on the host. Note we match the value type of the srcGrid!
auto* dstGrid = handle.grid<float>();
@@ -77,7 +77,7 @@ int main()
```cpp
#include <nanovdb/util/IO.h> // this is required to read (and write) NanoVDB files on the host
#include <nanovdb/util/cuda/CudaDeviceBuffer.h> // required for CUDA memory management
#include <nanovdb/DefaultCudaAllocator.h> // required for CUDA memory management
extern "C" void launch_kernels(const nanovdb::NanoGrid<float>*,
const nanovdb::NanoGrid<float>*,
+26 -131
View File
@@ -15,135 +15,30 @@
```bash
foo@bar:~$ tree
.
├── CMakeLists.txt
├── cmd
│ ├── CMakeLists.txt
│ ├── convert
│ │ └── nanovdb_convert.cc
│ ├── print
│ │ └── nanovdb_print.cc
│ └── validate
│ └── nanovdb_validate.cc
├── CNanoVDB.h
├── docs
│ ├── CMakeLists.txt
│ ├── codingstyle.txt
│ └── doxygen-config
├── examples
│ ├── benchmark
│ │ ├── BenchKernels_dense.cu
│ │ ├── BenchKernels_nano.cu
│ │ ├── Benchmark_dense.cu
│ │ ├── Benchmark_nano.cu
│ │ ├── Camera.h
│ │ ├── CMakeLists.txt
│ │ ├── DenseGrid.h
│ │ ├── Image.h
│ │ ├── TestBenchmark.cc
│ │ └── TestBenchmark.cu
│ ├── CMakeLists.txt
│ ├── ex_bump_pool_buffer
│ │ └── bump_pool_buffer.cc
│ ├── ex_collide_level_set
│ │ ├── common.h
│ │ ├── main.cc
│ │ ├── nanovdb.cu
│ │ └── openvdb.cc
│ ├── ex_index_grid_cuda
│ │ ├── index_grid_cuda.cu
│ │ └── index_grid_cuda_kernel.cu
│ ├── ex_make_custom_nanovdb
│ │ └── make_custom_nanovdb.cc
│ ├── ex_make_custom_nanovdb_cuda
│ │ ├── make_custom_nanovdb_cuda.cc
│ │ └── make_custom_nanovdb_cuda_kernel.cu
│ ├── ex_make_funny_nanovdb
│ │ └── make_funny_nanovdb.cc
│ ├── ex_make_nanovdb_sphere
│ │ └── make_nanovdb_sphere.cc
│ ├── ex_make_typed_grids
│ │ └── make_typed_grids.cc
│ ├── ex_map_pool_buffer
│ │ └── map_pool_buffer.cc
│ ├── ex_modify_nanovdb_thrust
│ │ └── modify_nanovdb_thrust.cu
│ ├── ex_nodemanager_cuda
│ │ ├── nodemanager_cuda.cc
│ │ └── nodemanager_cuda_kernel.cu
│ ├── ex_openvdb_to_nanovdb
│ │ └── openvdb_to_nanovdb.cc
│ ├── ex_openvdb_to_nanovdb_accessor
│ │ └── openvdb_to_nanovdb_accessor.cc
│ ├── ex_openvdb_to_nanovdb_cuda
│ │ ├── openvdb_to_nanovdb_cuda.cc
│ │ └── openvdb_to_nanovdb_cuda_kernel.cu
│ ├── ex_raytrace_fog_volume
│ │ ├── common.h
│ │ ├── main.cc
│ │ ├── nanovdb.cu
│ │ └── openvdb.cc
│ ├── ex_raytrace_level_set
│ │ ├── common.h
│ │ ├── main.cc
│ │ ├── nanovdb.cu
│ │ └── openvdb.cc
│ ├── ex_read_nanovdb_sphere
│ │ └── read_nanovdb_sphere.cc
│ ├── ex_read_nanovdb_sphere_accessor
│ │ └── read_nanovdb_sphere_accessor.cc
│ ├── ex_read_nanovdb_sphere_accessor_cuda
│ │ ├── read_nanovdb_sphere_accessor_cuda.cu
│ │ └── read_nanovdb_sphere_accessor_cuda_kernel.cu
│ ├── ex_util
│ │ └── ComputePrimitives.h
│ ├── ex_voxels_to_grid_cuda
│ │ └── ex_voxels_to_grid_cuda.cu
│ ├── ex_vox_to_nanovdb
│ │ ├── vox_to_nanovdb.cc
│ │ └── VoxToNanoVDB.h
│ └── ex_write_nanovdb_grids
│ └── write_nanovdb_grids.cc
├── NanoVDB.h
├── PNanoVDB.h
├── Readme.md
├── unittest
│ ├── CMakeLists.txt
│ ├── pnanovdb_validate_strides.h
│ ├── TestNanoVDB.cc
│ ├── TestNanoVDB.cu
│ └── TestOpenVDB.cc
└── util
├── CpuTimer.h
├── CreateNanoGrid.h
├── CSampleFromVoxels.h
├── cuda
│ ├── CudaAddBlindData.cuh
│ ├── CudaDeviceBuffer.h
│ ├── CudaGridHandle.cuh
│ ├── CudaIndexToGrid.cuh
│ ├── CudaPointsToGrid.cuh
│ ├── CudaSignedFloodFill.cuh
│ ├── CudaUtils.h
│ └── GpuTimer.cuh
├── DitherLUT.h
├── ForEach.h
├── GridBuilder.h
├── GridChecksum.h
├── GridHandle.h
├── GridStats.h
├── GridValidator.h
├── HDDA.h
├── HostBuffer.h
├── Invoke.h
├── IO.h
├── NanoToOpenVDB.h
├── NodeManager.h
├── OpenToNanoVDB.h
├── PrefixSum.h
├── Primitives.h
├── Range.h
├── Ray.h
├── Reduce.h
├── SampleFromVoxels.h
└── Stencils.h
├── nanovdb
│ ├── CNanoVDB.h
│ ├── NanoVDB.h
│ ├── PNanoVDB.h
│ └── util
│ ├── CSampleFromVoxels.h
│ ├── CudaDeviceBuffer.h
| ├── DitherLUT.h
│ ├── ForEach.h
│ ├── GridBuilder.h
│ ├── GridChecksum.h
│ ├── GridHandle.h
│ ├── GridStats.h
│ ├── GridValidator.h
│ ├── HDDA.h
│ ├── HostBuffer.h
│ ├── Invoke.h
│ ├── IO.h
│ ├── NanoToOpenVDB.h
│ ├── OpenToNanoVDB.h
| ├── Primitives.h
│ ├── Range.h
│ ├── Ray.h
| ├── Reduce.h
| ├── SampleFromVoxels.h
| └── Stencils.h
```
+4 -4
View File
@@ -2,7 +2,7 @@
Welcome to the NanoVDB documentation page.
* @subpage NanoVDB_HowToBuild
* @subpage NanoVDB_FAQ
* @subpage NanoVDB_SourceTree
* @subpage NanoVDB_HelloWorld
* @ref NanoVDB_HowToBuild
* @ref NanoVDB_FAQ
* @ref NanoVDB_SourceTree
* @ref NanoVDB_HelloWorld
+4 -2
View File
@@ -4,8 +4,10 @@
This section describes the OpenVDB Python module and includes Python code
snippets and some complete programs that illustrate how to perform common tasks.
The Python module exposes most of the functionality of the C++
@vdblink::Grid Grid@endlink class, including I/O, metadata
(An <a href="./python/index.html">API reference</a> is also available,
if <a href="http://epydoc.sourceforge.net/">Epydoc</a> is installed.)
As of OpenVDB 2.0, the Python module exposes most of the functionality
of the C++ @vdblink::Grid Grid@endlink class, including I/O, metadata
management, voxel access and iteration, but almost none of the many
@ref secToolUtils "tools".
We expect to add support for tools in forthcoming releases.
+7 -23
View File
@@ -7,7 +7,7 @@
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
project(NanoVDB LANGUAGES C CXX)
include(GNUInstallDirs)
@@ -25,7 +25,7 @@ message(STATUS "----------------------------------------------------")
option(NANOVDB_BUILD_TOOLS "Build command-line tools" ON)
option(NANOVDB_BUILD_UNITTESTS "Build Unit tests" OFF)
option(NANOVDB_BUILD_EXAMPLES "Build examples" OFF)
#option(NANOVDB_BUILD_BENCHMARK "Build benchmark in examples" OFF)
option(NANOVDB_BUILD_BENCHMARK "Build benchmark in examples" OFF)
option(NANOVDB_USE_INTRINSICS "Build with hardware intrinsics support" OFF)
option(NANOVDB_USE_CUDA "Build with CUDA support" OFF)
@@ -71,13 +71,12 @@ if(UNIX)
find_package(Threads REQUIRED)
endif()
#if(NANOVDB_BUILD_UNITTESTS OR NANOVDB_BUILD_BENCHMARK)
if(NANOVDB_BUILD_UNITTESTS)
if(NANOVDB_BUILD_UNITTESTS OR NANOVDB_BUILD_BENCHMARK)
find_package(GTest REQUIRED)
endif()
if(NANOVDB_USE_CUDA)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD 11)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
@@ -119,6 +118,8 @@ endif()
if(NANOVDB_USE_OPENVDB)
if(NOT OPENVDB_BUILD_CORE AND NOT TARGET OpenVDB::openvdb)
find_package(OpenVDB REQUIRED COMPONENTS openvdb)
# disable the shared libs that OpenVDB's cmake switches ON.
set(BUILD_SHARED_LIBS OFF)
endif()
endif()
@@ -166,20 +167,8 @@ set(NANOVDB_INCLUDE_FILES
# NanoVDB util header files
set(NANOVDB_INCLUDE_UTILFILES
util/CpuTimer.h
util/CreateNanoGrid.h
util/CSampleFromVoxels.h
util/cuda/CudaAddBlindData.cuh
util/cuda/CudaDeviceBuffer.h
util/cuda/CudaGridChecksum.cuh
util/cuda/CudaGridHandle.cuh
util/cuda/CudaGridStats.cuh
util/cuda/CudaIndexToGrid.cuh
util/cuda/CudaNodeManager.cuh
util/cuda/CudaPointsToGrid.cuh
util/cuda/CudaSignedFloodFill.cuh
util/cuda/CudaUtils.h
util/cuda/GpuTimer.h
util/CudaDeviceBuffer.h
util/DitherLUT.h
util/ForEach.h
util/GridBuilder.h
@@ -194,7 +183,6 @@ set(NANOVDB_INCLUDE_UTILFILES
util/NanoToOpenVDB.h
util/NodeManager.h
util/OpenToNanoVDB.h
util/PrefixSum.h
util/Primitives.h
util/Range.h
util/Ray.h
@@ -251,10 +239,6 @@ if(NANOVDB_USE_CUDA)
target_compile_options(nanovdb INTERFACE
"$<$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>:-arch=sm_75>")
endif()
# Add CUDA includes to any C++ units which use NanoVDB
target_include_directories(nanovdb INTERFACE
${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
endif()
if(NANOVDB_USE_MAGICAVOXEL)
+1 -1
View File
@@ -687,7 +687,7 @@ cnanovdb_griddata_valid(const CNANOVDB_GLOBAL cnanovdb_griddata *RESTRICT grid)
{
if (!grid)
return 0;
if (grid->mMagic != 0x304244566f6e614eUL && grid->mMagic != 0x314244566f6e614eUL)
if (grid->mMagic != 0x304244566f6e614eUL)
return 0;
return 1;
}
+1003 -4434
View File
File diff suppressed because it is too large Load Diff
+2502 -3384
View File
File diff suppressed because it is too large Load Diff
+5 -4
View File
@@ -3,10 +3,11 @@
# NanoVDB:
A lightweight GPU friendly version of VDB initially targeting rendering applications.
* [Build instructions for make and cmake](../../doc/nanovdb/HowToBuild.md)
* [Frequently asked questions](../../doc/nanovdb/FAQ.md)
* [Source tree](../../doc/nanovdb/SourceTree.md)
* [Examples](../../doc/nanovdb/HelloWorld.md)
* [Build instructions for make and cmake](docs/HowToBuild.md)
* [Frequently asked questions](docs/FAQ.md)
* [Grid cells vs grid nodes](docs/GridCells_vs_GridNodes/Main.pdf)
* [Source tree](docs/SourceTree.md)
* [Examples](docs/HelloWorld.md)
### Copyright Contributors to the OpenVDB Project
### SPDX-License-Identifier: MPL-2.0
+1 -1
View File
@@ -7,7 +7,7 @@
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
project(NanoVDBExamples LANGUAGES CXX)
include(GNUInstallDirs)
+32 -26
View File
@@ -16,7 +16,7 @@
#include <cctype>
#include <nanovdb/util/IO.h> // this is required to read (and write) NanoVDB files on the host
#include <nanovdb/util/CreateNanoGrid.h>
#include <nanovdb/util/OpenToNanoVDB.h>
#include <nanovdb/util/NanoToOpenVDB.h>
void usage [[noreturn]] (const std::string& progName, int exitStatus = EXIT_FAILURE)
@@ -201,26 +201,36 @@ int main(int argc, char* argv[])
auto openToNano = [&](const openvdb::GridBase::Ptr& base)
{
using SrcGridT = openvdb::FloatGrid;
if (auto floatGrid = openvdb::GridBase::grid<SrcGridT>(base)) {
nanovdb::CreateNanoGrid<SrcGridT> s(*floatGrid);
s.setStats(sMode);
s.setChecksum(cMode);
s.enableDithering(dither);
s.setVerbose(verbose ? 1 : 0);
if (auto floatGrid = openvdb::GridBase::grid<openvdb::FloatGrid>(base)) {
switch (qMode) {
case nanovdb::GridType::Fp4:
return s.getHandle<nanovdb::Fp4>();
case nanovdb::GridType::Fp8:
return s.getHandle<nanovdb::Fp8>();
case nanovdb::GridType::Fp16:
return s.getHandle<nanovdb::Fp16>();
case nanovdb::GridType::FpN:
case nanovdb::GridType::Fp4: {
nanovdb::OpenToNanoVDB<float, nanovdb::Fp4> s;
s.enableDithering(dither);
return s(*floatGrid, sMode, cMode, verbose ? 1 : 0);
}
case nanovdb::GridType::Fp8: {
nanovdb::OpenToNanoVDB<float, nanovdb::Fp8> s;
s.enableDithering(dither);
return s(*floatGrid, sMode, cMode, verbose ? 1 : 0);
}
case nanovdb::GridType::Fp16: {
nanovdb::OpenToNanoVDB<float, nanovdb::Fp16> s;
s.enableDithering(dither);
return s(*floatGrid, sMode, cMode, verbose ? 1 : 0);
}
case nanovdb::GridType::FpN: {
if (absolute) {
return s.getHandle<nanovdb::FpN>(nanovdb::AbsDiff(tolerance));
nanovdb::OpenToNanoVDB<float, nanovdb::FpN, nanovdb::AbsDiff> s;
s.enableDithering(dither);
s.oracle() = nanovdb::AbsDiff(tolerance);
return s(*floatGrid, sMode, cMode, verbose ? 1 : 0);
} else {
return s.getHandle<nanovdb::FpN>(nanovdb::RelDiff(tolerance));
nanovdb::OpenToNanoVDB<float, nanovdb::FpN, nanovdb::RelDiff> s;
s.enableDithering(dither);
s.oracle() = nanovdb::RelDiff(tolerance);
return s(*floatGrid, sMode, cMode, verbose ? 1 : 0);
}
}
default:
break;
}// end of switch
@@ -241,15 +251,13 @@ int main(int argc, char* argv[])
file.open(false); //disable delayed loading
if (gridName.empty()) {// convert all grid in the file
auto grids = file.getGrids();
std::vector<nanovdb::GridHandle<nanovdb::HostBuffer> > handles;
for (auto& grid : *grids) {
if (verbose) {
std::cout << "Converting OpenVDB grid named \"" << grid->getName() << "\" to NanoVDB" << std::endl;
}
handles.push_back(openToNano(grid));
auto handle = openToNano(grid);
nanovdb::io::writeGrid(os, handle, codec);
} // loop over OpenVDB grids in file
auto handle = nanovdb::mergeGrids<nanovdb::HostBuffer, std::vector>(handles);
nanovdb::io::writeGrid(os, handle, codec);
} else {// convert only grid with matching name
auto grid = file.readGrid(gridName);
if (verbose) {
@@ -272,11 +280,9 @@ int main(int argc, char* argv[])
if (gridName.empty()) {
auto handles = nanovdb::io::readGrids(inputFile, verbose);
for (auto &h : handles) {
for (uint32_t i = 0; i < h.gridCount(); ++i) {
if (verbose)
std::cout << "Converting NanoVDB grid named \"" << h.gridMetaData(i)->shortGridName() << "\" to OpenVDB" << std::endl;
grids->push_back(nanoToOpenVDB(h, 0, i));
}
if (verbose)
std::cout << "Converting NanoVDB grid named \"" << h.gridMetaData()->shortGridName() << "\" to OpenVDB" << std::endl;
grids->push_back(nanoToOpenVDB(h));
}
} else {
auto handle = nanovdb::io::readGrid(inputFile, gridName);
+5 -5
View File
@@ -103,7 +103,7 @@ int main(int argc, char* argv[])
if (size > n)
n = size;
};
auto Vec3dToStr = [](const nanovdb::Vec3d& v) {
auto vec3RToStr = [](const nanovdb::Vec3R& v) {
std::stringstream ss;
ss << std::setprecision(3);
ss << "(" << v[0] << "," << v[1] << "," << v[2] << ")";
@@ -148,7 +148,7 @@ int main(int argc, char* argv[])
for (auto& file : fileNames) {
auto list = nanovdb::io::readGridMetaData(file);
if (!gridName.empty()) {
std::vector<nanovdb::io::FileGridMetaData> tmp;
std::vector<nanovdb::io::GridMetaData> tmp;
for (auto& m : list) {
if (nameKey == m.nameKey && gridName == m.gridName)
tmp.emplace_back(m);
@@ -186,7 +186,7 @@ int main(int argc, char* argv[])
width(configWidth, nodesToStr(m.nodeCount));
width(tileWidth, nodesToStr(m.tileCount));
width(voxelsWidth, std::to_string(m.voxelCount));
width(voxelSizeWidth, Vec3dToStr(m.voxelSize));
width(voxelSizeWidth, vec3RToStr(m.voxelSize));
}
std::cout << "\nThe file \"" << file << "\" contains the following ";
if (list.size()>1) {
@@ -227,7 +227,7 @@ int main(int argc, char* argv[])
<< std::left << std::setw(codecWidth) << nanovdb::io::toStr(m.codec)
<< std::left << std::setw(sizeWidth) << format(m.gridSize)
<< std::left << std::setw(fileWidth) << format(m.fileSize)
<< std::left << std::setw(voxelSizeWidth) << Vec3dToStr(m.voxelSize);
<< std::left << std::setw(voxelSizeWidth) << vec3RToStr(m.voxelSize);
}
std::cout << std::left << std::setw(voxelsWidth) << m.voxelCount
<< std::left << std::setw(resWidth) << resToStr(m.indexBBox);
@@ -316,7 +316,7 @@ int main(int argc, char* argv[])
exitStatus = EXIT_FAILURE;
}
catch (...) {
std::cerr << "Exception of unexpected type caught" << std::endl;
std::cerr << "Exception oof unexpected type caught" << std::endl;
exitStatus = EXIT_FAILURE;
}
@@ -77,7 +77,7 @@ int main(int argc, char* argv[])
for (auto& file : fileNames) {
auto list = nanovdb::io::readGridMetaData(file);
if (!gridName.empty()) {
std::vector<nanovdb::io::FileGridMetaData> tmp;
std::vector<nanovdb::io::GridMetaData> tmp;
for (auto& m : list) {
if (nameKey == m.nameKey && gridName == m.gridName)
tmp.emplace_back(m);
+4 -8
View File
@@ -7,7 +7,7 @@
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.15)
project(NanoVDBExamples LANGUAGES CXX)
include(GNUInstallDirs)
@@ -83,12 +83,11 @@ endfunction()
# -----------------------------------------------------------------------
#if(NANOVDB_BUILD_BENCHMARK)
# add_subdirectory(benchmark)
#endif()
if(NANOVDB_BUILD_BENCHMARK)
add_subdirectory(benchmark)
endif()
nanovdb_example(NAME "ex_make_custom_nanovdb")
nanovdb_example(NAME "ex_make_custom_nanovdb_cuda")
nanovdb_example(NAME "ex_make_funny_nanovdb")
nanovdb_example(NAME "ex_make_typed_grids")
nanovdb_example(NAME "ex_make_nanovdb_sphere")
@@ -99,9 +98,6 @@ nanovdb_example(NAME "ex_openvdb_to_nanovdb_cuda" OPENVDB)
nanovdb_example(NAME "ex_read_nanovdb_sphere")
nanovdb_example(NAME "ex_read_nanovdb_sphere_accessor")
nanovdb_example(NAME "ex_read_nanovdb_sphere_accessor_cuda")
nanovdb_example(NAME "ex_index_grid_cuda")
nanovdb_example(NAME "ex_nodemanager_cuda")
nanovdb_example(NAME "ex_voxels_to_grid_cuda")
nanovdb_example(NAME "ex_modify_nanovdb_thrust")
nanovdb_example(NAME "ex_map_pool_buffer")
nanovdb_example(NAME "ex_bump_pool_buffer")
@@ -0,0 +1,108 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
/// @file BenchKernels_dense.cu
///
/// @author Ken Museth
///
/// @brief CUDA kernel for a simple ray-tracing benchmark test.
#include "DenseGrid.h"
#include <nanovdb/util/CudaDeviceBuffer.h> // for CUDA memory management
#include <nanovdb/util/Ray.h> // for nanovdb::Ray
#include <nanovdb/util/HDDA.h> // for nanovdb::DDA
#include "Image.h"
#include "Camera.h"
// Comment out to disable timing of the CUDA kernel
#define CUDA_TIMING
// This is called by the device
__global__ void render_kernel(const nanovdb::DenseGrid<float>& grid,
const nanovdb::Camera<float>& camera,
nanovdb::Image& img)
{
using RealT = float;
using Vec3T = nanovdb::Vec3<RealT>;
using CoordT = nanovdb::Coord;
using RayT = nanovdb::Ray<RealT>;
using ColorRGB = nanovdb::Image::ColorRGB;
const int w = blockIdx.x * blockDim.x + threadIdx.x;
const int h = blockIdx.y * blockDim.y + threadIdx.y;
if (w >= img.width() || h >= img.height()) return;
RayT ray = camera.getRay(img.u(w), img.v(h));// ray in world space
ray = ray.worldToIndexF(grid);// ray in index space
if (ray.clip(grid.indexBBox().expandBy(-1))) {// clip to the index bounding box
nanovdb::DDA<RayT> dda(ray);
const float v0 = grid.getValue(dda.voxel());
while( dda.step() ) {
CoordT ijk = dda.voxel();
const float v1 = grid.getValue(ijk);
if (v0*v1>0) continue;
#if 1// second-order central difference
Vec3T grad(grid.getValue(ijk.offsetBy(1,0,0)) - grid.getValue(ijk.offsetBy(-1,0,0)),
grid.getValue(ijk.offsetBy(0,1,0)) - grid.getValue(ijk.offsetBy(0,-1,0)),
grid.getValue(ijk.offsetBy(0,0,1)) - grid.getValue(ijk.offsetBy(0,0,-1)));
#else// first order single-sided difference
Vec3T grad(-v0);
ijk[0] += 1;
grad[0] += grid.getValue(ijk);
ijk[0] -= 1;
ijk[1] += 1;
grad[1] += grid.getValue(ijk);
ijk[1] -= 1;
ijk[2] += 1;
grad[2] += grid.getValue(ijk);
#endif
grad *= rnorm3df(grad[0], grad[1], grad[2]);
img(w, h) = ColorRGB(abs(grad.dot(ray.dir())), 0, 0);
return;
}
}
const int checkerboard = 1 << 7;
img(w, h) = ((h & checkerboard) ^ (w & checkerboard)) ? ColorRGB(1, 1, 1) : ColorRGB(0, 0, 0);
}
// This is called by the host
extern "C" float launch_kernels(const nanovdb::DenseGridHandle<nanovdb::CudaDeviceBuffer>& gridHandle,
nanovdb::ImageHandle<nanovdb::CudaDeviceBuffer>& imgHandle,
const nanovdb::Camera<float>* camera,
cudaStream_t stream)
{
const auto* img = imgHandle.image(); // host image!
auto round = [](int a, int b) { return (a + b - 1) / b; };
const dim3 threadsPerBlock(8, 8), numBlocks(round(img->width(), threadsPerBlock.x), round(img->height(), threadsPerBlock.y));
auto* deviceGrid = gridHandle.deviceGrid<float>(); // note this cannot be de-referenced since it points to a memory address on the GPU!
auto* deviceImage = imgHandle.deviceImage(); // note this cannot be de-referenced since it points to a memory address on the GPU!
assert(deviceGrid && deviceImage);
#ifdef CUDA_TIMING
cudaEvent_t start, stop;
cudaEventCreate(&start);
cudaEventCreate(&stop);
cudaEventRecord(start, stream);
#endif
// kernal syntax: <<<blocks per grid, threads per block, dynamic shared memory per block, stream >>>
render_kernel<<<numBlocks, threadsPerBlock, 0, stream>>>(*deviceGrid, *camera, *deviceImage);
float elapsedTime = 0.0f;
#ifdef CUDA_TIMING
cudaEventRecord(stop, stream);
cudaEventSynchronize(stop);
cudaEventElapsedTime(&elapsedTime, start, stop);
//printf("DenseGrid: GPU kernel with %i rays ... completed in %5.3f milliseconds\n", imgHandle.image()->size(), elapsedTime);
cudaError_t errCode = cudaGetLastError();
if (errCode != cudaSuccess) {
fprintf(stderr, "CUDA Runtime Error: %s %s %d\n", cudaGetErrorString(errCode), __FILE__, __LINE__);
exit(errCode);
}
cudaEventDestroy(start);
cudaEventDestroy(stop);
#endif
return elapsedTime;
}
@@ -0,0 +1,112 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
/// @file BenchKernels.cu
///
/// @author Ken Museth
///
/// @brief CUDA kernel for a simple ray-tracing benchmark test.
#include <nanovdb/util/GridHandle.h> // for nanovdb::GridHandle
#include <nanovdb/util/CudaDeviceBuffer.h> // for CUDA memory management
#include <nanovdb/util/Ray.h> // for nanovdb::Ray
#include <nanovdb/util/HDDA.h> // for nanovdb::ZeroCrossing
#include "Image.h"
#include "Camera.h"
// Comment out to disable timing of the CUDA kernel
#define CUDA_TIMING
// This is called by the device
template <typename T>
__global__ void render_kernel(const nanovdb::NanoGrid<T>& grid,
const nanovdb::Camera<float>& camera,
nanovdb::Image& img)
{
using RealT = float;
using Vec3T = nanovdb::Vec3<RealT>;
using CoordT = nanovdb::Coord;
using RayT = nanovdb::Ray<RealT>;
using ColorRGB = nanovdb::Image::ColorRGB;
const int w = blockIdx.x * blockDim.x + threadIdx.x;
const int h = blockIdx.y * blockDim.y + threadIdx.y;
if (w >= img.width() || h >= img.height())
return;
const auto& tree = grid.tree();
const auto& bbox = tree.bbox();
RayT ray = camera.getRay(img.u(w), img.v(h));
ray = ray.worldToIndexF(grid);
auto acc = tree.getAccessor();
CoordT ijk;
float t;
float v0;
if (nanovdb::ZeroCrossing(ray, acc, ijk, v0, t)) {
#if 1// second-order central difference
Vec3T grad(acc.getValue(ijk.offsetBy(1,0,0)) - acc.getValue(ijk.offsetBy(-1,0,0)),
acc.getValue(ijk.offsetBy(0,1,0)) - acc.getValue(ijk.offsetBy(0,-1,0)),
acc.getValue(ijk.offsetBy(0,0,1)) - acc.getValue(ijk.offsetBy(0,0,-1)));
#else// first order single-sided difference
Vec3T grad(-v0);
ijk[0] += 1;
grad[0] += acc.getValue(ijk);
ijk[0] -= 1;
ijk[1] += 1;
grad[1] += acc.getValue(ijk);
ijk[1] -= 1;
ijk[2] += 1;
grad[2] += acc.getValue(ijk);
#endif
grad *= rnorm3df(grad[0], grad[1], grad[2]);
img(w, h) = ColorRGB(abs(grad.dot(ray.dir())), 0, 0);
} else {
const int checkerboard = 1 << 7;
img(w, h) = ((h & checkerboard) ^ (w & checkerboard)) ? ColorRGB(1, 1, 1) : ColorRGB(0, 0, 0);
}
}
// This is called by the host
extern "C" float launch_kernels(const nanovdb::GridHandle<nanovdb::CudaDeviceBuffer>& gridHandle,
nanovdb::ImageHandle<nanovdb::CudaDeviceBuffer>& imgHandle,
const nanovdb::Camera<float>* camera,
cudaStream_t stream)
{
using BuildT = nanovdb::FpN;
const auto* img = imgHandle.image(); // host image!
auto round = [](int a, int b) { return (a + b - 1) / b; };
const dim3 threadsPerBlock(8, 8), numBlocks(round(img->width(), threadsPerBlock.x), round(img->height(), threadsPerBlock.y));
auto* deviceGrid = gridHandle.deviceGrid<BuildT>(); // note this cannot be de-referenced since it points to a memory address on the GPU!
auto* deviceImage = imgHandle.deviceImage(); // note this cannot be de-referenced since it points to a memory address on the GPU!
assert(deviceGrid && deviceImage);
#ifdef CUDA_TIMING
cudaEvent_t start, stop;
cudaEventCreate(&start);
cudaEventCreate(&stop);
cudaEventRecord(start, stream);
#endif
// kernal syntax: <<<blocks per grid, threads per block, dynamic shared memory per block, stream >>>
render_kernel<<<numBlocks, threadsPerBlock, 0, stream>>>(*deviceGrid, *camera, *deviceImage);
float elapsedTime = 0.0f;
#ifdef CUDA_TIMING
cudaEventRecord(stop, stream);
cudaEventSynchronize(stop);
cudaEventElapsedTime(&elapsedTime, start, stop);
//printf("NanoVDB: GPU kernel with %i rays ... completed in %5.3f milliseconds\n", imgHandle.image()->size(), elapsedTime);
cudaError_t errCode = cudaGetLastError();
if (errCode != cudaSuccess) {
fprintf(stderr, "CUDA Runtime Error: %s %s %d\n", cudaGetErrorString(errCode), __FILE__, __LINE__);
exit(errCode);
}
cudaEventDestroy(start);
cudaEventDestroy(stop);
#endif
return elapsedTime;
}
@@ -0,0 +1,721 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
/// @file Benchmark.cc
///
/// @author Ken Museth
///
/// @brief A simple ray-tracing benchmark test.
#include <nanovdb/util/IO.h>
#include <nanovdb/util/Ray.h>
#include <nanovdb/util/HDDA.h>
#include <nanovdb/util/Primitives.h>
#include <nanovdb/util/SampleFromVoxels.h>
#include "Image.h"
#include "Camera.h"
#include "../ex_util/CpuTimer.h"
#include "DenseGrid.h"
#if defined(NANOVDB_USE_CUDA)
#include <nanovdb/util/CudaDeviceBuffer.h>
#endif
#if defined(NANOVDB_USE_OPENVDB)
#include <nanovdb/util/OpenToNanoVDB.h>
#include <openvdb/openvdb.h>
#include <openvdb/tools/LevelSetSphere.h>
#include <openvdb/tools/LevelSetPlatonic.h>
#include <openvdb/tools/RayIntersector.h>
#include <openvdb/math/Ray.h>
#include <openvdb/math/Transform.h>
#endif
#if defined(NANOVDB_USE_TBB)
#include <tbb/parallel_for.h>
#include <tbb/blocked_range2d.h>
#endif
#include <gtest/gtest.h>
namespace nanovdb {
inline std::ostream&
operator<<(std::ostream& os, const CoordBBox& b)
{
os << "(" << b[0][0] << "," << b[0][1] << "," << b[0][2] << ") ->"
<< "(" << b[1][0] << "," << b[1][1] << "," << b[1][2] << ")";
return os;
}
inline std::ostream&
operator<<(std::ostream& os, const Coord& ijk)
{
os << "(" << ijk[0] << "," << ijk[1] << "," << ijk[2] << ")";
return os;
}
template <typename T>
inline std::ostream&
operator<<(std::ostream& os, const Vec3<T>& v)
{
os << "(" << v[0] << "," << v[1] << "," << v[2] << ")";
return os;
}
}
// define the environment variable VDB_DATA_PATH to use models from the web
// e.g. setenv VDB_DATA_PATH /home/kmu/dev/data/vdb
// or export VDB_DATA_PATH=/Users/ken/dev/data/vdb
// define the environment variable VDB_SCRATCH_PATH to specify the directory where image are saved
// The fixture for testing class.
class Benchmark : public ::testing::Test
{
protected:
Benchmark() {}
~Benchmark() override {}
// If the constructor and destructor are not enough for setting up
// and cleaning up each test, you can define the following methods:
void SetUp() override
{
// Code here will be called immediately after the constructor (right
// before each test).
}
void TearDown() override
{
// Code here will be called immediately after each test (right
// before the destructor).
}
std::string getEnvVar(const std::string& name, const std::string def = "") const
{
const char* str = std::getenv(name.c_str());
return str == nullptr ? def : std::string(str);
}
#if defined(NANOVDB_USE_OPENVDB)
openvdb::FloatGrid::Ptr getSrcGrid(int verbose = 1)
{
openvdb::FloatGrid::Ptr grid;
const std::string path = this->getEnvVar("VDB_DATA_PATH");
if (path.empty()) { // create a narrow-band level set sphere
std::cout << "\tSet the environment variable \"VDB_DATA_PATH\" to a directory\n"
<< "\tcontaining OpenVDB level sets files. They can be downloaded\n"
<< "\there: https://www.openvdb.org/download/" << std::endl;
const float radius = 50.0f;
const openvdb::Vec3f center(0.0f, 0.0f, 0.0f);
const float voxelSize = 0.1f, width = 3.0f;
if (verbose > 0) {
std::stringstream ss;
ss << "Generating level set sphere with a radius of " << radius << " voxels";
mTimer.start(ss.str());
}
#if 1 // choose between a sphere or one of five platonic solids
grid = openvdb::tools::createLevelSetSphere<openvdb::FloatGrid>(radius, center, voxelSize, width);
grid->setName("ls_sphere");
#else
const int faces[5] = {4, 6, 8, 12, 20};
grid = openvdb::tools::createLevelSetPlatonic<openvdb::FloatGrid>(faces[4], radius, center, voxelSize, width);
grid->setName("ls_platonic");
#endif
} else {
openvdb::initialize();
const std::vector<std::string> models = {"armadillo.vdb", "buddha.vdb", "bunny.vdb", "crawler.vdb", "dragon.vdb", "iss.vdb", "space.vdb", "torus_knot_helix.vdb", "utahteapot.vdb", "bunny_cloud.vdb", "wdas_cloud.vdb"};
const std::string fileName = path + "/" + models[4]; //
if (verbose > 0)
mTimer.start("Reading grid from the file \"" + fileName + "\"");
openvdb::io::File file(fileName);
file.open(false); //disable delayed loading
grid = openvdb::gridPtrCast<openvdb::FloatGrid>(file.readGrid(file.beginName().gridName()));
}
if (verbose > 0)
mTimer.stop();
if (verbose > 1)
grid->print(std::cout, 3);
return grid;
}
#endif
nanovdb::CpuTimer<> mTimer;
}; // Benchmark
TEST_F(Benchmark, Ray)
{
using RealT = float;
using Vec3T = nanovdb::Vec3<RealT>;
using CoordT = nanovdb::Coord;
using CoordBBoxT = nanovdb::BBox<CoordT>;
using BBoxT = nanovdb::BBox<Vec3T>;
using RayT = nanovdb::Ray<RealT>;
{// clip ray against an index bbox
// test bbox clip
const Vec3T dir(-1.0, 2.0, 3.0);
const Vec3T eye(2.0, 1.0, 1.0);
RealT t0 = 0.1, t1 = 12589.0;
RayT ray(eye, dir, t0, t1);
// intersects the two faces of the box perpendicular to the y-axis!
EXPECT_TRUE(ray.clip(CoordBBoxT(CoordT(0, 2, 2), CoordT(2, 4, 6))));
//std::cerr << "t0 = " << ray.t0() << ", ray.t1() = " << ray.t1() << std::endl;
//std::cerr << "ray(0.5) = " << ray(0.5) << std::endl;
//std::cerr << "ray(1.5) = " << ray(1.5) << std::endl;
//std::cerr << "ray(2.0) = " << ray(2.0) << std::endl;
EXPECT_EQ(0.5, ray.t0());
EXPECT_EQ(2.0, ray.t1());
EXPECT_EQ(ray(0.5)[1], 2); //lower y component of intersection
EXPECT_EQ(ray(2.0)[1], 5); //higher y component of intersection
ray.reset(eye, dir, t0, t1);
// intersects the lower edge anlong the z-axis of the box
EXPECT_TRUE(ray.clip(BBoxT(Vec3T(1.5, 2.0, 2.0), Vec3T(4.5, 4.0, 6.0))));
EXPECT_EQ(0.5, ray.t0());
EXPECT_EQ(0.5, ray.t1());
EXPECT_EQ(ray(0.5)[0], 1.5); //lower y component of intersection
EXPECT_EQ(ray(0.5)[1], 2.0); //higher y component of intersection
ray.reset(eye, dir, t0, t1);
// no intersections
EXPECT_TRUE(!ray.clip(CoordBBoxT(CoordT(4, 2, 2), CoordT(6, 4, 6))));
EXPECT_EQ(t0, ray.t0());
EXPECT_EQ(t1, ray.t1());
}
{// clip ray against an real bbox
// test bbox clip
const Vec3T dir(-1.0, 2.0, 3.0);
const Vec3T eye(2.0, 1.0, 1.0);
RealT t0 = 0.1, t1 = 12589.0;
RayT ray(eye, dir, t0, t1);
// intersects the two faces of the box perpendicular to the y-axis!
EXPECT_TRUE( ray.clip(CoordBBoxT(CoordT(0, 2, 2), CoordT(2, 4, 6)).asReal<double>()) );
//std::cerr << "t0 = " << ray.t0() << ", ray.t1() = " << ray.t1() << std::endl;
//std::cerr << "ray(0.5) = " << ray(0.5) << std::endl;
//std::cerr << "ray(1.5) = " << ray(1.5) << std::endl;
//std::cerr << "ray(2.0) = " << ray(2.0) << std::endl;
EXPECT_EQ(0.5, ray.t0());
EXPECT_EQ(2.0, ray.t1());
EXPECT_EQ(ray(0.5)[1], 2); //lower y component of intersection
EXPECT_EQ(ray(1.5)[1], 4); //higher y component of intersection
ray.reset(eye, dir, t0, t1);
// intersects the lower edge along the z-axis of the box
EXPECT_TRUE( ray.clip(BBoxT(Vec3T(1.5, 2.0, 2.0), Vec3T(4.5, 4.0, 6.0))) );
EXPECT_EQ(0.5, ray.t0());
EXPECT_EQ(0.5, ray.t1());
EXPECT_EQ(ray(0.5)[0], 1.5); //lower y component of intersection
EXPECT_EQ(ray(0.5)[1], 2.0); //higher y component of intersection
ray.reset(eye, dir, t0, t1);
// no intersections
EXPECT_TRUE(!ray.clip(CoordBBoxT(CoordT(4, 2, 2), CoordT(6, 4, 6)).asReal<double>()) );
EXPECT_EQ(t0, ray.t0());
EXPECT_EQ(t1, ray.t1());
}
}
TEST_F(Benchmark, HDDA)
{
using RealT = float;
using CoordT = nanovdb::Coord;
using RayT = nanovdb::Ray<RealT>;
using Vec3T = RayT::Vec3T;
{ // basic test
using DDAT = nanovdb::HDDA<RayT, CoordT>;
const RayT::Vec3T dir(1.0, 0.0, 0.0);
const RayT::Vec3T eye(-1.0, 0.0, 0.0);
const RayT ray(eye, dir);
DDAT dda(ray, 1 << (3 + 4 + 5));
EXPECT_EQ(nanovdb::Delta<RealT>::value(), dda.time());
EXPECT_EQ(1.0, dda.next());
dda.step();
EXPECT_EQ(1.0, dda.time());
EXPECT_EQ(4096 + 1.0, dda.next());
}
{ // Check for the notorious +-0 issue!
using DDAT = nanovdb::HDDA<RayT, CoordT>;
const Vec3T dir1(1.0, 0.0, 0.0);
const Vec3T eye1(2.0, 0.0, 0.0);
const RayT ray1(eye1, dir1);
DDAT dda1(ray1, 1 << 3);
dda1.step();
const Vec3T dir2(1.0, -0.0, -0.0);
const Vec3T eye2(2.0, 0.0, 0.0);
const RayT ray2(eye2, dir2);
DDAT dda2(ray2, 1 << 3);
dda2.step();
const Vec3T dir3(1.0, -1e-9, -1e-9);
const Vec3T eye3(2.0, 0.0, 0.0);
const RayT ray3(eye3, dir3);
DDAT dda3(ray3, 1 << 3);
dda3.step();
const Vec3T dir4(1.0, -1e-9, -1e-9);
const Vec3T eye4(2.0, 0.0, 0.0);
const RayT ray4(eye3, dir4);
DDAT dda4(ray4, 1 << 3);
dda4.step();
EXPECT_EQ(dda1.time(), dda2.time());
EXPECT_EQ(dda2.time(), dda3.time());
EXPECT_EQ(dda3.time(), dda4.time());
EXPECT_EQ(dda1.next(), dda2.next());
EXPECT_EQ(dda2.next(), dda3.next());
EXPECT_EQ(dda3.next(), dda4.next());
}
{ // test voxel traversal along both directions of each axis
using DDAT = nanovdb::HDDA<RayT>;
const Vec3T eye(0, 0, 0);
for (int s = -1; s <= 1; s += 2) {
for (int a = 0; a < 3; ++a) {
const int d[3] = {s * (a == 0), s * (a == 1), s * (a == 2)};
const Vec3T dir(d[0], d[1], d[2]);
RayT ray(eye, dir);
DDAT dda(ray, 1 << 0);
for (int i = 1; i <= 10; ++i) {
EXPECT_TRUE(dda.step());
EXPECT_EQ(i, dda.time());
}
}
}
}
{ // test Node traversal along both directions of each axis
using DDAT = nanovdb::HDDA<RayT, CoordT>;
const Vec3T eye(0, 0, 0);
for (int s = -1; s <= 1; s += 2) {
for (int a = 0; a < 3; ++a) {
const int d[3] = {s * (a == 0), s * (a == 1), s * (a == 2)};
const Vec3T dir(d[0], d[1], d[2]);
RayT ray(eye, dir);
DDAT dda(ray, 1 << 3);
for (int i = 1; i <= 10; ++i) {
EXPECT_TRUE(dda.step());
EXPECT_EQ(8 * i, dda.time());
}
}
}
}
{ // test accelerated Node traversal along both directions of each axis
using DDAT = nanovdb::HDDA<RayT, CoordT>;
const Vec3T eye(0, 0, 0);
for (int s = -1; s <= 1; s += 2) {
for (int a = 0; a < 3; ++a) {
const int d[3] = {s * (a == 0), s * (a == 1), s * (a == 2)};
const Vec3T dir(2 * d[0], 2 * d[1], 2 * d[2]);
RayT ray(eye, dir);
DDAT dda(ray, 1 << 3);
double next = 0;
for (int i = 1; i <= 10; ++i) {
EXPECT_TRUE(dda.step());
EXPECT_EQ(4 * i, dda.time());
if (i > 1) {
EXPECT_EQ(dda.time(), next);
}
next = dda.next();
}
}
}
}
} // HDDA
TEST_F(Benchmark, DenseGrid)
{
{// CoordT = nanovdb::Coord
using GridT = nanovdb::DenseGrid<float>;
const nanovdb::Coord min(-10,0,10), max(10,20,30), pos(0,5,20);
const nanovdb::CoordBBox bbox( min, max );
auto handle = GridT::create(min, max);
auto *grid = handle.grid<float>();
EXPECT_TRUE(grid);
EXPECT_TRUE(grid->test(min));
EXPECT_TRUE(grid->test(max));
EXPECT_TRUE(grid->test(pos));
EXPECT_EQ( uint64_t(21*21*21), bbox.volume() );
EXPECT_EQ( bbox.volume(), grid->size() );
EXPECT_EQ( 0u, grid->coordToOffset(min) );
float *p = grid->values();
for (uint64_t i=0; i<grid->size(); ++i) {
*p++ = 0.0f;
}
EXPECT_EQ( 0.0f, grid->getValue(min) );
EXPECT_EQ( 0.0f, grid->getValue(pos) );
EXPECT_EQ( 0.0f, grid->getValue(max) );
grid->setValue(pos, 1.0f);
EXPECT_EQ( 0.0f, grid->getValue(min) );
EXPECT_EQ( 1.0f, grid->getValue(pos) );
EXPECT_EQ( 0.0f, grid->getValue(max) );
for (auto it = bbox.begin(); it; ++it) {
auto &ijk = *it;
EXPECT_TRUE(grid->test(ijk));
if (ijk == pos) {
EXPECT_EQ( 1.0f, grid->getValue(ijk) );
} else {
EXPECT_EQ( 0.0f, grid->getValue(ijk) );
}
}
EXPECT_EQ(nanovdb::GridType::Float, grid->gridType());
EXPECT_EQ(nanovdb::GridClass::Unknown, grid->gridClass());
EXPECT_EQ(bbox, grid->indexBBox());
EXPECT_EQ(nanovdb::Vec3d(min[0], min[1], min[2]), grid->worldBBox()[0]);
EXPECT_EQ(nanovdb::Vec3d(max[0]+1, max[1]+1, max[2]+1), grid->worldBBox()[1]);
EXPECT_EQ(nanovdb::Vec3d(1.0), grid->voxelSize());
nanovdb::io::writeDense(handle, "data/dense.vol");
//nanovdb::io::writeDense(*grid, "data/dense.vol");
}
{// CoordT = nanovdb::Coord
auto handle = nanovdb::io::readDense<>("data/dense.vol");
const nanovdb::Coord min(-10,0,10), max(10,20,30), pos(0,5,20);
const nanovdb::CoordBBox bbox( min, max );
auto *grid = handle.grid<float>();
EXPECT_TRUE(grid);
EXPECT_TRUE(grid->test(min));
EXPECT_TRUE(grid->test(max));
EXPECT_TRUE(grid->test(pos));
EXPECT_EQ( uint64_t(21*21*21), bbox.volume() );
EXPECT_EQ( bbox.volume(), grid->size() );
EXPECT_EQ( 0u, grid->coordToOffset(min) );
EXPECT_EQ( 0.0f, grid->getValue(min) );
EXPECT_EQ( 1.0f, grid->getValue(pos) );
EXPECT_EQ( 0.0f, grid->getValue(max) );
EXPECT_EQ(min, grid->min());
EXPECT_EQ(max, grid->max());
for (auto it = bbox.begin(); it; ++it) {
auto &ijk = *it;
EXPECT_TRUE(grid->test(ijk));
if (ijk == pos) {
EXPECT_EQ( 1.0f, grid->getValue(ijk) );
} else {
EXPECT_EQ( 0.0f, grid->getValue(ijk) );
}
}
EXPECT_EQ(nanovdb::GridType::Float, grid->gridType());
EXPECT_EQ(nanovdb::GridClass::Unknown, grid->gridClass());
EXPECT_EQ(bbox, grid->indexBBox());
EXPECT_EQ(nanovdb::Vec3d(min[0], min[1], min[2]), grid->worldBBox()[0]);
EXPECT_EQ(nanovdb::Vec3d(max[0]+1, max[1]+1, max[2]+1), grid->worldBBox()[1]);
EXPECT_EQ(nanovdb::Vec3d(1.0), grid->voxelSize());
}
}
#if defined(NANOVDB_USE_OPENVDB)
TEST_F(Benchmark, OpenVDB_CPU)
{
using GridT = openvdb::FloatGrid;
using CoordT = openvdb::Coord;
using ColorRGB = nanovdb::Image::ColorRGB;
using RealT = float;
using Vec3T = openvdb::math::Vec3<RealT>;
using RayT = openvdb::math::Ray<RealT>;
const std::string image_path = this->getEnvVar("VDB_SCRATCH_PATH", ".");
auto srcGrid = this->getSrcGrid();
mTimer.start("Generating NanoVDB grid");
auto handle = nanovdb::openToNanoVDB(*srcGrid, nanovdb::StatsMode::BBox, nanovdb::ChecksumMode::Disable, /*verbose=*/0);
mTimer.restart("Writing NanoVDB grid");
#if defined(NANOVDB_USE_BLOSC)
nanovdb::io::writeGrid("data/test.nvdb", handle, nanovdb::io::Codec::BLOSC);
#elif defined(NANOVDB_USE_ZIP)
nanovdb::io::writeGrid("data/test.nvdb", handle, nanovdb::io::Codec::ZIP);
#else
nanovdb::io::writeGrid("data/test.nvdb", handle, nanovdb::io::Codec::NONE);
#endif
mTimer.stop();
{// convert and write DenseGRid
mTimer.start("Generating DenseGrid");
auto dHandle = nanovdb::convertToDense(*handle.grid<float>());
mTimer.restart("Writing DenseGrid");
nanovdb::io::writeDense(dHandle, "data/test.vol");
mTimer.stop();
}
const int width = 1280, height = 720;
const RealT vfov = 25.0f, aspect = RealT(width) / height, radius = 300.0f;
const auto bbox = srcGrid->evalActiveVoxelBoundingBox();
const openvdb::Vec3d center(0.5 * (bbox.max()[0] + bbox.min()[0]),
0.5 * (bbox.max()[1] + bbox.min()[1]),
0.5 * (bbox.max()[2] + bbox.min()[2]));
const Vec3T lookat = srcGrid->indexToWorld(center), up(0, -1, 0);
auto eye = [&lookat, &radius](int angle) {
const RealT theta = angle * M_PI / 180.0f;
return lookat + radius * Vec3T(sin(theta), 0, cos(theta));
};
nanovdb::Camera<RealT, Vec3T, RayT> camera(eye(0), lookat, up, vfov, aspect);
nanovdb::ImageHandle<> imgHandle(width, height);
auto* img = imgHandle.image();
auto kernel2D = [&](const tbb::blocked_range2d<int>& r) {
openvdb::tools::LevelSetRayIntersector<GridT, openvdb::tools::LinearSearchImpl<GridT, 0, RealT>, GridT::TreeType::RootNodeType::ChildNodeType::LEVEL, RayT> tester(*srcGrid);
const RealT wScale = 1.0f / width, hScale = 1.0f / height;
auto acc = srcGrid->getAccessor();
CoordT ijk;
Vec3T xyz;
float v;
for (int w = r.rows().begin(); w != r.rows().end(); ++w) {
for (int h = r.cols().begin(); h != r.cols().end(); ++h) {
const RayT wRay = camera.getRay(w * wScale, h * hScale);
RayT iRay = wRay.applyInverseMap(*srcGrid->transform().baseMap());
if (tester.intersectsIS(iRay, xyz)) {
ijk = openvdb::Coord::floor(xyz);
v = acc.getValue(ijk);
Vec3T grad(-v);
ijk[0] += 1;
grad[0] += acc.getValue(ijk);
ijk[0] -= 1;
ijk[1] += 1;
grad[1] += acc.getValue(ijk);
ijk[1] -= 1;
ijk[2] += 1;
grad[2] += acc.getValue(ijk);
grad.normalize();
(*img)(w, h) = ColorRGB(std::abs(grad.dot(iRay.dir())), 0, 0);
} else {
const int checkerboard = 1 << 7;
(*img)(w, h) = ((h & checkerboard) ^ (w & checkerboard)) ? ColorRGB(1, 1, 1) : ColorRGB(0, 0, 0);
}
}
}
}; // kernel
for (int angle = 0; angle < 6; ++angle) {
camera.update(eye(angle), lookat, up, vfov, aspect);
std::stringstream ss;
ss << "OpenVDB: CPU kernel with " << img->size() << " rays";
tbb::blocked_range2d<int> range2D(0, img->width(), 0, img->height());
mTimer.start(ss.str());
#if 1
tbb::parallel_for(range2D, kernel2D);
#else
kernel2D(range2D);
#endif
mTimer.stop();
//mTimer.start("Write image to file");
ss.str("");
ss.clear();
ss << image_path << "/openvdb_cpu_" << std::setfill('0') << std::setw(3) << angle << ".ppm";
img->writePPM(ss.str(), "Benchmark test");
//mTimer.stop();
} // loop over angle
} // OpenVDB_CPU
#endif
TEST_F(Benchmark, DenseGrid_CPU)
{
using CoordT = nanovdb::Coord;
using ColorRGB = nanovdb::Image::ColorRGB;
using RealT = float;
using Vec3T = nanovdb::Vec3<RealT>;
using RayT = nanovdb::Ray<RealT>;
auto handle = nanovdb::io::readDense("data/test.vol");
auto* grid = handle.grid<float>();
EXPECT_TRUE(grid);
EXPECT_TRUE(grid->isLevelSet());
const int width = 1280, height = 720;
const RealT vfov = 25.0f, aspect = RealT(width) / height, radius = 300.0f;
const auto bbox = grid->worldBBox();
const Vec3T lookat(0.5 * (bbox.min() + bbox.max())), up(0, -1, 0);
auto eye = [&lookat, &radius](int angle) {
const RealT theta = angle * M_PI / 180.0f;
return lookat + radius * Vec3T(sin(theta), 0, cos(theta));
};
nanovdb::Camera<RealT> camera(eye(0), lookat, up, vfov, aspect);
nanovdb::ImageHandle<> imgHandle(width, height);
auto* img = imgHandle.image();
auto kernel2D = [&](int x0, int y0, int x1, int y1) {
const RealT wScale = 1.0f / width, hScale = 1.0f / height;
for (int w = x0; w != x1; ++w) {
for (int h = y0; h != y1; ++h) {
RayT ray = camera.getRay(w * wScale, h * hScale);
ray = ray.worldToIndexF(*grid);
if (!ray.clip(grid->indexBBox().expandBy(-1))) continue;
nanovdb::DDA<RayT> dda(ray);
CoordT ijk = dda.voxel();
EXPECT_TRUE(grid->test(ijk));
const float v0 = grid->getValue(ijk);
bool hit = false;
while( !hit && dda.step() ) {
ijk = dda.voxel();
EXPECT_TRUE(grid->test(ijk));
const float v1 = grid->getValue(ijk);
if (v0*v1>0) continue;
Vec3T grad(-v1);
ijk[0] += 1;
grad[0] += grid->getValue(ijk);
ijk[0] -= 1;
ijk[1] += 1;
grad[1] += grid->getValue(ijk);
ijk[1] -= 1;
ijk[2] += 1;
grad[2] += grid->getValue(ijk);
grad.normalize();
(*img)(w, h) = ColorRGB(std::abs(grad.dot(ray.dir())), 0, 0);
hit = true;
}
if (!hit) {
const int checkerboard = 1 << 7;
(*img)(w, h) = ((h & checkerboard) ^ (w & checkerboard)) ? ColorRGB(1, 1, 1) : ColorRGB(0, 0, 0);
}
}
}
}; // kernel
for (int angle = 0; angle < 6; ++angle) {
camera.update(eye(angle), lookat, up, vfov, aspect);
std::stringstream ss;
ss << "DenseGrid: CPU kernel with " << img->size() << " rays";
mTimer.start(ss.str());
#if defined(NANOVDB_USE_TBB)
tbb::blocked_range2d<int> range(0, img->width(), 0, img->height());
tbb::parallel_for(range, [&](const tbb::blocked_range2d<int>& r) {
kernel2D(r.rows().begin(), r.cols().begin(), r.rows().end(), r.cols().end());
});
#else
kernel2D(0, 0, img->width(), img->height());
#endif
mTimer.stop();
//mTimer.start("Write image to file");
ss.str("");
ss.clear();
ss << "./dense_cpu_" << std::setfill('0') << std::setw(3) << angle << ".ppm";
img->writePPM(ss.str(), "Benchmark test");
//mTimer.stop();
} // loop over angle
} // DenseGrid_CPU
#if defined(NANOVDB_USE_CUDA)
// Convenience function for checking CUDA runtime API results
// can be wrapped around any runtime API call. No-op in release builds.
#define cudaCheck(ans) \
{ \
gpuAssert((ans), __FILE__, __LINE__); \
}
static inline bool gpuAssert(cudaError_t code, const char* file, int line, bool abort = true)
{
#if defined(DEBUG) || defined(_DEBUG)
if (code != cudaSuccess) {
fprintf(stderr, "CUDA Runtime Error: %s %s %d\n", cudaGetErrorString(code), file, line);
if (abort)
exit(code);
return false;
}
#endif
return true;
}
extern "C" void launch_kernels(const nanovdb::GridHandle<nanovdb::CudaDeviceBuffer>&,
nanovdb::ImageHandle<nanovdb::CudaDeviceBuffer>&,
const nanovdb::Camera<float>*,
cudaStream_t stream);
TEST_F(Benchmark, NanoVDB_GPU)
{
using BufferT = nanovdb::CudaDeviceBuffer;
using RealT = float;
using Vec3T = nanovdb::Vec3<RealT>;
using CameraT = nanovdb::Camera<RealT>;
const std::string image_path = this->getEnvVar("VDB_SCRATCH_PATH", ".");
// The first CUDA run time call initializes the CUDA sub-system (loads the runtime API) which takes time!
int deviceCount;
cudaGetDeviceCount(&deviceCount);
for (int device = 0; device < deviceCount; ++device) {
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, device);
printf("Device %d has compute capability %d.%d.\n",
device,
deviceProp.major,
deviceProp.minor);
}
cudaSetDevice(0);
cudaStream_t stream;
cudaCheck(cudaStreamCreate(&stream));
#if defined(NANOVDB_USE_OPENVDB)
auto handle = nanovdb::io::readGrid<BufferT>("data/test.nvdb");
#else
auto handle = nanovdb::createLevelSetTorus<float, float, BufferT>(100.0f, 50.0f);
#endif
//auto handle = nanovdb::io::readGrid<BufferT>("data/test.nvdb");
const auto* grid = handle.grid<float>();
EXPECT_TRUE(grid);
EXPECT_TRUE(grid->isLevelSet());
EXPECT_FALSE(grid->isFogVolume());
handle.deviceUpload(stream, false);
std::cout << "\nRay-tracing NanoVDB grid named \"" << grid->gridName() << "\"" << std::endl;
const int width = 1280, height = 720;
const RealT vfov = 25.0f, aspect = RealT(width) / height, radius = 300.0f;
const auto bbox = grid->worldBBox();
const Vec3T lookat(0.5 * (bbox.min() + bbox.max())), up(0, -1, 0);
auto eye = [&lookat, &radius](int angle) {
const RealT theta = angle * M_PI / 180.0f;
return lookat + radius * Vec3T(sin(theta), 0, cos(theta));
};
CameraT *host_camera, *dev_camera;
cudaCheck(cudaMalloc((void**)&dev_camera, sizeof(CameraT))); // un-managed memory on the device
cudaCheck(cudaMallocHost((void**)&host_camera, sizeof(CameraT)));
nanovdb::ImageHandle<BufferT> imgHandle(width, height);
auto* img = imgHandle.image();
imgHandle.deviceUpload(stream, false);
for (int angle = 0; angle < 6; ++angle) {
std::stringstream ss;
ss << "NanoVDB: GPU kernel with " << img->size() << " rays";
host_camera->update(eye(angle), lookat, up, vfov, aspect);
cudaCheck(cudaMemcpyAsync(dev_camera, host_camera, sizeof(CameraT), cudaMemcpyHostToDevice, stream));
mTimer.start(ss.str());
launch_kernels(handle, imgHandle, dev_camera, stream);
mTimer.stop();
//mTimer.start("Write image to file");
imgHandle.deviceDownload(stream);
ss.str("");
ss.clear();
ss << image_path << "/nanovdb_gpu_" << std::setfill('0') << std::setw(3) << angle << ".ppm";
img->writePPM(ss.str(), "Benchmark test");
//mTimer.stop();
} //frame number angle
cudaCheck(cudaStreamDestroy(stream));
cudaCheck(cudaFree(host_camera));
cudaCheck(cudaFree(dev_camera));
} // NanoVDB_GPU
#endif
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
@@ -0,0 +1,127 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
/// @file Benchmark_nano.cc
///
/// @author Ken Museth
///
/// @brief A super lightweight and portable ray-tracing benchmark
/// that only depends on NanoVDB (not OpenVDB) and CUDA.
#include <nanovdb/util/IO.h>
#include <nanovdb/util/CudaDeviceBuffer.h>
#include "Image.h"
#include "Camera.h"
#include "DenseGrid.h"
#include "../ex_util/CpuTimer.h"
#include <iomanip>// for std::setfill and std::setw
// Convenience function for checking CUDA runtime API results
// can be wrapped around any runtime API call. No-op in release builds.
#define cudaCheck(ans) \
{ \
gpuAssert((ans), __FILE__, __LINE__); \
}
static inline bool gpuAssert(cudaError_t code, const char* file, int line, bool abort = true)
{
#if defined(DEBUG) || defined(_DEBUG)
if (code != cudaSuccess) {
fprintf(stderr, "CUDA Runtime Error: %s %s %d\n", cudaGetErrorString(code), file, line);
if (abort)
exit(code);
return false;
}
#endif
return true;
}
extern "C" float launch_kernels(const nanovdb::DenseGridHandle<nanovdb::CudaDeviceBuffer>&,
nanovdb::ImageHandle<nanovdb::CudaDeviceBuffer>&,
const nanovdb::Camera<float>*,
cudaStream_t stream);
int main(int argc, char** argv)
{
using BufferT = nanovdb::CudaDeviceBuffer;
using RealT = float;
using Vec3T = nanovdb::Vec3<RealT>;
using CameraT = nanovdb::Camera<RealT>;
nanovdb::CpuTimer<> timer;
if (argc!=2) {
std::cerr << "Usage: " << argv[0] << " path/level_set.vol" << std::endl;
//std::cerr << "To generate an input file: nanovdb_convert dragon.vdb dragon.nvdb\n";
return 1;
}
// The first CUDA run time call initializes the CUDA sub-system (loads the runtime API) which takes time!
int deviceCount;
cudaGetDeviceCount(&deviceCount);
for (int device = 0; device < deviceCount; ++device) {
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, device);
printf("Device %d has compute capability %d.%d.\n",
device,
deviceProp.major,
deviceProp.minor);
}
cudaSetDevice(0);
cudaStream_t stream;
cudaCheck(cudaStreamCreate(&stream));
auto handle = nanovdb::io::readDense<BufferT>(argv[1]);
const auto* grid = handle.grid<float>();
if (!grid || !grid->isLevelSet()) {
std::cerr << "Error loading NanoVDB level set from file" << std::endl;
return 1;
}
handle.deviceUpload(stream, false);
std::cout << "\nRay-tracing DenseGrid of size "
<< (grid->gridSize() >> 20) << " MB" << std::endl;
const int width = 1280, height = 720;
const RealT vfov = 25.0f, aspect = RealT(width) / height, radius = 300.0f;
const auto bbox = grid->worldBBox();
const Vec3T lookat(0.5 * (bbox.min() + bbox.max())), up(0, -1, 0);
auto eye = [&lookat, &radius](int angle) {
const RealT theta = angle * M_PI / 180.0f;
return lookat + radius * Vec3T(sin(theta), 0, cos(theta));
};
CameraT *host_camera, *dev_camera;
cudaCheck(cudaMalloc((void**)&dev_camera, sizeof(CameraT))); // un-managed memory on the device
cudaCheck(cudaMallocHost((void**)&host_camera, sizeof(CameraT)));
nanovdb::ImageHandle<BufferT> imgHandle(width, height);
auto* img = imgHandle.image();
imgHandle.deviceUpload(stream, false);
float elapsedTime = 0.0f;
const int maxAngle = 360;
for (int angle = 0; angle < maxAngle; ++angle) {
host_camera->update(eye(angle), lookat, up, vfov, aspect);
cudaCheck(cudaMemcpyAsync(dev_camera, host_camera, sizeof(CameraT), cudaMemcpyHostToDevice, stream));
elapsedTime += launch_kernels(handle, imgHandle, dev_camera, stream);
//timer.start("Write image to file");
imgHandle.deviceDownload(stream);
std::stringstream ss;
ss << "./dense_gpu_" << std::setfill('0') << std::setw(3) << angle << ".ppm";
img->writePPM(ss.str(), "Benchmark test");
//timer.stop();
} //frame number angle
cudaCheck(cudaStreamDestroy(stream));
cudaCheck(cudaFree(host_camera));
cudaCheck(cudaFree(dev_camera));
printf("\nRay-traced %i different frames, each with %i rays, in %5.3f ms.\nThis corresponds to an average of %5.3f ms per frame or %5.3f FPS!\n",
maxAngle, imgHandle.image()->size(), elapsedTime, elapsedTime/maxAngle, 1000.0f*maxAngle/elapsedTime);
return 0;
}
@@ -0,0 +1,134 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
/// @file Benchmark_nano.cc
///
/// @author Ken Museth
///
/// @brief A super lightweight and portable ray-tracing benchmark
/// that only depends on NanoVDB (not OpenVDB) and CUDA.
#include <nanovdb/util/IO.h>
#include <nanovdb/util/CudaDeviceBuffer.h>
#include "Image.h"
#include "Camera.h"
#include "../ex_util/CpuTimer.h"
#include <iomanip>// for std::setfill and std::setw
// Convenience function for checking CUDA runtime API results
// can be wrapped around any runtime API call. No-op in release builds.
#define cudaCheck(ans) \
{ \
gpuAssert((ans), __FILE__, __LINE__); \
}
static inline bool gpuAssert(cudaError_t code, const char* file, int line, bool abort = true)
{
#if defined(DEBUG) || defined(_DEBUG)
if (code != cudaSuccess) {
fprintf(stderr, "CUDA Runtime Error: %s %s %d\n", cudaGetErrorString(code), file, line);
if (abort)
exit(code);
return false;
}
#endif
return true;
}
extern "C" float launch_kernels(const nanovdb::GridHandle<nanovdb::CudaDeviceBuffer>&,
nanovdb::ImageHandle<nanovdb::CudaDeviceBuffer>&,
const nanovdb::Camera<float>*,
cudaStream_t stream);
int main(int argc, char** argv)
{
using BufferT = nanovdb::CudaDeviceBuffer;
using ValueT = float;
using BuildT = nanovdb::FpN;
using Vec3T = nanovdb::Vec3<ValueT>;
using CameraT = nanovdb::Camera<ValueT>;
nanovdb::CpuTimer<> timer;
if (argc!=2) {
std::cerr << "Usage: " << argv[0] << " path/level_set.nvdb" << std::endl;
std::cerr << "To generate an input file: nanovdb_convert dragon.vdb dragon.nvdb\n";
return 1;
}
// The first CUDA run time call initializes the CUDA sub-system (loads the runtime API) which takes time!
int deviceCount;
cudaGetDeviceCount(&deviceCount);
for (int device = 0; device < deviceCount; ++device) {
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, device);
printf("Device %d has compute capability %d.%d.\n",
device,
deviceProp.major,
deviceProp.minor);
}
cudaSetDevice(0);
int driverVersion, runtimeVersion;
cudaDriverGetVersion(&driverVersion);
cudaRuntimeGetVersion(&runtimeVersion);
printf("CUDA driver version:\t%i.%i\n", driverVersion/1000, (driverVersion%1000)/10);
printf("CUDA runtime version:\t%i.%i\n", runtimeVersion/1000, (runtimeVersion%1000)/10);
cudaStream_t stream;
cudaCheck(cudaStreamCreate(&stream));
auto handle = nanovdb::io::readGrid<BufferT>(argv[1]);
const auto* grid = handle.grid<BuildT>();
if (!grid || !grid->isLevelSet()) {
std::cerr << "Error loading NanoVDB level set from file" << std::endl;
return 1;
}
handle.deviceUpload(stream, false);
std::cout << "\nRay-tracing NanoVDB grid named \"" << grid->gridName() << "\" of size "
<< (grid->gridSize() >> 20) << " MB" << std::endl;
const int width = 1280, height = 720;
const ValueT vfov = 25.0f, aspect = ValueT(width) / height, radius = 300.0f;
const auto bbox = grid->worldBBox();
const Vec3T lookat(0.5 * (bbox.min() + bbox.max())), up(0, -1, 0);
auto eye = [&lookat, &radius](int angle) {
const ValueT theta = angle * M_PI / 180.0f;
return lookat + radius * Vec3T(sin(theta), 0, cos(theta));
};
CameraT *host_camera, *dev_camera;
cudaCheck(cudaMalloc((void**)&dev_camera, sizeof(CameraT))); // un-managed memory on the device
cudaCheck(cudaMallocHost((void**)&host_camera, sizeof(CameraT)));
nanovdb::ImageHandle<BufferT> imgHandle(width, height);
auto* img = imgHandle.image();
imgHandle.deviceUpload(stream, false);
float elapsedTime = 0.0f;
const int maxAngle = 360;
for (int angle = 0; angle < maxAngle; ++angle) {
host_camera->update(eye(angle), lookat, up, vfov, aspect);
cudaCheck(cudaMemcpyAsync(dev_camera, host_camera, sizeof(CameraT), cudaMemcpyHostToDevice, stream));
elapsedTime += launch_kernels(handle, imgHandle, dev_camera, stream);
//timer.start("Write image to file");
imgHandle.deviceDownload(stream);
#if 1
std::stringstream ss;
ss << "./nanovdb_gpu_" << std::setfill('0') << std::setw(3) << angle << ".ppm";
img->writePPM(ss.str(), "Benchmark test");
#endif
//timer.stop();
} //frame number angle
cudaCheck(cudaStreamDestroy(stream));
cudaCheck(cudaFree(host_camera));
cudaCheck(cudaFree(dev_camera));
printf("\nRay-traced %i different frames, each with %i rays, in %5.3f ms.\nThis corresponds to an average of %5.3f ms per frame or %5.3f FPS!\n",
maxAngle, imgHandle.image()->size(), elapsedTime, elapsedTime/maxAngle, 1000.0f*maxAngle/elapsedTime);
return 0;
}
@@ -0,0 +1,74 @@
# Copyright Contributors to the OpenVDB Project
# SPDX-License-Identifier: MPL-2.0
#
#[=======================================================================[
CMake Configuration for NanoVDB Benchmark
#]=======================================================================]
cmake_minimum_required(VERSION 3.15)
project(NanoVDBBenchmark LANGUAGES CXX)
include(GNUInstallDirs)
###############################################################################
message(STATUS "----------------------------------------------------")
message(STATUS "---------- Configuring NanoVDB Benchmark -----------")
message(STATUS "----------------------------------------------------")
###############################################################################
if(WIN32 AND NANOVDB_CUDA_KEEP_PTX)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/Release")
endif()
# -----------------------------------------------------------------------
# TODO: Benchmark should probably not require gtest.
if(NOT TARGET GTest::GTest)
message(WARNING " - GTest required to build benchmark. Skipping.")
return()
endif()
# -----------------------------------------------------------------------
# many of the sample projects depend on a data directory. This allows Debug
# launching from the cmake binary working directory.
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/data")
set(BENCHMARK_SOURCES Benchmark.cc Camera.h Image.h)
if(NANOVDB_USE_CUDA)
list(APPEND BENCHMARK_SOURCES BenchKernels_nano.cu)
add_executable(benchmark_nano Benchmark_nano.cc BenchKernels_nano.cu)
add_executable(benchmark_dense Benchmark_dense.cc BenchKernels_dense.cu)
target_link_libraries(benchmark_nano PRIVATE nanovdb)
target_link_libraries(benchmark_dense PRIVATE nanovdb)
# Propagate MSVC Runtime from the OpenVDB library (if VDB_MSVC_RUNTIME_SELECTION
# has been set then we're building and linking against OpenVDB, see the root
# NanoVDB CMakeLists.txt)
if(VDB_MSVC_RUNTIME_SELECTION)
set_target_properties(benchmark_nano PROPERTIES
MSVC_RUNTIME_LIBRARY ${VDB_MSVC_RUNTIME_SELECTION})
set_target_properties(benchmark_dense PROPERTIES
MSVC_RUNTIME_LIBRARY ${VDB_MSVC_RUNTIME_SELECTION})
endif()
endif()
# -----------------------------------------------------------------------
add_executable(benchmark ${BENCHMARK_SOURCES})
target_link_libraries(benchmark PRIVATE nanovdb GTest::GTest GTest::Main)
# Propagate MSVC Runtime from the OpenVDB library (if VDB_MSVC_RUNTIME_SELECTION
# has been set then we're building and linking against OpenVDB, see the root
# NanoVDB CMakeLists.txt)
if(VDB_MSVC_RUNTIME_SELECTION)
set_target_properties(benchmark PROPERTIES
MSVC_RUNTIME_LIBRARY ${VDB_MSVC_RUNTIME_SELECTION})
endif()
install(TARGETS benchmark DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
@@ -0,0 +1,72 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
/// @file Camera.h
///
/// @author Ken Museth
///
/// @brief A simple camera class.
#ifndef NANOVDB_CAMERA_H_HAS_BEEN_INCLUDED
#define NANOVDB_CAMERA_H_HAS_BEEN_INCLUDED
#include <nanovdb/NanoVDB.h> // for Vec3
#include <nanovdb/util/Ray.h>
namespace nanovdb {
/// @brief A minimal perspective camera for ray generation
template<typename RealT = float, typename Vec3T = Vec3<RealT>, typename RayT = Ray<RealT>>
class Camera
{
Vec3T mEye, mW, mU, mV;
__hostdev__ void init(RealT vfov, RealT aspect)
{
const RealT halfHeight = RealT(tan(vfov * 3.14159265358979323846 / 360));
const RealT halfWidth = aspect * halfHeight;
mW = halfWidth * mU + halfHeight * mV + mW; // remove eye here and in getRay
mU *= 2 * halfWidth;
mV *= 2 * halfHeight;
}
public:
/// @brief default Ctor.
Camera() = default;
/// @brief Ctor. // vfov is top to bottom in degrees
/// @note up is assumed to be a unit-vector
__hostdev__ Camera(const Vec3T& eye, const Vec3T& lookat, const Vec3T& up, RealT vfov, RealT aspect)
: mEye(eye)
, mW((eye - lookat).normalize())
, mU(up.cross(mW))
, mV(up)
{
this->init(vfov, aspect);
}
__hostdev__ void update(const Vec3T& eye, const Vec3T& lookat, const Vec3T& up, RealT vfov, RealT aspect)
{
mEye = eye;
mV = up;
mW = mEye - lookat;
mW.normalize();
mU = mV.cross(mW);
this->init(vfov, aspect);
}
/// @brief {u,v} are are assumed to be [0,1]
__hostdev__ RayT getRay(RealT u, RealT v) const {
auto dir = u * mU + v * mV - mW;
dir.normalize();
return RayT(mEye, dir);
}
__hostdev__ const Vec3T& P() const { return mEye; }
__hostdev__ const Vec3T& U() const { return mU; }
__hostdev__ const Vec3T& V() const { return mV; }
__hostdev__ const Vec3T& W() const { return mW; }
}; // Camera
} // namespace nanovdb
#endif // NANOVDB_CAMERA_HAS_BEEN_INCLUDED
@@ -0,0 +1,487 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
/// @file DenseGrid.h
///
/// @author Ken Museth
///
/// @brief Simple dense grid class.
#ifndef NANOVDB_DENSEGRID_H_HAS_BEEN_INCLUDED
#define NANOVDB_DENSEGRID_H_HAS_BEEN_INCLUDED
#include <stdint.h>// for uint64_t
#include <fstream> // for std::ifstream
#include <nanovdb/util/HostBuffer.h>// for default Buffer
#include <nanovdb/util/ForEach.h>
#include <nanovdb/NanoVDB.h>// for Map, GridClass, GridType and and Coord
// use 4x4x4 tiles for better cache coherence
// else it uses dense indexing which is slow!
// 0 means disable, 1 is 2x2x2, 2 is 4x4x4 and 3 is 8x8x8
#define LOG2_TILE_SIZE 2
namespace nanovdb {
// forward decleration
template<typename BufferT = HostBuffer>
class DenseGridHandle;
#define DENSE_MAGIC_NUMBER 0x42445665736e6544UL // "DenseVDB" in hex - little endian (uint64_t)
struct DenseData
{
Map mMap;// defined in NanoVDB.h
CoordBBox mIndexBBox;// min/max of bbox
BBox<Vec3R> mWorldBBox;// 48B. floating-point AABB of active values in WORLD SPACE (2 x 3 doubles)
Vec3R mVoxelSize;
GridClass mGridClass;// defined in NanoVDB.h
GridType mGridType; // defined in NanoVDB.h
uint64_t mY, mX;//strides in the y and x direction
uint64_t mSize;
__hostdev__ Coord dim() const { return mIndexBBox.dim(); }
// Affine transformations based on double precision
template<typename Vec3T>
__hostdev__ Vec3T applyMap(const Vec3T& xyz) const { return mMap.applyMap(xyz); } // Pos: index -> world
template<typename Vec3T>
__hostdev__ Vec3T applyInverseMap(const Vec3T& xyz) const { return mMap.applyInverseMap(xyz); } // Pos: world -> index
template<typename Vec3T>
__hostdev__ Vec3T applyJacobian(const Vec3T& xyz) const { return mMap.applyJacobian(xyz); } // Dir: index -> world
template<typename Vec3T>
__hostdev__ Vec3T applyInverseJacobian(const Vec3T& xyz) const { return mMap.applyInverseJacobian(xyz); } // Dir: world -> index
template<typename Vec3T>
__hostdev__ Vec3T applyIJT(const Vec3T& xyz) const { return mMap.applyIJT(xyz); }
// Affine transformations based on single precision
template<typename Vec3T>
__hostdev__ Vec3T applyMapF(const Vec3T& xyz) const { return mMap.applyMapF(xyz); } // Pos: index -> world
template<typename Vec3T>
__hostdev__ Vec3T applyInverseMapF(const Vec3T& xyz) const { return mMap.applyInverseMapF(xyz); } // Pos: world -> index
template<typename Vec3T>
__hostdev__ Vec3T applyJacobianF(const Vec3T& xyz) const { return mMap.applyJacobianF(xyz); } // Dir: index -> world
template<typename Vec3T>
__hostdev__ Vec3T applyInverseJacobianF(const Vec3T& xyz) const { return mMap.applyInverseJacobianF(xyz); } // Dir: world -> index
template<typename Vec3T>
__hostdev__ Vec3T applyIJTF(const Vec3T& xyz) const { return mMap.applyIJTF(xyz); }
};
/// @brief Simple dense grid class
/// @note ZYX is the memory-layout in VDB. It leads to nested
/// for-loops of the order x, y, z.
template<typename ValueT>
class DenseGrid : private DenseData
{
#if LOG2_TILE_SIZE > 0
static constexpr uint32_t TileLog2 = LOG2_TILE_SIZE, TileMask = (1 << TileLog2) - 1, TileDim = 1 << (3*TileLog2);
#endif
using DenseData = DenseData;
public:
using ValueType = ValueT;
template<typename BufferT = HostBuffer>
inline static DenseGridHandle<BufferT> create(Coord min, // min inclusive index coordinate
Coord max, // max inclusive index coordinate
double dx = 1.0, //voxel size
const Vec3d& p0 = Vec3d(0.0), // origin
GridClass gridClass = GridClass::Unknown,
const BufferT& allocator = BufferT());
__hostdev__ DenseGrid(const DenseGrid&) = delete;
__hostdev__ ~DenseGrid() = delete;
__hostdev__ DenseGrid& operator=(const DenseGrid&) = delete;
__hostdev__ uint64_t size() const { return mIndexBBox.volume(); }
__hostdev__ inline uint64_t coordToOffset(const Coord &ijk) const;
__hostdev__ inline bool test(const Coord &ijk) const;
__hostdev__ uint64_t memUsage() const {return mSize;}
__hostdev__ uint64_t gridSize() const {return this->memUsage();}
__hostdev__ const Coord& min() const { return mIndexBBox[0]; }
__hostdev__ const Coord& max() const { return mIndexBBox[1]; }
__hostdev__ inline bool isValidType() const;
/// @brief Return a const reference to the Map for this grid
__hostdev__ const Map& map() const { return DenseData::mMap; }
// @brief Return a const reference to the size of a voxel in world units
__hostdev__ const Vec3R& voxelSize() const { return DenseData::mVoxelSize; }
/// @brief world to index space transformation
template<typename Vec3T>
__hostdev__ Vec3T worldToIndex(const Vec3T& xyz) const { return this->applyInverseMap(xyz); }
/// @brief world to index space transformation
template<typename Vec3T>
__hostdev__ Vec3T indexToWorld(const Vec3T& xyz) const { return this->applyMap(xyz); }
/// @brief transformation from index space direction to world space direction
/// @warning assumes dir to be normalized
template<typename Vec3T>
__hostdev__ Vec3T indexToWorldDir(const Vec3T& dir) const { return this->applyJacobian(dir); }
/// @brief transformation from world space direction to index space direction
/// @warning assumes dir to be normalized
template<typename Vec3T>
__hostdev__ Vec3T worldToIndexDir(const Vec3T& dir) const { return this->applyInverseJacobian(dir); }
/// @brief transform the gradient from index space to world space.
/// @details Applies the inverse jacobian transform map.
template<typename Vec3T>
__hostdev__ Vec3T indexToWorldGrad(const Vec3T& grad) const { return this->applyIJT(grad); }
/// @brief world to index space transformation
template<typename Vec3T>
__hostdev__ Vec3T worldToIndexF(const Vec3T& xyz) const { return this->applyInverseMapF(xyz); }
/// @brief index to world space transformation
template<typename Vec3T>
__hostdev__ Vec3T indexToWorldF(const Vec3T& xyz) const { return this->applyMapF(xyz); }
/// @brief transformation from index space direction to world space direction
/// @warning assumes dir to be normalized
template<typename Vec3T>
__hostdev__ Vec3T indexToWorldDirF(const Vec3T& dir) const { return this->applyJacobianF(dir); }
/// @brief transformation from world space direction to index space direction
/// @warning assumes dir to be normalized
template<typename Vec3T>
__hostdev__ Vec3T worldToIndexDirF(const Vec3T& dir) const { return this->applyInverseJacobianF(dir); }
/// @brief Transforms the gradient from index space to world space.
/// @details Applies the inverse jacobian transform map.
template<typename Vec3T>
__hostdev__ Vec3T indexToWorldGradF(const Vec3T& grad) const { return DenseData::applyIJTF(grad); }
/// @brief Computes a AABB of active values in world space
__hostdev__ const BBox<Vec3R>& worldBBox() const { return DenseData::mWorldBBox; }
__hostdev__ bool isLevelSet() const { return DenseData::mGridClass == GridClass::LevelSet; }
__hostdev__ bool isFogVolume() const { return DenseData::mGridClass == GridClass::FogVolume; }
/// @brief Computes a AABB of active values in index space
///
/// @note This method is returning a floating point bounding box and not a CoordBBox. This makes
/// it more useful for clipping rays.
__hostdev__ const CoordBBox& indexBBox() const { return mIndexBBox; }
__hostdev__ const GridType& gridType() const { return DenseData::mGridType; }
__hostdev__ const GridClass& gridClass() const { return DenseData::mGridClass; }
__hostdev__ DenseData* data() { return reinterpret_cast<DenseData*>(this); }
__hostdev__ const DenseData* data() const { return reinterpret_cast<const DenseData*>(this); }
__hostdev__ ValueT* values() { return reinterpret_cast<ValueT*>(this+1);}
__hostdev__ const ValueT* values() const { return reinterpret_cast<const ValueT*>(this+1); }
__hostdev__ inline const ValueT& getValue(const Coord &ijk) const;
__hostdev__ inline void setValue(const Coord &ijk, const ValueT &v);
}; // Grid
template<typename ValueT>
template<typename BufferT>
DenseGridHandle<BufferT>
DenseGrid<ValueT>::create(Coord min,
Coord max,
double dx, //voxel size
const Vec3d& p0, // origin
GridClass gridClass,
const BufferT& allocator)
{
if (dx <= 0) {
throw std::runtime_error("GridBuilder: voxel size is zero or negative");
}
max += Coord(1,1,1);// now max is exclusive
#if LOG2_TILE_SIZE > 0
const uint64_t dim[3] = {(uint64_t(max[0] - min[0]) + TileMask) >> TileLog2,
(uint64_t(max[1] - min[1]) + TileMask) >> TileLog2,
(uint64_t(max[2] - min[2]) + TileMask) >> TileLog2};
const uint64_t size = sizeof(DenseGrid) + sizeof(ValueT)*TileDim*dim[0]*dim[1]*dim[2];
#else
const uint64_t dim[3] = {uint64_t(max[0] - min[0]),
uint64_t(max[1] - min[1]),
uint64_t(max[2] - min[2])};
const uint64_t size = sizeof(DenseGrid) + sizeof(ValueT)*dim[0]*dim[1]*dim[2];
#endif
DenseGridHandle<BufferT> handle(allocator.create(size));
DenseGrid* grid = reinterpret_cast<DenseGrid*>(handle.data());
grid->mSize = size;
const double Tx = p0[0], Ty = p0[1], Tz = p0[2];
const double mat[4][4] = {
{dx, 0.0, 0.0, 0.0}, // row 0
{0.0, dx, 0.0, 0.0}, // row 1
{0.0, 0.0, dx, 0.0}, // row 2
{Tx, Ty, Tz, 1.0}, // row 3
};
const double invMat[4][4] = {
{1 / dx, 0.0, 0.0, 0.0}, // row 0
{0.0, 1 / dx, 0.0, 0.0}, // row 1
{0.0, 0.0, 1 / dx, 0.0}, // row 2
{-Tx, -Ty, -Tz, 1.0}, // row 3
};
grid->mMap.set(mat, invMat, 1.0);
for (int i=0; i<3; ++i) {
grid->mIndexBBox[0][i] = min[i];
grid->mIndexBBox[1][i] = max[i] - 1;
}
grid->mWorldBBox[0] = grid->mWorldBBox[1] = grid->mMap.applyMap(Vec3d(min[0], min[1], min[2]));
grid->mWorldBBox.expand(grid->mMap.applyMap(Vec3d(min[0], min[1], max[2])));
grid->mWorldBBox.expand(grid->mMap.applyMap(Vec3d(min[0], max[1], min[2])));
grid->mWorldBBox.expand(grid->mMap.applyMap(Vec3d(max[0], min[1], min[2])));
grid->mWorldBBox.expand(grid->mMap.applyMap(Vec3d(max[0], max[1], min[2])));
grid->mWorldBBox.expand(grid->mMap.applyMap(Vec3d(max[0], min[1], max[2])));
grid->mWorldBBox.expand(grid->mMap.applyMap(Vec3d(min[0], max[1], max[2])));
grid->mWorldBBox.expand(grid->mMap.applyMap(Vec3d(max[0], max[1], max[2])));
grid->mVoxelSize = grid->mMap.applyMap(Vec3d(1)) - grid->mMap.applyMap(Vec3d(0));
if (gridClass == GridClass::LevelSet && !is_floating_point<ValueT>::value)
throw std::runtime_error("Level sets are expected to be floating point types");
if (gridClass == GridClass::FogVolume && !is_floating_point<ValueT>::value)
throw std::runtime_error("Fog volumes are expected to be floating point types");
grid->mGridClass = gridClass;
grid->mGridType = mapToGridType<ValueT>();
grid->mY = dim[2];
grid->mX = dim[2] * dim[1];
return handle;
}
template<typename ValueT>
bool DenseGrid<ValueT>::test(const Coord &ijk) const
{
return (ijk[0]>=mIndexBBox[0][0]) && (ijk[0]<=mIndexBBox[1][0]) &&
(ijk[1]>=mIndexBBox[0][1]) && (ijk[1]<=mIndexBBox[1][1]) &&
(ijk[2]>=mIndexBBox[0][2]) && (ijk[2]<=mIndexBBox[1][2]);
}
template<typename ValueT>
uint64_t DenseGrid<ValueT>::coordToOffset(const Coord &ijk) const
{
assert(this->test(ijk));
#if LOG2_TILE_SIZE > 0
const uint32_t x = ijk[0] - mIndexBBox[0][0];
const uint32_t y = ijk[1] - mIndexBBox[0][1];
const uint32_t z = ijk[2] - mIndexBBox[0][2];
return ((mX*(x>>TileLog2) + mY*(y>>TileLog2) + (z>>TileLog2))<<(3*TileLog2)) +
((x&TileMask)<<(2*TileLog2)) + ((y&TileMask)<<TileLog2) + (z&TileMask);
#else
return uint64_t(ijk[0]-mIndexBBox[0][0])*mX +
uint64_t(ijk[1]-mIndexBBox[0][1])*mY +
uint64_t(ijk[2]-mIndexBBox[0][2]);
#endif
}
template<typename ValueT>
const ValueT& DenseGrid<ValueT>::getValue(const Coord &ijk) const
{
return this->values()[this->coordToOffset(ijk)];
}
template<typename ValueT>
void DenseGrid<ValueT>::setValue(const Coord &ijk, const ValueT &value)
{
this->values()[this->coordToOffset(ijk)] = value;
}
template<typename ValueT>
bool DenseGrid<ValueT>::isValidType() const
{
return std::is_same<float, ValueT>::value ? mGridType == GridType::Float : false;
}
/////////////////////////////////////////////
namespace io{
template<typename ValueT>
void writeDense(const DenseGrid<ValueT> &grid, const char* fileName)
{
std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
if (!os.is_open()) {
throw std::runtime_error("Unable to open file for output");
}
const uint64_t tmp[2] = {DENSE_MAGIC_NUMBER, grid.memUsage()};
os.write(reinterpret_cast<const char*>(tmp), 2*sizeof(uint64_t));
os.write(reinterpret_cast<const char*>(&grid), tmp[1]);
}
template<typename BufferT>
void writeDense(const DenseGridHandle<BufferT> &handle, const char* fileName)
{
std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
if (!os.is_open()) {
throw std::runtime_error("Unable to open file for output");
}
const uint64_t tmp[2] = {DENSE_MAGIC_NUMBER, handle.size()};
os.write(reinterpret_cast<const char*>(tmp), 2*sizeof(uint64_t));
os.write(reinterpret_cast<const char*>(handle.data()), tmp[1]);
}
template<typename BufferT = HostBuffer>
DenseGridHandle<BufferT>
readDense(const char* fileName, const BufferT& allocator = BufferT())
{
std::ifstream is(fileName, std::ios::in | std::ios::binary);
if (!is.is_open()) {
throw std::runtime_error("Unable to open file for input");
}
uint64_t tmp[2];
is.read(reinterpret_cast<char*>(tmp), 2*sizeof(uint64_t));
if (tmp[0] != DENSE_MAGIC_NUMBER) {
throw std::runtime_error("This is not a dense NanoVDB file!");
}
DenseGridHandle<BufferT> handle(allocator.create(tmp[1]));
is.read(reinterpret_cast<char*>(handle.data()), tmp[1]);
return handle;
}
}// namespace io
/////////////////////////////////////////////
/// @brief Converts a NanoVDB grid to a DenseGrid
template<typename GridT, typename BufferT = HostBuffer>
DenseGridHandle<BufferT> convertToDense(const GridT &grid, const BufferT& allocator = BufferT())
{
using ValueT = typename GridT::ValueType;
using DenseT = DenseGrid<ValueT>;
const Coord min = grid.indexBBox().min(), max = grid.indexBBox().max() + Coord(1,1,1);// max is exclusive!
#if LOG2_TILE_SIZE > 0
static constexpr uint32_t TileLog2 = LOG2_TILE_SIZE, TileMask = (1 << TileLog2) - 1, TileDim = 1 << (3*TileLog2);
const uint64_t dim[3] = {(uint64_t(max[0] - min[0]) + TileMask) >> TileLog2,
(uint64_t(max[1] - min[1]) + TileMask) >> TileLog2,
(uint64_t(max[2] - min[2]) + TileMask) >> TileLog2};
const uint64_t size = sizeof(DenseT) + sizeof(ValueT)*TileDim*dim[0]*dim[1]*dim[2];
#else
const uint64_t dim[3] = {uint64_t(max[0] - min[0]),
uint64_t(max[1] - min[1]),
uint64_t(max[2] - min[2])};
const uint64_t size = sizeof(DenseT) + sizeof(ValueT)*dim[0]*dim[1]*dim[2];
#endif
DenseGridHandle<BufferT> handle( allocator.create(size) );
auto *dense = reinterpret_cast<DenseT*>(handle.data());
auto *data = dense->data();
// copy DenseData
data->mMap = grid.map();
data->mIndexBBox = grid.indexBBox();
data->mWorldBBox = grid.worldBBox();
data->mVoxelSize = grid.voxelSize();
data->mGridClass = grid.gridClass();
data->mGridType = grid.gridType();
data->mY = dim[2];
data->mX = dim[2] * dim[1];
data->mSize = size;
// copy values
auto kernel = [&](const Range<1,int> &r) {
auto acc = grid.getAccessor();
Coord ijk;
for (ijk[0] = r.begin(); ijk[0] < r.end(); ++ijk[0]) {
for (ijk[1] = min[1]; ijk[1] < max[1]; ++ijk[1]) {
for (ijk[2] = min[2]; ijk[2] < max[2]; ++ijk[2]) {
dense->setValue(ijk, acc.getValue(ijk));
}
}
}
};
Range<1,int> range(min[0], max[0]);
#if 1
forEach(range, kernel);
#else
kernel(range);
#endif
return handle;
}
/////////////////////////////////////////////
template<typename BufferT>
class DenseGridHandle
{
BufferT mBuffer;
public:
DenseGridHandle(BufferT&& resources) { mBuffer = std::move(resources); }
DenseGridHandle() = default;
/// @brief Disallow copy-construction
DenseGridHandle(const DenseGridHandle&) = delete;
/// @brief Disallow copy assignment operation
DenseGridHandle& operator=(const DenseGridHandle&) = delete;
/// @brief Move copy assignment operation
DenseGridHandle& operator=(DenseGridHandle&& other) noexcept
{
mBuffer = std::move(other.mBuffer);
return *this;
}
/// @brief Move copy-constructor
DenseGridHandle(DenseGridHandle&& other) noexcept { mBuffer = std::move(other.mBuffer); }
/// @brief Default destructor
~DenseGridHandle() { this->reset(); }
void reset() { mBuffer.clear(); }
BufferT& buffer() { return mBuffer; }
const BufferT& buffer() const { return mBuffer; }
/// @brief Returns a non-const pointer to the data.
///
/// @warning Note that the return pointer can be NULL if the DenseGridHandle was not initialized
uint8_t* data() {return mBuffer.data();}
/// @brief Returns a const pointer to the data.
///
/// @warning Note that the return pointer can be NULL if the DenseGridHandle was not initialized
const uint8_t* data() const {return mBuffer.data();}
/// @brief Returns the size in bytes of the raw memory buffer managed by this DenseGridHandle's allocator.
uint64_t size() const { return mBuffer.size();}
/// @brief Returns a const pointer to the NanoVDB grid encoded in the DenseGridHandle.
///
/// @warning Note that the return pointer can be NULL if the DenseGridHandle was not initialized or the template
/// parameter does not match!
template<typename ValueT>
const DenseGrid<ValueT>* grid() const
{
using GridT = const DenseGrid<ValueT>;
GridT* grid = reinterpret_cast<GridT*>(mBuffer.data());
return (grid && grid->isValidType()) ? grid : nullptr;
}
template<typename ValueT>
DenseGrid<ValueT>* grid()
{
using GridT = DenseGrid<ValueT>;
GridT* grid = reinterpret_cast<GridT*>(mBuffer.data());
return (grid && grid->isValidType()) ? grid : nullptr;
}
template<typename ValueT, typename U = BufferT>
typename std::enable_if<BufferTraits<U>::hasDeviceDual, const DenseGrid<ValueT>*>::type
deviceGrid() const
{
using GridT = const DenseGrid<ValueT>;
bool isValidType = reinterpret_cast<GridT*>(mBuffer.data())->isValidType();
GridT* grid = reinterpret_cast<GridT*>(mBuffer.deviceData());
return (grid && isValidType) ? grid : nullptr;
}
template<typename U = BufferT>
typename std::enable_if<BufferTraits<U>::hasDeviceDual, void>::type
deviceUpload(void* stream = nullptr, bool sync = true) {
mBuffer.deviceUpload(stream, sync);
}
template<typename U = BufferT>
typename std::enable_if<BufferTraits<U>::hasDeviceDual, void>::type
deviceDownload(void* stream = nullptr, bool sync = true) {
mBuffer.deviceDownload(stream, sync);
}
}; // DenseGridHandle
} // namespace nanovdb
#endif // NANOVDB_DENSEGRID_HAS_BEEN_INCLUDED
+159
View File
@@ -0,0 +1,159 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
/*!
\file Image.h
\author Ken Museth
\date January 8, 2020
\brief A simple image class that uses pinned memory for fast GPU transfer
\warning This class is only included to support benchmark-tests.
*/
#ifndef NANOVDB_IMAGE_H_HAS_BEEN_INCLUDED
#define NANOVDB_IMAGE_H_HAS_BEEN_INCLUDED
#include <stdint.h> // for uint8_t
#include <string> // for std::string
#include <fstream> // for std::ofstream
#include <cassert>
#include <nanovdb/util/HostBuffer.h>
#if defined(NANOVDB_USE_TBB)
#include <tbb/parallel_for.h>
#include <tbb/blocked_range2d.h>
#endif
namespace nanovdb {
struct ImageData
{
int mWidth, mHeight, mSize;
float mScale[2];
ImageData(int w, int h)
: mWidth(w)
, mHeight(h)
, mSize(w * h)
, mScale{1.0f / w, 1.0f / h}
{
}
};
/// @note Can only be constructed by an ImageHandle
class Image : private ImageData
{
using DataT = ImageData;
public:
struct ColorRGB
{
uint8_t r, g, b;
__hostdev__ ColorRGB(float _r, float _g, float _b)
: r(uint8_t(_r * 255.0f))
, g(uint8_t(_g * 255.0f))
, b(uint8_t(_b * 255.0f))
{
}
};
void clear(int log2 = 7);
__hostdev__ int width() const { return DataT::mWidth; }
__hostdev__ int height() const { return DataT::mHeight; }
__hostdev__ int size() const { return DataT::mSize; }
__hostdev__ float u(int w) const { return w * mScale[0]; }
__hostdev__ float v(int h) const { return h * mScale[1]; }
__hostdev__ inline ColorRGB& operator()(int w, int h);
void writePPM(const std::string& fileName, const std::string& comment = "width height 255");
}; // Image
template<typename BufferT = HostBuffer>
class ImageHandle
{
BufferT mBuffer;
public:
ImageHandle(int width, int height, int log2 = 7);
const Image* image() const { return reinterpret_cast<const Image*>(mBuffer.data()); }
Image* image() { return reinterpret_cast<Image*>(mBuffer.data()); }
template<typename U = BufferT>
typename std::enable_if<BufferTraits<U>::hasDeviceDual, const Image*>::type
deviceImage() const { return reinterpret_cast<const Image*>(mBuffer.deviceData()); }
template<typename U = BufferT>
typename std::enable_if<BufferTraits<U>::hasDeviceDual, Image*>::type
deviceImage() { return reinterpret_cast<Image*>(mBuffer.deviceData()); }
template<typename U = BufferT>
typename std::enable_if<BufferTraits<U>::hasDeviceDual, void>::type
deviceUpload(void* stream = nullptr, bool sync = true) { mBuffer.deviceUpload(stream, sync); }
template<typename U = BufferT>
typename std::enable_if<BufferTraits<U>::hasDeviceDual, void>::type
deviceDownload(void* stream = nullptr, bool sync = true) { mBuffer.deviceDownload(stream, sync); }
};
template<typename BufferT>
ImageHandle<BufferT>::ImageHandle(int width, int height, int log2)
: mBuffer(sizeof(ImageData) + width * height * sizeof(Image::ColorRGB))
{
ImageData data(width, height);
*reinterpret_cast<ImageData*>(mBuffer.data()) = data;
this->image()->clear(log2); // clear pixels or set background
}
inline void Image::clear(int log2)
{
ColorRGB* ptr = &(*this)(0, 0);
if (log2 < 0) {
for (auto* end = ptr + ImageData::mSize; ptr != end;)
*ptr++ = ColorRGB(0, 0, 0);
} else {
const int checkerboard = 1 << log2;
auto kernel2D = [&](int x0, int y0, int x1, int y1) {
for (int h = y0; h != y1; ++h) {
const int n = h & checkerboard;
ColorRGB* p = ptr + h * ImageData::mWidth;
for (int w = x0; w != x1; ++w) {
*(p + w) = (n ^ (w & checkerboard)) ? ColorRGB(1, 1, 1) : ColorRGB(0, 0, 0);
}
}
};
#if defined(NANOVDB_USE_TBB)
tbb::blocked_range2d<int> range(0, ImageData::mWidth, 0, ImageData::mHeight);
tbb::parallel_for(range, [&](const tbb::blocked_range2d<int>& r) {
kernel2D(r.rows().begin(), r.cols().begin(), r.rows().end(), r.cols().end());
});
#else
kernel2D(0, 0, ImageData::mWidth, ImageData::mHeight);
#endif
}
}
inline Image::ColorRGB& Image::operator()(int w, int h)
{
assert(w < ImageData::mWidth);
assert(h < ImageData::mHeight);
return *(reinterpret_cast<ColorRGB*>((uint8_t*)this + sizeof(ImageData)) + w + h * ImageData::mWidth);
}
inline void Image::writePPM(const std::string& fileName, const std::string& comment)
{
std::ofstream os(fileName, std::ios::out | std::ios::binary);
if (os.fail())
throw std::runtime_error("Unable to open file named \"" + fileName + "\" for output");
os << "P6\n#" << comment << "\n"
<< this->width() << " " << this->height() << "\n255\n";
os.write((const char*)&(*this)(0, 0), this->size() * sizeof(ColorRGB));
}
} // namespace nanovdb
#endif // end of NANOVDB_IMAGE_H_HAS_BEEN_INCLUDED
@@ -110,8 +110,8 @@ int main()
std::vector<nanovdb::GridHandle<PoolBuffer>> gridHdls;
// create two grids...
gridHdls.push_back(nanovdb::createLevelSetSphere<float >(100.0, nanovdb::Vec3d(-20, 0, 0), 1.0, 3.0, nanovdb::Vec3d(0), "spheref", nanovdb::StatsMode::BBox, nanovdb::ChecksumMode::Partial, bufferContext));
gridHdls.push_back(nanovdb::createLevelSetSphere<double>(100.0, nanovdb::Vec3d( 20, 0, 0), 1.0, 3.0, nanovdb::Vec3d(0), "sphered", nanovdb::StatsMode::BBox, nanovdb::ChecksumMode::Partial, bufferContext));
gridHdls.push_back(nanovdb::createLevelSetSphere(100.0f, nanovdb::Vec3f(-20, 0, 0), 1.0, 3.0, nanovdb::Vec3R(0), "spheref", nanovdb::StatsMode::BBox, nanovdb::ChecksumMode::Partial, -1.0f, false, bufferContext));
gridHdls.push_back(nanovdb::createLevelSetSphere(100.0, nanovdb::Vec3d( 20, 0, 0), 1.0, 3.0, nanovdb::Vec3R(0), "sphered", nanovdb::StatsMode::BBox, nanovdb::ChecksumMode::Partial, -1.0f, false, bufferContext));
// Get a (raw) pointer to the NanoVDB grid form the GridManager.
auto* dstGrid = gridHdls[0].grid<float>();
@@ -3,7 +3,6 @@
#pragma once
#define _USE_MATH_DEFINES
#include <cmath>
#include <chrono>
#include <fstream>
@@ -5,7 +5,7 @@
#include <iostream>
#include <nanovdb/util/IO.h>
#include <nanovdb/util/Primitives.h>
#include <nanovdb/util/cuda/CudaDeviceBuffer.h>
#include <nanovdb/util/CudaDeviceBuffer.h>
#if defined(NANOVDB_USE_CUDA)
using BufferT = nanovdb::CudaDeviceBuffer;
@@ -26,7 +26,7 @@ int main(int ac, char** av)
handle = nanovdb::io::readGrid<BufferT>(av[1]);
std::cout << "Loaded NanoVDB grid[" << handle.gridMetaData()->shortGridName() << "]...\n";
} else {
handle = nanovdb::createLevelSetSphere<float, BufferT>(100.0f, nanovdb::Vec3d(-20, 0, 0), 1.0, 3.0, nanovdb::Vec3d(0), "sphere");
handle = nanovdb::createLevelSetSphere<float, float, BufferT>(100.0f, nanovdb::Vec3f(-20, 0, 0), 1.0, 3.0, nanovdb::Vec3R(0), "sphere");
}
if (handle.gridMetaData()->isLevelSet() == false) {
@@ -1,12 +1,12 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
#define _USE_MATH_DEFINES
#include <cmath>
#include <chrono>
#include <nanovdb/util/IO.h>
#include <nanovdb/util/cuda/CudaDeviceBuffer.h>
#include <nanovdb/util/GridBuilder.h>
#include <nanovdb/util/CudaDeviceBuffer.h>
#include <nanovdb/util/Ray.h>
#include <nanovdb/util/HDDA.h>
@@ -44,7 +44,8 @@ void runNanoVDB(nanovdb::GridHandle<BufferT>& handle, int numIterations, int num
using namespace nanovdb;
auto* h_grid = handle.grid<float>();
if (!h_grid) throw std::runtime_error("GridHandle does not contain a FloatGrid");
if (!h_grid)
throw std::runtime_error("GridHandle does not contain a FloatGrid");
Vec3f* h_positions = reinterpret_cast<Vec3f*>(positionBuffer.data());
computeFill(false, h_positions, 0, sizeof(Vec3f) * numPoints);
@@ -3,14 +3,13 @@
#if defined(NANOVDB_USE_OPENVDB)
#define _USE_MATH_DEFINES
#include <cmath>
#include <chrono>
#include <openvdb/openvdb.h>
#include <openvdb/math/Ray.h>
#include <nanovdb/util/cuda/CudaDeviceBuffer.h>
#include <nanovdb/util/CudaDeviceBuffer.h>
#include <nanovdb/util/NanoToOpenVDB.h>
#include "common.h"
@@ -21,8 +20,6 @@ using BufferT = nanovdb::CudaDeviceBuffer;
using BufferT = nanovdb::HostBuffer;
#endif
openvdb::GridBase::Ptr nanoToOpenVDB(nanovdb::GridHandle<BufferT>& handle);
void runOpenVDB(nanovdb::GridHandle<BufferT>& handle, int numIterations, int numPoints, BufferT& positionBuffer, BufferT& velocityBuffer)
{
using GridT = openvdb::FloatGrid;
@@ -39,4 +36,4 @@ void runOpenVDB(nanovdb::GridHandle<BufferT>& handle, int numIterations, int num
// Not yet implemented...
}
#endif
#endif
@@ -1,44 +0,0 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
#include <nanovdb/util/CreateNanoGrid.h>
#include <nanovdb/util/Primitives.h> // for nanovdb::createLevelSetSphere
#include <nanovdb/util/cuda/CudaDeviceBuffer.h>// for nanovdb::CudaDeviceBuffer
extern "C" void launch_kernels(const nanovdb::NanoGrid<nanovdb::ValueOnIndex>*,// device grid
const nanovdb::NanoGrid<nanovdb::ValueOnIndex>*,// host grid
cudaStream_t stream);
/// @brief This examples depends on NanoVDB and CUDA.
int main(int, char**)
{
using SrcGridT = nanovdb::FloatGrid;
using DstBuildT = nanovdb::ValueOnIndex;
using BufferT = nanovdb::CudaDeviceBuffer;
try {
// Create an NanoVDB grid of a sphere at the origin with radius 100 and voxel size 1.
auto srcHandle = nanovdb::createLevelSetSphere<float>();
auto *srcGrid = srcHandle.grid<float>();
// Converts the FloatGrid to an IndexGrid using CUDA for memory management.
auto idxHandle = nanovdb::createNanoGrid<SrcGridT, DstBuildT, BufferT>(*srcGrid, 1u, false , false);// 1 channel, no tiles or stats
cudaStream_t stream; // Create a CUDA stream to allow for asynchronous copy of pinned CUDA memory.
cudaStreamCreate(&stream);
idxHandle.deviceUpload(stream, false); // Copy the NanoVDB grid to the GPU asynchronously
auto* cpuGrid = idxHandle.grid<DstBuildT>(); // get a (raw) pointer to a NanoVDB grid of value type float on the CPU
auto* gpuGrid = idxHandle.deviceGrid<DstBuildT>(); // get a (raw) pointer to a NanoVDB grid of value type float on the GPU
if (!gpuGrid) throw std::runtime_error("GridHandle did not contain a device grid with value type float");
if (!cpuGrid) throw std::runtime_error("GridHandle did not contain a host grid with value type float");
launch_kernels(cpuGrid, cpuGrid, stream); // Call a host method to print a grid value on both the CPU and GPU
cudaStreamDestroy(stream); // Destroy the CUDA stream
}
catch (const std::exception& e) {
std::cerr << "An exception occurred: \"" << e.what() << "\"" << std::endl;
}
return 0;
}
@@ -1,42 +0,0 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
#include <nanovdb/NanoVDB.h> // this defined the core tree data structure of NanoVDB accessable on both the host and device
#include <nanovdb/util/cuda/CudaGridHandle.cuh>// required since GridHandle<CudaDeviceBuffer> has device code
#include <stdio.h> // for printf
// This is called by the host only
void cpu_kernel(const nanovdb::NanoGrid<nanovdb::ValueOnIndex>* cpuGrid)
{
nanovdb::ChannelAccessor<float, nanovdb::ValueOnIndex> acc(*cpuGrid);
//printf("\nNanoVDB CPU: channels=%u values=%lu\n", acc.grid().blindDataCount(), acc.root().maximum());
printf("NanoVDB CPU; %lu\n", acc.idx( 0, 0, 0));
printf("NanoVDB CPU; %lu\n", acc.idx( 99, 0, 0));
printf("NanoVDB CPU; %lu\n", acc.idx(100, 0, 0));
printf("NanoVDB CPU; %4.2f\n", acc( 0, 0, 0));
printf("NanoVDB CPU; %4.2f\n", acc( 99, 0, 0));
printf("NanoVDB CPU; %4.2f\n", acc(100, 0, 0));
}
// This is called by the device only
__global__ void gpu_kernel(const nanovdb::NanoGrid<nanovdb::ValueOnIndex>* gpuGrid)
{
nanovdb::ChannelAccessor<float, nanovdb::ValueOnIndex> acc(*gpuGrid);
//printf("\nNanoVDB GPU: channels=%u values=%lu\n", gpuGrid->blindDataCount(), acc.root().maximum());
printf("NanoVDB GPU; %lu\n", acc.idx( 0, 0, 0));
printf("NanoVDB GPU; %lu\n", acc.idx( 99, 0, 0));
printf("NanoVDB GPU; %lu\n", acc.idx(100, 0, 0));
printf("NanoVDB GPU; %4.2f\n", acc( 0, 0, 0));
printf("NanoVDB GPU; %4.2f\n", acc( 99, 0, 0));
printf("NanoVDB GPU; %4.2f\n", acc(100, 0, 0));
}
// This is called by the client code on the host
extern "C" void launch_kernels(const nanovdb::NanoGrid<nanovdb::ValueOnIndex>* gpuGrid,
const nanovdb::NanoGrid<nanovdb::ValueOnIndex>* cpuGrid,
cudaStream_t stream)
{
gpu_kernel<<<1, 1, 0, stream>>>(gpuGrid); // Launch the device kernel asynchronously
cpu_kernel(cpuGrid); // Launch the host "kernel" (synchronously)
}
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: MPL-2.0
#include <nanovdb/util/GridBuilder.h>
#include <nanovdb/util/CreateNanoGrid.h>
#include <iostream>
@@ -12,14 +11,14 @@
int main()
{
try {
nanovdb::build::Grid<float> grid(0.0f);
auto acc = grid.getAccessor();
nanovdb::GridBuilder<float> builder(0.0f);
auto acc = builder.getAccessor();
acc.setValue(nanovdb::Coord(1, 2, 3), 1.0f);
printf("build::Grid: (%i,%i,%i)=%4.2f\t", 1, 2, 3, acc.getValue(nanovdb::Coord(1, 2, 3)));
printf("build::Grid: (%i,%i,%i)=%4.2f\n", 1, 2,-3, acc.getValue(nanovdb::Coord(1, 2,-3)));
printf("GridBuilder: (%i,%i,%i)=%4.2f\t", 1, 2, 3, acc.getValue(nanovdb::Coord(1, 2, 3)));
printf("GridBuilder: (%i,%i,%i)=%4.2f\n", 1, 2,-3, acc.getValue(nanovdb::Coord(1, 2,-3)));
auto handle = nanovdb::createNanoGrid(grid);
auto handle = builder.getHandle<>();
auto* dstGrid = handle.grid<float>(); // Get a (raw) pointer to the NanoVDB grid form the GridManager.
if (!dstGrid)
throw std::runtime_error("GridHandle does not contain a grid with value type float");
@@ -1,47 +0,0 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
#undef NANOVDB_USE_OPENVDB // Prevents include/openvdb/points/AttributeArray.h:1841:25: error: ‘stride’ cannot be used as a function
#include <nanovdb/util/GridBuilder.h>
#include <nanovdb/util/CreateNanoGrid.h>
#include <nanovdb/util/cuda/CudaDeviceBuffer.h>
#include <iostream>
extern "C" void launch_kernels(const nanovdb::NanoGrid<float>*,// GPU grid
const nanovdb::NanoGrid<float>*,// CPU grid
cudaStream_t stream);
/// @brief Creates a NanoVDB grids with custom values and access them.
///
/// @note This example only depends on NanoVDB.
int main()
{
try {
using GridT = nanovdb::build::Grid<float>;
GridT grid(0.0f);// empty grid with a background value of zero
auto acc = grid.getAccessor();
acc.setValue(nanovdb::Coord(1, 2, 3), 1.0f);
printf("build::Grid: (%i,%i,%i)=%4.2f\n", 1, 2,-3, acc.getValue(nanovdb::Coord(1, 2,-3)));
printf("build::Grid: (%i,%i,%i)=%4.2f\n", 1, 2, 3, acc.getValue(nanovdb::Coord(1, 2, 3)));
// convert build::grid to a nanovdb::GridHandle using a Cuda buffer
auto handle = nanovdb::createNanoGrid<GridT, float, nanovdb::CudaDeviceBuffer>(grid);
auto* cpuGrid = handle.grid<float>(); //get a (raw) pointer to a NanoVDB grid of value type float on the CPU
if (!cpuGrid) throw std::runtime_error("GridHandle does not contain a grid with value type float");
cudaStream_t stream; // Create a CUDA stream to allow for asynchronous copy of pinned CUDA memory.
cudaStreamCreate(&stream);
handle.deviceUpload(stream, false); // Copy the NanoVDB grid to the GPU asynchronously
auto* gpuGrid = handle.deviceGrid<float>(); // get a (raw) pointer to a NanoVDB grid of value type float on the GPU
launch_kernels(gpuGrid, cpuGrid, stream); // Call a host method to print a grid values on both the CPU and GPU
cudaStreamDestroy(stream); // Destroy the CUDA stream
}
catch (const std::exception& e) {
std::cerr << "An exception occurred: \"" << e.what() << "\"" << std::endl;
}
return 0;
}
@@ -1,36 +0,0 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
#include <nanovdb/NanoVDB.h> // this defined the core tree data structure of NanoVDB accessable on both the host and device
#include <nanovdb/util/cuda/CudaGridHandle.cuh>// required since GridHandle<CudaDeviceBuffer> has device code
#include <stdio.h> // for printf
// This is called by the host only
void cpu_kernel(const nanovdb::NanoGrid<float>* cpuGrid)
{
auto cpuAcc = cpuGrid->getAccessor();
for (int k=-3; k<=3; k+=6) {
printf("NanoVDB cpu: (%i,%i,%i)=%4.2f\n", 1, 2, k, cpuAcc.getValue(nanovdb::Coord(1, 2, k)));
}
}
// This is called by the device only
__global__ void gpu_kernel(const nanovdb::NanoGrid<float>* deviceGrid)
{
if (threadIdx.x != 0 && threadIdx.x != 6) return;
int k = threadIdx.x - 3;
auto gpuAcc = deviceGrid->getAccessor();
printf("NanoVDB gpu: (%i,%i,%i)=%4.2f\n", 1, 2, k, gpuAcc.getValue(nanovdb::Coord(1, 2, k)));
}
// This is called by the client code on the host
extern "C" void launch_kernels(const nanovdb::NanoGrid<float>* deviceGrid,
const nanovdb::NanoGrid<float>* cpuGrid,
cudaStream_t stream)
{
// Launch the device kernel asynchronously
gpu_kernel<<<1, 64, 0, stream>>>(deviceGrid);
// Launch the host "kernel" (synchronously)
cpu_kernel(cpuGrid);
}
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: MPL-2.0
#include <nanovdb/util/GridBuilder.h>
#include <nanovdb/util/CreateNanoGrid.h>
#include <nanovdb/util/IO.h>
#include <iostream>
@@ -12,20 +11,22 @@
/// @note This example only depends on NanoVDB.
int main()
{
using namespace nanovdb;
try {
const float background = 5.0f;
nanovdb::GridBuilder<float> builder(background, nanovdb::GridClass::LevelSet);
auto acc = builder.getAccessor();
const int size = 500;
auto func = [&](const Coord &ijk){
auto func = [&](const nanovdb::Coord &ijk){
float v = 40.0f + 50.0f*(cos(ijk[0]*0.1f)*sin(ijk[1]*0.1f) +
cos(ijk[1]*0.1f)*sin(ijk[2]*0.1f) +
cos(ijk[2]*0.1f)*sin(ijk[0]*0.1f));
v = Max(v, Vec3f(ijk).length() - size);// CSG intersection with a sphere
v = nanovdb::Max(v, nanovdb::Vec3f(ijk).length() - size);// CSG intersection with a sphere
return v > background ? background : v < -background ? -background : v;// clamp value
};
build::Grid<float> grid(background, "funny", GridClass::LevelSet);
grid(func, CoordBBox(Coord(-size), Coord(size)));
io::writeGrid("data/funny.nvdb", createNanoGrid(grid), io::Codec::BLOSC);
builder(func, nanovdb::CoordBBox(nanovdb::Coord(-size),nanovdb::Coord(size)));
auto handle = builder.getHandle<>();
nanovdb::io::writeGrid("data/funny.nvdb", handle, nanovdb::io::Codec::BLOSC);
}
catch (const std::exception& e) {
std::cerr << "An exception occurred: \"" << e.what() << "\"" << std::endl;
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: MPL-2.0
#include <nanovdb/util/GridBuilder.h>
#include <nanovdb/util/CreateNanoGrid.h>
#include <nanovdb/util/IO.h>
// Helper struct to create a default value for the type.
@@ -37,9 +36,11 @@ void buildGridForType(std::vector<nanovdb::GridHandle<>>& gridHandles, T const&
try {
nanovdb::build::Grid<ValueT> grid(bgValue, typeNameStr);
auto acc = grid.getAccessor();
nanovdb::GridBuilder<ValueT> builder(bgValue);
auto acc = builder.getAccessor();
const int radius = 16;
for (int z = -radius; z <= radius; ++z) {
for (int y = -radius; y <= radius; ++y) {
for (int x = -radius; x <= radius; ++x) {
@@ -49,7 +50,8 @@ void buildGridForType(std::vector<nanovdb::GridHandle<>>& gridHandles, T const&
}
}
}
gridHandles.push_back(nanovdb::createNanoGrid(grid));
gridHandles.push_back(builder.template getHandle<>(1.0, nanovdb::Vec3d(0), typeNameStr));
}
catch (const std::exception& e) {
std::cerr << "An exception occurred: \"" << e.what() << "\"" << std::endl;
@@ -81,11 +83,8 @@ int main()
*/
buildGridForType(gridHandles, float(0), double(0), int16_t(0), int32_t(0), int64_t(0), uint32_t(0), nanovdb::Vec3f(0) /*, nanovdb::Vec3d(0)*/ /*, bool(false)*/ /*, uint16_t(0)*/);
#if 0
nanovdb::io::writeGrids("data/custom_types.nvdb", gridHandles);
#else
nanovdb::io::writeUncompressedGrids("data/custom_types.nvdb", gridHandles);
#endif
nanovdb::io::writeGrids<nanovdb::HostBuffer, std::vector>("data/custom_types.nvdb", gridHandles);
}
catch (const std::exception& e) {
std::cerr << "An exception occurred: \"" << e.what() << "\"" << std::endl;
@@ -148,8 +148,8 @@ int main()
std::vector<nanovdb::GridHandle<MapPoolBuffer>> gridHdls;
// create two grids...
gridHdls.push_back(nanovdb::createLevelSetSphere<float >(100.0, nanovdb::Vec3d(-20, 0, 0), 1.0, 3.0, nanovdb::Vec3d(0), "spheref", nanovdb::StatsMode::BBox, nanovdb::ChecksumMode::Partial, bufferContext));
gridHdls.push_back(nanovdb::createLevelSetSphere<double>(100.0, nanovdb::Vec3d( 20, 0, 0), 1.0, 3.0, nanovdb::Vec3d(0), "sphered", nanovdb::StatsMode::BBox, nanovdb::ChecksumMode::Partial, bufferContext));
gridHdls.push_back(nanovdb::createLevelSetSphere(100.0f, nanovdb::Vec3f(-20, 0, 0), 1.0, 3.0, nanovdb::Vec3R(0), "spheref", nanovdb::StatsMode::BBox, nanovdb::ChecksumMode::Partial, -1.0f, false, bufferContext));
gridHdls.push_back(nanovdb::createLevelSetSphere(100.0, nanovdb::Vec3d( 20, 0, 0), 1.0, 3.0, nanovdb::Vec3R(0), "sphered", nanovdb::StatsMode::BBox, nanovdb::ChecksumMode::Partial, -1.0f, false, bufferContext));
// share grid[0]'s buffer into a parent-scope handle to prevent deletion.
anotherHdl = nanovdb::GridHandle<MapPoolBuffer>(bufferContext.copy(gridHdls[0].buffer().mId));
@@ -1,43 +0,0 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
/// @brief This examples demonstrates how values in a NanpVDB grid can be
/// modified on the device. It depends on NanoVDB and CUDA thrust.
#include <nanovdb/util/Primitives.h>
#include <nanovdb/util/cuda/CudaDeviceBuffer.h>
extern "C" void scaleActiveVoxels(nanovdb::FloatGrid *grid_d, uint64_t leafCount, float scale);
int main()
{
try {
// Create an NanoVDB grid of a sphere at the origin with radius 100 and voxel size 1.
auto handle = nanovdb::createLevelSetSphere<float, nanovdb::CudaDeviceBuffer>(100.0f);
using GridT = nanovdb::FloatGrid;
handle.deviceUpload(0, false); // Copy the NanoVDB grid to the GPU asynchronously
const GridT* grid = handle.grid<float>(); // get a (raw) const pointer to a NanoVDB grid of value type float on the CPU
GridT* deviceGrid = handle.deviceGrid<float>(); // get a (raw) pointer to a NanoVDB grid of value type float on the GPU
if (!deviceGrid || !grid) {
throw std::runtime_error("GridHandle did not contain a grid with value type float");
}
if (!grid->isSequential<0>()) {
throw std::runtime_error("Grid does not support sequential access to leaf nodes!");
}
std::cout << "Value before scaling = " << grid->tree().getValue(nanovdb::Coord(101,0,0)) << std::endl;
scaleActiveVoxels(deviceGrid, grid->tree().nodeCount(0), 2.0f);
handle.deviceDownload(0, true); // Copy the NanoVDB grid to the CPU synchronously
std::cout << "Value after scaling = " << grid->tree().getValue(nanovdb::Coord(101,0,0)) << std::endl;
}
catch (const std::exception& e) {
std::cerr << "An exception occurred: \"" << e.what() << "\"" << std::endl;
}
return 0;
}
@@ -7,10 +7,10 @@
#include <thrust/iterator/counting_iterator.h>
#include <thrust/for_each.h>
#include <nanovdb/util/cuda/CudaDeviceBuffer.h>
#include <nanovdb/util/cuda/CudaGridHandle.cuh>
#include <nanovdb/util/Primitives.h>
#include <nanovdb/util/CudaDeviceBuffer.h>
extern "C" void scaleActiveVoxels(nanovdb::FloatGrid *grid_d, uint64_t leafCount, float scale)
void scaleActiveVoxels(nanovdb::FloatGrid *grid_d, uint64_t leafCount, float scale)
{
auto kernel = [grid_d, scale] __device__ (const uint64_t n) {
auto *leaf_d = grid_d->tree().getFirstNode<0>() + (n >> 9);// this only works if grid->isSequential<0>() == true
@@ -23,4 +23,37 @@ extern "C" void scaleActiveVoxels(nanovdb::FloatGrid *grid_d, uint64_t leafCoun
thrust::counting_iterator<uint64_t, thrust::device_system_tag> iter(0);
thrust::for_each(iter, iter + 512*leafCount, kernel);
}
int main()
{
try {
// Create an NanoVDB grid of a sphere at the origin with radius 100 and voxel size 1.
auto handle = nanovdb::createLevelSetSphere<float, float, nanovdb::CudaDeviceBuffer>(100.0f);
using GridT = nanovdb::FloatGrid;
handle.deviceUpload(0, false); // Copy the NanoVDB grid to the GPU asynchronously
const GridT* grid = handle.grid<float>(); // get a (raw) const pointer to a NanoVDB grid of value type float on the CPU
GridT* deviceGrid = handle.deviceGrid<float>(); // get a (raw) pointer to a NanoVDB grid of value type float on the GPU
if (!deviceGrid || !grid) {
throw std::runtime_error("GridHandle did not contain a grid with value type float");
}
if (!grid->isSequential<0>()) {
throw std::runtime_error("Grid does not support sequential access to leaf nodes!");
}
std::cout << "Value before scaling = " << grid->tree().getValue(nanovdb::Coord(101,0,0)) << std::endl;
scaleActiveVoxels(deviceGrid, grid->tree().nodeCount(0), 2.0f);
handle.deviceDownload(0, true); // Copy the NanoVDB grid to the CPU synchronously
std::cout << "Value after scaling = " << grid->tree().getValue(nanovdb::Coord(101,0,0)) << std::endl;
}
catch (const std::exception& e) {
std::cerr << "An exception occurred: \"" << e.what() << "\"" << std::endl;
}
return 0;
}
@@ -1,59 +0,0 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
#include <openvdb/tools/LevelSetSphere.h> // replace with your own dependencies for generating the OpenVDB grid
#include <nanovdb/util/CreateNanoGrid.h> // converter from OpenVDB to NanoVDB (includes NanoVDB.h and GridManager.h)
#include <nanovdb/util/cuda/CudaDeviceBuffer.h>
#include <nanovdb/util/NodeManager.h>
extern "C" void launch_kernels(const nanovdb::NodeManager<float>*,
const nanovdb::NodeManager<float>*,
cudaStream_t stream);
extern "C" void cudaCreateNodeManager(const nanovdb::NanoGrid<float>*,
nanovdb::NodeManagerHandle<nanovdb::CudaDeviceBuffer>*);
/// @brief This examples depends on OpenVDB, NanoVDB and CUDA.
int main()
{
using SrcGridT = openvdb::FloatGrid;
using BufferT = nanovdb::CudaDeviceBuffer;
try {
cudaStream_t stream; // Create a CUDA stream to allow for asynchronous copy of pinned CUDA memory.
cudaStreamCreate(&stream);
// Create an OpenVDB grid of a sphere at the origin with radius 100 and voxel size 1.
auto srcGrid = openvdb::tools::createLevelSetSphere<SrcGridT>(100.0f, openvdb::Vec3f(0.0f), 1.0f);
// Converts the OpenVDB to NanoVDB and returns a GridHandle that uses CUDA for memory management.
auto gridHandle = nanovdb::createNanoGrid<SrcGridT, float, BufferT>(*srcGrid);
gridHandle.deviceUpload(stream, false); // Copy the NanoVDB grid to the GPU asynchronously
auto* grid = gridHandle.grid<float>(); // get a (raw) pointer to a NanoVDB grid of value type float on the CPU
auto* deviceGrid = gridHandle.deviceGrid<float>(); // get a (raw) pointer to a NanoVDB grid of value type float on the GPU
if (!deviceGrid || !grid) {
throw std::runtime_error("GridHandle did not contain a grid with value type float");
}
auto nodeHandle = nanovdb::createNodeManager<float, BufferT>(*grid);
auto *nodeMgr = nodeHandle.template mgr<float>();
#if 0// this approach copies a NodeManager from host to device
nodeHandle.deviceUpload(deviceGrid, stream, false);
auto *deviceNodeMgr = nodeHandle.template deviceMgr<float>();
#else// the approach below constructs a new NodeManager directly for a device grid
nanovdb::NodeManagerHandle<BufferT> nodeHandle2;
cudaCreateNodeManager(deviceGrid, &nodeHandle2);
auto *deviceNodeMgr = nodeHandle2.template deviceMgr<float>();
#endif
if (!deviceNodeMgr || !nodeMgr) {
throw std::runtime_error("NodeManagerHandle did not contain a grid with value type float");
}
launch_kernels(deviceNodeMgr, nodeMgr, stream); // Call a host method to print a grid value on both the CPU and GPU
cudaStreamDestroy(stream); // Destroy the CUDA stream
}
catch (const std::exception& e) {
std::cerr << "An exception occurred: \"" << e.what() << "\"" << std::endl;
}
return 0;
}
@@ -1,37 +0,0 @@
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
#include <nanovdb/NanoVDB.h> // this defined the core tree data structure of NanoVDB accessable on both the host and device
#include <nanovdb/util/NodeManager.h>
#include <nanovdb/util/cuda/CudaGridHandle.cuh>// required since GridHandle<CudaDeviceBuffer> has device code
#include <nanovdb/util/cuda/CudaNodeManager.cuh>
#include <stdio.h> // for printf
// This is called by the host only
void cpu_kernel(const nanovdb::NodeManager<float>* cpuMgr)
{
printf("NanoVDB cpu; %4.2f\n", cpuMgr->tree().getValue(nanovdb::Coord(99, 0, 0)));
}
// This is called by the device only
__global__ void gpu_kernel(const nanovdb::NodeManager<float>* deviceMgr)
{
printf("NanoVDB gpu: %4.2f\n", deviceMgr->tree().getValue(nanovdb::Coord(99, 0, 0)));
}
// This is called by the client code on the host
extern "C" void launch_kernels(const nanovdb::NodeManager<float>* deviceMgr,
const nanovdb::NodeManager<float>* cpuMgr,
cudaStream_t stream)
{
gpu_kernel<<<1, 1, 0, stream>>>(deviceMgr); // Launch the device kernel asynchronously
cpu_kernel(cpuMgr); // Launch the host "kernel" (synchronously)
}
// Simple wrapper that makes sure nanovdb::cudaCreateNodeManager is initiated
extern "C" void cudaCreateNodeManager(const nanovdb::NanoGrid<float> *d_grid,
nanovdb::NodeManagerHandle<nanovdb::CudaDeviceBuffer> *handle)
{
*handle = std::move(nanovdb::cudaCreateNodeManager<float>(d_grid));
}
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: MPL-2.0
#include <openvdb/tools/LevelSetSphere.h> // replace with your own dependencies for generating the OpenVDB grid
#include <nanovdb/util/CreateNanoGrid.h> // converter from OpenVDB to NanoVDB (includes NanoVDB.h and GridManager.h)
#include <nanovdb/util/OpenToNanoVDB.h> // converter from OpenVDB to NanoVDB (includes NanoVDB.h and GridManager.h)
#include <nanovdb/util/IO.h>
/// @brief Convert an openvdb level set sphere into a nanovdb, access a single value in both grids, and save NanoVDB to file.
@@ -13,7 +13,9 @@ int main()
try {
// Create an OpenVDB grid of a sphere at the origin with radius 100 and voxel size 1.
auto srcGrid = openvdb::tools::createLevelSetSphere<openvdb::FloatGrid>(100.0f, openvdb::Vec3f(0.0f), 1.0f);
auto handle = nanovdb::createNanoGrid(*srcGrid); // Convert from OpenVDB to NanoVDB and return a shared pointer to a GridHandle.
auto handle = nanovdb::openToNanoVDB(*srcGrid); // Convert from OpenVDB to NanoVDB and return a shared pointer to a GridHandle.
auto* dstGrid = handle.grid<float>(); // Get a (raw) pointer to the NanoVDB grid form the GridManager.
if (!dstGrid)
throw std::runtime_error("GridHandle does not contain a grid with value type float");
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: MPL-2.0
#include <openvdb/tools/LevelSetSphere.h> // replace with your own dependencies for generating the OpenVDB grid
#include <nanovdb/util/CreateNanoGrid.h> // converter from OpenVDB to NanoVDB (includes NanoVDB.h and GridManager.h)
#include <nanovdb/util/OpenToNanoVDB.h> // converter from OpenVDB to NanoVDB (includes NanoVDB.h and GridManager.h)
#include <nanovdb/util/IO.h>
// Convert an openvdb level set sphere into a nanovdb, use accessors to print out multiple values from both
@@ -15,7 +15,7 @@ int main()
auto srcGrid = openvdb::tools::createLevelSetSphere<openvdb::FloatGrid>(100.0f, openvdb::Vec3f(0.0f), 1.0f);
// Convert the OpenVDB grid, srcGrid, into a NanoVDB grid handle.
auto handle = nanovdb::createNanoGrid(*srcGrid);
auto handle = nanovdb::openToNanoVDB(*srcGrid);
// Define a (raw) pointer to the NanoVDB grid on the host. Note we match the value type of the srcGrid!
auto* dstGrid = handle.grid<float>();
@@ -2,23 +2,22 @@
// SPDX-License-Identifier: MPL-2.0
#include <openvdb/tools/LevelSetSphere.h> // replace with your own dependencies for generating the OpenVDB grid
#include <nanovdb/util/CreateNanoGrid.h> // converter from OpenVDB to NanoVDB (includes NanoVDB.h and GridManager.h)
#include <nanovdb/util/cuda/CudaDeviceBuffer.h>
#include <nanovdb/util/OpenToNanoVDB.h> // converter from OpenVDB to NanoVDB (includes NanoVDB.h and GridManager.h)
#include <nanovdb/util/CudaDeviceBuffer.h>
extern "C" void launch_kernels(const nanovdb::NanoGrid<float>*,
const nanovdb::NanoGrid<float>*,
cudaStream_t stream);
/// @brief This examples depends on OpenVDB, NanoVDB and CUDA.
int main(int, char**)
int main()
{
using SrcGridT = openvdb::FloatGrid;
try {
// Create an OpenVDB grid of a sphere at the origin with radius 100 and voxel size 1.
auto srcGrid = openvdb::tools::createLevelSetSphere<SrcGridT>(100.0f, openvdb::Vec3f(0.0f), 1.0f);
auto srcGrid = openvdb::tools::createLevelSetSphere<openvdb::FloatGrid>(100.0f, openvdb::Vec3f(0.0f), 1.0f);
// Converts the OpenVDB to NanoVDB and returns a GridHandle that uses CUDA for memory management.
auto handle = nanovdb::createNanoGrid<SrcGridT, float, nanovdb::CudaDeviceBuffer>(*srcGrid);
auto handle = nanovdb::openToNanoVDB<nanovdb::CudaDeviceBuffer>(*srcGrid);
cudaStream_t stream; // Create a CUDA stream to allow for asynchronous copy of pinned CUDA memory.
cudaStreamCreate(&stream);
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: MPL-2.0
#include <nanovdb/NanoVDB.h> // this defined the core tree data structure of NanoVDB accessable on both the host and device
#include <nanovdb/util/cuda/CudaGridHandle.cuh>// required since GridHandle<CudaDeviceBuffer> has device code
#include <stdio.h> // for printf
// This is called by the host only
@@ -3,7 +3,6 @@
#pragma once
#define _USE_MATH_DEFINES
#include <cmath>
#include <chrono>
#include <fstream>
@@ -5,9 +5,9 @@
#include <iostream>
#include <nanovdb/util/IO.h>
#include <nanovdb/util/Primitives.h>
#include <nanovdb/util/CudaDeviceBuffer.h>
#if defined(NANOVDB_USE_CUDA)
#include <nanovdb/util/cuda/CudaDeviceBuffer.h>
using BufferT = nanovdb::CudaDeviceBuffer;
#else
using BufferT = nanovdb::HostBuffer;
@@ -26,7 +26,7 @@ int main(int ac, char** av)
handle = nanovdb::io::readGrid<BufferT>(av[1]);
std::cout << "Loaded NanoVDB grid[" << handle.gridMetaData()->shortGridName() << "]...\n";
} else {
handle = nanovdb::createFogVolumeSphere<float, BufferT>(100.0f, nanovdb::Vec3d(-20, 0, 0), 1.0, 3.0, nanovdb::Vec3d(0), "sphere");
handle = nanovdb::createFogVolumeSphere<float, float, BufferT>(100.0f, nanovdb::Vec3f(-20, 0, 0), 1.0, 3.0, nanovdb::Vec3d(0), "sphere");
}
if (handle.gridMetaData()->isFogVolume() == false) {

Some files were not shown because too many files have changed in this diff Show More