wolfhece.opengl.tile_packer
Module Contents
- class wolfhece.opengl.tile_packer.TilePackingMode[source]
Bases:
enum.Enum
Generic enumeration.
Derive from this class to define new enumerations.
- class wolfhece.opengl.tile_packer.TilePacker(nap: numpy.ndarray, tile_size: int, mode: TilePackingMode = TilePackingMode.REGULAR)[source]
A class that packs an array in tiles and provides an indirection map
- After the initialization phase based on the “NAP” array, the class provides two methods:
shuffle_and_pack_array
unpack_and_deshuffle_array
- mode() TilePackingMode [source]
- packed_size()[source]
Size of the arrays after padding them and packing them in tiles, expressed in meshes. Size is a (width, height) tuple.
Note that this size can be very different than the actual computation domain size.
- packed_size_in_tiles()[source]
Size of the arrays after padding them and packing them in tiles, expressed in tiles. Size is a (width, height) tuple.
Note that this size can be very different than the actual computation domain size.
- size_in_tiles()[source]
Size of the (original, non packed, non tiled) computation domain, in tiles. Not that we count full tiles. So if one dimension of the domain is not a multiple of the tile size, then we round one tile up.
Size is a (width, height) tuple.
- unpack_and_deshuffle_array(a: numpy.ndarray) numpy.ndarray [source]
De-shuffle and un-pad an array that was shuffled and padded.
- _pad_array_to_tiles(a: numpy.ndarray) numpy.ndarray [source]
Make an array fit in a given number of tiles (on x and y axis). After this, the array’s dimensions are multiple of the tile_size.
- shuffle_and_pack_array(a: numpy.ndarray, neutral_values=None) numpy.ndarray [source]
Reorganize an array by moving tiles around to follow the ordering given by self._tile_indirection_map The array is resized in order to be just as large as needed to hold the active tiles plus the “empty” tile.
neutral_values: value to fill the empty tile with.