8000 transition from VTK-m to Viskores by aumuell · Pull Request #281 · vistle/vistle · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

transition from VTK-m to Viskores #281

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

Merged
merged 1 commit into from
May 8, 2025
Merged
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
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
[submodule "module/geometry/DelaunayTriangulator/tetgen"]
path = module/geometry/DelaunayTriangulator/tetgen
url = https://github.com/vistle/tetgen.git
[submodule "lib/3rdparty/vtk-m"]
path = lib/3rdparty/vtk-m
url = https://gitlab.kitware.com/vtk/vtk-m.git
[submodule "lib/3rdparty/viskores"]
path = lib/3rdparty/viskores
url = https://github.com/Viskores/viskores.git
[submodule "lib/3rdparty/mpi-serial"]
path = lib/3rdparty/mpi-serial
url = https://github.com/vistle/mpi-serial.git
Expand Down
36 changes: 18 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ set(VISTLE_CPU_ARCH
""
CACHE STRING "CPU architecture to optimize for (native, corei7-avx, core-avx2, atom, ...)")

option(VISTLE_PEDANTIC_ERRORS "Be pedantic about C++ standard and emit errors" OFF) # for diy, also included in vtk-m
option(VISTLE_PEDANTIC_ERRORS "Be pedantic about C++ standard and emit errors" OFF) # for diy, also included in Viskores

option(VISTLE_SANITIZE_UNDEFINED "Build with -fsanitize=undefined" OFF)
option(VISTLE_SANITIZE_ADDRESS "Build with -fsanitize=address" OFF)
Expand Down Expand Up @@ -523,7 +523,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()

if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" AND CMAKE_CXX_COMPILER_VERSION MATCHES "^11")
# silence "note: parameter passing for argument of type ‘vtkm::Vec<double, 2>’ when C++17 is enabled changed to match C++14 in GCC 10.1"
# silence "note: parameter passing for argument of type ‘viskores::Vec<double, 2>’ when C++17 is enabled changed to match C++14 in GCC 10.1"
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
Expand Down Expand Up @@ -786,8 +786,8 @@ macro(vistle_target_link_libraries targetname)
endif()
endforeach()

set(DependencyList Boost vtkm) # Name when linking the package
set(DependencyListNames Boost VTKm) # Name when finding the package
set(DependencyList Boost viskores) # Name when linking the package
set(DependencyListNames Boost Viskores) # Name when finding the package
set(CurrentDependencyList 0)

foreach(Dependency IN ITEMS ${DependencyList})
Expand Down Expand Up @@ -1015,9 +1015,9 @@ if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Emscripten")
add_module(${targetname} ${description} ${SOURCES})
if(IDX GREATER_EQUAL 0)
list(SUBLIST SOURCES ${IDX} -1 DEVSOURCES)
vtkm_add_target_information(${targetname} MODIFY_CUDA_FLAGS DEVICE_SOURCES ${DEVSOURCES})
viskores_add_target_information(${targetname} MODIFY_CUDA_FLAGS DEVICE_SOURCES ${DEVSOURCES})
endif()
target_link_libraries(${targetname} vistle_vtkm vtkm::cont vtkm::filter)
target_link_libraries(${targetname} vistle_viskores viskores::cont viskores::filter)
if(VISTLE_USE_CUDA AND VISTLE_USE_SEPARABLE_COMPILATION)
set_target_properties(${targetname} PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
endif()
Expand Down Expand Up @@ -1182,27 +1182,27 @@ vistle_find_package(
option(VISTLE_64BIT_INDICES "use 64-bit integers for array indices" OFF)
option(VISTLE_DOUBLE_PRECISION "use double instead of float for coordinates and data arrays" OFF)

option(VISTLE_INTERNAL_VTKM "Use internal copy of VTK-m" ON)
option(VISTLE_INTERNAL_VISKORES "Use internal copy of Viskores" ON)

if(VTK_FOUND AND VTK_HAS_VTKm)
message("Using VTK-m provided by VTK ${VTK_VERSION}")
if(VTK_FOUND AND VTK_HAS_Viskores)
message("Using Viskores provided by VTK ${VTK_VERSION}")

if(VISTLE_INTERNAL_VTKM)
message(WARNING "Provided VTK already contains VTK-m, cannot build internal copy of VTK-m. Disabling VISTLE_INTERNAL_VTKM...")
set(VISTLE_INTERNAL_VTKM OFF)
if(VISTLE_INTERNAL_VISKORES)
message(WARNING "Provided VTK already contains Viskores, cannot build internal copy of Viskores. Disabling VISTLE_INTERNAL_VISKORES...")
set(VISTLE_INTERNAL_VISKORES OFF)
endif()
endif()

if(NOT VISTLE_INTERNAL_VTKM)
if(NOT VISTLE_INTERNAL_VISKORES)
# search without version argument, as it is not possible to search for all compatible versions (2.0 & 2.1) in one go
vistle_find_package(VTKm REQUIRED)
vistle_find_package(Viskores REQUIRED)

if(NOT ("${VTKm_VERSION_MAJOR}" EQUAL 2))
message(FATAL_ERROR "Vtk-m version must be >= 2.0 and < 3.0 (but is ${VTKm_VERSION}).")
if(NOT ("${Viskores_VERSION_MAJOR}" EQUAL 1))
message(FATAL_ERROR "Viskores version must be >= 1.0 and < 2.0 (but is ${Viskores_VERSION}).")
endif()

# make sure vtk-m and vistle data types are compatible (if not, overwrite user flags, accordingly)
add_subdirectory(cmake/Modules/vtkm)
# make sure viskores and vistle data types are compatible (if not, overwrite user flags, accordingly)
add_subdirectory(cmake/Modules/viskores)
endif()

# configure data-type sizes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Check integer compatibility between vistle and vtk-m
# Check integer compatibility between vistle and viskores
try_run(
RUN_REPORT
COMPILE_REPORT
"${CMAKE_BINARY_DIR}/tmp"
SOURCES
"${CMAKE_CURRENT_LIST_DIR}/checkIntCompatibility.cpp"
LINK_LIBRARIES
vtkm::cont
viskores::cont
ARGS "${VISTLE_64BIT_INDICES}")

if(RUN_REPORT STREQUAL "FAILED_TO_RUN")
Expand All @@ -15,27 +15,27 @@ if(RUN_REPORT STREQUAL "FAILED_TO_RUN")
CACHE VISTLE_64BIT_INDICES
PROPERTY HELPSTRING)
if(VISTLE_64BIT_INDICES)
message(WARNING "To ensure compatibility with vtk-m VISTLE_64BIT_INDICES will be disabled.")
message(WARNING "To ensure compatibility with viskores VISTLE_64BIT_INDICES will be disabled.")
set(VISTLE_64BIT_INDICES
OFF
CACHE BOOL "${helperString}" FORCE)
else()
message(WARNING "To ensure compatibility with vtk-m VISTLE_64BIT_INDICES will be enabled.")
message(WARNING "To ensure compatibility with viskores VISTLE_64BIT_INDICES will be enabled.")
set(VISTLE_64BIT_INDICES
ON
CACHE BOOL "${helperString}" FORCE)
endif()
endif()

# Check float compatibility between vistle and vtk-m
# Check float compatibility between vistle and viskores
try_run(
RUN_REPORT
COMPILE_REPORT
"${CMAKE_BINARY_DIR}/tmp"
SOURCES
"${CMAKE_CURRENT_LIST_DIR}/checkFloatCompatibility.cpp"
LINK_LIBRARIES
vtkm::cont
viskores::cont
ARGS "${VISTLE_DOUBLE_PRECISION}")

if(RUN_REPORT STREQUAL "FAILED_TO_RUN")
Expand All @@ -44,12 +44,12 @@ if(RUN_REPORT STREQUAL "FAILED_TO_RUN")
CACHE VISTLE_DOUBLE_PRECISION
PROPERTY HELPSTRING)
if(VISTLE_DOUBLE_PRECISION)
message(WARNING "To ensure compatibility with vtk-m VISTLE_DOUBLE_PRECISION will be disabled.")
message(WARNING "To ensure compatibility with viskores VISTLE_DOUBLE_PRECISION will be disabled.")
set(VISTLE_DOUBLE_PRECISION
OFF
CACHE BOOL "${helperString}" FORCE)
else()
message(WARNING "To ensure compatibility with vtk-m VISTLE_DOUBLE_PRECISION will be enabled.")
message(WARNING "To ensure compatibility with viskores VISTLE_DOUBLE_PRECISION will be enabled.")
set(VISTLE_DOUBLE_PRECISION
ON
CACHE BOOL "${helperString}" FORCE)
Expand Down
24 changes: 24 additions & 0 deletions cmake/Modules/viskores/checkFloatCompatibility.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <cstring>
#include <limits>
#include <stdexcept>

#include <viskores/Types.h>

// We need to cast vistle floats (vistle::Scalar) to viskores floats (viskores::FloatDefault)
// and vice-versa. So, in this program, we check if they are compatible.
int main(int argc, char **argv)
{
// We expect this program to be called with ${VISTLE_DOUBLE_PRECISION}.
assert(argc == 2);
bool usingDoublePrecision = (std::string(argv[1]) == "ON");

auto viskoresFloatSize = sizeof(viskores::FloatDefault);

if ((viskoresFloatSize == sizeof(float)) && usingDoublePrecision)
throw std::runtime_error("Vistle and Viskores floating point types are incompatible!");

if ((viskoresFloatSize == sizeof(double)) && !usingDoublePrecision)
throw std::runtime_error("Vistle and Viskores floating point types are incompatible!");

return 0;
}
24 changes: 24 additions & 0 deletions cmake/Modules/viskores/checkIntCompatibility.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <cstring>
#include <limits>
#include <stdexcept>

#include <viskores/Types.h>

// We need to cast vistle indices (vistle::Index) to viskores indices (viskores::Id) and
// vice-versa. So, in this program, we check if they are compatible.
int main(int argc, char **argv)
{
// We expect this program to be called with ${VISTLE_64BIT_INDICES}.
assert(argc == 2);
bool using64Bit = (std::string(argv[1]) == "ON");

auto viskoresIntSize = sizeof(viskores::Id);

if ((viskoresIntSize == sizeof(int32_t)) && using64Bit)
throw std::runtime_error("Vistle and Viskores integer types are incompatible!");

if ((viskoresIntSize == sizeof(int64_t)) && !using64Bit)
throw std::runtime_error("Vistle and Viskores integer types are incompatible!");

return 0;
}
24 changes: 0 additions & 24 deletions cmake/Modules/vtkm/checkFloatCompatibility.cpp

This file was deleted.

24 changes: 0 additions & 24 deletions cmake/Modules/vtkm/checkIntCompatibility.cpp

This file was deleted.

Loading
Loading
0