aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test/cxx11_tensor_executor.cpp
diff options
context:
space:
mode:
authorGravatar Eugene Zhulenev <ezhulenev@google.com>2019-09-03 17:20:56 -0700
committerGravatar Eugene Zhulenev <ezhulenev@google.com>2019-09-03 17:20:56 -0700
commit47fefa235f73315bc57d685a7bc9cd8d3577349f (patch)
treeb6a380d7ae558dcafa2fa586a54e6632564fe16b /unsupported/test/cxx11_tensor_executor.cpp
parenta8d264fa9c56e42f77e2129d4e504f5c854821c2 (diff)
Allow move-only done callback in TensorAsyncDevice
Diffstat (limited to 'unsupported/test/cxx11_tensor_executor.cpp')
-rw-r--r--unsupported/test/cxx11_tensor_executor.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/unsupported/test/cxx11_tensor_executor.cpp b/unsupported/test/cxx11_tensor_executor.cpp
index f4d0401da..aa4ab0b80 100644
--- a/unsupported/test/cxx11_tensor_executor.cpp
+++ b/unsupported/test/cxx11_tensor_executor.cpp
@@ -578,11 +578,15 @@ static void test_async_execute_unary_expr(Device d)
src.setRandom();
const auto expr = src.square();
+ Eigen::Barrier done(1);
+ auto on_done = [&done]() { done.Notify(); };
+
using Assign = TensorAssignOp<decltype(dst), const decltype(expr)>;
- using Executor = internal::TensorAsyncExecutor<const Assign, Device,
+ using DoneCallback = decltype(on_done);
+ using Executor = internal::TensorAsyncExecutor<const Assign, Device, DoneCallback,
Vectorizable, Tileable>;
- Eigen::Barrier done(1);
- Executor::runAsync(Assign(dst, expr), d, [&done]() { done.Notify(); });
+
+ Executor::runAsync(Assign(dst, expr), d, on_done);
done.Wait();
for (Index i = 0; i < dst.dimensions().TotalSize(); ++i) {
@@ -610,12 +614,15 @@ static void test_async_execute_binary_expr(Device d)
const auto expr = lhs + rhs;
+ Eigen::Barrier done(1);
+ auto on_done = [&done]() { done.Notify(); };
+
using Assign = TensorAssignOp<decltype(dst), const decltype(expr)>;
- using Executor = internal::TensorAsyncExecutor<const Assign, Device,
+ using DoneCallback = decltype(on_done);
+ using Executor = internal::TensorAsyncExecutor<const Assign, Device, DoneCallback,
Vectorizable, Tileable>;
- Eigen::Barrier done(1);
- Executor::runAsync(Assign(dst, expr), d, [&done]() { done.Notify(); });
+ Executor::runAsync(Assign(dst, expr), d, on_done);
done.Wait();
for (Index i = 0; i < dst.dimensions().TotalSize(); ++i) {