TensorFlow.NET
TensorFlow.NET copied to clipboard
Failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED
My system:
- GTX 1660Ti 6GB
- 16GB of RAM
- Windows 10
- cuDNN 7.6.5 for CUDA 10
- CUDA 8, CUDA 10.1, CUDA 11 (why ? for some reason tensorflow need CUDA 8, CUDA 10 and CUDA 11 dlls to work)
My code:
var img = cv2.imread($"{dd}/thu1.png");
img = cv2.resize(img, (640, 384));
NDArray nd = img.GetData();
nd = nd[np.newaxis];
Console.WriteLine(nd.Shape);
//return;
tf.compat.v1.disable_eager_execution();
var graph = new Graph();
graph.Import($"{dd}pydnet.pb");
//Some stackoverflow post said i need ConfigProto but it didn't work (https://stackoverflow.com/questions/41117740/tensorflow-crashes-with-cublas-status-alloc-failed)
ConfigProto cf = new ConfigProto()
{
GpuOptions = new GPUOptions()
{
AllowGrowth = true,
PerProcessGpuMemoryFraction = 0.5
}
};
using (var sess = tf.Session(graph, cf))
{
Tensor imgTensor = graph.OperationByName("im0");
Tensor outTensor = graph.OperationByName("truediv");
var ndout = sess.run(outTensor, (imgTensor, nd));
}
Error messages:
Same error for me. GTX 1650 Ti Windows 10 32GB RAM CUDNN 8.0.5 with CUDA 11.0.