Class ColumnTwoPassFNTStrategy

  • All Implemented Interfaces:
    Parallelizable, NTTStrategy

    public class ColumnTwoPassFNTStrategy
    extends TwoPassFNTStrategy
    Two-pass NTT implementation that processes the data in the columns of the matrix.

    This transform only works together with an NTTStepStrategy implementation that processes the data in columns instead of rows.

    Note that if the data size is too big compared to the maximum available memory then the data is read from disk in too thin slices and the level of parallelism may become too small for the GPU, ruining the performance. The GPU global size i.e. the number of columns read from the data matrix to memory at one time should be at least 1024.

    Since:
    1.8.3
    Version:
    1.8.3
    Author:
    Mikko Tommila
    • Constructor Detail

      • ColumnTwoPassFNTStrategy

        public ColumnTwoPassFNTStrategy​(NTTStepStrategy stepStrategy)
        Basic constructor.
        Parameters:
        stepStrategy - A step strategy that can process data in columns.
    • Method Detail

      • getColumns

        protected ArrayAccess getColumns​(DataStorage dataStorage,
                                         int startColumn,
                                         int columns,
                                         int rows)
        Description copied from class: TwoPassFNTStrategy
        Get a block of column data. The data may be transposed, depending on the implementation.
        Overrides:
        getColumns in class TwoPassFNTStrategy
        Parameters:
        dataStorage - The data storage.
        startColumn - The starting column where data is read.
        columns - The number of columns of data to read.
        rows - The number of rows of data to read. This should be equivalent to n1, number of rows in the matrix.
        Returns:
        Access to an array of size columns x rows containing the data.
      • getRows

        protected ArrayAccess getRows​(DataStorage dataStorage,
                                      int startRow,
                                      int rows,
                                      int columns)
        Description copied from class: TwoPassFNTStrategy
        Get a block of row data. The data may be transposed, depending on the implementation.
        Overrides:
        getRows in class TwoPassFNTStrategy
        Parameters:
        dataStorage - The data storage.
        startRow - The starting row where data is read.
        rows - The number of rows of data to read.
        columns - The number of columns of data to read. This should be equivalent to n2, number of columns in the matrix.
        Returns:
        Access to an array of size columns x rows containing the data.
      • multiplyElements

        protected void multiplyElements​(ArrayAccess arrayAccess,
                                        int startRow,
                                        int startColumn,
                                        int rows,
                                        int columns,
                                        long length,
                                        long totalTransformLength,
                                        boolean isInverse,
                                        int modulus)
        Description copied from class: TwoPassFNTStrategy
        Multiply each matrix element (i, j) by wi * j / totalTransformLength. The matrix size is n1 x n2.
        Overrides:
        multiplyElements in class TwoPassFNTStrategy
        Parameters:
        arrayAccess - The memory array to multiply.
        startRow - Which row in the whole matrix the starting row in the arrayAccess is.
        startColumn - Which column in the whole matrix the starting column in the arrayAccess is.
        rows - The number of rows in the arrayAccess to multiply.
        columns - The number of columns in the matrix (= n2).
        length - The length of data in the matrix being transformed.
        totalTransformLength - The total transform length, for the scaling factor. Used only for the inverse case.
        isInverse - If the multiplication is done for the inverse transform or not.
        modulus - Index of the modulus.