()
| 262 | |
| 263 | |
| 264 | def load_workloads(): |
| 265 | file_path = package_path / "demo" / "comparison" / f"features_by_workload_{target}.json" |
| 266 | with open(file_path, "r") as f: |
| 267 | return json.load(f).keys() |
| 268 | |
| 269 | |
| 270 | # def plot_pareto_front_html(workload): |
| 271 | # df = load_and_prepare_data(gcc_samples_path / f"GCC_{workload}.json") |
| 272 | df = load_and_prepare_data(llvm_samples_path / f"LLVM_{workload}.json") |
| 273 | df_normalized = (df - df.min()) / (df.max() - df.min()) |
| 274 | _, pareto_indices = find_pareto_front(df_normalized[objectives].values, return_index=True) |
| 275 | |
| 276 | # Retrieve Pareto points |
| 277 | pareto_points = df_normalized.iloc[pareto_indices][objectives] |
| 278 | |
| 279 | # Create a 3D scatter plot using plotly |
| 280 | fig = go.Figure(data=[go.Scatter3d( |
| 281 | x=pareto_points[objectives[0]], |
| 282 | y=pareto_points[objectives[1]], |
| 283 | z=pareto_points[objectives[2]], |
| 284 | mode='markers', |
| 285 | marker=dict( |
| 286 | size=5, |
| 287 | color='blue', # set color to blue |
| 288 | opacity=0.8 |
| 289 | ) |
| 290 | )]) |
| 291 | |
| 292 | # Update the layout |
| 293 | fig.update_layout( |
| 294 | title=f"Pareto Front for {workload}", |
| 295 | scene=dict( |
| 296 | xaxis_title=objectives[0], |
| 297 | yaxis_title=objectives[1], |
| 298 | zaxis_title=objectives[2] |
| 299 | ) |
| 300 | ) |
| 301 | |
| 302 | # Define the path for HTML file |
| 303 | html_path = package_path / "demo" / "comparison" / "htmls" |
| 304 | # Ensure the directory exists |
| 305 | html_path.mkdir(parents=True, exist_ok=True) |
| 306 | |
| 307 | # Save the plot as an HTML file |
| 308 | fig.write_html(str(html_path / f"{target}_pareto_front_{workload}.html")) |
| 309 | |
| 310 | |
| 311 | def plot_pareto_front(workload): |
nothing calls this directly
no test coverage detected