aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/verbs/verbs_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/contrib/verbs/verbs_util.cc')
-rw-r--r--tensorflow/contrib/verbs/verbs_util.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/tensorflow/contrib/verbs/verbs_util.cc b/tensorflow/contrib/verbs/verbs_util.cc
index c3350f7958..76e44d34a9 100644
--- a/tensorflow/contrib/verbs/verbs_util.cc
+++ b/tensorflow/contrib/verbs/verbs_util.cc
@@ -21,6 +21,40 @@ limitations under the License.
namespace tensorflow {
// static sync wrapper:
+Status VerbsUtil::CopyGPUTensorToCPUSync(Device* gpu_device,
+ const DeviceContext* device_context,
+ const Tensor* gpu_tensor,
+ Tensor* cpu_tensor) {
+ Notification n;
+ Status status;
+ GPUUtil::CopyGPUTensorToCPU(gpu_device, device_context,
+ gpu_tensor, cpu_tensor,
+ [&n, &status](const Status& s) {
+ status = s;
+ n.Notify();
+ });
+ n.WaitForNotification();
+ return status;
+}
+
+// static sync wrapper:
+Status VerbsUtil::CopyCPUTensorToGPUSync(const Tensor* cpu_tensor,
+ const DeviceContext* device_context,
+ Device* gpu_device,
+ Tensor* gpu_tensor) {
+ Notification n;
+ Status status;
+ GPUUtil::CopyCPUTensorToGPU(cpu_tensor, device_context,
+ gpu_device, gpu_tensor,
+ [&n, &status](const Status& s) {
+ status = s;
+ n.Notify();
+ });
+ n.WaitForNotification();
+ return status;
+}
+
+// static sync wrapper:
Status VerbsUtil::SetProtoFromGPUSync(const Tensor& tensor, Device* dev,
const DeviceContext* device_context,
TensorProto* proto, bool is_dead) {