def locate_cuda():
 if ('CUDAHOME' in os.environ):
  home = os.environ['CUDAHOME']
  nvcc = pjoin(home, 'bin', 'nvcc')
 else:
  default_path = pjoin(os.sep, 'usr', 'local', 'cuda', 'bin')
  nvcc = find_in_path('nvcc', ((os.environ['PATH'] + os.pathsep) + default_path))
  if (nvcc is None):
   raise EnvironmentError('The nvcc binary could not be located in your $PATH. Either add it to your path, or set $CUDAHOME')
  home = os.path.dirname(os.path.dirname(nvcc))
 cudaconfig = {'home': home, 'nvcc': nvcc, 'include': pjoin(home, 'include'), 'lib64': pjoin(home, 'lib64')}
 for (k, v) in cudaconfig.iteritems():
  if (not os.path.exists(v)):
   raise EnvironmentError(('The CUDA %s path could not be located in %s' % (k, v)))
 return cudaconfig

def locate_cuda ( ) : if ( 'CUDAHOME' in os . environ ) : home = os . environ [ 'CUDAHOME' ] nvcc = pjoin ( home , 'bin' , 'nvcc' ) else : default_path = pjoin ( os . sep , 'usr' , 'local' , 'cuda' , 'bin' ) nvcc = find_in_path ( 'nvcc' , ( ( os . environ [ 'PATH' ] + os . pathsep ) + default_path ) ) if ( nvcc is None ) : raise EnvironmentError ( 'The nvcc binary could not be located in your $PATH. Either add it to your path, or set $CUDAHOME' ) home = os . path . dirname ( os . path . dirname ( nvcc ) ) cudaconfig = { 'home' : home , 'nvcc' : nvcc , 'include' : pjoin ( home , 'include' ) , 'lib64' : pjoin ( home , 'lib64' ) } for ( k , v ) in cudaconfig . iteritems ( ) : if ( not os . path . exists ( v ) ) : raise EnvironmentError ( ( 'The CUDA %s path could not be located in %s' % ( k , v ) ) ) return cudaconfig
locate the cuda environment on the system returns a dict with keys home .