Commit 72d4556f authored by Abhishek Yenpure's avatar Abhishek Yenpure Committed by Abhishek Yenpure

Adding changes for Ken's review from GitLab

- Reducing the stack allocation for CUDA for the BIH unit test
- Adding changes from Ken's review
- Suppress ptxas stack size warning for BoundingIntervalHierarchy
parent 7a122f23
......@@ -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.*"
)
This diff is collapsed.
......@@ -47,7 +47,6 @@ set(headers
ArrayRangeCompute.h
AssignerMultiBlock.h
BoundingIntervalHierarchyNode.h
BoundingIntervalHierarchyExec.h
BoundingIntervalHierarchy.h
BoundsCompute.h
BoundsGlobalCompute.h
......
......@@ -21,34 +21,14 @@
#define vtk_m_cont_CellLocator_h
#include <vtkm/Types.h>
#include <vtkm/VirtualObjectBase.h>
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/DynamicCellSet.h>
#include <vtkm/cont/ExecutionObjectBase.h>
#include <vtkm/exec/CellLocator.h>
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<vtkm::FloatDefault, 3>& point,
vtkm::Id& cellId,
vtkm::Vec<vtkm::FloatDefault, 3>& 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;
......
......@@ -24,23 +24,10 @@
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/ExecutionObjectBase.h>
#include <vtkm/exec/PointLocator.h>
namespace vtkm
{
namespace exec
{
class PointLocator
{
public:
VTKM_EXEC virtual void FindNearestNeighbor(const vtkm::Vec<vtkm::FloatDefault, 3>& 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;
......
......@@ -20,11 +20,13 @@
#ifndef vtk_m_cont_BoundingIntervalHierarchyExec_h
#define vtk_m_cont_BoundingIntervalHierarchyExec_h
#include <vtkm/TopologyElementTag.h>
#include <vtkm/VecFromPortalPermute.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ArrayHandleVirtualCoordinates.h>
#include <vtkm/cont/BoundingIntervalHierarchyNode.h>
#include <vtkm/cont/CellLocator.h>
#include <vtkm/exec/CellInside.h>
#include <vtkm/exec/CellLocator.h>
#include <vtkm/exec/ParametricCoordinates.h>
namespace vtkm
......
......@@ -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
)
......
//============================================================================
// 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 <vtkm/Types.h>
#include <vtkm/VirtualObjectBase.h>
#include <vtkm/exec/FunctorBase.h>
namespace vtkm
{
namespace exec
{
class CellLocator : public vtkm::VirtualObjectBase
{
public:
VTKM_EXEC
virtual void FindCell(const vtkm::Vec<vtkm::FloatDefault, 3>& point,
vtkm::Id& cellId,
vtkm::Vec<vtkm::FloatDefault, 3>& parametric,
const vtkm::exec::FunctorBase& worklet) const = 0;
};
} // namespace exec
} // namespace vtkm
#endif // vtk_m_exec_CellLocator_h
//============================================================================
// 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 <vtkm/Types.h>
#include <vtkm/VirtualObjectBase.h>
namespace vtkm
{
namespace exec
{
class PointLocator : public vtkm::VirtualObjectBase
{
public:
VTKM_EXEC virtual void FindNearestNeighbor(const vtkm::Vec<vtkm::FloatDefault, 3>& queryPoint,
vtkm::Id& pointId,
vtkm::FloatDefault& distanceSquared) const = 0;
};
} // namespace exec
} // namespace vtkm
#endif // vtk_m_exec_PointLocator_h
......@@ -20,7 +20,6 @@
#include <vtkm/cont/ArrayHandleConcatenate.h>
#include <vtkm/cont/BoundingIntervalHierarchy.h>
#include <vtkm/cont/BoundingIntervalHierarchyExec.h>
#include <vtkm/cont/DataSetBuilderUniform.h>
#include <vtkm/cont/Timer.h>
#include <vtkm/cont/testing/Testing.h>
......@@ -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<vtkm::Vec<vtkm::FloatDefault, 3>> 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<BoundingIntervalHierarchyTester>().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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment