class_docstr: .. warning::
  
      This class is deprecated, to be removed in PyOpenCL 2018.x.
  
  .. versionadded:: 2011.2
  
  .. attribute:: state
  
      A :class:`pyopencl.array.Array` containing the state of the generator.
  
  .. attribute:: nskip
  
      nskip is an integer which can (optionally) be defined in the kernel
      code as RANLUXCL_NSKIP. If this is done the generator will be faster
      for luxury setting 0 and 1, or when the p-value is manually set to a
      multiple of 24.
class_docstr_tok: ["..","warning",":",":","This","class","is","deprecated",",","to","be","removed","in","PyOpenCL","2018.x",".","..","versionadded",":",":","2011.2","..","attribute",":",":","state","A",":","class",":","`","pyopencl.array.Array","`","containing","the","state","of","the","generator",".","..","attribute",":",":","nskip","nskip","is","an","integer","which","can","(","optionally",")","be","defined","in","the","kernel","code","as","RANLUXCL_NSKIP",".","If","this","is","done","the","generator","will","be","faster","for","luxury","setting","0","and","1",",","or","when","the","p-value","is","manually","set","to","a","multiple","of","24","."]
docstr: :param queue: :class:`pyopencl.CommandQueue`, only used for initialization
  :param luxury: the "luxury value" of the generator, and should be 0-4,
      where 0 is fastest and 4 produces the best numbers. It can also be
      >=24, in which case it directly sets the p-value of RANLUXCL.
  :param num_work_items: is the number of generators to initialize,
      usually corresponding to the number of work-items in the NDRange
      RANLUXCL will be used with.  May be *None*, in which case a default
      value is used.
  :param max_work_items: should reflect the maximum number of work-items
      that will be used on any parallel instance of RANLUXCL. So for
      instance if we are launching 5120 work-items on GPU1 and 10240
      work-items on GPU2, GPU1's RANLUXCLTab would be generated by
      calling ranluxcl_intialization with numWorkitems = 5120 while
      GPU2's RANLUXCLTab would use numWorkitems = 10240. However
      maxWorkitems must be at least 10240 for both GPU1 and GPU2, and it
      must be set to the same value for both. (may be *None*)
  
  .. versionchanged:: 2013.1
  
      Added default value for ``num_work_items``.
docstr_tok: [":","param","queue",":",":","class",":","`","pyopencl.CommandQueue","`",",","only","used","for","initialization",":","param","luxury",":","the","``","luxury","value","''","of","the","generator",",","and","should","be","0-4",",","where","0","is","fastest","and","4","produces","the","best","numbers",".","It","can","also","be",">","=24",",","in","which","case","it","directly","sets","the","p-value","of","RANLUXCL",".",":","param","num_work_items",":","is","the","number","of","generators","to","initialize",",","usually","corresponding","to","the","number","of","work-items","in","the","NDRange","RANLUXCL","will","be","used","with",".","May","be","*","None","*",",","in","which","case","a","default","value","is","used",".",":","param","max_work_items",":","should","reflect","the","maximum","number","of","work-items","that","will","be","used","on","any","parallel","instance","of","RANLUXCL",".","So","for","instance","if","we","are","launching","5120","work-items","on","GPU1","and","10240","work-items","on","GPU2",",","GPU1","'s","RANLUXCLTab","would","be","generated","by","calling","ranluxcl_intialization","with","numWorkitems","=","5120","while","GPU2","'s","RANLUXCLTab","would","use","numWorkitems","=","10240",".","However","maxWorkitems","must","be","at","least","10240","for","both","GPU1","and","GPU2",",","and","it","must","be","set","to","the","same","value","for","both",".","(","may","be","*","None","*",")","..","versionchanged",":",":","2013.1","Added","default","value","for","``","num_work_items","``","."]
code: def __init__(
      self,
      queue,
      num_work_items=None,
      luxury=None,
      seed=None,
      no_warmup=False,
      use_legacy_init=False,
      max_work_items=None,
  ):
      """
      :param queue: :class:`pyopencl.CommandQueue`, only used for initialization
      :param luxury: the "luxury value" of the generator, and should be 0-4,
          where 0 is fastest and 4 produces the best numbers. It can also be
          >=24, in which case it directly sets the p-value of RANLUXCL.
      :param num_work_items: is the number of generators to initialize,
          usually corresponding to the number of work-items in the NDRange
          RANLUXCL will be used with.  May be *None*, in which case a default
          value is used.
      :param max_work_items: should reflect the maximum number of work-items
          that will be used on any parallel instance of RANLUXCL. So for
          instance if we are launching 5120 work-items on GPU1 and 10240
          work-items on GPU2, GPU1's RANLUXCLTab would be generated by
          calling ranluxcl_intialization with numWorkitems = 5120 while
          GPU2's RANLUXCLTab would use numWorkitems = 10240. However
          maxWorkitems must be at least 10240 for both GPU1 and GPU2, and it
          must be set to the same value for both. (may be *None*)
  
      .. versionchanged:: 2013.1
  
          Added default value for ``num_work_items``.
      """
  
      from warnings import warn
  
      warn(
          "Ranlux random number generation is deprecated and will go away "
          "in 2022.",
          DeprecationWarning,
          stacklevel=2,
      )
  
      if luxury is None:
          luxury = 4
  
      if num_work_items is None:
          if queue.device.type & cl.device_type.CPU:
              num_work_items = 8 * queue.device.max_compute_units
          else:
              num_work_items = 64 * queue.device.max_compute_units
  
      if seed is None:
          from time import time
  
          seed = int(time() * 1e6) % 2 << 30
  
      self.context = queue.context
      self.luxury = luxury
      self.num_work_items = num_work_items
  
      from pyopencl.characterize import has_double_support
  
      self.support_double = has_double_support(queue.device)
  
      self.no_warmup = no_warmup
      self.use_legacy_init = use_legacy_init
      self.max_work_items = max_work_items
  
      src = """
              %(defines)s
  
              #include <pyopencl-ranluxcl.cl>
  
              kernel void init_ranlux(unsigned seeds,
                  global ranluxcl_state_t *ranluxcltab)
              {
                if (get_global_id(0) < %(num_work_items)d)
                  ranluxcl_initialization(seeds, ranluxcltab);
              }
              """ % {
          "defines": self.generate_settings_defines(),
          "num_work_items": num_work_items,
      }
      prg = cl.Program(queue.context, src).build()
  
      # {{{ compute work group size
  
      wg_size = None
  
      import sys
      import platform
  
      if (
          "darwin" in sys.platform
          and "Apple" in queue.device.platform.vendor
          and platform.mac_ver()[0].startswith("10.7")
          and queue.device.type & cl.device_type.CPU
      ):
          wg_size = (1,)
  
      self.wg_size = wg_size
  
      # }}}
  
      self.state = cl_array.empty(
          queue, (num_work_items, 112), dtype=np.uint8
      )
      self.state.fill(17)
  
      prg.init_ranlux(
          queue,
          (num_work_items,),
          self.wg_size,
          np.uint32(seed),
          self.state.data,
      )
  
imports: import pyopencl
  import pyopencl.array
  import pyopencl.cltypes
  from pyopencl.tools import first_arg_dependent_memoize
  from pytools import memoize_method
  import numpy
label_desc: Use image node_id 1 to create a new RanluxGenerator object  with example: obj = RanluxGenerator(queue, num_work_items, luxury, seed, no_warmup, use_legacy_init, max_work_items)