code: def get_take_kernel(dtype, idx_dtype, vec_count=1):
      ctx = {
          "idx_tp": dtype_to_ctype(idx_dtype),
          "tp": dtype_to_ctype(dtype),
          "tex_tp": dtype_to_ctype(dtype, with_fp_tex_hack=True),
      }
  
      args = (
          [VectorArg(idx_dtype, "idx")]
          + [
              VectorArg(dtype, "dest" + str(i))
              for i in range(vec_count)
          ]
          + [ScalarArg(np.intp, "n")]
      )
      preamble = "#include <pycuda-helpers.hpp>\n\n" + "\n".join(
          "texture <%s, 1, cudaReadModeElementType> tex_src%d;"
          % (ctx["tex_tp"], i)
          for i in range(vec_count)
      )
      body = ("%(idx_tp)s src_idx = idx[i];\n" % ctx) + "\n".join(
          "dest%d[i] = fp_tex1Dfetch(tex_src%d, src_idx);" % (i, i)
          for i in range(vec_count)
      )
  
      mod = get_elwise_module(args, body, "take", preamble=preamble)
      func = mod.get_function("take")
      tex_src = [
          mod.get_texref("tex_src%d" % i) for i in range(vec_count)
      ]
      func.prepare(
          "P" + (vec_count * "P") + np.dtype(np.uintp).char,
          texrefs=tex_src,
      )
      return func, tex_src
  
imports: from pycuda.tools import context_dependent_memoize
  from typing import Any
  import numpy
  from pycuda.tools import dtype_to_ctype, VectorArg, ScalarArg
  from pytools import memoize_method
label_desc: Use image node_id 5 for calling a global function with example usage: get_take_kernel(dtype, idx_dtype, vec_count) and returns: func,  tex_src