mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Remove improper defines of the default device adapter.
Worklets should never set or define the default device adapter
This commit is contained in:
parent
40a0b5dcce
commit
705dac67b3
@ -20,48 +20,48 @@
|
||||
// Copyright (c) 2016, Los Alamos National Security, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Copyright 2016. Los Alamos National Security, LLC.
|
||||
// This software was produced under U.S. Government contract DE-AC52-06NA25396
|
||||
// for Los Alamos National Laboratory (LANL), which is operated by
|
||||
// Los Alamos National Security, LLC for the U.S. Department of Energy.
|
||||
// The U.S. Government has rights to use, reproduce, and distribute this
|
||||
// software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC
|
||||
// MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE
|
||||
// USE OF THIS SOFTWARE. If software is modified to produce derivative works,
|
||||
// such modified software should be clearly marked, so as not to confuse it
|
||||
// Copyright 2016. Los Alamos National Security, LLC.
|
||||
// This software was produced under U.S. Government contract DE-AC52-06NA25396
|
||||
// for Los Alamos National Laboratory (LANL), which is operated by
|
||||
// Los Alamos National Security, LLC for the U.S. Department of Energy.
|
||||
// The U.S. Government has rights to use, reproduce, and distribute this
|
||||
// software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC
|
||||
// MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE
|
||||
// USE OF THIS SOFTWARE. If software is modified to produce derivative works,
|
||||
// such modified software should be clearly marked, so as not to confuse it
|
||||
// with the version available from LANL.
|
||||
//
|
||||
// Additionally, redistribution and use in source and binary forms, with or
|
||||
// without modification, are permitted provided that the following conditions
|
||||
// Additionally, redistribution and use in source and binary forms, with or
|
||||
// without modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
// 3. Neither the name of Los Alamos National Security, LLC, Los Alamos
|
||||
// National Laboratory, LANL, the U.S. Government, nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// 3. Neither the name of Los Alamos National Security, LLC, Los Alamos
|
||||
// National Laboratory, LANL, the U.S. Government, nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND
|
||||
// CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
||||
// BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS
|
||||
// NATIONAL SECURITY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
// THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND
|
||||
// CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
||||
// BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS
|
||||
// NATIONAL SECURITY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//============================================================================
|
||||
|
||||
// This code is based on the algorithm presented in the paper:
|
||||
// “Parallel Peak Pruning for Scalable SMP Contour Tree Computation.”
|
||||
// Hamish Carr, Gunther Weber, Christopher Sewell, and James Ahrens.
|
||||
// Proceedings of the IEEE Symposium on Large Data Analysis and Visualization
|
||||
// This code is based on the algorithm presented in the paper:
|
||||
// “Parallel Peak Pruning for Scalable SMP Contour Tree Computation.”
|
||||
// Hamish Carr, Gunther Weber, Christopher Sewell, and James Ahrens.
|
||||
// Proceedings of the IEEE Symposium on Large Data Analysis and Visualization
|
||||
// (LDAV), October 2016, Baltimore, Maryland.
|
||||
|
||||
|
||||
@ -82,17 +82,11 @@
|
||||
#include <vtkm/worklet/contourtree/Mesh2D_DEM_Triangulation.h>
|
||||
#include <vtkm/worklet/contourtree/Mesh3D_DEM_Triangulation.h>
|
||||
|
||||
#ifndef VTKM_DEVICE_ADAPTER
|
||||
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
|
||||
#endif
|
||||
|
||||
const bool JOIN = true;
|
||||
const bool SPLIT = false;
|
||||
const bool JOIN_3D = true;
|
||||
const bool SPLIT_3D = false;
|
||||
|
||||
typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
|
||||
|
||||
namespace vtkm {
|
||||
namespace worklet {
|
||||
|
||||
@ -113,17 +107,17 @@ public:
|
||||
vtkm::Id nSlices = 1;
|
||||
|
||||
// Build the mesh and fill in the values
|
||||
contourtree::Mesh2D_DEM_Triangulation<FieldType,StorageType,DeviceAdapter>
|
||||
contourtree::Mesh2D_DEM_Triangulation<FieldType,StorageType,DeviceAdapter>
|
||||
mesh(fieldArray, nRows, nCols);
|
||||
|
||||
// Initialize the join tree so that all arcs point to maxima
|
||||
contourtree::MergeTree<FieldType,StorageType,DeviceAdapter>
|
||||
contourtree::MergeTree<FieldType,StorageType,DeviceAdapter>
|
||||
joinTree(fieldArray, nRows, nCols, nSlices, JOIN);
|
||||
mesh.SetStarts(joinTree.extrema, JOIN);
|
||||
joinTree.BuildRegularChains();
|
||||
|
||||
// Create the active topology graph from the regular graph
|
||||
contourtree::ChainGraph<FieldType,StorageType,DeviceAdapter>
|
||||
contourtree::ChainGraph<FieldType,StorageType,DeviceAdapter>
|
||||
joinGraph(fieldArray, joinTree.extrema, JOIN);
|
||||
mesh.SetSaddleStarts(joinGraph, JOIN);
|
||||
|
||||
@ -131,13 +125,13 @@ public:
|
||||
joinGraph.Compute(joinTree.saddles);
|
||||
|
||||
// Initialize the split tree so that all arcs point to maxima
|
||||
contourtree::MergeTree<FieldType,StorageType,DeviceAdapter>
|
||||
contourtree::MergeTree<FieldType,StorageType,DeviceAdapter>
|
||||
splitTree(fieldArray, nRows, nCols, nSlices, SPLIT);
|
||||
mesh.SetStarts(splitTree.extrema, SPLIT);
|
||||
splitTree.BuildRegularChains();
|
||||
|
||||
// Create the active topology graph from the regular graph
|
||||
contourtree::ChainGraph<FieldType,StorageType,DeviceAdapter>
|
||||
contourtree::ChainGraph<FieldType,StorageType,DeviceAdapter>
|
||||
splitGraph(fieldArray, splitTree.extrema, SPLIT);
|
||||
mesh.SetSaddleStarts(splitGraph, SPLIT);
|
||||
|
||||
@ -145,7 +139,7 @@ public:
|
||||
splitGraph.Compute(splitTree.saddles);
|
||||
|
||||
// Now compute the contour tree
|
||||
contourtree::ContourTree<FieldType,StorageType,DeviceAdapter>
|
||||
contourtree::ContourTree<FieldType,StorageType,DeviceAdapter>
|
||||
contourTree(fieldArray,
|
||||
joinTree, splitTree,
|
||||
joinGraph, splitGraph);
|
||||
@ -170,17 +164,17 @@ public:
|
||||
(void) device;
|
||||
|
||||
// Build the mesh and fill in the values
|
||||
contourtree::Mesh3D_DEM_Triangulation<FieldType,StorageType,DeviceAdapter>
|
||||
contourtree::Mesh3D_DEM_Triangulation<FieldType,StorageType,DeviceAdapter>
|
||||
mesh(fieldArray, nRows, nCols, nSlices);
|
||||
|
||||
// Initialize the join tree so that all arcs point to maxima
|
||||
contourtree::MergeTree<FieldType,StorageType,DeviceAdapter>
|
||||
contourtree::MergeTree<FieldType,StorageType,DeviceAdapter>
|
||||
joinTree(fieldArray, nRows, nCols, nSlices, JOIN_3D);
|
||||
mesh.SetStarts(joinTree.extrema, JOIN_3D);
|
||||
joinTree.BuildRegularChains();
|
||||
|
||||
// Create the active topology graph from the regular graph
|
||||
contourtree::ChainGraph<FieldType,StorageType,DeviceAdapter>
|
||||
contourtree::ChainGraph<FieldType,StorageType,DeviceAdapter>
|
||||
joinGraph(fieldArray, joinTree.extrema, JOIN_3D);
|
||||
mesh.SetSaddleStarts(joinGraph, JOIN_3D);
|
||||
|
||||
@ -188,13 +182,13 @@ public:
|
||||
joinGraph.Compute(joinTree.saddles);
|
||||
|
||||
// Initialize the split tree so that all arcs point to maxima
|
||||
contourtree::MergeTree<FieldType,StorageType,DeviceAdapter>
|
||||
contourtree::MergeTree<FieldType,StorageType,DeviceAdapter>
|
||||
splitTree(fieldArray, nRows, nCols, nSlices, SPLIT_3D);
|
||||
mesh.SetStarts(splitTree.extrema, SPLIT_3D);
|
||||
splitTree.BuildRegularChains();
|
||||
|
||||
// Create the active topology graph from the regular graph
|
||||
contourtree::ChainGraph<FieldType,StorageType,DeviceAdapter>
|
||||
contourtree::ChainGraph<FieldType,StorageType,DeviceAdapter>
|
||||
splitGraph(fieldArray, splitTree.extrema, SPLIT_3D);
|
||||
mesh.SetSaddleStarts(splitGraph, SPLIT_3D);
|
||||
|
||||
@ -202,7 +196,7 @@ public:
|
||||
splitGraph.Compute(splitTree.saddles);
|
||||
|
||||
// Now compute the contour tree
|
||||
contourtree::ContourTree<FieldType,StorageType,DeviceAdapter>
|
||||
contourtree::ContourTree<FieldType,StorageType,DeviceAdapter>
|
||||
contourTree(fieldArray,
|
||||
joinTree, splitTree,
|
||||
joinGraph, splitGraph);
|
||||
|
@ -24,18 +24,12 @@
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/DeviceAdapter.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
|
||||
#include <vtkm/cont/Field.h>
|
||||
|
||||
#ifndef VTKM_DEVICE_ADAPTER
|
||||
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
|
||||
#endif
|
||||
|
||||
typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
|
||||
|
||||
namespace
|
||||
{
|
||||
// GCC creates false positive warnings for signed/unsigned char* operations.
|
||||
@ -105,24 +99,21 @@ public:
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(FieldIn<IdType> inputIndex,
|
||||
WholeArrayIn<IdType> counts,
|
||||
FieldOut<IdType> outputCount);
|
||||
typedef void ExecutionSignature(_1,_2);
|
||||
typedef void ExecutionSignature(_1,_2,_3);
|
||||
typedef _1 InputDomain;
|
||||
|
||||
typedef vtkm::cont::ArrayHandle<vtkm::Id>::ExecutionTypes<DeviceAdapter>::PortalConst IdPortalType;
|
||||
IdPortalType totalCountArray;
|
||||
|
||||
VTKM_CONT
|
||||
AdjacentDifference(IdPortalType totalCount) :
|
||||
totalCountArray(totalCount) { }
|
||||
|
||||
template<typename WholeArrayType>
|
||||
VTKM_EXEC
|
||||
void operator()(const vtkm::Id &index, vtkm::Id & difference) const
|
||||
void operator()(const vtkm::Id &index,
|
||||
const WholeArrayType& counts,
|
||||
vtkm::Id & difference) const
|
||||
{
|
||||
if (index == 0)
|
||||
difference = this->totalCountArray.Get(index);
|
||||
difference = counts.Get(index);
|
||||
else
|
||||
difference = this->totalCountArray.Get(index) - this->totalCountArray.Get(index - 1);
|
||||
difference = counts.Get(index) - counts.Get(index - 1);
|
||||
}
|
||||
};
|
||||
|
||||
@ -137,9 +128,8 @@ public:
|
||||
vtkm::Range& rangeOfValues,
|
||||
FieldType& binDelta,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id>& binArray,
|
||||
DeviceAdapter device)
|
||||
DeviceAdapter vtkmNotUsed(device))
|
||||
{
|
||||
(void) device;
|
||||
typedef typename vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter> DeviceAlgorithms;
|
||||
|
||||
//todo: need to have a signature that can use an input range so we can
|
||||
@ -155,8 +145,6 @@ public:
|
||||
|
||||
const FieldType& fieldMinValue = result[0];
|
||||
const FieldType& fieldMaxValue = result[1];
|
||||
|
||||
|
||||
const FieldType fieldDelta = compute_delta(fieldMinValue, fieldMaxValue, numberOfBins);
|
||||
|
||||
// Worklet fills in the bin belonging to each value
|
||||
@ -177,9 +165,8 @@ public:
|
||||
DeviceAlgorithms::UpperBounds(binIndex, binCounter, totalCount);
|
||||
|
||||
// Difference between adjacent items is the bin count
|
||||
vtkm::worklet::DispatcherMapField<AdjacentDifference>
|
||||
adjacentDifferenceDispatcher(AdjacentDifference(totalCount.PrepareForInput(DeviceAdapter())));
|
||||
adjacentDifferenceDispatcher.Invoke(binCounter, binArray);
|
||||
vtkm::worklet::DispatcherMapField<AdjacentDifference, DeviceAdapter> dispatcher;
|
||||
dispatcher.Invoke(binCounter, totalCount, binArray);
|
||||
|
||||
//update the users data
|
||||
rangeOfValues = vtkm::Range( fieldMinValue, fieldMaxValue );
|
||||
|
@ -31,12 +31,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef VTKM_DEVICE_ADAPTER
|
||||
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
|
||||
#endif
|
||||
|
||||
typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
|
||||
|
||||
namespace vtkm {
|
||||
namespace worklet {
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include <vtkm/worklet/splatkernels/KernelBase.h>
|
||||
#include <vtkm/worklet/splatkernels/Spline3rdOrder.h>
|
||||
|
||||
#define __VTKM_GAUSSIAN_SPLATTER_BENCHMARK
|
||||
//#define __VTKM_GAUSSIAN_SPLATTER_BENCHMARK
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Macros for timing
|
||||
|
@ -287,7 +287,7 @@ void TestMarchingCubesExplicit()
|
||||
std::cout << "Testing MarchingCubes filter on explicit data" << std::endl;
|
||||
|
||||
typedef MakeRadiantDataSet DataSetGenerator;
|
||||
typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceTag;
|
||||
typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
|
||||
typedef vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32,3> > Vec3Handle;
|
||||
typedef vtkm::cont::ArrayHandle<vtkm::Float32> DataHandle;
|
||||
|
||||
@ -318,7 +318,7 @@ void TestMarchingCubesExplicit()
|
||||
contourArray,
|
||||
vertices,
|
||||
normals,
|
||||
DeviceTag());
|
||||
DeviceAdapter());
|
||||
|
||||
DataHandle scalars;
|
||||
|
||||
@ -329,7 +329,7 @@ void TestMarchingCubesExplicit()
|
||||
|
||||
marchingCubes.MapFieldOntoIsosurface(projectedArray,
|
||||
scalars,
|
||||
DeviceTag());
|
||||
DeviceAdapter());
|
||||
|
||||
std::cout << "vertices: ";
|
||||
vtkm::cont::printSummary_ArrayHandle(vertices, std::cout);
|
||||
|
Loading…
Reference in New Issue
Block a user