10 #ifndef vtk_m_cont_TryExecute_h
11 #define vtk_m_cont_TryExecute_h
30 const std::string& functorName);
32 template <
typename DeviceTag,
typename Functor,
typename... Args>
33 inline bool TryExecuteIfValid(std::true_type,
40 if ((tag == devId || devId == DeviceAdapterTagAny()) && tracker.
CanRunOn(tag))
49 return f(tag, std::forward<Args>(args)...);
53 detail::HandleTryExecuteException(tag, tracker, vtkm::cont::TypeToString<Functor>());
61 template <
typename DeviceTag,
typename Functor,
typename... Args>
62 inline bool TryExecuteIfValid(std::false_type,
72 struct TryExecuteWrapper
74 template <
typename DeviceTag,
typename Functor,
typename... Args>
75 inline void operator()(DeviceTag tag,
84 ran = TryExecuteIfValid(std::integral_constant<bool, DeviceTag::IsEnabled>(),
86 std::forward<Functor>(f),
88 std::forward<decltype(tracker)>(tracker),
89 std::forward<Args>(args)...);
94 template <
typename Functor,
typename DeviceList,
typename... Args>
101 bool success =
false;
103 TryExecuteWrapper task;
106 std::forward<Functor>(functor),
110 std::forward<Args>(args)...);
114 template <
typename Functor,
typename... Args>
120 bool success =
false;
122 TryExecuteWrapper task;
125 std::forward<Functor>(functor),
129 std::forward<Args>(args)...);
177 template <
typename Functor>
181 return detail::TryExecuteImpl(devId, std::forward<Functor>(functor), std::false_type{});
183 template <
typename Functor,
typename Arg1,
typename... Args>
190 using is_deviceAdapter = vtkm::internal::IsList<Arg1>;
192 return detail::TryExecuteImpl(devId,
193 std::forward<Functor>(functor),
195 std::forward<Arg1>(arg1),
196 std::forward<Args>(args)...);
243 template <
typename Functor,
typename... Args>
247 vtkm::cont::DeviceAdapterTagAny(), std::forward<Functor>(functor), std::forward<Args>(args)...);
255 #endif //vtk_m_cont_TryExecute_h