18 #ifndef viskores_cont_TryExecute_h
19 #define viskores_cont_TryExecute_h
38 const std::string& functorName);
40 template <
typename DeviceTag,
typename Functor,
typename... Args>
41 inline bool TryExecuteIfValid(std::true_type,
48 if ((tag == devId || devId == DeviceAdapterTagAny()) && tracker.
CanRunOn(tag))
57 return f(tag, std::forward<Args>(args)...);
61 detail::HandleTryExecuteException(tag, tracker, viskores::cont::TypeToString<Functor>());
69 template <
typename DeviceTag,
typename Functor,
typename... Args>
70 inline bool TryExecuteIfValid(std::false_type,
80 struct TryExecuteWrapper
82 template <
typename DeviceTag,
typename Functor,
typename... Args>
83 inline void operator()(DeviceTag tag,
92 ran = TryExecuteIfValid(std::integral_constant<bool, DeviceTag::IsEnabled>(),
94 std::forward<Functor>(f),
96 std::forward<decltype(tracker)>(tracker),
97 std::forward<Args>(args)...);
102 template <
typename Functor,
typename DeviceList,
typename... Args>
109 bool success =
false;
111 TryExecuteWrapper task;
114 std::forward<Functor>(functor),
118 std::forward<Args>(args)...);
122 template <
typename Functor,
typename... Args>
128 bool success =
false;
130 TryExecuteWrapper task;
133 std::forward<Functor>(functor),
137 std::forward<Args>(args)...);
185 template <
typename Functor>
189 return detail::TryExecuteImpl(devId, std::forward<Functor>(functor), std::false_type{});
191 template <
typename Functor,
typename Arg1,
typename... Args>
198 using is_deviceAdapter = viskores::internal::IsList<Arg1>;
200 return detail::TryExecuteImpl(devId,
201 std::forward<Functor>(functor),
203 std::forward<Arg1>(arg1),
204 std::forward<Args>(args)...);
251 template <
typename Functor,
typename... Args>
255 std::forward<Functor>(functor),
256 std::forward<Args>(args)...);
264 #endif //viskores_cont_TryExecute_h