AcademySoftwareFoundation / openvdb

OpenVDB - Sparse volume data structure and tools
http://www.openvdb.org/
Apache License 2.0
2.71k stars 660 forks source link

[BUILD] How do I enable BLOSC compression codec? #1745

Open rddrdhd opened 10 months ago

rddrdhd commented 10 months ago

Environment

Operating System: CentOS Linux release 7.9 Version: OpenVDB v10.1.0 CMake Version: 3.20.1 Compiler: gcc 10.2.0

Describe the problem

When I try to run my built project, I get

An exception occurred: "BLOSC compression codec was disabled during build"

which I understand it was disabled during my OpenVDB lib build, even though using a flag NANOVDB_USE_BLOSC=ON. Or maybe it was disabled in my project built? Or maybe I'm just not using it correctly?

To Reproduce

in main.cpp:

    openvdb::initialize();

    openvdb::io::File inputFile("/path/to/input.vdb"); 
    auto grids = inputFile.getGrids();

    const std::string outputFile = "/path/to/output.nvdb";
    nanovdb::io::Codec codec = nanovdb::io::Codec::BLOSC;
    std::ofstream os(outputFile, std::ios::out | std::ios::binary);

    for (auto& srcGrid : *grids) {
        auto handle = nanovdb::openToNanoVDB<nanovdb::CudaDeviceBuffer>(srcGrid);
        // ... 
        nanovdb::io::writeGrid(os, handle, codec);
    }

Additional context

I'm building OpenVDB with this:

cmake .. \
-DUSE_NANOVDB=ON \
-DNANOVDB_BUILD_UNITTESTS=OFF \
-DNANOVDB_BUILD_EXAMPLES=ON \
-DNANOVDB_USE_INTRINSICS=ON \
-DNANOVDB_USE_CUDA=ON \
-DNANOVDB_CUDA_KEEP_PTX=ON \
-DNANOVDB_USE_OPENVDB=ON \
-DNANOVDB_USE_BLOSC=ON \
-DTBB_ROOT=/path/to/tbb/2020.3 \
-DBOOST_ROOT=/path/to/Boost/1.74.0 \
-DBLOSC_ROOT=/path/to/c-blosc/1.21.0 \
-DCMAKE_INSTALL_PREFIX:PATH=/path/to/my/openvdb/install