nabu.processing.processing_base
source module nabu.processing.processing_base
Classes
source class ProcessingBase()
Methods
-
init_arrays_to_none — Initialize arrays to None. After calling this method, the current instance will have self.array_name = None, and self._old_array_name = None.
-
recover_arrays_references — Performs self._array_name = self._old_array_name, for each array_name in arrays_names.
-
allocate_array — Allocate a GPU array on the current context/stream/device, and set 'self.array_name' to this array.
-
set_array — Set the content of a device array.
-
check_array — Check whether a given array is suitable for being processed (shape, dtype, contiguous)
source method ProcessingBase.init_arrays_to_none(arrays_names)
Initialize arrays to None. After calling this method, the current instance will have self.array_name = None, and self._old_array_name = None.
Parameters
-
arrays_names : list of str — List of arrays names.
source method ProcessingBase.recover_arrays_references(arrays_names)
Performs self._array_name = self._old_array_name, for each array_name in arrays_names.
Parameters
-
arrays_names : list of str — List of array names
source method ProcessingBase.allocate_array(array_name, shape, dtype=np.float32)
Allocate a GPU array on the current context/stream/device, and set 'self.array_name' to this array.
Parameters
-
array_name : str — Name of the array (for book-keeping)
-
shape : tuple of int — Array shape
-
dtype : numpy.dtype, optional — Data type. Default is float32.
source method ProcessingBase.set_array(array_name, array_ref, dtype=np.float32)
Set the content of a device array.
Parameters
-
array_name : str — Array name. This method will look for self.array_name.
-
array_ref : array (numpy or GPU array) — Array containing the data to copy to 'array_name'.
-
dtype : numpy.dtype, optional — Data type. Default is float32.
Raises
-
TypeError
source method ProcessingBase.get_array(array_name)
source method ProcessingBase.is_contiguous(arr)
Raises
-
TypeError
source method ProcessingBase.check_array(arr, expected_shape, expected_dtype='f', check_contiguous=True)
Check whether a given array is suitable for being processed (shape, dtype, contiguous)
Raises
-
ValueError
source method ProcessingBase.kernel(*args, **kwargs)
Raises
-
ValueError
source method ProcessingBase.to_device(array_name, array)