MCPcopy Create free account
hub / github.com/PABannier/sam3.cpp / main

Function main

tests/test_metal_python_ref_compare.cpp:468–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

466}
467
468int main(int argc, char ** argv) {
469 if (argc < 2) {
470 fprintf(stderr,
471 "Usage: %s <model.ggml> [ref_dir] [backend=metal|cpu|both] [phase6_case_tsv]\n",
472 argv[0]);
473 fprintf(stderr,
474 "Defaults: ref_dir=tests/debug_pipeline/e2e_ref backend=both phase6_case_tsv=tests/debug_pipeline/phase6_cat_box.tsv\n");
475 return 1;
476 }
477
478 const std::string model_path = argv[1];
479 const std::string ref_dir = argc >= 3 ? argv[2] : "tests/debug_pipeline/e2e_ref";
480 const std::string backend_mode = argc >= 4 ? argv[3] : "both";
481 const std::string case_tsv = argc >= 5 ? argv[4] : "tests/debug_pipeline/phase6_cat_box.tsv";
482
483 sam3_pvs_params pvs_params;
484 std::string phase6_case_id;
485 if (!parse_phase6_case(case_tsv, pvs_params, phase6_case_id)) {
486 fprintf(stderr, "Failed to parse phase 6 case file: %s\n", case_tsv.c_str());
487 return 1;
488 }
489
490 std::vector<backend_run> runs;
491 if (backend_mode == "cpu" || backend_mode == "both") {
492 runs.push_back(run_backend("cpu", false, model_path, ref_dir, pvs_params, phase6_case_id));
493 }
494 if (backend_mode == "metal" || backend_mode == "both") {
495 runs.push_back(run_backend("metal", true, model_path, ref_dir, pvs_params, phase6_case_id));
496 }
497
498 for (const auto & run : runs) {
499 print_summary(run);
500 }
501
502 return 0;
503}

Callers

nothing calls this directly

Calls 3

parse_phase6_caseFunction · 0.85
print_summaryFunction · 0.85
run_backendFunction · 0.70

Tested by

no test coverage detected