mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Cleanup.
This commit is contained in:
parent
bc10b6dbf1
commit
533f2e5eb3
@ -94,9 +94,6 @@ public:
|
||||
#ifdef VTKM_CUDA
|
||||
CudaStackSizeBackup = 0;
|
||||
cudaDeviceGetLimit(&CudaStackSizeBackup, cudaLimitStackSize);
|
||||
//std::cout<<"Initial stack size: "<<CudaStackSizeBackup<<std::endl;
|
||||
// std::cout<<"Increase stack size"<<std::endl;
|
||||
// cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 64);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -106,7 +103,6 @@ public:
|
||||
#ifdef VTKM_CUDA
|
||||
if (CudaStackSizeBackup > 0)
|
||||
{
|
||||
//std::cout<<"DE-Increase stack size "<<CudaStackSizeBackup<<std::endl;
|
||||
cudaDeviceSetLimit(cudaLimitStackSize, CudaStackSizeBackup);
|
||||
CudaStackSizeBackup = 0;
|
||||
}
|
||||
|
@ -545,8 +545,8 @@ const HandleType BoundingIntervalHierarchy::PrepareForExecutionImpl(
|
||||
const vtkm::cont::DeviceAdapterId deviceId) const
|
||||
{
|
||||
#ifdef VTKM_CUDA
|
||||
//std::cout<<"Increase stack size"<<std::endl;
|
||||
cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 64);
|
||||
static constexpr std::size_t stackSize = 1024 * 64;
|
||||
cudaDeviceSetLimit(cudaLimitStackSize, stackSize);
|
||||
#endif
|
||||
|
||||
const bool success =
|
||||
|
@ -47,9 +47,6 @@ public:
|
||||
#ifdef VTKM_CUDA
|
||||
CudaStackSizeBackup = 0;
|
||||
cudaDeviceGetLimit(&CudaStackSizeBackup, cudaLimitStackSize);
|
||||
//std::cout<<"Initial stack size: "<<CudaStackSizeBackup<<std::endl;
|
||||
// std::cout<<"Increase stack size"<<std::endl;
|
||||
// cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 64);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -59,7 +56,6 @@ public:
|
||||
#ifdef VTKM_CUDA
|
||||
if (CudaStackSizeBackup > 0)
|
||||
{
|
||||
//std::cout<<"DE-Increase stack size "<<CudaStackSizeBackup<<std::endl;
|
||||
cudaDeviceSetLimit(cudaLimitStackSize, CudaStackSizeBackup);
|
||||
CudaStackSizeBackup = 0;
|
||||
}
|
||||
@ -108,8 +104,8 @@ public:
|
||||
const vtkm::cont::DeviceAdapterId deviceId) const override
|
||||
{
|
||||
#ifdef VTKM_CUDA
|
||||
//std::cout<<"Increase stack size"<<std::endl;
|
||||
cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 64);
|
||||
static constexpr std::size_t stackSize = 1024 * 64;
|
||||
cudaDeviceSetLimit(cudaLimitStackSize, stackSize);
|
||||
#endif
|
||||
const bool success = vtkm::cont::TryExecuteOnDevice(
|
||||
deviceId, PrepareForExecutionFunctor(), *this, this->ExecHandle);
|
||||
|
@ -42,18 +42,15 @@ public:
|
||||
#ifdef VTKM_CUDA
|
||||
CudaStackSizeBackup = 0;
|
||||
cudaDeviceGetLimit(&CudaStackSizeBackup, cudaLimitStackSize);
|
||||
//std::cout<<"Initial stack size: "<<CudaStackSizeBackup<<std::endl;
|
||||
// std::cout<<"Increase stack size"<<std::endl;
|
||||
// cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 64);
|
||||
#endif
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
~CellLocatorUniformGrid()
|
||||
{
|
||||
#ifdef VTKM_CUDA
|
||||
if (CudaStackSizeBackup > 0)
|
||||
{
|
||||
//std::cout<<"DE-Increase stack size "<<CudaStackSizeBackup<<std::endl;
|
||||
cudaDeviceSetLimit(cudaLimitStackSize, CudaStackSizeBackup);
|
||||
CudaStackSizeBackup = 0;
|
||||
}
|
||||
@ -107,8 +104,8 @@ public:
|
||||
const vtkm::cont::DeviceAdapterId deviceId) const override
|
||||
{
|
||||
#ifdef VTKM_CUDA
|
||||
//std::cout<<"Increase stack size"<<std::endl;
|
||||
cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 64);
|
||||
static constexpr std::size_t stackSize = 1024 * 64;
|
||||
cudaDeviceSetLimit(cudaLimitStackSize, stackSize);
|
||||
#endif
|
||||
const bool success = vtkm::cont::TryExecuteOnDevice(
|
||||
deviceId, PrepareForExecutionFunctor(), *this, this->ExecHandle);
|
||||
|
@ -75,9 +75,7 @@ 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);
|
||||
@ -85,37 +83,26 @@ 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;
|
||||
}
|
||||
}
|
||||
@ -129,12 +116,9 @@ 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;
|
||||
|
@ -72,9 +72,7 @@ vtkm::cont::DataSet ConstructDataSet(vtkm::Id size)
|
||||
return vtkm::cont::DataSetBuilderUniform().Create(vtkm::Id3(size, size, size));
|
||||
}
|
||||
|
||||
void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet,
|
||||
vtkm::IdComponent numPlanes,
|
||||
const vtkm::cont::DeviceAdapterId& id)
|
||||
void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet, vtkm::IdComponent numPlanes)
|
||||
{
|
||||
using Timer = vtkm::cont::Timer;
|
||||
|
||||
@ -102,28 +100,10 @@ void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet,
|
||||
Timer interpolationTimer;
|
||||
interpolationTimer.Start();
|
||||
vtkm::cont::ArrayHandle<vtkm::IdComponent> results;
|
||||
#ifdef VTKM_CUDA
|
||||
//set up stack size for cuda envinroment
|
||||
size_t stackSizeBackup(0);
|
||||
(void)stackSizeBackup;
|
||||
if (id.GetValue() == VTKM_DEVICE_ADAPTER_CUDA)
|
||||
{
|
||||
cudaDeviceGetLimit(&stackSizeBackup, cudaLimitStackSize);
|
||||
cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 50);
|
||||
}
|
||||
#else
|
||||
(void)id;
|
||||
#endif
|
||||
|
||||
vtkm::worklet::DispatcherMapField<BoundingIntervalHierarchyTester>().Invoke(
|
||||
centroids, bih, expectedCellIds, results);
|
||||
|
||||
#ifdef VTKM_CUDA
|
||||
if (id.GetValue() == VTKM_DEVICE_ADAPTER_CUDA)
|
||||
{
|
||||
cudaDeviceSetLimit(cudaLimitStackSize, stackSizeBackup);
|
||||
}
|
||||
#endif
|
||||
vtkm::Id numDiffs = vtkm::cont::Algorithm::Reduce(results, 0, vtkm::Add());
|
||||
interpolationTimer.Stop();
|
||||
vtkm::Float64 timeDiff = interpolationTimer.GetElapsedTime();
|
||||
@ -135,17 +115,17 @@ void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet,
|
||||
VTKM_TEST_ASSERT(numDiffs == 0, "Calculated cell Ids not the same as expected cell Ids");
|
||||
}
|
||||
|
||||
void RunTest(const vtkm::cont::DeviceAdapterId& id)
|
||||
void RunTest()
|
||||
{
|
||||
TestBoundingIntervalHierarchy(ConstructDataSet(16), 3, id);
|
||||
TestBoundingIntervalHierarchy(ConstructDataSet(16), 4, id);
|
||||
TestBoundingIntervalHierarchy(ConstructDataSet(16), 6, id);
|
||||
TestBoundingIntervalHierarchy(ConstructDataSet(16), 9, id);
|
||||
TestBoundingIntervalHierarchy(ConstructDataSet(16), 3);
|
||||
TestBoundingIntervalHierarchy(ConstructDataSet(16), 4);
|
||||
TestBoundingIntervalHierarchy(ConstructDataSet(16), 6);
|
||||
TestBoundingIntervalHierarchy(ConstructDataSet(16), 9);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int UnitTestBoundingIntervalHierarchy(int argc, char* argv[])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::RunOnDevice(RunTest, argc, argv);
|
||||
return vtkm::cont::testing::Testing::Run(RunTest, argc, argv);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user