0

I need information about the memory allocation of the C-Api of tensorflow, especially of the tensors of the output for TF_SessionRun. I would like for those tensors to remain in the memory of the GPU, but from what I can see, It seems to be reallocated on the host memory.

TF_SessionRun(session, NULL, inp_ops, inp_val, inpSize, out_ops, out_val, out_size, NULL, 0, NULL, status);

void* ptfe = TF_TensorData(out_val[0]);
cudaPointerAttributes ptra;
cudaPointerGetAttributes(&ptra, ptfe);

In this code snippet, I call TF_SessionRun. I then extract a pointer to the data of an output tensor with TF_TensorData and use CUDA to check, wheter the pointer points to host or device memory. It always states that it points to host memory, but I need it to remain in device memory. I'm not sure if I have done it right here, tough.

user2762996
  • 566
  • 1
  • 5
  • 16

0 Answers0