Home / Function/ parser() — pytorch Function Reference

parser() — pytorch Function Reference

Architecture documentation for the parser() function in update_expected.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  48ac7219_0d89_c217_fc61_0fdfee3ad13e["parser()"]
  6c99088d_53b6_0274_333c_b9b65c65ed00["query_job_sha()"]
  48ac7219_0d89_c217_fc61_0fdfee3ad13e -->|calls| 6c99088d_53b6_0274_333c_b9b65c65ed00
  8073e5ea_530f_1b5c_680a_d9861242f1c9["get_artifacts_urls()"]
  48ac7219_0d89_c217_fc61_0fdfee3ad13e -->|calls| 8073e5ea_530f_1b5c_680a_d9861242f1c9
  9c7cdd83_081e_ffec_b29f_0c8c75d577e4["write_filtered_csvs()"]
  48ac7219_0d89_c217_fc61_0fdfee3ad13e -->|calls| 9c7cdd83_081e_ffec_b29f_0c8c75d577e4
  style 48ac7219_0d89_c217_fc61_0fdfee3ad13e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/ci_expected_accuracy/update_expected.py lines 263–324

    parser = argparse.ArgumentParser(
        description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
    )

    parser.add_argument("sha")
    args = parser.parse_args()

    repo = "pytorch/pytorch"

    suites = {
        f"{a}_{b}"
        for a, b in product(
            [
                "aot_eager",
                "aot_inductor",
                "cpu_aot_inductor",
                "cpu_aot_inductor_amp_freezing",
                "cpu_aot_inductor_freezing",
                "cpu_inductor",
                "cpu_inductor_amp_freezing",
                "cpu_inductor_freezing",
                "dynamic_aot_eager",
                "dynamic_cpu_aot_inductor",
                "dynamic_cpu_aot_inductor_amp_freezing",
                "dynamic_cpu_aot_inductor_freezing",
                "dynamic_cpu_inductor",
                "dynamic_inductor",
                "dynamo_eager",
                "inductor",
            ],
            ["huggingface", "timm", "torchbench"],
        )
    }

    root_path = "benchmarks/dynamo/ci_expected_accuracy/"
    if not os.path.exists(root_path):
        raise AssertionError(f"cd <pytorch root> and ensure {root_path} exists")
    rocm_path = "benchmarks/dynamo/ci_expected_accuracy/rocm/"
    if not os.path.exists(rocm_path):
        raise AssertionError(f"cd <pytorch root> and ensure {rocm_path} exists")

    results = query_job_sha(repo, args.sha)

    # Get URLs for both CUDA and ROCm
    cuda_urls = get_artifacts_urls(results, suites, is_rocm=False)
    rocm_urls = get_artifacts_urls(results, suites, is_rocm=True)

    # Download CUDA and ROCm artifacts in parallel
    print("Downloading CUDA and ROCm artifacts in parallel...")
    with ThreadPoolExecutor(max_workers=2) as executor:
        cuda_future = executor.submit(download_artifacts_and_extract_csvs, cuda_urls)
        rocm_future = executor.submit(download_artifacts_and_extract_csvs, rocm_urls)
        cuda_dataframes = cuda_future.result()
        rocm_dataframes = rocm_future.result()

    print("Writing CUDA CSVs...")
    write_filtered_csvs(root_path, cuda_dataframes)

    print("Writing ROCm CSVs...")
    write_filtered_csvs(rocm_path, rocm_dataframes)

    print("Success. Now, confirm the changes to .csvs and `git add` them if satisfied.")

Subdomains

Frequently Asked Questions

What does parser() do?
parser() is a function in the pytorch codebase.
What does parser() call?
parser() calls 3 function(s): get_artifacts_urls, query_job_sha, write_filtered_csvs.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free