A graph that consumes and produces string tensors (which are not GPU-compatible, i.e., there are no GPU kernels for these operations).
| 2153 | // (which are not GPU-compatible, i.e., there are no |
| 2154 | // GPU kernels for these operations). |
| 2155 | bool IsCUDATensor(const Tensor& t) { |
| 2156 | #ifdef GOOGLE_CUDA |
| 2157 | cudaPointerAttributes attributes; |
| 2158 | cudaError_t err = |
| 2159 | cudaPointerGetAttributes(&attributes, t.tensor_data().data()); |
| 2160 | if (err == cudaErrorInvalidValue) return false; |
| 2161 | CHECK_EQ(cudaSuccess, err) << cudaGetErrorString(err); |
| 2162 | #if CUDA_VERSION >= 11000 |
| 2163 | return (attributes.type == cudaMemoryTypeDevice); |
| 2164 | #else |
| 2165 | return (attributes.memoryType == cudaMemoryTypeDevice); |
| 2166 | #endif |
| 2167 | #elif TENSORFLOW_USE_ROCM |
| 2168 | hipPointerAttribute_t attributes; |
| 2169 | hipError_t err = hipPointerGetAttributes(&attributes, t.tensor_data().data()); |
| 2170 | if (err == hipErrorInvalidValue) return false; |
| 2171 | CHECK_EQ(hipSuccess, err) << hipGetErrorString(err); |
| 2172 | return (attributes.memoryType == hipMemoryTypeDevice); |
| 2173 | #else |
| 2174 | return false; |
| 2175 | #endif |
| 2176 | } |
| 2177 | |
| 2178 | string GPUDeviceName(Session* session) { |
| 2179 | std::vector<DeviceAttributes> devices; |
no test coverage detected