class_docstr: Parallel processing engine.
  
  Engine for running computational graph.
  
  :class:`ParallelProcessing` is a manager for executing a sequence of tasks
  in a given caller, where each task is run sequentially, but assumed to be
  parallelized internally. The main responsibility of
  :class:`ParallelProcessing` is to handle memory-mapping, estimation
  cache updates, input and output array updates and output collection.
  
  Parameters
  ----------
  caller :  obj
      the caller of the job. Either a Layer or a meta layer class
      such as Sequential.
  
  *args : optional
      Optional arguments to :class:`~mlens.parallel.backend.BaseProcessor`
  
  **kwargs : optional
      Optional keyword arguments to
      :class:`~mlens.parallel.backend.BaseProcessor`.
class_docstr_tok: ["Parallel","processing","engine",".","Engine","for","running","computational","graph",".",":","class",":","`","ParallelProcessing","`","is","a","manager","for","executing","a","sequence","of","tasks","in","a","given","caller",",","where","each","task","is","run","sequentially",",","but","assumed","to","be","parallelized","internally",".","The","main","responsibility","of",":","class",":","`","ParallelProcessing","`","is","to","handle","memory-mapping",",","estimation","cache","updates",",","input","and","output","array","updates","and","output","collection",".","Parameters","--","--","--","--","--","caller",":","obj","the","caller","of","the","job",".","Either","a","Layer","or","a","meta","layer","class","such","as","Sequential",".","*","args",":","optional","Optional","arguments","to",":","class",":","`","~mlens.parallel.backend.BaseProcessor","`","*","*","kwargs",":","optional","Optional","keyword","arguments","to",":","class",":","`","~mlens.parallel.backend.BaseProcessor","`","."]
docstr: Generate prediction array either in-memory or persist to disk.
docstr_tok: ["Generate","prediction","array","either","in-memory","or","persist","to","disk","."]
code: def _gen_prediction_array(self, task, job, threading):
      """Generate prediction array either in-memory or persist to disk."""
      shape = task.shape(job)
      if threading:
          self.job.predict_out = np.zeros(shape, dtype=_dtype(task))
      else:
          f = os.path.join(
              self.job.dir, "%s_out_array.mmap" % task.name
          )
          try:
              self.job.predict_out = np.memmap(
                  filename=f, dtype=_dtype(task), mode="w+", shape=shape
              )
          except Exception as exc:
              raise OSError(
                  "Cannot create prediction matrix of shape ("
                  "%i, %i), size %i MBs, for %s.\n Details:\n%r"
                  % (
                      shape[0],
                      shape[1],
                      8 * shape[0] * shape[1] / (1024**2),
                      task.name,
                      exc,
                  )
              )
  
imports: from __future__ import with_statement, division
  import gc
  import os
  import shutil
  import subprocess
  import tempfile
  import warnings
  from abc import ABCMeta, abstractmethod
  import numpy
  from scipy.sparse import issparse, hstack
  from ..None import config
  from ..externals.joblib import Parallel, dump, load
  from ..utils import check_initialized
  from ..utils.exceptions import ParallelProcessingError, ParallelProcessingWarning
  from ..externals.sklearn.validation import check_random_state
label_desc: Use image node_id 7 for calling the ParallelProcessing obj's underlying member method code with example usage: obj._gen_prediction_array(task, job, threading) without return types