Commit 9c2fdd57 authored by Li-Ta Lo's avatar Li-Ta Lo
Browse files

infinite loop at ptxas

parent b2f16a64
......@@ -55,13 +55,15 @@ public:
}
template <typename DeviceAdapter>
VTKM_CONT const vtkm::exec::PointLocator* PrepareForExecution(DeviceAdapter device) const
VTKM_CONT const vtkm::exec::PointLocator* PrepareForExecution(DeviceAdapter) const
{
vtkm::cont::DeviceAdapterId deviceId = vtkm::cont::DeviceAdapterTraits<DeviceAdapter>::GetId();
return PrepareForExecutionImp(deviceId);
return PrepareForExecutionImp(deviceId).PrepareForExecution(DeviceAdapter());
}
VTKM_CONT virtual const vtkm::exec::PointLocator* PrepareForExecutionImp(
//VTKM_CONT virtual const vtkm::exec::PointLocator*
using HandleType = vtkm::cont::VirtualObjectHandle<vtkm::exec::PointLocator>;
VTKM_CONT virtual const HandleType PrepareForExecutionImp(
vtkm::cont::DeviceAdapterId deviceId) const = 0;
private:
......@@ -71,4 +73,4 @@ private:
};
}
}
#endif // vtk_m_cont_PointLocator_h
\ No newline at end of file
#endif // vtk_m_cont_PointLocator_h
......@@ -142,27 +142,29 @@ public:
template <typename DeviceAdapter>
VTKM_CONT void operator()(DeviceAdapter,
const vtkm::cont::PointLocatorUniformGrid& self,
HandleType handle) const
HandleType& handle) const
{
vtkm::exec::PointLocatorUniformGrid* locator =
new vtkm::exec::PointLocatorUniformGrid(self.Min,
self.Max,
self.Dims,
self.coords.PrepareForInput(DeviceAdapter()),
self.pointIds.PrepareForInput(DeviceAdapter()),
self.cellLower.PrepareForInput(DeviceAdapter()),
self.cellUpper.PrepareForInput(DeviceAdapter()));
handle.Reset(locator);
//vtkm::exec::PointLocatorUniformGrid* locator =
vtkm::exec::PointLocatorUniformGrid<DeviceAdapter>* h =
new vtkm::exec::PointLocatorUniformGrid<DeviceAdapter>(
self.Min,
self.Max,
self.Dims,
self.coords.PrepareForInput(DeviceAdapter()),
self.pointIds.PrepareForInput(DeviceAdapter()),
self.cellLower.PrepareForInput(DeviceAdapter()),
self.cellUpper.PrepareForInput(DeviceAdapter()));
handle.Reset(h);
//return handle.PrepareForExecution(DeviceAdapter());
}
};
VTKM_CONT
const vtkm::exec::PointLocator* PrepareForExecutionImp(
vtkm::cont::DeviceAdapterId deviceId) const override
//const vtkm::exec::PointLocator *
const HandleType PrepareForExecutionImp(vtkm::cont::DeviceAdapterId deviceId) const override
{
// TODO: call VirtualObjectHandle::PrepareForExecution() and return vtkm::exec::PointLocator
// TODO: how to convert deviceId back to DeviceAdapter tag?
using DeviceAdapter = vtkm::cont::DeviceAdapterTagSerial;
using DeviceList = vtkm::ListTagBase<vtkm::cont::DeviceAdapterTagCuda,
vtkm::cont::DeviceAdapterTagTBB,
vtkm::cont::DeviceAdapterTagSerial>;
......@@ -170,8 +172,9 @@ public:
//HandleType ExecHandle; // = new HandleType(locator, false);
vtkm::cont::internal::FindDeviceAdapterTagAndCall(
deviceId, DeviceList(), PrepareForExecutionFunctor(), *this, ExecHandle);
return ExecHandle;
return ExecHandle.PrepareForExecution(DeviceAdapter());
//return ExecHandle.PrepareForExecution(DeviceAdapter());
}
private:
......@@ -187,7 +190,7 @@ private:
vtkm::cont::ArrayHandle<vtkm::Id> cellUpper;
// TODO: std::unique_ptr/std::shared_ptr?
HandleType ExecHandle;
mutable HandleType ExecHandle;
};
}
}
......
......@@ -99,7 +99,7 @@ public:
CoordiType& nnDis) const
{
locator->FindNearestNeighbor(qc, nnIdOut, nnDis);
};
}
};
template <typename DeviceAdapter>
......
......@@ -34,11 +34,12 @@ namespace exec
{
// TODO: remove template T
template <typename DeviceAdapter>
class PointLocatorUniformGrid : public vtkm::exec::PointLocator
{
public:
// TODO: figure hout how to parametize/passing DeviceAdapter.
using DeviceAdapter = vtkm::cont::DeviceAdapterTagSerial;
//using DeviceAdapter = vtkm::cont::DeviceAdapterTagSerial;
using CoordPortalType = typename vtkm::cont::ArrayHandle<
vtkm::Vec<vtkm::FloatDefault, 3>>::template ExecutionTypes<DeviceAdapter>::PortalConst;
using IdPortalType =
......@@ -81,7 +82,7 @@ public:
vtkm::Id& nearestNeighborId,
FloatDefault& distance) const override
{
std::cout << "FindNeareastNeighbor: " << queryPoint << std::endl;
//std::cout << "FindNeareastNeighbor: " << queryPoint << std::endl;
#if 1
auto nlayers = vtkm::Max(vtkm::Max(Dims[0], Dims[1]), Dims[2]);
......@@ -153,4 +154,4 @@ private:
}
}
#endif // vtk_m_exec_PointLocatorUniformGrid_h
\ No newline at end of file
#endif // vtk_m_exec_PointLocatorUniformGrid_h
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