diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 1af619b59..0e1b5a0ce 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -39,4 +39,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION # We explicitly only suppress specific worklets so we can see when new recursive # worklets are added "ptxas warning : Stack size for entry function.*NearestNeighborSearch3DWorklet.*" + "ptxas warning : Stack size for entry function.*BoundingIntervalHierarchy.*" + "ptxas warning : Stack size for entry function.*CoordinatesPortal.*" + "ptxas warning : Stack size for entry function.*CellRangesExtracter.*" ) diff --git a/vtkm/cont/BoundingIntervalHierarchy.h b/vtkm/cont/BoundingIntervalHierarchy.h index 5968c2a56..5644411e9 100644 --- a/vtkm/cont/BoundingIntervalHierarchy.h +++ b/vtkm/cont/BoundingIntervalHierarchy.h @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -40,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -49,7 +49,7 @@ namespace vtkm { namespace cont { -namespace +namespace detail { #define START_TIMER(x) Timer x; @@ -645,7 +645,7 @@ struct RangeAdd } }; // struct RangeAdd -} // namespace +} // namespace detail class BoundingIntervalHierarchy : public vtkm::cont::CellLocator @@ -661,10 +661,10 @@ private: using RangeArrayHandle = vtkm::cont::ArrayHandle; using RangePermutationArrayHandle = vtkm::cont::ArrayHandlePermutation; - using SplitArrayHandle = vtkm::cont::ArrayHandle; + using SplitArrayHandle = vtkm::cont::ArrayHandle; using SplitPermutationArrayHandle = vtkm::cont::ArrayHandlePermutation; - using SplitPropertiesArrayHandle = vtkm::cont::ArrayHandle; + using SplitPropertiesArrayHandle = vtkm::cont::ArrayHandle; class BuildFunctor { @@ -690,7 +690,7 @@ private: vtkm::cont::DynamicCellSet cellSet = Self->GetCellSet(); vtkm::Id numCells = cellSet.GetNumberOfCells(); - vtkm::cont::CoordinateSystem coords = Self->GetCoords(); + vtkm::cont::CoordinateSystem coords = Self->GetCoordinates(); vtkm::cont::ArrayHandleVirtualCoordinates points = coords.GetData(); //std::cout << "No of cells: " << numCells << "\n"; @@ -705,7 +705,7 @@ private: //START_TIMER(s12); CoordsArrayHandle centerXs, centerYs, centerZs; RangeArrayHandle xRanges, yRanges, zRanges; - vtkm::worklet::DispatcherMapTopology().Invoke( + vtkm::worklet::DispatcherMapTopology().Invoke( cellSet, points, xRanges, yRanges, zRanges, centerXs, centerYs, centerZs); //PRINT_TIMER("1.2", s12); @@ -743,7 +743,7 @@ private: //START_TIMER(s22); // Calculate split costs for NumPlanes split planes, across X, Y and Z dimensions vtkm::Id numSplitPlanes = numSegments * (Self->NumPlanes + 1); - vtkm::cont::ArrayHandle xSplits, ySplits, zSplits; + vtkm::cont::ArrayHandle xSplits, ySplits, zSplits; xSplits.Allocate(numSplitPlanes); ySplits.Allocate(numSplitPlanes); zSplits.Allocate(numSplitPlanes); @@ -760,8 +760,8 @@ private: SplitArrayHandle segmentSplits; vtkm::cont::ArrayHandle segmentPlanes; vtkm::cont::ArrayHandle splitChoices; - SplitSelector worklet(Self->NumPlanes, Self->MaxLeafSize, Self->NumPlanes + 1); - vtkm::worklet::DispatcherMapField splitSelectorDispatcher(worklet); + detail::SplitSelector worklet(Self->NumPlanes, Self->MaxLeafSize, Self->NumPlanes + 1); + vtkm::worklet::DispatcherMapField splitSelectorDispatcher(worklet); CountingIdArrayHandle indices(0, 1, numSegments); splitSelectorDispatcher.Invoke(indices, xSplits, @@ -779,7 +779,8 @@ private: //START_TIMER(s31); IdArrayHandle leqFlags; - vtkm::worklet::DispatcherMapField computeFlagDispatcher; + vtkm::worklet::DispatcherMapField + computeFlagDispatcher; computeFlagDispatcher.Invoke(centerXs, centerYs, centerZs, splits, planes, leqFlags); //PRINT_TIMER("3.1", s31); @@ -788,30 +789,31 @@ private: Self->CalculateSplitScatterIndices(cellIds, leqFlags, segmentIds, DeviceAdapter()); IdArrayHandle newSegmentIds; IdPermutationArrayHandle sizes(segmentIds, segmentSizes); - vtkm::worklet::DispatcherMapField(SegmentSplitter(Self->MaxLeafSize)) + vtkm::worklet::DispatcherMapField( + detail::SegmentSplitter(Self->MaxLeafSize)) .Invoke(segmentIds, leqFlags, sizes, newSegmentIds); //PRINT_TIMER("3.2", s32); //START_TIMER(s33); vtkm::cont::ArrayHandle choices; Algorithms::Copy(IdPermutationArrayHandle(segmentIds, splitChoices), choices); - cellIds = ScatterArray(cellIds, scatterIndices); - segmentIds = ScatterArray(segmentIds, scatterIndices); - newSegmentIds = ScatterArray(newSegmentIds, scatterIndices); - xRanges = ScatterArray(xRanges, scatterIndices); - yRanges = ScatterArray(yRanges, scatterIndices); - zRanges = ScatterArray(zRanges, scatterIndices); - centerXs = ScatterArray(centerXs, scatterIndices); - centerYs = ScatterArray(centerYs, scatterIndices); - centerZs = ScatterArray(centerZs, scatterIndices); - choices = ScatterArray(choices, scatterIndices); + cellIds = detail::ScatterArray(cellIds, scatterIndices); + segmentIds = detail::ScatterArray(segmentIds, scatterIndices); + newSegmentIds = detail::ScatterArray(newSegmentIds, scatterIndices); + xRanges = detail::ScatterArray(xRanges, scatterIndices); + yRanges = detail::ScatterArray(yRanges, scatterIndices); + zRanges = detail::ScatterArray(zRanges, scatterIndices); + centerXs = detail::ScatterArray(centerXs, scatterIndices); + centerYs = detail::ScatterArray(centerYs, scatterIndices); + centerZs = detail::ScatterArray(centerZs, scatterIndices); + choices = detail::ScatterArray(choices, scatterIndices); //PRINT_TIMER("3.3", s33); // Move the cell ids at leafs to the processed cellids list //START_TIMER(s41); IdArrayHandle nonSplitSegmentSizes; - vtkm::worklet::DispatcherMapField( - NonSplitIndexCalculator(Self->MaxLeafSize)) + vtkm::worklet::DispatcherMapField( + detail::NonSplitIndexCalculator(Self->MaxLeafSize)) .Invoke(segmentSizes, nonSplitSegmentSizes); IdArrayHandle nonSplitSegmentIndices; Algorithms::ScanExclusive(nonSplitSegmentSizes, nonSplitSegmentIndices); @@ -821,18 +823,18 @@ private: //START_TIMER(s42); IdArrayHandle doneCellIds; - Algorithms::CopyIf(cellIds, choices, doneCellIds, Invert()); + Algorithms::CopyIf(cellIds, choices, doneCellIds, detail::Invert()); Algorithms::CopySubRange( doneCellIds, 0, doneCellIds.GetNumberOfValues(), Self->ProcessedCellIds, cellIdsOffset); - cellIds = CopyIfArray(cellIds, choices, DeviceAdapter()); - newSegmentIds = CopyIfArray(newSegmentIds, choices, DeviceAdapter()); - xRanges = CopyIfArray(xRanges, choices, DeviceAdapter()); - yRanges = CopyIfArray(yRanges, choices, DeviceAdapter()); - zRanges = CopyIfArray(zRanges, choices, DeviceAdapter()); - centerXs = CopyIfArray(centerXs, choices, DeviceAdapter()); - centerYs = CopyIfArray(centerYs, choices, DeviceAdapter()); - centerZs = CopyIfArray(centerZs, choices, DeviceAdapter()); + cellIds = detail::CopyIfArray(cellIds, choices, DeviceAdapter()); + newSegmentIds = detail::CopyIfArray(newSegmentIds, choices, DeviceAdapter()); + xRanges = detail::CopyIfArray(xRanges, choices, DeviceAdapter()); + yRanges = detail::CopyIfArray(yRanges, choices, DeviceAdapter()); + zRanges = detail::CopyIfArray(zRanges, choices, DeviceAdapter()); + centerXs = detail::CopyIfArray(centerXs, choices, DeviceAdapter()); + centerYs = detail::CopyIfArray(centerYs, choices, DeviceAdapter()); + centerZs = detail::CopyIfArray(centerZs, choices, DeviceAdapter()); //PRINT_TIMER("4.2", s42); //START_TIMER(s43); @@ -843,8 +845,8 @@ private: Algorithms::CopySubRange(Self->Nodes, 0, Self->Nodes.GetNumberOfValues(), newTree); CountingIdArrayHandle nodesIndices(nodesIndexOffset, 1, numSegments); - TreeLevelAdder nodesAdder(cellIdsOffset, nodesSize, Self->MaxLeafSize); - vtkm::worklet::DispatcherMapField(nodesAdder) + detail::TreeLevelAdder nodesAdder(cellIdsOffset, nodesSize, Self->MaxLeafSize); + vtkm::worklet::DispatcherMapField(nodesAdder) .Invoke(nodesIndices, segmentSplits, nonSplitSegmentIndices, @@ -908,7 +910,7 @@ private: RangeArrayHandle ranges, CoordsArrayHandle& coords, IdArrayHandle& segmentIds, - vtkm::cont::ArrayHandle& splits, + vtkm::cont::ArrayHandle& splits, DeviceAdapter) { for (vtkm::IdComponent planeIndex = 0; planeIndex < NumPlanes; ++planeIndex) @@ -935,21 +937,21 @@ private: RangeArrayHandle ranges, CoordsArrayHandle& coords, IdArrayHandle& segmentIds, - vtkm::cont::ArrayHandle& splits, + vtkm::cont::ArrayHandle& splits, vtkm::IdComponent index, DeviceAdapter) { using Algorithms = typename vtkm::cont::DeviceAdapterAlgorithm; // Make candidate split plane array vtkm::cont::ArrayHandle splitPlanes; - SplitPlaneCalculatorWorklet splitPlaneCalcWorklet(planeIndex, numPlanes); - vtkm::worklet::DispatcherMapField splitDispatcher( - splitPlaneCalcWorklet); + detail::SplitPlaneCalculatorWorklet splitPlaneCalcWorklet(planeIndex, numPlanes); + vtkm::worklet::DispatcherMapField + splitDispatcher(splitPlaneCalcWorklet); splitDispatcher.Invoke(segmentRanges, splitPlanes); // Check if a point is to the left of the split plane or right vtkm::cont::ArrayHandle isLEQOfSplitPlane, isROfSplitPlane; - vtkm::worklet::DispatcherMapField().Invoke( + vtkm::worklet::DispatcherMapField().Invoke( coords, splitPlanes, isLEQOfSplitPlane, isROfSplitPlane); // Count of points to the left @@ -964,23 +966,23 @@ private: // Calculate Lmax and Rmin vtkm::cont::ArrayHandle leqRanges; vtkm::cont::ArrayHandle rRanges; - vtkm::worklet::DispatcherMapField>().Invoke( + vtkm::worklet::DispatcherMapField>().Invoke( coords, splitPlanes, ranges, leqRanges); - vtkm::worklet::DispatcherMapField>().Invoke( + vtkm::worklet::DispatcherMapField>().Invoke( coords, splitPlanes, ranges, rRanges); vtkm::cont::ArrayHandle lMaxRanges; vtkm::cont::ArrayHandle rMinRanges; - Algorithms::ReduceByKey(segmentIds, leqRanges, discardKeys, lMaxRanges, RangeAdd()); - Algorithms::ReduceByKey(segmentIds, rRanges, discardKeys, rMinRanges, RangeAdd()); + Algorithms::ReduceByKey(segmentIds, leqRanges, discardKeys, lMaxRanges, detail::RangeAdd()); + Algorithms::ReduceByKey(segmentIds, rRanges, discardKeys, rMinRanges, detail::RangeAdd()); vtkm::cont::ArrayHandle segmentedSplitPlanes; Algorithms::ReduceByKey( segmentIds, splitPlanes, discardKeys, segmentedSplitPlanes, vtkm::Minimum()); // Calculate costs - SplitPropertiesCalculator splitPropertiesCalculator(index, NumPlanes + 1); - vtkm::worklet::DispatcherMapField(splitPropertiesCalculator) + detail::SplitPropertiesCalculator splitPropertiesCalculator(index, NumPlanes + 1); + vtkm::worklet::DispatcherMapField(splitPropertiesCalculator) .Invoke(pointsToLeft, pointsToRight, lMaxRanges, rMinRanges, segmentedSplitPlanes, splits); } @@ -1003,12 +1005,13 @@ private: Algorithms::ScanInclusiveByKey(segmentIds, counts, countPreviousSegments, vtkm::Minimum()); // Total number of false flags so far in segment - vtkm::cont::ArrayHandleTransform flagsInverse(leqFlags, Invert()); + vtkm::cont::ArrayHandleTransform flagsInverse(leqFlags, + detail::Invert()); vtkm::cont::ArrayHandle runningFalseFlagCount; Algorithms::ScanInclusiveByKey(segmentIds, flagsInverse, runningFalseFlagCount, vtkm::Add()); // Total number of false flags in segment - IdArrayHandle totalFalseFlagSegmentCount = ReverseScanInclusiveByKey( + IdArrayHandle totalFalseFlagSegmentCount = detail::ReverseScanInclusiveByKey( segmentIds, runningFalseFlagCount, vtkm::Maximum(), DeviceAdapter()); // if point is to the left, @@ -1016,12 +1019,13 @@ private: // else // index = total number in previous segments + number of falses preceeding it in the segment. IdArrayHandle scatterIndices; - vtkm::worklet::DispatcherMapField().Invoke(leqFlags, - trueFlagCounts, - countPreviousSegments, - runningFalseFlagCount, - totalFalseFlagSegmentCount, - scatterIndices); + vtkm::worklet::DispatcherMapField().Invoke( + leqFlags, + trueFlagCounts, + countPreviousSegments, + runningFalseFlagCount, + totalFalseFlagSegmentCount, + scatterIndices); return scatterIndices; } @@ -1042,7 +1046,7 @@ private: ExecutionType* execObject = new ExecutionType(bih->Nodes, bih->ProcessedCellIds, bih->GetCellSet().Cast(), - bih->GetCoords().GetData(), + bih->GetCoordinates().GetData(), DeviceAdapter()); *bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter()); } @@ -1053,7 +1057,7 @@ private: ExecutionType* execObject = new ExecutionType(bih->Nodes, bih->ProcessedCellIds, bih->GetCellSet().Cast(), - bih->GetCoords().GetData(), + bih->GetCoordinates().GetData(), DeviceAdapter()); *bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter()); } @@ -1064,7 +1068,7 @@ private: ExecutionType* execObject = new ExecutionType(bih->Nodes, bih->ProcessedCellIds, bih->GetCellSet().Cast(), - bih->GetCoords().GetData(), + bih->GetCoordinates().GetData(), DeviceAdapter()); *bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter()); } @@ -1075,7 +1079,7 @@ private: ExecutionType* execObject = new ExecutionType(bih->Nodes, bih->ProcessedCellIds, bih->GetCellSet().Cast(), - bih->GetCoords().GetData(), + bih->GetCoordinates().GetData(), DeviceAdapter()); *bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter()); } @@ -1094,6 +1098,28 @@ public: { } + VTKM_CONT + void SetNumberOfSplittingPlanes(vtkm::IdComponent numPlanes) + { + NumPlanes = numPlanes; + SetDirty(); + } + + VTKM_CONT + vtkm::IdComponent GetNumberOfSplittingPlanes() { return NumPlanes; } + + VTKM_CONT + void SetMaxLeafSize(vtkm::IdComponent maxLeafSize) + { + MaxLeafSize = maxLeafSize; + SetDirty(); + } + + VTKM_CONT + vtkm::Id GetMaxLeafSize() { return MaxLeafSize; } + + +protected: VTKM_CONT void Build() override { @@ -1101,13 +1127,10 @@ public: vtkm::cont::TryExecute(functor); } -protected: VTKM_CONT const vtkm::exec::CellLocator* PrepareForExecutionImpl(const vtkm::Int8 device) const override { - using DeviceList = vtkm::ListTagBase; + using DeviceList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST_TAG; const vtkm::exec::CellLocator* toReturn; vtkm::cont::internal::FindDeviceAdapterTagAndCall( device, DeviceList(), PrepareForExecutionFunctor(), this, &toReturn); @@ -1120,7 +1143,8 @@ private: vtkm::cont::ArrayHandle Nodes; IdArrayHandle ProcessedCellIds; }; -} -} // namespace vtkm::cont + +} // namespace cont +} // namespace vtkm #endif // vtk_m_cont_BoundingIntervalHierarchy_h diff --git a/vtkm/cont/CMakeLists.txt b/vtkm/cont/CMakeLists.txt index a1fe33d52..04de1b926 100644 --- a/vtkm/cont/CMakeLists.txt +++ b/vtkm/cont/CMakeLists.txt @@ -47,7 +47,6 @@ set(headers ArrayRangeCompute.h AssignerMultiBlock.h BoundingIntervalHierarchyNode.h - BoundingIntervalHierarchyExec.h BoundingIntervalHierarchy.h BoundsCompute.h BoundsGlobalCompute.h diff --git a/vtkm/cont/CellLocator.h b/vtkm/cont/CellLocator.h index c4ad88ac2..f304482a6 100644 --- a/vtkm/cont/CellLocator.h +++ b/vtkm/cont/CellLocator.h @@ -21,34 +21,14 @@ #define vtk_m_cont_CellLocator_h #include -#include #include #include #include #include +#include namespace vtkm { - -namespace exec -{ -// This will actually be used in the Execution Environment. -// As this object is returned by the PrepareForExecution on -// the CellLocator we need it to be covarient, and this acts -// like a base class. - -class CellLocator : public vtkm::VirtualObjectBase -{ -public: - VTKM_EXEC - virtual void FindCell(const vtkm::Vec& point, - vtkm::Id& cellId, - vtkm::Vec& parametric, - const vtkm::exec::FunctorBase& worklet) const = 0; -}; - -} // namespace exec - namespace cont { @@ -66,20 +46,17 @@ public: void SetCellSet(const vtkm::cont::DynamicCellSet& cellSet) { CellSet = cellSet; - Dirty = true; + SetDirty(); } - vtkm::cont::CoordinateSystem GetCoords() const { return Coords; } + vtkm::cont::CoordinateSystem GetCoordinates() const { return Coords; } - void SetCoords(const vtkm::cont::CoordinateSystem& coords) + void SetCoordinates(const vtkm::cont::CoordinateSystem& coords) { Coords = coords; - Dirty = true; + SetDirty(); } - //This is going to need a TryExecute - virtual void Build() = 0; - void Update() { if (Dirty) @@ -95,6 +72,11 @@ public: } protected: + void SetDirty() { Dirty = true; } + + //This is going to need a TryExecute + VTKM_CONT virtual void Build() = 0; + VTKM_CONT virtual const vtkm::exec::CellLocator* PrepareForExecutionImpl( const vtkm::Int8 device) const = 0; diff --git a/vtkm/cont/PointLocator.h b/vtkm/cont/PointLocator.h index d14e46d3c..42086a9f5 100644 --- a/vtkm/cont/PointLocator.h +++ b/vtkm/cont/PointLocator.h @@ -24,23 +24,10 @@ #include #include #include +#include namespace vtkm { - -namespace exec -{ - -class PointLocator -{ -public: - VTKM_EXEC virtual void FindNearestNeighbor(const vtkm::Vec& queryPoint, - vtkm::Id& pointId, - vtkm::FloatDefault& distanceSquared) const = 0; -}; - -} // namespace exec - namespace cont { @@ -53,16 +40,14 @@ public: { } - vtkm::cont::CoordinateSystem GetCoords() const { return Coords; } + vtkm::cont::CoordinateSystem GetCoordinates() const { return Coords; } - void SetCoords(const vtkm::cont::CoordinateSystem& coords) + void SetCoordinates(const vtkm::cont::CoordinateSystem& coords) { Coords = coords; Dirty = true; } - virtual void Build() = 0; - void Update() { if (Dirty) @@ -77,6 +62,11 @@ public: return PrepareForExecution(deviceId); } +protected: + void SetDirty() { Dirty = true; } + + VTKM_CONT virtual void Build() = 0; + VTKM_CONT virtual const vtkm::exec::PointLocator* PrepareForExecutionImpl( const vtkm::Int8 device) = 0; diff --git a/vtkm/cont/BoundingIntervalHierarchyExec.h b/vtkm/exec/BoundingIntervalHierarchyExec.h similarity index 97% rename from vtkm/cont/BoundingIntervalHierarchyExec.h rename to vtkm/exec/BoundingIntervalHierarchyExec.h index 1bbc6196f..5d3ce8bf5 100644 --- a/vtkm/cont/BoundingIntervalHierarchyExec.h +++ b/vtkm/exec/BoundingIntervalHierarchyExec.h @@ -20,11 +20,13 @@ #ifndef vtk_m_cont_BoundingIntervalHierarchyExec_h #define vtk_m_cont_BoundingIntervalHierarchyExec_h +#include #include #include +#include #include -#include #include +#include #include namespace vtkm diff --git a/vtkm/exec/CMakeLists.txt b/vtkm/exec/CMakeLists.txt index d2c8cf3b1..cc9f4be29 100644 --- a/vtkm/exec/CMakeLists.txt +++ b/vtkm/exec/CMakeLists.txt @@ -20,11 +20,13 @@ set(headers AtomicArray.h + BoundingIntervalHierarchyExec.h CellDerivative.h CellEdge.h CellFace.h CellInside.h CellInterpolate.h + CellLocator.h CellMeasure.h ColorTable.h ConnectivityExplicit.h @@ -34,6 +36,7 @@ set(headers FunctorBase.h Jacobian.h ParametricCoordinates.h + PointLocator.h TaskBase.h ) diff --git a/vtkm/exec/CellLocator.h b/vtkm/exec/CellLocator.h new file mode 100644 index 000000000..bbf757718 --- /dev/null +++ b/vtkm/exec/CellLocator.h @@ -0,0 +1,45 @@ +//============================================================================ +// 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 2017 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2017 UT-Battelle, LLC. +// Copyright 2017 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#ifndef vtk_m_exec_CellLocator_h +#define vtk_m_exec_CellLocator_h + +#include +#include +#include + +namespace vtkm +{ +namespace exec +{ + +class CellLocator : public vtkm::VirtualObjectBase +{ +public: + VTKM_EXEC + virtual void FindCell(const vtkm::Vec& point, + vtkm::Id& cellId, + vtkm::Vec& parametric, + const vtkm::exec::FunctorBase& worklet) const = 0; +}; + +} // namespace exec +} // namespace vtkm + +#endif // vtk_m_exec_CellLocator_h diff --git a/vtkm/exec/PointLocator.h b/vtkm/exec/PointLocator.h new file mode 100644 index 000000000..e986ea5d5 --- /dev/null +++ b/vtkm/exec/PointLocator.h @@ -0,0 +1,42 @@ +//============================================================================ +// 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 2017 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2017 UT-Battelle, LLC. +// Copyright 2017 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#ifndef vtk_m_exec_PointLocator_h +#define vtk_m_exec_PointLocator_h + +#include +#include + +namespace vtkm +{ +namespace exec +{ + +class PointLocator : public vtkm::VirtualObjectBase +{ +public: + VTKM_EXEC virtual void FindNearestNeighbor(const vtkm::Vec& queryPoint, + vtkm::Id& pointId, + vtkm::FloatDefault& distanceSquared) const = 0; +}; + +} // namespace exec +} // namespace vtkm + +#endif // vtk_m_exec_PointLocator_h diff --git a/vtkm/worklet/testing/UnitTestBoundingIntervalHierarchy.cxx b/vtkm/worklet/testing/UnitTestBoundingIntervalHierarchy.cxx index bfe559910..934bd69ec 100644 --- a/vtkm/worklet/testing/UnitTestBoundingIntervalHierarchy.cxx +++ b/vtkm/worklet/testing/UnitTestBoundingIntervalHierarchy.cxx @@ -20,7 +20,6 @@ #include #include -#include #include #include #include @@ -79,8 +78,8 @@ void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet, vtkm::IdComponen std::cout << "Using numPlanes: " << numPlanes << "\n"; vtkm::cont::BoundingIntervalHierarchy bih = vtkm::cont::BoundingIntervalHierarchy(numPlanes, 5); bih.SetCellSet(cellSet); - bih.SetCoords(dataSet.GetCoordinateSystem()); - bih.Build(); + bih.SetCoordinates(dataSet.GetCoordinateSystem()); + bih.Update(); Timer centroidsTimer; vtkm::cont::ArrayHandle> centroids; @@ -96,7 +95,10 @@ void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet, vtkm::IdComponen //set up stack size for cuda envinroment size_t stackSizeBackup; cudaDeviceGetLimit(&stackSizeBackup, cudaLimitStackSize); - cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 200); + + std::cout << "Default stack size" << stackSizeBackup << "\n"; + + cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 50); #endif vtkm::worklet::DispatcherMapField().Invoke( @@ -117,10 +119,10 @@ void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet, vtkm::IdComponen void RunTest() { - TestBoundingIntervalHierarchy(ConstructDataSet(10), 3); - TestBoundingIntervalHierarchy(ConstructDataSet(10), 4); - TestBoundingIntervalHierarchy(ConstructDataSet(10), 6); - TestBoundingIntervalHierarchy(ConstructDataSet(10), 9); + TestBoundingIntervalHierarchy(ConstructDataSet(16), 3); + TestBoundingIntervalHierarchy(ConstructDataSet(16), 4); + TestBoundingIntervalHierarchy(ConstructDataSet(16), 6); + TestBoundingIntervalHierarchy(ConstructDataSet(16), 9); } } // anonymous namespace