class_docstr: Generates and executes code to produce a large number of variable-size
  lists, simply.
  
  .. note:: This functionality is provided as a preview. Its interface
      is subject to change until this notice is removed.
  
  .. versionadded:: 2013.1
  
  Here's a usage example::
  
      from pyopencl.algorithm import ListOfListsBuilder
      builder = ListOfListsBuilder(context, [("mylist", np.int32)], """
              void generate(LIST_ARG_DECL USER_ARG_DECL index_type i)
              {
                  int count = i % 4;
                  for (int j = 0; j < count; ++j)
                  {
                      APPEND_mylist(count);
                  }
              }
              """, arg_decls=[])
  
      result, event = builder(queue, 2000)
  
      inf = result["mylist"]
      assert inf.count == 3000
      assert (inf.list.get()[-6:] == [1, 2, 2, 3, 3, 3]).all()
  
  The function ``generate`` above is called once for each "input object".
  Each input object can then generate zero or more list entries.
  The number of these input objects is given to :meth:`__call__` as *n_objects*.
  List entries are generated by calls to ``APPEND_<list name>(value)``.
  Multiple lists may be generated at once.
  
  .. automethod:: __init__
  .. automethod:: __call__
code: def get_count_kernel(self, index_dtype):
      index_ctype = dtype_to_ctype(index_dtype)
      from pyopencl.tools import VectorArg, OtherArg
  
      kernel_list_args = [
          VectorArg(index_dtype, "plb_%s_count" % name)
          for name, dtype in self.list_names_and_dtypes
          if name not in self.count_sharing
      ]
  
      user_list_args = []
      for name, _dtype in self.list_names_and_dtypes:
          if name in self.count_sharing:
              continue
  
          name = "plb_loc_%s_count" % name
          user_list_args.append(
              OtherArg("{} *{}".format(index_ctype, name), name)
          )
  
      kernel_name = self.name_prefix + "_count"
  
      from pyopencl.characterize import has_double_support
  
      src = _LIST_BUILDER_TEMPLATE.render(
          is_count_stage=True,
          kernel_name=kernel_name,
          double_support=all(
              has_double_support(dev) for dev in self.context.devices
          ),
          debug=self.debug,
          do_not_vectorize=self.do_not_vectorize(),
          eliminate_empty_output_lists=self.eliminate_empty_output_lists,
          kernel_list_arg_decl=_get_arg_decl(kernel_list_args),
          kernel_list_arg_values=_get_arg_list(
              user_list_args, prefix="&"
          ),
          user_list_arg_decl=_get_arg_decl(user_list_args),
          user_list_args=_get_arg_list(user_list_args),
          user_arg_decl_with_offset=_get_arg_decl(self.arg_decls),
          user_arg_decl_no_offset=_get_arg_decl(
              self.arg_decls_no_offset
          ),
          user_args_no_offset=_get_arg_list(self.arg_decls_no_offset),
          arg_offset_adjustment=get_arg_offset_adjuster_code(
              self.arg_decls
          ),
          list_names_and_dtypes=self.list_names_and_dtypes,
          count_sharing=self.count_sharing,
          name_prefix=self.name_prefix,
          generate_template=self.generate_template,
          preamble=self.preamble,
          index_type=index_ctype,
      )
  
      src = str(src)
  
      prg = cl.Program(self.context, src).build(self.options)
      knl = getattr(prg, kernel_name)
  
      from pyopencl.tools import get_arg_list_scalar_arg_dtypes
  
      knl.set_scalar_arg_dtypes(
          get_arg_list_scalar_arg_dtypes(
              kernel_list_args + self.arg_decls
          )
          + [index_dtype]
      )
  
      return knl
  
imports: from dataclasses import dataclass
  from typing import Optional
  import numpy
  import pyopencl
  import pyopencl.array
  from pyopencl.elementwise import ElementwiseKernel
  from pyopencl.scan import ScanTemplate, GenericScanKernel
  from pyopencl.tools import dtype_to_ctype, get_arg_offset_adjuster_code
  from pytools import memoize, memoize_method
  from mako.template import Template
label_desc: Use image node_id 5 for calling the ListOfListsBuilder obj's underlying member method code with example usage: obj.get_count_kernel(index_dtype) and returns: knl