Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Massive improvements to NanoVDB #1651

Merged
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
563ff1b
Massive improvements to NanoVDB
kmuseth Aug 1, 2023
492ea4d
fixed typo
kmuseth Aug 1, 2023
6f9ab93
fixed typos
kmuseth Aug 1, 2023
fa4e20b
removed tabs
kmuseth Aug 1, 2023
77ec3eb
fixed Windows compiler error
kmuseth Aug 1, 2023
7c02a1f
added back ex_modify_nanovdb_thrust
kmuseth Aug 2, 2023
9b1b1d6
major refactoring and renaming
kmuseth Aug 4, 2023
07089f2
fixed build issue of nanovdb benchmarks
kmuseth Aug 4, 2023
ebd750a
snapshot
kmuseth Aug 4, 2023
680a67b
updated CMakeLists.txt
kmuseth Aug 4, 2023
4b6cdc8
removed tabs
kmuseth Aug 4, 2023
7764a85
removed tabs
kmuseth Aug 4, 2023
4ba3f1d
fixed build issue
kmuseth Aug 4, 2023
046f663
build fix
kmuseth Aug 4, 2023
0555dd4
fixing thrust example
kmuseth Aug 4, 2023
82711d9
Merge remote-tracking branch 'origin/master' into feature/nanovdb_32.5.1
kmuseth Aug 24, 2023
2a883ed
sync with private repo
kmuseth Aug 24, 2023
c320c63
fixed warning
kmuseth Aug 24, 2023
9cc8778
fixing build on Windows
kmuseth Aug 24, 2023
60dabbf
fixed typo
kmuseth Aug 24, 2023
04cc6be
cleanup of CudaPointsToGrid and improvements to is_same
kmuseth Aug 31, 2023
df574a8
fixed issues in IO.h and CreateNanoGrid.h
kmuseth Sep 5, 2023
433aa35
fixing nvcc/tbb build issue
kmuseth Sep 5, 2023
28f6361
snapshot
kmuseth Sep 27, 2023
8705672
removed Benchmark from cmake - for now
kmuseth Sep 28, 2023
96499dd
removed examples/Benchmark (for now)
kmuseth Sep 28, 2023
a901aeb
another major commit, e.g. added lots of new cuda tools in util/cuda
kmuseth Oct 11, 2023
fb90858
added dummy implementation of cudaMallocAsync and cudaFreeAsync
kmuseth Oct 12, 2023
a56439b
fixed typo in previous commit
kmuseth Oct 12, 2023
90cccba
fixed CMakeLists.txt
kmuseth Oct 12, 2023
99d0ea8
cleanup
kmuseth Oct 12, 2023
b7d76dd
fixed Windows build issue in ex_nodemanager_cuda
kmuseth Oct 12, 2023
5b3681a
fixed compiler warning on OSX
kmuseth Oct 12, 2023
09dd3ea
improved documentation of fancy_ptr
kmuseth Oct 13, 2023
0eff43e
removed whitespace
kmuseth Oct 13, 2023
e9b89e5
added Vec3/4 methods to Rgba8
kmuseth Oct 16, 2023
6faffc3
treading GridType::Half as active
kmuseth Oct 19, 2023
ef1c3fe
improved documentation
kmuseth Oct 19, 2023
e0f345e
updated pendingchanges/nanovdb.txt
kmuseth Oct 19, 2023
cba0e7c
added CudaGridStats.cuh and fixed an issue in CudaPointsToGrids
kmuseth Oct 22, 2023
d15e5b2
reverted nanovdb/Readme.md
kmuseth Oct 22, 2023
e25ebd8
nanovdb/unittest/CMakeLists.txt
kmuseth Oct 22, 2023
b85092c
improved CudaGridStats and modified NanoVDB.h to support non-serial g…
kmuseth Oct 24, 2023
888fefd
removed whitespace
kmuseth Oct 24, 2023
6dd5547
fixed issue in CreateNanoGrid.h
kmuseth Oct 25, 2023
b9ab546
more cleanup and minor improvements
kmuseth Oct 25, 2023
490788e
fixed bug in BBox::ITerator::end()
kmuseth Oct 25, 2023
79f8241
fixed bug in BBox::ITerator::end()
kmuseth Oct 25, 2023
5005cc6
added more unit-tests
kmuseth Oct 25, 2023
d5aac5c
fixes typos and windows build issues
kmuseth Oct 26, 2023
29463fa
Merge remote-tracking branch 'origin/master' into feature/nanovdb_32.5.1
kmuseth Oct 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/nanovdb/HelloWorld.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```cpp
#include <openvdb/tools/LevelSetSphere.h> // replace with your own dependencies for generating the OpenVDB grid
#include <nanovdb/util/OpenToNanoVDB.h> // converter from OpenVDB to NanoVDB (includes NanoVDB.h and GridManager.h)
#include <nanovdb/util/CreateNanoGrid.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
Expand All @@ -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::openToNanoVDB(*srcGrid);
auto handle = nanovdb::createNanoGrid(*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>();
Expand Down Expand Up @@ -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/DefaultCudaAllocator.h> // required for CUDA memory management
#include <nanovdb/util/cuda/CudaDeviceBuffer.h> // required for CUDA memory management

extern "C" void launch_kernels(const nanovdb::NanoGrid<float>*,
const nanovdb::NanoGrid<float>*,
Expand Down
247 changes: 131 additions & 116 deletions doc/nanovdb/SourceTree.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,120 +15,135 @@
```bash
foo@bar:~$ tree
.
└── nanovdb
├── 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.cc
│ │ ├── Benchmark_dense.cc
│ │ ├── Benchmark_nano.cc
│ │ ├── Camera.h
│ │ ├── CMakeLists.txt
│ │ ├── DenseGrid.h
│ │ └── Image.h
│ ├── 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.cc
│ │ └── index_grid_cuda.cu
│ ├── ex_make_custom_nanovdb
│ │ └── make_custom_nanovdb.cc
│ ├── 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.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.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.cc
│ │ └── read_nanovdb_sphere_accessor_cuda.cu
│ ├── ex_util
│ │ ├── ComputePrimitives.h
│ │ └── CpuTimer.h
│ ├── 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
│ └── TestOpenVDB.cc
└── util
├── CSampleFromVoxels.h
├── CudaDeviceBuffer.h
├── DitherLUT.h
├── ForEach.h
├── GridBuilder.h
├── GridChecksum.h
├── GridHandle.h
├── GridStats.h
├── GridValidator.h
├── HDDA.h
├── HostBuffer.h
├── IndexGridBuilder.h
├── Invoke.h
├── IO.h
├── NanoToOpenVDB.h
├── NodeManager.h
├── OpenToNanoVDB.h
├── Primitives.h
├── Range.h
├── Ray.h
├── Reduce.h
├── SampleFromVoxels.h
└── Stencils.h
├── 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
```
21 changes: 17 additions & 4 deletions nanovdb/nanovdb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -71,12 +71,13 @@ if(UNIX)
find_package(Threads REQUIRED)
endif()

if(NANOVDB_BUILD_UNITTESTS OR NANOVDB_BUILD_BENCHMARK)
#if(NANOVDB_BUILD_UNITTESTS OR NANOVDB_BUILD_BENCHMARK)
if(NANOVDB_BUILD_UNITTESTS)
find_package(GTest REQUIRED)
endif()

if(NANOVDB_USE_CUDA)
set(CMAKE_CUDA_STANDARD 11)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)

if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
Expand Down Expand Up @@ -167,8 +168,19 @@ set(NANOVDB_INCLUDE_FILES

# NanoVDB util header files
set(NANOVDB_INCLUDE_UTILFILES
util/CpuTimer.h
util/CreateNanoGrid.h
util/CSampleFromVoxels.h
util/CudaDeviceBuffer.h
util/cuda/CudaAddBlindData.cuh
util/cuda/CudaDeviceBuffer.h
util/cuda/CudaGridChecksum.cuh
util/cuda/CudaGridHandle.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/DitherLUT.h
util/ForEach.h
util/GridBuilder.h
Expand All @@ -183,6 +195,7 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion nanovdb/nanovdb/CNanoVDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ cnanovdb_griddata_valid(const CNANOVDB_GLOBAL cnanovdb_griddata *RESTRICT grid)
{
if (!grid)
return 0;
if (grid->mMagic != 0x304244566f6e614eUL)
if (grid->mMagic != 0x304244566f6e614eUL && grid->mMagic != 0x314244566f6e614eUL)
return 0;
return 1;
}
Expand Down
Loading