Skip to content
Snippets Groups Projects
Commit 9637e0c7 authored by Vicente Bolea's avatar Vicente Bolea
Browse files

vtk-m: update to v2.0.0

parent 398031b1
No related branches found
No related tags found
No related merge requests found
Showing
with 162 additions and 106 deletions
......@@ -14,8 +14,6 @@
##
##=============================================================================
set(VTKm_NO_DEPRECATED_VIRTUAL ON)
list(INSERT CMAKE_MODULE_PATH 0
"${VTK_SOURCE_DIR}/ThirdParty/vtkm/vtkvtkm/vtk-m/CMake")
......@@ -27,6 +25,7 @@ set(private_headers
set(nowrap_classes
vtkmDataArray
vtkmlib/DataArrayConverters
vtkmlib/DataSetUtils
vtkmlib/Portals
vtkmlib/vtkmInitializer)
......@@ -41,16 +40,6 @@ configure_file(
set(headers
"${CMAKE_CURRENT_BINARY_DIR}/vtkmConfigCore.h")
if (TARGET vtkm::cuda)
enable_language(CUDA)
# Temporarily suppress "has address taken but no possible call to it" warnings,
# until we figure out its implications.
# We are disabling all warnings as nvlink has no known way to suppress
# individual warning types.
string(APPEND CMAKE_CUDA_FLAGS " -Xnvlink -w")
endif ()
vtk_module_add_module(VTK::AcceleratorsVTKmCore
HEADER_DIRECTORIES
SOURCES ${sources}
......@@ -58,33 +47,33 @@ vtk_module_add_module(VTK::AcceleratorsVTKmCore
NOWRAP_HEADERS ${nowrap_headers}
NOWRAP_CLASSES ${nowrap_classes}
PRIVATE_HEADERS ${private_headers})
vtk_module_set_property(VTK::AcceleratorsVTKmCore
PROPERTY JOB_POOL_COMPILE
VALUE vtkm_pool)
_vtk_module_real_target(vtkm_accel_target VTK::AcceleratorsVTKmCore)
vtkm_add_target_information(${vtkm_accel_target}
DROP_UNUSED_SYMBOLS
EXTENDS_VTKM
MODIFY_CUDA_FLAGS
DEVICE_SOURCES ${sources})
vtk_module_set_property(VTK::AcceleratorsVTKmCore
PROPERTY JOB_POOL_COMPILE
VALUE vtkm_pool)
if (TARGET vtkm::kokkos_hip)
list(TRANSFORM nowrap_classes APPEND ".cxx" OUTPUT_VARIABLE hip_impl)
set_source_files_properties(${hip_impl} PROPERTIES LANGUAGE HIP)
kokkos_compilation(SOURCE ${hip_impl})
endif ()
list(TRANSFORM nowrap_classes APPEND ".cxx" OUTPUT_VARIABLE device_sources)
if (TARGET vtkm::cuda)
list(TRANSFORM nowrap_classes APPEND ".cxx" OUTPUT_VARIABLE cuda_impl)
set_source_files_properties(${cuda_impl} PROPERTIES
LANGUAGE CUDA
CUDA_SOURCE_PROPERTY_FORMAT OBJ
CUDA_SEPARABLE_COMPILATION ON)
# Temporarily suppress "has address taken but no possible call to it" warnings,
# until we figure out its implications.
# We are disabling all warnings as nvlink has no known way to suppress
# individual warning types.
string(APPEND CMAKE_CUDA_FLAGS " -Xnvlink -w")
set_source_files_properties(${device_sources} PROPERTIES LANGUAGE CUDA)
vtk_module_set_properties(VTK::AcceleratorsVTKmCore CUDA_SEPARABLE_COMPILATION ON)
elseif (TARGET vtkm::kokkos_hip)
set_source_files_properties(${device_sources} PROPERTIES LANGUAGE HIP)
kokkos_compilation(SOURCE ${device_sources})
endif ()
vtk_module_set_properties(VTK::AcceleratorsVTKmCore
LANGUAGE CUDA
CUDA_SEPARABLE_COMPILATION ON)
endif()
if (MSVC)
set(msvc_warning_flags
......
......@@ -7,17 +7,11 @@ vtk_add_test_cxx(vtkAcceleratorsVTKmCoreCxxTests tests
)
if (TARGET vtkm::cuda)
#the enable_language call is scoped! so we have to re-enable
#cuda in the test directory
enable_language(CUDA)
foreach(src IN LISTS tests)
string(REPLACE "," ";" src ${src})
list(GET src 0 src)
set_source_files_properties(${src} PROPERTIES
LANGUAGE CUDA
CUDA_SOURCE_PROPERTY_FORMAT OBJ
CUDA_SEPARABLE_COMPILATION ON)
set_source_files_properties(${src} PROPERTIES LANGUAGE CUDA)
endforeach()
#the tests aren't scoped as a child directory of vtkAcceleratorsVTKmCore
......
......@@ -6,7 +6,7 @@ DESCRIPTION
VTKm data structures
DEPENDS
VTK::CommonCore
VTK::vtkm
VTK::vtkvtkm
TEST_DEPENDS
VTK::CommonSystem
VTK::FiltersSources
......
//=============================================================================
//
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2012 Sandia Corporation.
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
//=============================================================================
#include "DataSetUtils.h"
#include <algorithm>
#include <numeric>
#include <vector>
VTK_ABI_NAMESPACE_BEGIN
std::vector<vtkm::Id> GetFieldsIndicesWithoutCoords(const vtkm::cont::DataSet& input)
{
std::vector<vtkm::Id> allFields(input.GetNumberOfFields());
std::vector<vtkm::Id> coords(input.GetNumberOfCoordinateSystems());
std::iota(allFields.begin(), allFields.end(), 0);
std::iota(coords.begin(), coords.end(), 0);
std::transform(coords.begin(), coords.end(), coords.begin(),
[&input](auto idx) { return input.GetFieldIndex(input.GetCoordinateSystemName(idx)); });
std::vector<vtkm::Id> fields;
std::set_difference(
allFields.begin(), allFields.end(), coords.begin(), coords.end(), std::back_inserter(fields));
return fields;
}
//=============================================================================
//
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2012 Sandia Corporation.
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
//=============================================================================
#ifndef vtkmlib_DataSetUtils_h
#define vtkmlib_DataSetUtils_h
#include "vtkAcceleratorsVTKmCoreModule.h" //required for correct implementation
#include "vtkmConfigCore.h" //required for general vtkm setup
#include <vtkm/cont/DataSet.h>
VTK_ABI_NAMESPACE_BEGIN
/**
* Get Fields indices of VTKm DataSet excluding the Coordinate Systems fields indices.
*/
VTKACCELERATORSVTKMCORE_EXPORT
std::vector<vtkm::Id> GetFieldsIndicesWithoutCoords(const vtkm::cont::DataSet& input);
VTK_ABI_NAMESPACE_END
#endif // vtkmlib_DataSetUtils_h
/* VTK-HeaderTest-Exclude: DataSetUtils.h */
......@@ -48,16 +48,6 @@ configure_file(
list(APPEND headers
"${CMAKE_CURRENT_BINARY_DIR}/vtkmConfigDataModel.h")
if (TARGET vtkm::cuda)
enable_language(CUDA)
# Temporarily suppress "has address taken but no possible call to it" warnings,
# until we figure out its implications.
# We are disabling all warnings as nvlink has no known way to suppress
# individual warning types.
string(APPEND CMAKE_CUDA_FLAGS " -Xnvlink -w")
endif ()
vtk_module_add_module(VTK::AcceleratorsVTKmDataModel
HEADER_DIRECTORIES
SOURCES ${sources}
......@@ -65,25 +55,27 @@ vtk_module_add_module(VTK::AcceleratorsVTKmDataModel
CLASSES ${classes}
NOWRAP_CLASSES ${nowrap_classes}
PRIVATE_HEADERS ${private_headers})
vtk_module_set_property(VTK::AcceleratorsVTKmDataModel
PROPERTY JOB_POOL_COMPILE
VALUE vtkm_pool)
_vtk_module_real_target(vtkm_accel_target VTK::AcceleratorsVTKmDataModel)
vtkm_add_target_information(${vtkm_accel_target}
EXTENDS_VTKM
MODIFY_CUDA_FLAGS
DEVICE_SOURCES ${sources})
vtk_module_set_property(VTK::AcceleratorsVTKmDataModel
PROPERTY JOB_POOL_COMPILE
VALUE vtkm_pool)
if (TARGET vtkm::cuda)
set(cuda_impl ${nowrap_classes} vtkmDataSet.cxx)
set_source_files_properties(${cuda_impl} PROPERTIES
LANGUAGE CUDA
CUDA_SOURCE_PROPERTY_FORMAT OBJ
CUDA_SEPARABLE_COMPILATION ON)
# Temporarily suppress "has address taken but no possible call to it" warnings,
# until we figure out its implications.
# We are disabling all warnings as nvlink has no known way to suppress
# individual warning types.
string(APPEND CMAKE_CUDA_FLAGS " -Xnvlink -w")
list(TRANSFORM nowrap_classes APPEND ".cxx" OUTPUT_VARIABLE nowrap_sources)
set(cuda_impl ${nowrap_sources} vtkmDataSet.cxx)
set_source_files_properties(${cuda_impl} PROPERTIES LANGUAGE CUDA)
vtk_module_set_properties(VTK::AcceleratorsVTKmDataModel
LANGUAGE CUDA
CUDA_SEPARABLE_COMPILATION ON)
vtk_module_compile_options(VTK::AcceleratorsVTKmDataModel
......
# We need this in order to make External Test builds to work: TestVTKMDataSet
# includes MakeTestDataSet, however, both MakeTestDataSet.h source tree and
# installed tree has two different paths. To deal with it, we need to determine
# at configure time the VTKm dependency type and pass that information down to
# the build tool so that the source code can parametrize the include.
if (NOT VTKm_FOUND)
set_source_files_properties(TestVTKMDataSet.cxx PROPERTIES
COMPILE_DEFINITIONS VTKm_INCLUDED_IN_VTK)
endif()
# We are splitting the tests into two executables to workaround an issue in
# cuda. With all the tests in the same executable several tests are failing
# in cuda. We have not identified the root cause of the problem yet.
......@@ -6,18 +16,11 @@ vtk_add_test_cxx(vtkAcceleratorsVTKmDataModelCxxTests tests
)
if (TARGET vtkm::cuda)
#the enable_language call is scoped! so we have to re-enable
#cuda in the test directory
enable_language(CUDA)
foreach(src IN LISTS tests)
string(REPLACE "," ";" src ${src})
list(GET src 0 src)
set_source_files_properties(${src} PROPERTIES
LANGUAGE CUDA
CUDA_SOURCE_PROPERTY_FORMAT OBJ
CUDA_SEPARABLE_COMPILATION ON)
set_source_files_properties(${src} PROPERTIES LANGUAGE CUDA)
endforeach()
#the tests aren't scoped as a child directory of vtkAcceleratorsVTKmDataModel
......
......@@ -17,9 +17,16 @@
#include "vtkUnsignedCharArray.h"
#include "vtkUnstructuredGrid.h"
#include "vtkmDataArray.h"
#include "vtkmlib/DataArrayConverters.h"
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
// Note the difference between the below two includes (testing != testlib)
#ifdef VTKm_INCLUDED_IN_VTK
#include <vtkm/cont/testing/MakeTestDataSet.h>
#else
#include <vtkm/cont/testlib/MakeTestDataSet.h>
#endif
#include <array>
#include <random>
......
......@@ -8,7 +8,7 @@ DEPENDS
VTK::AcceleratorsVTKmCore
VTK::CommonCore
VTK::CommonDataModel
VTK::vtkm
VTK::vtkvtkm
TEST_DEPENDS
VTK::FiltersGeneral
VTK::TestingCore
......
......@@ -17,6 +17,7 @@
#include "vtkmDataArray.h"
#include "vtkmlib/DataSetUtils.h"
#include "vtkmlib/PortalTraits.h"
#include <vtkm/cont/ArrayHandle.h>
......@@ -137,8 +138,8 @@ bool ConvertArrays(const vtkm::cont::DataSet& input, vtkDataSet* output)
vtkPointData* pd = output->GetPointData();
vtkCellData* cd = output->GetCellData();
vtkm::IdComponent numFields = input.GetNumberOfFields();
for (vtkm::IdComponent i = 0; i < numFields; ++i)
// Do not copy the coordinate systems, this is done in a higher level routine.
for (auto i : GetFieldsIndicesWithoutCoords(input))
{
const vtkm::cont::Field& f = input.GetField(i);
vtkDataArray* vfield = Convert(f);
......
......@@ -84,9 +84,13 @@ vtkm::cont::DataSet Convert(vtkPolyData* input, FieldsFlag fields)
// set where possible
vtkm::cont::DataSet dataset;
// first step convert the points over to an array handle
vtkm::cont::CoordinateSystem coords = Convert(input->GetPoints());
dataset.AddCoordinateSystem(coords);
// Only set coordinates if they exists in the vtkPolyData
if (input->GetPoints())
{
// first step convert the points over to an array handle
vtkm::cont::CoordinateSystem coords = Convert(input->GetPoints());
dataset.AddCoordinateSystem(coords);
}
// first check if we only have polys/lines/verts
bool filled = false;
......
......@@ -56,16 +56,6 @@ configure_file(
set(headers
"${CMAKE_CURRENT_BINARY_DIR}/vtkmConfigFilters.h")
if (TARGET vtkm::cuda)
enable_language(CUDA)
# Temporarily suppress "has address taken but no possible call to it" warnings,
# until we figure out its implications.
# We are disabling all warnings as nvlink has no known way to suppress
# individual warning types.
string(APPEND CMAKE_CUDA_FLAGS " -Xnvlink -w")
endif ()
#=============================================================================
# Option to enable VTK-m override of corresponding VTK filters. Note that
# there is also a run-time option that needs to be enabled. It can be accessed
......@@ -116,12 +106,6 @@ vtk_module_add_module(VTK::AcceleratorsVTKmFilters
SOURCES ${sources}
HEADERS ${headers}
CLASSES ${classes})
_vtk_module_real_target(vtkm_accel_target VTK::AcceleratorsVTKmFilters)
vtkm_add_target_information(${vtkm_accel_target}
EXTENDS_VTKM
MODIFY_CUDA_FLAGS
DEVICE_SOURCES ${sources})
vtk_module_set_property(VTK::AcceleratorsVTKmFilters
PROPERTY JOB_POOL_COMPILE
VALUE vtkm_pool)
......@@ -132,15 +116,23 @@ vtk_module_link(VTK::AcceleratorsVTKmFilters
vtk_module_definitions(VTK::AcceleratorsVTKmFilters
PUBLIC "VTK_ENABLE_VTKM_OVERRIDES=$<BOOL:${VTK_ENABLE_VTKM_OVERRIDES}>")
_vtk_module_real_target(vtkm_accel_target VTK::AcceleratorsVTKmFilters)
vtkm_add_target_information(${vtkm_accel_target}
EXTENDS_VTKM
MODIFY_CUDA_FLAGS
DEVICE_SOURCES ${sources})
if (TARGET vtkm::cuda)
# Temporarily suppress "has address taken but no possible call to it" warnings,
# until we figure out its implications.
# We are disabling all warnings as nvlink has no known way to suppress
# individual warning types.
string(APPEND CMAKE_CUDA_FLAGS " -Xnvlink -w")
list(TRANSFORM classes APPEND ".cxx" OUTPUT_VARIABLE cuda_impl)
set_source_files_properties(${cuda_impl} PROPERTIES
LANGUAGE CUDA
CUDA_SOURCE_PROPERTY_FORMAT OBJ
CUDA_SEPARABLE_COMPILATION ON)
set_source_files_properties(${cuda_impl} PROPERTIES LANGUAGE CUDA)
vtk_module_set_properties(VTK::AcceleratorsVTKmFilters
LANGUAGE CUDA
CUDA_SEPARABLE_COMPILATION ON)
vtk_module_compile_options(VTK::AcceleratorsVTKmFilters
......
......@@ -27,17 +27,11 @@ vtk_add_test_cxx(vtkAcceleratorsVTKmFiltersCxxTests tests
)
if (TARGET vtkm::cuda)
#the enable_language call is scoped! so we have to re-enable
#cuda in the test directory
enable_language(CUDA)
foreach(src IN LISTS tests)
string(REPLACE "," ";" src ${src})
list(GET src 0 src)
set_source_files_properties(${src} PROPERTIES
LANGUAGE CUDA
CUDA_SOURCE_PROPERTY_FORMAT OBJ
CUDA_SEPARABLE_COMPILATION ON)
set_source_files_properties(${src} PROPERTIES LANGUAGE CUDA)
endforeach()
#the tests aren't scoped as a child directory of vtkAcceleratorsVTKmFilters
......
......@@ -24,6 +24,7 @@
#include "vtkmlib/ArrayConverters.h"
#include "vtkmlib/DataSetConverters.h"
#include "vtkmlib/DataSetUtils.h"
#include <vtkm/cont/ErrorFilterExecution.h>
#include <vtkm/filter/field_conversion/CellAverage.h>
......@@ -132,7 +133,7 @@ int vtkmAverageToCells::RequestData(
// Execute the vtk-m filter
vtkm::filter::field_conversion::CellAverage filter;
for (int i = 0; i < in.GetNumberOfFields(); ++i)
for (auto i : GetFieldsIndicesWithoutCoords(in))
{
const auto& name = in.GetField(i).GetName();
filter.SetActiveField(name, vtkm::cont::Field::Association::Points);
......
......@@ -30,7 +30,7 @@
#include "vtkmlib/ArrayConverters.h"
#include "vtkmlib/DataSetConverters.h"
#include "vtkm/cont/DataSetFieldAdd.h"
#include "vtkm/cont/DataSet.h"
#include <vtkm/filter/field_transform/WarpScalar.h>
......
......@@ -30,7 +30,7 @@
#include "vtkmlib/ArrayConverters.h"
#include "vtkmlib/DataSetConverters.h"
#include "vtkm/cont/DataSetFieldAdd.h"
#include "vtkm/cont/DataSet.h"
#include <vtkm/filter/field_transform/WarpVector.h>
......
......@@ -134,6 +134,11 @@ if (${CMAKE_FIND_PACKAGE_NAME}_HAS_VTKm)
if (NOT VTKm_FOUND)
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
endif ()
# Prior to VTK-m 2.0, the main VTK module was called VTK::vtkm
if (TARGET VTK::vtkvtkm)
add_library(VTK::vtkm ALIAS VTK::vtkvtkm)
endif()
endif ()
include("${CMAKE_CURRENT_LIST_DIR}/vtkCMakeBackports.cmake")
......
......@@ -34,7 +34,7 @@ foreach (_vtk_non_module_component IN LISTS _vtk_non_module_components)
endif ()
endforeach ()
if (TARGET "VTK::vtkm")
if (TARGET "VTK::vtkvtkm")
set(vtk_has_vtkm ON)
else ()
set(vtk_has_vtkm OFF)
......
......@@ -3,7 +3,7 @@ NAME
LIBRARY_NAME
vtkfides
DEPENDS
VTK::vtkm
VTK::vtkvtkm
OPTIONAL_DEPENDS
VTK::mpi
THIRD_PARTY
vtk_module_third_party_internal(
LICENSE_FILES "vtkvtkm/vtk-m/LICENSE.txt"
VERSION "1.7.1"
VERSION "2.0.0-rc1"
SUBDIRECTORY vtkvtkm
STANDARD_INCLUDE_DIRS
INTERFACE)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment