{"id":20373536,"url":"https://github.com/megengine/megengine-benchmark","last_synced_at":"2026-05-26T23:31:44.237Z","repository":{"id":88225367,"uuid":"436899596","full_name":"MegEngine/MegEngine-Benchmark","owner":"MegEngine","description":null,"archived":false,"fork":false,"pushed_at":"2021-12-14T04:11:02.000Z","size":6106,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-04T20:44:49.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MegEngine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-10T08:08:27.000Z","updated_at":"2021-12-24T02:49:08.000Z","dependencies_parsed_at":"2023-03-04T18:30:37.016Z","dependency_job_id":null,"html_url":"https://github.com/MegEngine/MegEngine-Benchmark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MegEngine/MegEngine-Benchmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegEngine%2FMegEngine-Benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegEngine%2FMegEngine-Benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegEngine%2FMegEngine-Benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegEngine%2FMegEngine-Benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MegEngine","download_url":"https://codeload.github.com/MegEngine/MegEngine-Benchmark/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegEngine%2FMegEngine-Benchmark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33543973,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"ssl_error","status_checked_at":"2026-05-26T15:22:15.568Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T01:18:52.158Z","updated_at":"2026-05-26T23:31:44.214Z","avatar_url":"https://github.com/MegEngine.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MegEngine-Benchmark\n\n本仓库对 [Models](https://github.com/MegEngine/Models) 与 [basecls](https://github.com/megvii-research/basecls) 中的模型进行基本测速，\n输出信息包括：每个 iter 运行时间(单位: ms)，最大显存占用(单位: MiB)，平均 cpu 占用率(top loadavg 的显示值)。\n\n## 使用指南\n\n#### 一键运行自定义的所有 benchmarks\n\n```bash\n# 运行单卡 benchmark\n./run_benchmark.sh\n\n# 运行单卡+八卡 benchmark\n./run_benchmark.sh -d\n\n# 运行单卡+八卡+pytorch benchmark\n./run_benchmark.sh -d -t\n```\n\n#### 运行指定的 benchmark\n\n运行指定 benchmark 只能获得每个 iter 的运行时间这一项数据，无法自动从外部监控显存/cpu等信息。\n\n- 基本参数\n\n     指定模型和卡数: `run.py -b \u003cbenchmark_name\u003e -n \u003cngpus\u003e`\n\n- 可选参数\n\n     1. 指定 batch_size: `run.py -b \u003cbenchmark_name\u003e -n \u003cngpus\u003e --batch-size \u003cbs\u003e`\n     2. 指定训练步数: `run.py -b \u003cbenchmark_name\u003e -n \u003cngpus\u003e --steps \u003cn_steps\u003e`\n     3. 使用混合精度训练: `run.py -b \u003cbenchmark_name\u003e -n \u003cngpus\u003e -m mp`\n     4. 使用 trace: `run.py -b \u003cbenchmark_name\u003e -n \u003cngpus\u003e -t`\n     5. trace 指定使用 symbolic=True 模式: `run.py -b \u003cbenchmark_name\u003e -n \u003cngpus\u003e -t --symbolic`\n     6. 使用 dataloader: `run.py -b \u003cbenchmark_name\u003e -n \u003cngpus\u003e --loader`\n     7. 使用 preloader(需要先打开 dataloader): `run.py -b \u003cbenchmark_name\u003e -n \u003cngpus\u003e --loader --preload`\n\n- 示例运行\n\n```bash\n\u003e ./run.py -b faster_rcnn -n 1 --steps 20\ncommand:  source prepare.sh \u0026\u0026 python3 ./detection/train_random.py -a faster_rcnn -n 1 -s 20\n13 14:12:40 load_serialized_obj_from_url: download to or using cached /home/chenyuanzhao/.cache/megengine/serialized/928d77_resnet50_fbaug_76254_4e14b7d1.pkl\nStep 0, Loss (5.559 0.688 0.478 4.394 0.000 ), Time (tot:0.529, data:0.000)\nStep 1, Loss (5.552 0.688 0.478 4.386 0.000 ), Time (tot:0.526, data:0.000)\nStep 2, Loss (5.542 0.687 0.477 4.377 0.000 ), Time (tot:0.519, data:0.000)\nStep 3, Loss (5.532 0.687 0.477 4.368 0.000 ), Time (tot:0.524, data:0.000)\nStep 4, Loss (5.522 0.687 0.477 4.358 0.000 ), Time (tot:0.525, data:0.000)\nStep 5, Loss (5.513 0.687 0.477 4.349 0.000 ), Time (tot:0.527, data:0.000)\nStep 6, Loss (5.503 0.688 0.477 4.338 0.000 ), Time (tot:0.527, data:0.000)\nStep 7, Loss (5.492 0.687 0.476 4.328 0.000 ), Time (tot:0.530, data:0.000)\nStep 8, Loss (5.484 0.688 0.476 4.319 0.000 ), Time (tot:0.527, data:0.000)\nStep 9, Loss (5.470 0.685 0.476 4.308 0.000 ), Time (tot:0.527, data:0.000)\nStep 10, Loss (5.462 0.688 0.476 4.298 0.000 ), Time (tot:0.526, data:0.000)\nStep 11, Loss (5.448 0.685 0.476 4.288 0.000 ), Time (tot:0.526, data:0.000)\nStep 12, Loss (5.438 0.686 0.475 4.276 0.000 ), Time (tot:0.524, data:0.000)\nStep 13, Loss (5.428 0.685 0.475 4.267 0.000 ), Time (tot:0.523, data:0.000)\nStep 14, Loss (5.417 0.685 0.475 4.257 0.000 ), Time (tot:0.522, data:0.000)\nStep 15, Loss (5.403 0.682 0.475 4.246 0.000 ), Time (tot:0.521, data:0.000)\nStep 16, Loss (5.393 0.684 0.475 4.234 0.000 ), Time (tot:0.521, data:0.000)\nStep 17, Loss (5.385 0.685 0.475 4.225 0.000 ), Time (tot:0.521, data:0.000)\nStep 18, Loss (5.374 0.684 0.474 4.213 0.003 ), Time (tot:0.521, data:0.000)\nStep 19, Loss (5.361 0.683 0.474 4.200 0.003 ), Time (tot:0.521, data:0.000)\n==================== summary ====================\n benchmark: detection\n      mode: imperative\n    loader:\n      arch: faster_rcnn\ntrain_mode: normal\n batchsize: 2\n      #GPU: 1\n  avg time: 0.521 seconds\n```\n\n会发现 run.py 只是对模型做了分发，仍然是进入到特定的模型子目录中去运行对应的 train_random.py。\n\n## 可选的 benchmarks\n\n* shufflenet\n* resnet\n* faster_rcnn\n* atss\n* retinanet\n* vision_transformer\n* [basecls related models](https://github.com/megvii-research/basecls/blob/main/basecls/models/__init__.py)\n* torch_shufflenet\n* torch_resnet\n* torch_vision_transformer\n* [timm related models](https://github.com/rwightman/pytorch-image-models)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegengine%2Fmegengine-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmegengine%2Fmegengine-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegengine%2Fmegengine-benchmark/lists"}