title: CUDA 9.0 and pycuda, error:CompileError: nvcc compilation ... kernel.cu failed
body: <pre><code>import pycuda.driver as cuda
  import pycuda.autoinit
  from pycuda.compiler import SourceModule
  import numpy
  a = numpy.random.randn(4,4)
  a = a.astype(numpy.float32)
  a_gpu = cuda.mem_alloc(a.nbytes)
  cuda.memcpy_htod(a_gpu, a)
  mod = SourceModule("""
  __global__ void doublify(float *a)
  {
  int idx = threadIdx.x + threadIdx.y*4;
  a[idx] *= 2;
  }
  """)
  </code></pre>
  
  <p>I just installed CUDA 9.0 and pycuda, and I am following the tutorial to run the first cuda program.
  But it always turns out error:</p>
  
  <p>CompileError: nvcc compilation of c:\users\rl74173\appdata\local\temp\tmp6nww2c\kernel.cu failed</p>
  
  <p>I did some research and find some answers to this before. So I add this before running:</p>
  
  <pre><code>import os
  os.system("vcvarsamd64.bat")
  </code></pre>
  
  <p>But it is still error. </p>
  
  <p>I also see someone figure it out by adding line below to nvcc.profile</p>
  
  <pre><code>COMPILER-BINDIR = C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64
  </code></pre>
  
  <p>I installed visual studio community 2017,so in my case, I tried</p>
  
  <pre><code>COMPILER-BINDIR = C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\lib\amd64
  </code></pre>
  
  <p>But it doesn't help.</p>