code: def compile(self, kernel_name, kernel_string):
          
          try:
              no_extern_c = 'extern "C"' in kernel_string
  
              compiler_options = ['-Xcompiler=-Wall']
              if self.compiler_options:
                  compiler_options += self.compiler_options
  
              self.current_module = self.source_mod(kernel_string, options=compiler_options + ["-e", kernel_name],
                                               arch=('compute_' + self.cc) if self.cc != "00" else None,
                                               code=('sm_' + self.cc) if self.cc != "00" else None,
                                               cache_dir=False, no_extern_c=no_extern_c)
  
              func = self.current_module.get_function(kernel_name)
              return func
          except drv.CompileError as e:
              if "uses too much shared data" in e.stderr:
                  raise Exception("uses too much shared data")
              else:
                  raise e
docs: call the CUDA compiler to compile the kernel, return the device function
  
          :param kernel_name: The name of the kernel to be compiled, used to lookup the
              function after compilation.
          :type kernel_name: string
  
          :param kernel_string: The CUDA kernel code that contains the function `kernel_name`
          :type kernel_string: string
  
          :returns: An CUDA kernel that can be called directly.
          :rtype: pycuda.driver.Function