Package dsc_suite :: Package tools :: Module benchmarks :: Class Benchmark
[hide private]
[frames] | no frames]

Class Benchmark

source code

object --+
         |
        Benchmark
Known Subclasses:

class Benchmark() - encapsulating basic benchmark operations

Use this class for benchmark format independent operations.
E.g., use this class for random benchmark generation.

This class currently handles only rectangluar blocks (i.e.,
storing only dimension informations of blocks). Benchmark
status information is used to distinguish 2D/3D,
rectangular/rectilinear, ...

The most important variable is data, which stores the
benchmark information. It's format is as following:
data = {modulename : [moduletype, dimensions, connections]
where dimensions is a list and connections is a dictionary.

Instance Methods [hide private]
 
__init__(data, status)
data ...
source code
data
parse_benchmark_string(text)
text ...
source code
 
load_benchmark(filename)
filename ...
source code
status
get_status()
status ...
source code
blocks
get_blocks()
blocks ...
source code
 
rename_blocks(block_list)
block_list ...
source code
 
remove_blocks(self, block_list) source code
dimensions
get_dimensions()
dimensions ...
source code
connections
get_connections()
connections ...
source code
 
join(benchmark)
benchmark ...
source code
 
set_connections(self, connections) source code
 
add_connections(self, connections) source code
 
remove_connections(self, connections) source code
 
to_3d(z)
z ...
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
__abstract()
static helper method to implement abstract methods
source code
string
load_benchmark_file(filename)
filename ...
source code
Class Variables [hide private]
  MODULETYPE = 0
  DIMENSIONS = 1
  CONNECTIONS = 2
Properties [hide private]
  status
get_status() -> status
  blocks
get_blocks() -> blocks
  dimensions
get_dimensions() -> dimensions
  connections
get_connections() -> connections

Inherited from object: __class__

Method Details [hide private]

__init__(data, status)
(Constructor)

source code 
data   ... data from an external source
status ... benchmark status dictionary

Takes data and creates an own benchmark instance. data needs to
be in the right format. No format testing is done!
Example status = {'source' : 'YAL',
                  'name' : filename,
                  'number of dimensions' : 2,
                  'shape of modules' : 'rectangluar'}

Overrides: object.__init__

load_benchmark_file(filename)
Static Method

source code 
filename ... benchmark file
  string ... string representation of benchmark file

Loading benchmark file and reading content into a single
string for further processing.
(TODO: Exception handling)

Returns: string

parse_benchmark_string(text)

source code 

text ... string representation of benchmark file data ... dictionary representation of benchmark

Abstract method!!! Needs to be implemented in subclass.

Parsing string representation of a SPECIFIC benchmark. data format: {modulename: [moduletype, dimensions, connections]}

Returns: data

load_benchmark(filename)

source code 

filename ... benchmark file

This method shall be executed in every __init__ of a file based benchmark (e.g., YAL). It loads the benchmark file and parses the content into the data variable, which then is accessible through several getter methods (e.g., get_blocks, get_dimensions) or by direct access (e.g., blocks, dimensions).

get_status()

source code 

status ... dictionary containing status information regarding benchmark status.keys() = ['source', 'name', 'number of dimensions', 'shapes of modules']

Getter method for the status dictionary.

Returns: status

get_blocks()

source code 

blocks ... list of module names

Getter method for getting a list of module names.

Returns: blocks

rename_blocks(block_list)

source code 

block_list ... list of block name tuples

Renames blocks with a occurences in block_list. block_list format: [[a,b], [c,d], ...] Where a's new name would be b and c's new name d. If there was a b or before it will be overwritten without a warning.

get_dimensions()

source code 

dimensions ... dictionary of module dimensions dimensions format: {'M1' : [X, Y, Z], ...}

Getter method to a dictionary of module dimensions. Dimensions are floats. Returns a dictionary with dimensions corresponding to len(data[X][DIMENSIONS]) (i.e., 'number of dimensions').

Returns: dimensions

get_connections()

source code 

connections ... dictionary of module connections connections format: {'MN' : connection weight factor, ...}

Getter method to a dictionary of module connections. Returns a dictionary with connections to other any other module. Maybe it could be optimized removing nonexisting (i.e., weight == 0) connections.

Returns: connections

join(benchmark)

source code 

benchmark ... benchmark which is added to current data

Add new benchmark data to the current benchmark. Identical module names are renamed. Only benchmarks with the same dimensionalty can be merged. The resulting benchmark don't have connections between the modules of the different benchmarks. So, typically further connections should be added (e.g., using the random connection generator of the RandomBench class).

to_3d(z)

source code 

z ... if integer: new z dimension of all modules

Transforms a current 2D benchmark into a 3D benchmark.

TODO: More versatile methods needs to be implemented. (e.g., randomized z-dimension, folded 2d, ...)


Property Details [hide private]

status

get_status() -> status

status ... dictionary containing status information regarding benchmark status.keys() = ['source', 'name', 'number of dimensions', 'shapes of modules']

Getter method for the status dictionary.

Get Method:
get_status() - status ...

blocks

get_blocks() -> blocks

blocks ... list of module names

Getter method for getting a list of module names.

Get Method:
get_blocks() - blocks ...

dimensions

get_dimensions() -> dimensions

dimensions ... dictionary of module dimensions dimensions format: {'M1' : [X, Y, Z], ...}

Getter method to a dictionary of module dimensions. Dimensions are floats. Returns a dictionary with dimensions corresponding to len(data[X][DIMENSIONS]) (i.e., 'number of dimensions').

Get Method:
get_dimensions() - dimensions ...

connections

get_connections() -> connections

connections ... dictionary of module connections connections format: {'MN' : connection weight factor, ...}

Getter method to a dictionary of module connections. Returns a dictionary with connections to other any other module. Maybe it could be optimized removing nonexisting (i.e., weight == 0) connections.

Get Method:
get_connections() - connections ...
Set Method:
set_connections(self, connections)