Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/ldyken53/TVCG-progiso
31 October 2024, 16:40:01 UTC
  • Code
  • Branches (3)
  • Releases (0)
  • Visits
Revision f93ee0c2285e5a4cfe5962a28ceb12cf0ce15352 authored by Landon Dyken on 17 October 2024, 22:37:18 UTC, committed by GitHub on 17 October 2024, 22:37:18 UTC
Update README.md
1 parent 2ce7ba9
  • Files
  • Changes
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • refs/heads/master
    • refs/heads/npm
    • f93ee0c2285e5a4cfe5962a28ceb12cf0ce15352
    No releases to show
  • 1eea666
  • /
  • plot_figure6.py
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
  • snapshot
origin badgerevision badge
swh:1:rev:f93ee0c2285e5a4cfe5962a28ceb12cf0ce15352
origin badgedirectory badge Iframe embedding
swh:1:dir:1eea666d890d590fb9ee9ef46f3931b981dc685f
origin badgecontent badge Iframe embedding
swh:1:cnt:5825a03cdfba44365150629dde339eb62db5ba3a
origin badgesnapshot badge
swh:1:snp:6dbeb1fbe859f48945dd22bd530e60eb1a5ac9b6

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: f93ee0c2285e5a4cfe5962a28ceb12cf0ce15352 authored by Landon Dyken on 17 October 2024, 22:37:18 UTC
Update README.md
Tip revision: f93ee0c
plot_figure6.py
#!/usr/bin/env python3

import sys
import os
import re
import json
import numpy as np
import matplotlib
from matplotlib import rc
from matplotlib import cm
import matplotlib.pyplot as plt

# Each data set has its list of performance at the given resolutions,
# ordered as in the resolution map above. Key's are the dataset name
image_completeness = [
    0.85,
    1
]
prog_iso_scaling = {k: {} for k in image_completeness}
bcmc_perf = {}
dataset_sizes = {}

dataset_labels = {
    "magnetic_reconnection": "Plasma",
    "chameleon": "Chameleon",
    "miranda": "Miranda"
}

match_benchmark_name = re.compile("(\\w+)\\/perf-(\\w+)_(\\d+x\\d+x\\d+)_\\w+.raw.crate\\d-[a-z]+-[a-z]+-([0-9]+)p-([0-9])ssc-([0-9]\.*[0-9]*)r.*\\.json")
match_benchmark_name2 = re.compile("(\\w+)\\/perf-(\\w+)_(\\d+x\\d+x\\d+)_\\w+.raw.crate\\d-[a-z]+-[a-z]+-([0-9]+)p-([0-9])ssc-.*\\.json")

# Compute and plot utilization statistics for the benchmarks
directory = "benchmarks"
for results_file in os.listdir(directory):
    file_name = os.path.join(directory, results_file)
    m = match_benchmark_name.search(file_name)
    if not m:
        m = match_benchmark_name2.search(file_name)
    if m:
        print(f"Matched {file_name}, dataset: {m.group(1)}, dims: {m.group(4)}")
        dataset = m.group(2)
        spec_count = m.group(5)
        if dataset not in dataset_labels.keys():
            continue
        dataset_sizes[dataset] = m.group(2)
        if not dataset in prog_iso_scaling[1]:
            for k in image_completeness:
                prog_iso_scaling[k][dataset] = {}

        with open(file_name, "r") as f:
            b = json.load(f)
            time_to_complete = []
            img_size = b[0]["stats"][0]["imageSize"]
            resolution = f"{img_size[0]}x{img_size[1]}"
            if not resolution in prog_iso_scaling[1][dataset]:
                for k in image_completeness:
                    prog_iso_scaling[k][dataset][resolution] = []

            for run in b:
                total_time = {k: 0 for k in image_completeness}
                estimate_reached = {k: False for k in image_completeness}
                for s in run["stats"]:
                    for k in image_completeness:
                        if not estimate_reached[k]:
                            total_time[k] += s["totalPassTime_ms"]
                        if s["imageCompleteness"] > k:
                            estimate_reached[k] = True

                time_to_complete.append(total_time)

            for k in image_completeness:
                prog_iso_scaling[k][dataset][resolution].append(np.mean([pas[k] for pas in time_to_complete]))
            
            print(f"""Results {dataset} @ {img_size[0]}x{img_size[1]}:
            Avg. Total Time: {np.mean([pas[k] for pas in time_to_complete]):.2f}ms
            Starting Speculation Count: {spec_count}
            """)
    else:
        print(f"Failed to match {file_name}")


resolution_order = {
    "640x360": 0,
    "1280x720": 1,
    "1920x1080": 2
}
colors = {
    "640x360": "tab:blue",
    "1280x720": "tab:orange",
    "1920x1080": "tab:green"
}

for k in image_completeness:
    fig, ax = plt.subplots()
    # Build the plot sets for the bars to have the right labels/grouping
    resolution_results = {
        "640x360": [],
        "1280x720": [],
        "1920x1080": []
    }
    max_y = 0
    idx = 0
    for name in dataset_labels.keys():
        for res in resolution_order.keys():
            if prog_iso_scaling[k][name].get(res):
                prog_iso_scaling[k][name][res].sort()

                # We need to plot each bar on its own to get the coloring by resolution
                resolution_results[res].append(prog_iso_scaling[k][name][res][0])

                max_y = max(max_y, prog_iso_scaling[k][name][res][0])
                idx += 1
            else:
                resolution_results[res].append(0)
                idx += 1


    group_width = 0.5
    offset = -group_width / 3.0
    x_ticks = np.arange(len(resolution_results["1280x720"]))
    for res, results in resolution_results.items():
        ax.bar(x_ticks + offset, results, group_width / 3, label=res, color=colors[res])
        offset += group_width / 3.0

    benchmark_names = [dataset_labels[n] for n in dataset_labels.keys()]

    ax.spines["right"].set_visible(False)
    ax.spines["top"].set_visible(False)
    ax.yaxis.set_ticks_position("left")
    ax.xaxis.set_ticks_position("bottom")
    ax.xaxis.set_ticks(x_ticks)
    plt.xticks(x_ticks, benchmark_names)
    ax.set_ylabel("Avg. Total Time (ms)")


    ax.set_xlabel("Data set")
    ax.set_ylim((0, max_y + max_y * .1))

    plt.legend(loc="upper left")
    plt.savefig(f"ResultsAt{int(k * 100)}%Complete.png", dpi=300, bbox_inches="tight")

The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API