Skip to content

Add template cProfile runner#12

Open
ReguiguiMohamed wants to merge 1 commit into
pyfenn:mainfrom
ReguiguiMohamed:profile-templates
Open

Add template cProfile runner#12
ReguiguiMohamed wants to merge 1 commit into
pyfenn:mainfrom
ReguiguiMohamed:profile-templates

Conversation

@ReguiguiMohamed

@ReguiguiMohamed ReguiguiMohamed commented Jun 12, 2026

Copy link
Copy Markdown

Summary

  • add a small runner for profiling any template with Python's built-in cProfile
  • write a binary profile and cumulative-time report
  • document workload requirements without changing normal template execution

Why

The templates have different dependencies and workloads. Running cProfile in
a child process keeps profiler code out of each example and leaves normal
template execution unchanged.

Generated traces remain local because profiler output depends on the workload, dependency versions, and hardware.

Related to pyfenn/fenn#146.

Validation

  • ruff check --isolated profiling/profile_template.py
  • ruff format --check --isolated profiling/profile_template.py
  • python -m compileall -q profiling/profile_template.py
  • smoke-tested against the empty template
  • verified unknown template names fail before execution

@ReguiguiMohamed ReguiguiMohamed changed the title Add reusable template profiling harness Add template cProfile runner Jun 12, 2026
@ReguiguiMohamed ReguiguiMohamed marked this pull request as ready for review June 13, 2026 10:41
@ApusBerliozi

ApusBerliozi commented Jun 15, 2026

Copy link
Copy Markdown

Hi @ReguiguiMohamed, thx for your work man!

Could you please provide us with an example of profiling result for mlp-binary? Screenshot will do just fine

@ReguiguiMohamed

Copy link
Copy Markdown
Author

Sure, here is an example cProfile result generated for mlp-binary.

image

Environment: Python 3.12.4, PyTorch 2.12.0+cpu, running on CPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants