extend stacksize

This commit is contained in:
Dave Pugmire 2019-03-13 08:17:54 -04:00
parent fcb81f8c24
commit 722d4262e1
3 changed files with 51 additions and 3 deletions

@ -480,6 +480,18 @@ public:
const vtkm::cont::BoundingIntervalHierarchy& bih,
HandleType& bihExec) const
{
#if 0
std::cout<<"BIH:"<<std::endl;
vtkm::Id N = bih.Nodes.GetNumberOfValues();
auto portal = bih.Nodes.GetPortalConstControl();
for (vtkm::Id i = 0; i < N; i++)
{
auto n = portal.Get(i);
//printf("%d: {%d %d %f %f}\n", i, n.ChildIndex, n.Dimension, n.Node.LMax0,0);
std::cout<<i<<": {"<<n.ChildIndex<<" "<<n.Dimension<<" "<<n.Node.LMax<<" "<<n.Node.RMin<<"}"<<std::endl;
}
#endif
vtkm::cont::DynamicCellSet cellSet = bih.GetCellSet();
if (cellSet.IsType<vtkm::cont::CellSetExplicit<>>())
{
@ -544,6 +556,20 @@ VTKM_CONT
const HandleType BoundingIntervalHierarchy::PrepareForExecutionImpl(
const vtkm::cont::DeviceAdapterId deviceId) const
{
//set up stack size for cuda environment
#ifdef VTKM_CUDA
std::size_t stackSizeBackup(0);
(void)stackSizeBackup;
if (deviceId.GetValue() == VTKM_DEVICE_ADAPTER_CUDA)
{
cudaDeviceGetLimit(&stackSizeBackup, cudaLimitStackSize);
cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 16);
}
#else
(void)deviceId;
#endif
const bool success =
vtkm::cont::TryExecuteOnDevice(deviceId, PrepareForExecutionFunctor(), *this, this->ExecHandle);
if (!success)

@ -75,7 +75,9 @@ private:
vtkm::Vec<vtkm::FloatDefault, 3>& parametric,
const vtkm::exec::FunctorBase& worklet) const
{
//printf("Find %lld pt= <%f %f %f> (%f %f %f)\n", index, point[0],point[1],point[2], parametric[0],parametric[1],parametric[2]);
const vtkm::cont::BoundingIntervalHierarchyNode& node = Nodes.Get(index);
//printf(" node {%lld %d %f %f}\n", node.ChildIndex, (int)node.Dimension,node.Node.LMax, node.Node.RMin);
if (node.ChildIndex < 0)
{
return FindInLeaf(point, parametric, node, worklet);
@ -83,26 +85,37 @@ private:
else
{
const vtkm::FloatDefault& c = point[node.Dimension];
//printf(" c= %f\n", c);
vtkm::Id id1 = -1;
vtkm::Id id2 = -1;
if (c <= node.Node.LMax)
{
//printf(" %f<=LMax...\n", c);
//printf(" call: Find(%lld, pt, par, wo);\n", node.ChildIndex);
id1 = Find(node.ChildIndex, point, parametric, worklet);
//printf(" id1= %lld\n", id1);
}
if (id1 == -1 && c >= node.Node.RMin)
{
//printf(" %f>=Rmin ...\n", c);
//printf(" call: Find(%lld, pt, par, wo);\n", node.ChildIndex+1);
id2 = Find(node.ChildIndex + 1, point, parametric, worklet);
//printf(" id2= %lld\n", id2);
}
if (id1 == -1 && id2 == -1)
{
//printf("DONE Find %lld pt= <%f %f %f> id= -1\n", index, point[0],point[1],point[2]);
return -1;
}
else if (id1 == -1)
{
//printf("DONE Find %lld pt= <%f %f %f> id= %lld\n", index, point[0],point[1],point[2], id2);
return id2;
}
else
{
//printf("DONE Find %lld pt= <%f %f %f> id= %lld\n", index, point[0],point[1],point[2], id1);
return id1;
}
}
@ -116,9 +129,12 @@ private:
using IndicesType = typename CellSetPortal::IndicesType;
for (vtkm::Id i = node.Leaf.Start; i < node.Leaf.Start + node.Leaf.Size; ++i)
{
//printf(" FindInLeaf i= %lld\n", i);
vtkm::Id cellId = CellIds.Get(i);
//printf(" FindInLeaf cellId= %lld\n", cellId);
IndicesType cellPointIndices = CellSet.GetIndices(cellId);
vtkm::VecFromPortalPermute<IndicesType, CoordsPortal> cellPoints(&cellPointIndices, Coords);
//printf(" Call IsPointInCell\n");
if (IsPointInCell(point, parametric, CellSet.GetCellShape(cellId), cellPoints, worklet))
{
return cellId;

@ -31,6 +31,8 @@
#include <vtkm/worklet/particleadvection/Integrators.h>
#include <vtkm/worklet/particleadvection/Particles.h>
#include <vtkm/io/writer/VTKDataSetWriter.h>
namespace
{
@ -394,7 +396,7 @@ void TestEvaluators()
dataSets.push_back(CreateUniformDataSet<ScalarType>(bound, dim));
dataSets.push_back(CreateRectilinearDataSet<ScalarType>(bound, dim));
//Create an explicit dataset.
auto expDS = CreateExplicitFromStructuredDataSet<ScalarType>(dataSets[0]);
auto expDS = CreateExplicitFromStructuredDataSet<ScalarType>(dataSets[0], false);
dataSets.push_back(expDS);
vtkm::cont::ArrayHandle<vtkm::Vec<ScalarType, 3>> vecField;
@ -423,6 +425,10 @@ void TestEvaluators()
for (auto& ds : dataSets)
{
// ds.PrintSummary(std::cout);
// vtkm::io::writer::VTKDataSetWriter writer1("ds.vtk");
// writer1.WriteDataSet(ds);
GridEvalType gridEval(ds.GetCoordinateSystem(), ds.GetCellSet(), vecField);
ValidateEvaluator(gridEval, pointIns, vec, "grid evaluator");
@ -494,7 +500,7 @@ void TestParticleWorklets()
dataSets.push_back(CreateUniformDataSet<ScalarType>(bound, dims));
dataSets.push_back(CreateRectilinearDataSet<ScalarType>(bound, dims));
//Create an explicit dataset.
auto expDS = CreateExplicitFromStructuredDataSet<ScalarType>(dataSets[0]);
auto expDS = CreateExplicitFromStructuredDataSet<ScalarType>(dataSets[0], false);
dataSets.push_back(expDS);
//Generate three random points.
@ -547,7 +553,7 @@ void TestParticleWorklets()
void TestParticleAdvection()
{
TestEvaluators();
//TestParticleWorklets();
TestParticleWorklets();
}
int UnitTestParticleAdvection(int argc, char* argv[])