p3analysis.plot package

Subpackages

Module contents

class p3analysis.plot.ApplicationStyle(colors=None, markers=None, **kwargs)

Bases: object

Container for application styling options.

class p3analysis.plot.Legend(**kwargs)

Bases: object

Container for legend styling options.

class p3analysis.plot.PlatformStyle(colors=None, **kwargs)

Bases: object

Container for platform styling options.

p3analysis.plot.cascade(df, eff=None, *, size=None, platform_legend=None, application_legend=None, platform_style=None, application_style=None, backend='matplotlib', **kwargs)

Plot a cascade summarizing the efficiency and performance portability of each application in a DataFrame, highlighting differences in platform support across the applications.

Parameters:
  • df (DataFrame) – A pandas DataFrame storing performance efficiency data. The following columns are always required: “problem”, “platform”, “application”. At least one of the following columns is required: “app eff” or “arch eff”.

  • eff (string, optional) – The efficiency value to use when plotting the cascade. Must be either “app” or “arch”. If no value is provided, the efficiency is selected automatically based on the data available in df.

  • size (2-tuple of floats, optional) – The size of the plot, in backend-specific units. In the matplotlib backend, the default is (6, 5), in the pgfplots backend the size controls only the top left plot, where the default is (“200pt”, “200pt”)

  • platform_legend (p3analysis.plot.Legend, optional) – Styling options for platform legend.

  • application_legend (p3analysis.plot.Legend, optional) – Styling options for application legend.

  • platform_style (p3analysis.plot.PlatformStyle, optional) – Styling options for platforms.

  • application_style (p3analysis.plot.ApplicationStyle, optional) – Styling options for applications.

  • backend (str, {"matplotlib", "pgfplots"}, default: "matplotlib") – Backend to use to produce the plot.

  • **kwargs (properties, optional) – kwargs are used to specify properties that control various backend-specific plotting options.

Returns:

An object providing direct access to backend-specific components of the cascade plot.

Return type:

CascadePlot

Raises:
  • ValueError – If any of the required columns are missing from df. If eff is set to any value other than “app” or “arch”. If any (application, platform) pair has multiple efficiency values, since the plot shows only one efficiency value per (application, platform) combination.

  • TypeError – If any of the values in the efficiency column(s) is non-numeric.

p3analysis.plot.navchart(pp, cd, eff=None, *, size=None, goal=None, legend=None, style=None, backend='matplotlib', **kwargs)

Plot a navigation chart showing the performance portability and code convergence of each application in a DataFrame. The chart highlights the tradeoff between performance (portability) and programmer productivity, assisting in navigation of the P3 space and reasoning about how to reach development goals.

Parameters:
  • pp (DataFrame) – A pandas DataFrame storing performance portability data. The following columns are always required: “problem”, “application”. At least one of the following columns is required: “app pp” or “arch pp”.

  • cd (DataFrame) – A pandas DataFrame storing code divergence data. The following columns are required: “problem”, “application”, “divergence”.

  • eff (string, optional) – The efficiency value to use when plotting the navchart. Must be either “app” or “arch”. If no value is provided, the efficiency is selected automatically based on the data available in pp.

  • size (2-tuple of floats, optional) – The size of the plot, in backend-specific units. In the matplotlib backend, the default is (5, 5), in the pgfplots backend, the default is (“200pt”, “200pt”)

  • goal (tuple, optional) – User-defined goal, expressed as (convergence, portability). The region between this point and (1, 1) will be highlighted.

  • legend (p3analysis.plot.Legend, optional) – Styling options for platform legend.

  • style (p3analysis.plot.ApplicationStyle, optional) – Styling options for applications.

  • backend (str, {"matplotlib", "pgfplots"}, default: "matplotlib") – Backend to use to produce the plot.

  • **kwargs (properties, optional) – kwargs are used to specify properties that control various backend-specific plotting options.

Returns:

An object providing direct access to backend-specific components of the navigation chart.

Return type:

NavChart

Raises:
  • ValueError – If any of the required columns are missing from pp or cd. If eff is set to any value other than “app” or “arch”.

  • TypeError – If any of the values in the “pp” column(s) of pp or the “divergence” column of cd are non-numeric.