failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED

failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED problem causes and solutions

when running a program using tensorflow’s gpu, this error is reported because the gpu has been occupied by another python script or because the gpu is repeatedly called by your own program. There are three types of situations in which individuals find this problem occurring, two of which are common, and one of which may be difficult to reach.
case 1: you already have a python program running on the gpu. If you run your own program, you will report this error.
solution: you can only turn off python programs that already use the gpu, and then run your own.
case 2: if the program is written by yourself, you may have the problem of repeatedly defining sessions, which is equivalent to calling the gpu again, so the error is reported.
solution: think about where another session has been defined, look for it yourself, and remove it.
case 3: the emergence of this situation, difficult to see, because we usually use a framework to deal with problems, such as tensorflow, but I also use the pytorch, problems arise in pytorch build datasets can’t occupy gpu calls when the gpu cause tensorflow
the solution: the problem in another framework will call the gpu, don’t let it use

Read More: