This commit is contained in:
Dave Pugmire 2021-11-22 13:47:37 -05:00
commit 91de783f40
5 changed files with 40 additions and 8 deletions

@ -2,10 +2,10 @@
set -xe
readonly version="v1.5.2"
readonly version="91ed7eea6856f8785139c58fbcc827e82579243c"
readonly tarball="$version.tar.gz"
readonly url="https://github.com/google/benchmark/archive/$tarball"
readonly sha256sum="dccbdab796baa1043f04982147e67bb6e118fe610da2c65f88912d73987e700c"
readonly sha256sum="039054b7919b0af1082b121df35f4c24fccdd97f308e3dc28f36a0d3a3c64c69"
readonly install_dir="$HOME/gbench"
if ! [[ "$VTKM_SETTINGS" =~ "benchmarks" ]]; then

@ -464,6 +464,16 @@ function(vtkm_library)
set(VTKm_LIB_type SHARED)
endif()
# Skip unity builds unless explicitly asked
foreach(source IN LISTS VTKm_LIB_SOURCES VTKm_LIB_DEVICE_SOURCES)
get_source_file_property(is_candidate ${source} UNITY_BUILD_CANDIDATE)
if (NOT is_candidate)
list(APPEND non_unity_sources ${source})
endif()
endforeach()
set_source_files_properties(${non_unity_sources} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
add_library(${lib_name}
${VTKm_LIB_type}
${VTKm_LIB_SOURCES}
@ -615,8 +625,10 @@ function(vtkm_add_instantiations instantiations_list)
math(EXPR counter "${counter} + 1")
endforeach(instantiation)
set_source_files_properties(${_instantiations_list}
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON
# Force unity builds here
set_source_files_properties(${_instantiations_list} PROPERTIES
SKIP_UNITY_BUILD_INCLUSION OFF
UNITY_BUILD_CANDIDATE ON
)
set(${instantiations_list} ${_instantiations_list} PARENT_SCOPE)
endfunction(vtkm_add_instantiations)

@ -24,6 +24,14 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(VTKm_CMAKE_MODULE_PATH ${VTKm_SOURCE_DIR}/CMake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${VTKm_CMAKE_MODULE_PATH})
# While disabled system-wide, VTK-m uses UNITY builds in some modules
set(CMAKE_UNITY_BUILD OFF)
# By default effectively disable unity builds
if (NOT DEFINED CMAKE_UNITY_BUILD_BATCH_SIZE)
set(CMAKE_UNITY_BUILD_BATCH_SIZE 1)
endif()
# Determine VTK-m version
include(Utilities/Git/Git.cmake)
include(VTKmDetermineVersion)

@ -0,0 +1,12 @@
## Enable Unity build ##
VTK-m now partially supports unity builds in a subset its sources files which
are known to take the longer time/memory to build. Particularly, this enables
you to speedup compilation in VTK-m not memory intensive builds (HIP, CUDA) in a
system with sufficient resources.
We use `BATCH` unity builds type and the number of source files per batch can be
controlled by the canonical _CMake_ variable: `CMAKE_UNITY_BUILD_BATCH_SIZE`.
Unity builds requires _CMake_ >= 3.16, if using a older version, unity build
will be disabled a regular build will be performed.

@ -234,8 +234,6 @@ set(gradient_sources_device
vtkm_pyexpander_generated_file(ClipWithFieldExternInstantiations.h)
vtkm_pyexpander_generated_file(ClipWithImplicitFunctionExternInstantiations.h)
set_source_files_properties(Contour.cxx ExtractStructured.cxx PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
add_library(vtkm_filter INTERFACE)
vtkm_library(
@ -270,12 +268,14 @@ vtkm_library(
USE_VTKM_JOB_POOL
)
set_property(TARGET
set_target_properties(
vtkm_filter_common
vtkm_filter_extra
vtkm_filter_contour
vtkm_filter_gradient
PROPERTY UNITY_BUILD_MODE GROUP
PROPERTIES
UNITY_BUILD ON
UNITY_BUILD_MODE BATCH
)
target_link_libraries(vtkm_filter_common PUBLIC vtkm_worklet)