code: def get_elwise_module(
      arguments,
      operation,
      name="kernel",
      keep=False,
      options=None,
      preamble="",
      loop_prep="",
      after_loop="",
  ):
      from pycuda.compiler import SourceModule
  
      return SourceModule(
          """
          #include <pycuda-complex.hpp>
  
          %(preamble)s
  
          extern "C"
          __global__ void %(name)s(%(arguments)s)
          {
  
            size_t tid = threadIdx.x;
            size_t total_threads = gridDim.x*blockDim.x;
            size_t cta_start = blockDim.x*blockIdx.x;
            size_t i;
  
            %(loop_prep)s;
  
            for (i = cta_start + tid; i < n; i += total_threads)
            {
              %(operation)s;
            }
  
            %(after_loop)s;
          }
          """
          % {
              "arguments": ", ".join(
                  arg.declarator() for arg in arguments
              ),
              "operation": operation,
              "name": name,
              "preamble": preamble,
              "loop_prep": loop_prep,
              "after_loop": after_loop,
          },
          options=options,
          keep=keep,
          no_extern_c=True,
      )
  
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 1 for calling a global function with example usage: get_elwise_module(arguments, operation, name, keep, options, preamble, loop_prep, after_loop) and returns: SourceModule