title: Tensorflow crash with CUDNN_STATUS_ALLOC_FAILED
body: <p>Been searching the web for hours with no results, so figured I'd ask here.</p>
  
  <p>I'm trying to make a self driving car following Sentdex's tutorial, but when running the model, I get a bunch of fatal errors. I've searched all over the internet for the solution, and many seem to have the same problem. However, none of the solutions I've found (Including <a href="https://stackoverflow.com/questions/41117740/tensorflow-crashes-with-cublas-status-alloc-failed">this Stack-post</a>), work for me.</p>
  
  <p>Here is my software:</p>
  
  <ul>
  <li>Tensorflow: 1.5, GPU version</li>
  <li>CUDA: 9.0, with the patch</li>
  <li>CUDnn: 7</li>
  <li>Windows 10 Pro</li>
  <li>Python 3.6</li>
  </ul>
  
  <p>Hardware:</p>
  
  <ul>
  <li>Nvidia 1070ti, with latest drivers</li>
  <li>Intel i5 7600K</li>
  </ul>
  
  <p>Here is the crash log: </p>
  
  <p><code>2018-02-04 16:29:33.606903: E C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\stream_executor\cuda\cuda_blas.cc:444] failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED
  2018-02-04 16:29:33.608872: E C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\stream_executor\cuda\cuda_blas.cc:444] failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED
  2018-02-04 16:29:33.609308: E C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\stream_executor\cuda\cuda_blas.cc:444] failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED
  2018-02-04 16:29:35.145249: E C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\stream_executor\cuda\cuda_dnn.cc:385] could not create cudnn handle: CUDNN_STATUS_ALLOC_FAILED
  2018-02-04 16:29:35.145563: E C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\stream_executor\cuda\cuda_dnn.cc:352] could not destroy cudnn handle: CUDNN_STATUS_BAD_PARAM
  2018-02-04 16:29:35.149896: F C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\kernels\conv_ops.cc:717] Check failed: stream-&gt;parent()-&gt;GetConvolveAlgorithms( conv_parameters.ShouldIncludeWinogradNonfusedAlgo&lt;T&gt;(), &amp;algorithms)</code></p>
  
  <p>Here's my code:</p>
  
  <pre><code> import tensorflow as tf
      import numpy as np
      import cv2
      import time
      from PIL import ImageGrab
      from getkeys import key_check
      from alexnet import alexnet
      import os
      from sendKeys import PressKey, ReleaseKey, W,A,S,D,Sp
  
      import random
  
      WIDTH = 80
      HEIGHT = 60
      LR = 1e-3
      EPOCHS = 10
      MODEL_NAME = 'DiRT-AI-Driver-{}-{}-{}-epochs.model'.format(LR, 'alexnetv2', EPOCHS)
  
      def straight():
          PressKey(W)
          ReleaseKey(A)
          ReleaseKey(S)
          ReleaseKey(D)
          ReleaseKey(Sp)
      def left():
          PressKey(A)
          ReleaseKey(W)
          ReleaseKey(S)
          ReleaseKey(D)
          ReleaseKey(Sp)
      def right():
          PressKey(D)
          ReleaseKey(A)
          ReleaseKey(S)
          ReleaseKey(W)
          ReleaseKey(Sp)
      def brake():
          PressKey(S)
          ReleaseKey(A)
          ReleaseKey(W)
          ReleaseKey(D)
          ReleaseKey(Sp)
      def handbrake():
          PressKey(Sp)
          ReleaseKey(A)
          ReleaseKey(S)
          ReleaseKey(D)
          ReleaseKey(W)
  
      model = alexnet(WIDTH, HEIGHT, LR)
      model.load(MODEL_NAME)
  
  
      def main():
          last_time = time.time()
          for i in list(range(4))[::-1]:
              print(i+1)
              time.sleep(1)
  
  
      paused = False
      while(True):
              if not paused:
                  screen = np.array(ImageGrab.grab(bbox=(0,40,1024,768)))
                  screen = cv2.cvtColor(screen,cv2.COLOR_BGR2GRAY)
                  screen = cv2.resize(screen,(80,60))
                  print('Loop took {} seconds'.format(time.time()-last_time))
                  last_time = time.time()
                  print('took time')
                  prediction = model.predict([screen.reshape(WIDTH,HEIGHT,1)])[0]
                  print('predicted')
                  moves = list(np.around(prediction))
                  print('got moves')
                  print(moves,prediction)
  
                  if moves == [1,0,0,0,0]:
                      straight()
                  elif moves == [0,1,0,0,0]:
                      left()
                  elif moves == [0,0,1,0,0]:
                      brake()
                  elif moves == [0,0,0,1,0]:
                      right()
                  elif moves == [0,0,0,0,1]:
                      handbrake()
  
              keys = key_check()
  
              if 'T' in keys:
                  if paused:
                      pased = False
                      time.sleep(1)
                  else:
                      paused = True
                      ReleaseKey(W)
                      ReleaseKey(A)
                      ReleaseKey(S)
                      ReleaseKey(D)
                      ReleaseKey(Sp)
                      time.sleep(1)
  
  
  main()
  </code></pre>
  
  <p>I've found that the line that crashes python and spawns the first three bugs is this line: </p>
  
  <ul>
  <li><code>prediction = model.predict([screen.reshape(WIDTH,HEIGHT,1)])[0]</code></li>
  </ul>
  
  <p>When running the code, the CPU goes up to a whopping 100%, suggesting that something is seriously off. GPU goes to about 40-50%</p>
  
  <p>I've tried Tensorflow 1.2 and 1.3, as well as CUDA 8, to no good. When installing CUDA I do not install the specific drivers, since they are too old for my GPU. Tried different CUDnn's too, did no good.</p>