kerncraft/kernel.py
def print_kernel_info(self, output_file=sys.stdout):
        """Print kernel information in human readble format."""
        table = ('     idx |        min        max       step\n' +
                 '---------+---------------------------------\n')
        for l in self._loop_stack:
            table += '{:>8} | {!r:>10} {!r:>10} {!r:>10}\n'.format(*l)
        print(prefix_indent('loop stack:        ', table), file=output_file)

        table = ('    name |  offsets   ...\n' +
                 '---------+------------...\n')
        for name, offsets in list(self.sources.items()):
            prefix = '{:>8} | '.format(name)
            right_side = '\n'.join(['{!r:}'.format(o) for o in offsets])
            table += prefix_indent(prefix, right_side, later_prefix='         | ')
        print(prefix_indent('data sources:      ', table), file=output_file)

        table = ('    name |  offsets   ...\n' +
                 '---------+------------...\n')
        for name, offsets in list(self.destinations.items()):
            prefix = '{:>8} | '.format(name)
            right_side = '\n'.join(['{!r:}'.format(o) for o in offsets])
            table += prefix_indent(prefix, right_side, later_prefix='         | ')
        print(prefix_indent('data destinations: ', table), file=output_file)

        table = (' op | count \n' +
                 '----+-------\n')
        for op, count in list(self._flops.items()):
            table += '{:>3} | {:>4}\n'.format(op, count)
        table += '     =======\n'
        table += '      {:>4}'.format(sum(self._flops.values()))
        print(prefix_indent('FLOPs:     ', table), file=output_file)
def print_kernel_info(self, output_file=sys.stdout):
        table = ('     idx |        min        max       step\n' +
                 '---------+---------------------------------\n')
        for l in self._loop_stack:
            table += '{:>8} | {!r:>10} {!r:>10} {!r:>10}\n'.format(*l)
        print(prefix_indent('loop stack:        ', table), file=output_file)

        table = ('    name |  offsets   ...\n' +
                 '---------+------------...\n')
        for name, offsets in list(self.sources.items()):
            prefix = '{:>8} | '.format(name)
            right_side = '\n'.join(['{!r:}'.format(o) for o in offsets])
            table += prefix_indent(prefix, right_side, later_prefix='         | ')
        print(prefix_indent('data sources:      ', table), file=output_file)

        table = ('    name |  offsets   ...\n' +
                 '---------+------------...\n')
        for name, offsets in list(self.destinations.items()):
            prefix = '{:>8} | '.format(name)
            right_side = '\n'.join(['{!r:}'.format(o) for o in offsets])
            table += prefix_indent(prefix, right_side, later_prefix='         | ')
        print(prefix_indent('data destinations: ', table), file=output_file)

        table = (' op | count \n' +
                 '----+-------\n')
        for op, count in list(self._flops.items()):
            table += '{:>3} | {:>4}\n'.format(op, count)
        table += '     =======\n'
        table += '      {:>4}'.format(sum(self._flops.values()))
        print(prefix_indent('FLOPs:     ', table), file=output_file)
def print_kernel_info ( self , output_file = sys . stdout ) : table = ( '     idx |        min        max       step\n' + '---------+---------------------------------\n' ) for l in self . _loop_stack : table += '{:>8} | {!r:>10} {!r:>10} {!r:>10}\n' . format ( * l ) print ( prefix_indent ( 'loop stack:        ' , table ) , file = output_file ) table = ( '    name |  offsets   ...\n' + '---------+------------...\n' ) for name , offsets in list ( self . sources . items ( ) ) : prefix = '{:>8} | ' . format ( name ) right_side = '\n' . join ( [ '{!r:}' . format ( o ) for o in offsets ] ) table += prefix_indent ( prefix , right_side , later_prefix = '         | ' ) print ( prefix_indent ( 'data sources:      ' , table ) , file = output_file ) table = ( '    name |  offsets   ...\n' + '---------+------------...\n' ) for name , offsets in list ( self . destinations . items ( ) ) : prefix = '{:>8} | ' . format ( name ) right_side = '\n' . join ( [ '{!r:}' . format ( o ) for o in offsets ] ) table += prefix_indent ( prefix , right_side , later_prefix = '         | ' ) print ( prefix_indent ( 'data destinations: ' , table ) , file = output_file ) table = ( ' op | count \n' + '----+-------\n' ) for op , count in list ( self . _flops . items ( ) ) : table += '{:>3} | {:>4}\n' . format ( op , count ) table += '     =======\n' table += '      {:>4}' . format ( sum ( self . _flops . values ( ) ) ) print ( prefix_indent ( 'FLOPs:     ' , table ) , file = output_file )
Print kernel information in human readble format.
Print kernel information in human readble format .