infinite loop at ptxas

This commit is contained in:
Li-Ta Lo 2018-06-26 13:35:22 -06:00
parent b2f16a64fb
commit 9c2fdd5745
4 changed files with 29 additions and 23 deletions

@ -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
#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
#endif // vtk_m_exec_PointLocatorUniformGrid_h