Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 9 additions & 10 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,15 @@ jobs:
strategy:
matrix:
config:
- { name: 'all', image: '2026', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_BLOSC=ON -DUSE_ZLIB=ON -DUSE_EXR=ON -DUSE_PNG=ON' }
- { name: 'lite', image: '2026', 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', image: '2026', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_BLOSC=OFF -DUSE_IMATH_HALF=ON' }
- { name: 'sse', image: '2026', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DOPENVDB_SIMD=SSE42' }
- { name: 'avx', image: '2026', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DOPENVDB_SIMD=AVX' }
- { name: 'pygrid', image: '2026', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DOPENVDB_PYTHON_WRAP_ALL_GRID_TYPES=ON' }
- { name: 'asan', image: '2026', build: 'asan', components: 'core,test', cmake: '-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON -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', image: '2026', build: 'ubsan', components: 'core,test', cmake: '-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" ' }
- { name: 'c++20', image: '2026', build: 'Release', components: 'core,test', cmake: '-DCMAKE_CXX_STANDARD=20' }
- { name: 'conf', image: '2026', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON' }
- { name: 'all', image: '2026', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_BLOSC=ON -DUSE_ZLIB=ON -DUSE_EXR=ON -DUSE_PNG=ON' }
- { name: 'lite', image: '2026', 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', image: '2026', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_BLOSC=OFF -DUSE_IMATH_HALF=ON' }
- { name: 'simd', image: '2026', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DUSE_VCL=ON' }
- { name: 'pygrid', image: '2026', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DOPENVDB_PYTHON_WRAP_ALL_GRID_TYPES=ON' }
- { name: 'asan', image: '2026', build: 'asan', components: 'core,test', cmake: '-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON -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', image: '2026', build: 'ubsan', components: 'core,test', cmake: '-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" ' }
- { name: 'c++20', image: '2026', build: 'Release', components: 'core,test', cmake: '-DCMAKE_CXX_STANDARD=20' }
- { name: 'conf', image: '2026', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON' }
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand Down
17 changes: 12 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ required.]=] ${USE_EXR})
option(USE_PNG "Use PNG while building openvdb components." OFF)
option(USE_AX "Use OpenVDB AX while building openvdb components." ${OPENVDB_BUILD_AX})
option(USE_NANOVDB "Use NanoVDB while building openvdb components." ${OPENVDB_BUILD_NANOVDB})
option(USE_VCL [=[
Use the internally supplied copy of Agner Fog's vectorclass (VCL) SIMD wrapper library to instrument OpenVDB tools.
This also requires VCL to be installed along with OpenVDB headers. Only applicable which compiling for x86 targets.]=] OFF)

cmake_dependent_option(OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING
"Disable the implicit linking of Boost libraries on Windows" ON "WIN32" OFF)
Expand Down Expand Up @@ -175,7 +178,7 @@ endif()
set(_OPENVDB_SIMD_OPTIONS None SSE42 AVX)
if(NOT OPENVDB_SIMD)
set(OPENVDB_SIMD None CACHE STRING
"Choose whether to enable SIMD compiler flags or not, options are: None SSE42 AVX.
"Choose whether to enable x86 SIMD compiler flags or not, options are: None SSE42 AVX.
Although not required, it is strongly recommended to enable SIMD. AVX implies SSE42.
None is the default." FORCE
)
Expand Down Expand Up @@ -404,20 +407,24 @@ if(CONCURRENT_MALLOC STREQUAL "Auto")
endif()
endif()

# Configure SIMD. AVX implies SSE 4.2.
# Configure SIMD. AVX implies SSE 4.2 (for our builds)
# @note You can also provide target specific flags to CXX_FLAGS, however
# OpenVDB may not detect this usage correctly in all places. To ensure
# the library is instrumented fully with your desired ISA, it's best to
# define these macros.

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_definitions("$<$<COMPILE_LANGUAGE:CXX>:OPENVDB_USE_AVX>")
add_compile_definitions("$<$<COMPILE_LANGUAGE:CXX>:OPENVDB_USE_SSE42>")
set(OPENVDB_USE_AVX ON)
set(OPENVDB_USE_SSE42 ON)
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_definitions("$<$<COMPILE_LANGUAGE:CXX>:OPENVDB_USE_SSE42>")
set(OPENVDB_USE_SSE42 ON)
endif()

#########################################################################
Expand Down
119 changes: 115 additions & 4 deletions cmake/OpenVDBUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ function(OPENVDB_GET_VERSION_DEFINE HEADER KEY VALUE)
endfunction()


########################################################################
########################################################################
###############################################################################
###############################################################################


function(OPENVDB_VERSION_FROM_HEADER OPENVDB_VERSION_FILE)
Expand Down Expand Up @@ -120,8 +120,8 @@ function(OPENVDB_VERSION_FROM_HEADER OPENVDB_VERSION_FILE)
endfunction()


########################################################################
########################################################################
###############################################################################
###############################################################################


function(OPENVDB_ABI_VERSION_FROM_PRINT OPENVDB_PRINT)
Expand Down Expand Up @@ -162,3 +162,114 @@ function(OPENVDB_ABI_VERSION_FROM_PRINT OPENVDB_PRINT)
set(${_VDB_ABI} ${_OpenVDB_ABI} PARENT_SCOPE)
endif()
endfunction()

###############################################################################
## @brief Compute the enumerated ISA value for x86/x86_64 architectures that
## VCL will use during compilation of OpenVDB. The value is stored in the
## VCL_INSTRSET variable. Possible values are:
## 0: Unknown or error
## 2: SSE2
## 3: SSE3
## 4: SSSE3
## 5: SSE4.1
## 6: SSE4.2
## 7: AVX
## 8: AVX2
## 9: AVX512F
## 10: AVX512BW/DQ/VL
function(OPENVDB_COMPUTE_X86_INSTRSET_FROM_VCL VCL_INSTRSET)
# Append project specific flags
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
if(OPENVDB_SIMD STREQUAL "AVX")
set(CMAKE_REQUIRED_FLAGS "-mavx;-msse4.2")
elseif(OPENVDB_SIMD STREQUAL "SSE42")
set(CMAKE_REQUIRED_FLAGS "-msse4.2")
endif()

# Figure out that the INSTRSET macor would expand to.
# @todo would be much faster with try_run
include(CheckCXXSourceCompiles)
check_cxx_source_compiles([[
#include "${CMAKE_SOURCE_DIR}/ext/vcl/openvdb/ext/vcl/instrset.h"
int main() { static_assert(INSTRSET == 10); return 0; } ]] COMPUTE_VCL_INSTRSET__AVX512VL_DQ_BW__)
if(COMPUTE_VCL_INSTRSET__AVX512VL_DQ_BW__)
set(${VCL_INSTRSET} 10 PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
return()
endif()
check_cxx_source_compiles([[
#include "${CMAKE_SOURCE_DIR}/ext/vcl/openvdb/ext/vcl/instrset.h"
int main() { static_assert(INSTRSET == 9); return 0; } ]] COMPUTE_VCL_INSTRSET__AVX512F__)
if(COMPUTE_VCL_INSTRSET__AVX512F__)
set(${VCL_INSTRSET} 9 PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
return()
endif()
check_cxx_source_compiles([[
#include "${CMAKE_SOURCE_DIR}/ext/vcl/openvdb/ext/vcl/instrset.h"
int main() { static_assert(INSTRSET == 8); return 0; } ]] COMPUTE_VCL_INSTRSET__AVX2__)
if(COMPUTE_VCL_INSTRSET__AVX2__)
set(${VCL_INSTRSET} 8 PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
return()
endif()
check_cxx_source_compiles([[
#include "${CMAKE_SOURCE_DIR}/ext/vcl/openvdb/ext/vcl/instrset.h"
int main() { static_assert(INSTRSET == 7); return 0; } ]] COMPUTE_VCL_INSTRSET__AVX__)
if(COMPUTE_VCL_INSTRSET__AVX__)
set(${VCL_INSTRSET} 7 PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
return()
endif()
check_cxx_source_compiles([[
#include "${CMAKE_SOURCE_DIR}/ext/vcl/openvdb/ext/vcl/instrset.h"
int main() { static_assert(INSTRSET == 6); return 0; } ]] COMPUTE_VCL_INSTRSET__SSE4_2__)
if(COMPUTE_VCL_INSTRSET__SSE4_2__)
set(${VCL_INSTRSET} 6 PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
return()
endif()
check_cxx_source_compiles([[
#include "${CMAKE_SOURCE_DIR}/ext/vcl/openvdb/ext/vcl/instrset.h"
int main() { static_assert(INSTRSET == 5); return 0; } ]] COMPUTE_VCL_INSTRSET__SSE4_1__)
if(COMPUTE_VCL_INSTRSET__SSE4_1__)
set(${VCL_INSTRSET} 5 PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
return()
endif()
check_cxx_source_compiles([[
#include "${CMAKE_SOURCE_DIR}/ext/vcl/openvdb/ext/vcl/instrset.h"
int main() { static_assert(INSTRSET == 4); return 0; } ]] COMPUTE_VCL_INSTRSET__SSSE3__)
if(COMPUTE_VCL_INSTRSET__SSSE3__)
set(${VCL_INSTRSET} 4 PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
return()
endif()
check_cxx_source_compiles([[
#include "${CMAKE_SOURCE_DIR}/ext/vcl/openvdb/ext/vcl/instrset.h"
int main() { static_assert(INSTRSET == 3); return 0; } ]] COMPUTE_VCL_INSTRSET__SSE3__)
if(COMPUTE_VCL_INSTRSET__SSE3__)
set(${VCL_INSTRSET} 3 PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
return()
endif()
check_cxx_source_compiles([[
#include "${CMAKE_SOURCE_DIR}/ext/vcl/openvdb/ext/vcl/instrset.h"
int main() { static_assert(INSTRSET == 2); return 0; } ]] COMPUTE_VCL_INSTRSET__SSE2__)
if(COMPUTE_VCL_INSTRSET__SSE2__)
set(${VCL_INSTRSET} 2 PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
return()
endif()
check_cxx_source_compiles([[
#include "${CMAKE_SOURCE_DIR}/ext/vcl/openvdb/ext/vcl/instrset.h"
int main() { static_assert(INSTRSET == 1); return 0; } ]] COMPUTE_VCL_INSTRSET__SSE__)
if(COMPUTE_VCL_INSTRSET__SSE__)
set(${VCL_INSTRSET} 1 PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
return()
endif()
# Unknown or error
set(${VCL_INSTRSET} 0 PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
endfunction()
Loading
Loading