Skip to content

Commit

Permalink
Add release call into wrapped_callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertnishihara committed Nov 30, 2018
1 parent 0db9154 commit a2a9c36
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions python/pyarrow/tensorflow/plasma_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,19 @@ class PlasmaToTensorOp : public tf::AsyncOpKernel {
OP_REQUIRES_OK_ASYNC(context, context->allocate_output(0, shape, &output_tensor),
done);

auto wrapped_callback = [this, context, done, object_id]() {
{
tf::mutex_lock lock(mu_);
ARROW_CHECK_OK(client_.Release(object_id));
}
done();
};

if (std::is_same<Device, CPUDevice>::value) {
std::memcpy(
reinterpret_cast<void*>(const_cast<char*>(output_tensor->tensor_data().data())),
plasma_data, size_in_bytes);
done();
wrapped_callback();
} else {
#ifdef GOOGLE_CUDA
auto orig_stream = context->op_device_context()->stream();
Expand Down Expand Up @@ -340,7 +348,7 @@ class PlasmaToTensorOp : public tf::AsyncOpKernel {
CHECK(orig_stream->ThenWaitFor(h2d_stream).ok());

context->device()->tensorflow_gpu_device_info()->event_mgr->ThenExecute(
h2d_stream, std::move(done));
h2d_stream, std::move(wrapped_callback));
#endif
}
}
Expand Down

0 comments on commit a2a9c36

Please sign in to comment.