wolfgpu.tile_packer
Author: HECE - University of Liege, Stéphane Champailler, Pierre Archambeau Date: 2024
Copyright (c) 2024 University of Liege. All rights reserved.
This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited.
Module Contents
- class wolfgpu.tile_packer.TilePackingMode[source]
Bases:
enum.Enum
Generic enumeration.
Derive from this class to define new enumerations.
- wolfgpu.tile_packer._unpack_and_deshuffle_array(a: numpy.ndarray, shape: tuple, height: int, width: int, active_tiles: numpy.ndarray, tile_size: int, tile_indirection_map: numpy.ndarray) numpy.ndarray [source]
- class wolfgpu.tile_packer.TilePacker(nap: numpy.array, tile_size: int, mode: TilePackingMode = TilePackingMode.REGULAR)[source]
-
- tile_indirection_map()[source]
The tile indirection map. Its shape is (nb_tiles_y,nb_tiles_x,2). The z-axis contains the indirected coordinates of the bottom-left corner of the tile denoted by the x and y axis values. For example, if you have the tile coordinates (t_i, t_j), then map[t_i, t_j, :] is a 2-tuple containing the coordinates (in meshes) of the bottom-left corner of that tile, on the indirected map.
- 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 of tiles that was shuffled and padded.
- _pad_array_to_tiles(a: numpy.array, neutral_values) numpy.array [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.
- Parameters:
neutral_values – The value used to pad.
- shuffle_and_pack_array(a: numpy.array, neutral_values=None, debug=False) numpy.array [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.