[A2-P] 王琪琦 - Profiling 与性能分析 - #120
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4b3c5c72e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| peaks.append({"model":"xl","context":ctx,"batch_size":1,"mode":mode,"dtype":"fp32","status":d["status"],"peak_allocated_mib":d.get("peak_allocated_mib"),"peak_reserved_mib":d.get("peak_reserved_mib"),"peak_active_mib":d.get("peak_active_mib","")}) | ||
| for model,ctx in (("xl",1024),("large",2048)): | ||
| d=load(RAW/f"memory/{model}_{ctx}_train.json"); memruns.append(d["config"]) | ||
| peaks.append({"model":model,"context":ctx,"batch_size":1,"mode":"train_step","dtype":"fp32","status":d["status"],"peak_allocated_mib":d.get("peak_allocated_mib"),"peak_reserved_mib":d.get("peak_reserved_mib"),"peak_active_mib":d.get("peak_active_mib","")}) |
There was a problem hiding this comment.
Preserve OOM failure details in the published summaries
When an OOM occurs (as in all four submitted train-step OOM rows), this summary drops the error_type produced by memory_snapshot.py, and no failure phase is recorded anywhere. Since the raw per-run JSON files are deliberately not submitted, peaks.csv and run_metadata.json leave reviewers unable to determine whether the failure occurred during model construction, forward, backward, or optimizer state allocation; retain at least the exception type and stage in the lightweight outputs.
Useful? React with 👍 / 👎.
| rows=sorted(rows,key=lambda r:max(r["cpu_total_us"],r["cuda_total_us"]),reverse=True) | ||
| Path(a.table).parent.mkdir(parents=True,exist_ok=True) | ||
| with open(a.table,"w",newline="") as f: w=csv.DictWriter(f,fieldnames=rows[0]); w.writeheader(); w.writerows(rows) | ||
| write_json(a.output,{"status":"success","config":{"model_size":a.model_size,"context_length":a.context_length,"batch_size":a.batch_size,"warmup":a.warmup,"mode":"train_step","dtype":"fp32","tool":"torch.profiler","trace_file":Path(a.trace).name},"environment":environment(d),"events":rows}) |
There was a problem hiding this comment.
Record each profiling command in the run metadata
The six committed profile metadata entries are generated from this config and contain only model/context/settings and a trace filename; they never retain the invocation command (including output/table paths and any execution environment arguments). The README supplies only one medium-1024 example, so the other five published traces cannot be replayed from the committed evidence. Persist sys.argv or an equivalent full command for every profile run.
Useful? React with 👍 / 👎.
WillQvQ
left a comment
There was a problem hiding this comment.
审核结论:需要修改。
阻塞项:students/王琪琦/assignments/A2-P/submission/profiling/summarize.py 第 19 行的 f-string 无法解析,python3 -m compileall 报 SyntaxError: f-string: expecting '}'。请修复该语法错误,并在原 PR 分支继续提交;其他目录范围、附件大小、结果文件和敏感信息检查未发现阻塞问题。
审核者:GPT-5.6 Sol Ultra
Summary
torch.profiler, mixed-precision, and memory evidenceValidation