Skip to content

[QUESTION] Converting openvdb grid to nanovdb::cuda::DeviceBuffer #2144

@Ayamur0

Description

@Ayamur0

I am trying to convert a openvdb::FloatGrid to a nanovdb grid on the GPU.
From the examples I gathered that I should use a nanovdb::cuda::DeviceBuffer and then the .deviceUpload(stream, sync) function.

But I am struggling with converting the openvdb grid into a nanovdb::GridHandle<nanovdb::HostBuffer>.

Converting it to a HostBuffer works fine like this:
auto handle = nanovdb::tools::openToNanoVDB(vdbGrid);

But when I try to convert it to a cuda::DeviceBuffer, with either of these two calls:
auto d_handle = nanovdb::tools::openToNanoVDB<nanovdb::cuda::DeviceBuffer>(vdbGrid);
auto d_handle = nanovdb::tools::createNanoGrid<openvdb::FloatGrid, float, nanovdb::cuda::DeviceBuffer>(*vdbGrid);

I keep getting a LNK2019 error when compiling:

unresolved external symbol "public: __cdecl nanovdb::GridHandle<class 
nanovdb::cuda::DeviceBuffer>::GridHandle<class nanovdb::cuda::DeviceBuffer><class 
nanovdb::cuda::DeviceBuffer,0>(class nanovdb::cuda::DeviceBuffer &&)" (??$?0VDeviceBuffer@cuda@nanovdb@@$0A@@?
$GridHandle@VDeviceBuffer@cuda@nanovdb@@@nanovdb@@QEAA@$$QEAVDeviceBuffer@cuda@1@@Z) 
referenced in function "private: class nanovdb::GridHandle<class nanovdb::cuda::DeviceBuffer> __cdecl 
nanovdb::tools::CreateNanoGrid<class openvdb::v12_0::Grid<class openvdb::v12_0::tree::Tree<class 
openvdb::v12_0::tree::RootNode<class openvdb::v12_0::tree::InternalNode<class 
openvdb::v12_0::tree::InternalNode<class openvdb::v12_0::tree::LeafNode<float,3>,4>,5> > > > 
>::initHandle<float,class nanovdb::cuda::DeviceBuffer>(class nanovdb::cuda::DeviceBuffer const &)" (??
$initHandle@MVDeviceBuffer@cuda@nanovdb@@@?$CreateNanoGrid@V?$Grid@V?$Tree@V?$RootNode@V?
$InternalNode@V?$InternalNode@V?
$LeafNode@M$02@tree@v12_0@openvdb@@$03@tree@v12_0@openvdb@@$04@tree@v12_0@openvdb@
@@tree@v12_0@openvdb@@@tree@v12_0@openvdb@@@v12_0@openvdb@@@tools@nanovdb@@AEAA?
AV?$GridHandle@VDeviceBuffer@cuda@nanovdb@@@2@AEBVDeviceBuffer@cuda@2@@Z)

I am using the newest version from vcpkg (openvdb 12.0.0#1) and have both NANOVDB_USE_CUDA and NANOVDB_USE_OPENVDB macros defined.
The Examples from the documentation also compile perfectly fine (loading a grid from a file like this:
auto handle = nanovdb::io::readGrid<nanovdb::CudaDeviceBuffer>("data/sphere.nvdb");)

I don't know what I am doing wrong. Is there a different way to convert the openvdb grid?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions