code: def get_ptx_file(kernel_spec, kernel_name, arch, ptx_ver):
      thread_spec = kernel_spec["threads"]
      args_spec = str(kernel_spec.get("args", ""))
      param_spec = _params[kernel_spec["params"]]
  
      kernel_params = []
      for p in param_spec:
          ptype, pname = _space_re.split(p)
  
          if ptype[-1] == "*":
              ptype = ".u64"
          elif ptype == "float":
              ptype = ".f32"
          else:
              ptype = ".u32"
  
          kernel_params.append("    .param %s %s" % (ptype, pname))
  
      kernel_params = ",\n".join(kernel_params)
  
      if "share" in kernel_spec:
          share = _share_template.format(eval(kernel_spec["share"]))
      else:
          share = ""
  
      kernel_text = _kernel_template.format(
          arch,
          kernel_name,
          kernel_params,
          thread_spec,
          share,
          args_spec,
          ptx_ver,
      )
      kernel_ptx = os.path.join(ptx_dir, kernel_name + ".ptx")
  
      current_text = ""
      if os.path.exists(kernel_ptx):
          f = open(kernel_ptx, "r")
          current_text = f.read()
          f.close()
      # only write out the kernel if text has changed.
      if kernel_text != current_text:
          f = open(kernel_ptx, "w")
          f.write(kernel_text)
          f.close()
  
      return kernel_ptx
  
file_path: neon/neon/backends/kernel_specs.py
imports: from builtins import str
  import re
  import os.path
  import subprocess
  import pycuda.driver
  from pycuda.tools import context_dependent_memoize
  from neon import logger
  from neon.util.persist import get_cache_dir
label_desc: Use image node_id 1 for calling a global function with example usage: get_ptx_file(kernel_spec, kernel_name, arch, ptx_ver) and returns: kernel_ptx