Performance optimization
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 12/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Active
- Tech stack
- python
- Domain
- performance
Research direction
This is an open proposal, not a concrete task: the author asks whether maintainers want performance changes such as running totals for leaf classes, deferred end-of-day condition checks, and compiled step functions. The payload names no files or tests in diffWOFOST. Start by reading the thread and the linked mGV issue, then wait for a maintainer decision. Done would mean a maintainer has agreed on scope and the work is split into smaller issues.
Written by the indexing model from the issue text.
Description
I have performed some performance benchmarks, and found that diffWOFOST main performs similarly at large vector sizes (e.g., many crops simulated at once under different weather conditions) to the non-vectorized WOFOST C port.
However, for coupling WOFOST to the hydrological model we are developing, this performance is likely insufficient compared to mGV and MODFLOW 6. To avoid this bottleneck we would require either diffWOFOST to be more performant, or write our own WOFOST implementation in Julia. Of course we would prefer to tag along with the developments of diffWOFOST.
With an LLM I was able to get diffWOFOST performant enough (WOFOST-72 at least) that there was only a minor difference between diffWOFOST and an optimized Julia GPU port.
The main performance improvements stemmed from:
- Keeping leaf classes as running totals, instead of computing a cumulative sum every time step
- Defer condition checking to end-of-day, instead of mid-step so they can be computed with only a single host-device sync (Carbon-balance, partitioning, latitude and vernalisation checks currently queue a device-side flag)
- Stop traitlets comparing every assigned tensor (Every state assignment ran bool(old == new). On a multi-element tensor this launches a comparison kernel and then fails silently; on one-element tensors it forces a sync)
- Move sets of operations into a single function, and compile these functions (e.g. in root_dynamics move computation of calc_rates into a separate compilable function)
For the tests I did add a copy to/from the device to simulate exchanging variables every time step in a coupled model setup.
Would you be interested in (at some point) improving the performance of diffWOFOST with these strategies, or is this out of scope for the current work?
- Dominant language
- Python
- Stars
- 25
- Forks
- 7
- Avg merge
- 14d 3h
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from WUR-AI/diffWOFOST
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
WUR-AI/diffWOFOST#132 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
WUR-AI/diffWOFOST#133 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
WUR-AI/diffWOFOST#129 ·
-
ideas
Difficulty 5/5 Over a week Newbie friendliness 35/100
WUR-AI/diffWOFOST#128 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
WUR-AI/diffWOFOST#127 ·
All issues in WUR-AI/diffWOFOST
Similar issues
-
Workflow.schedule stops when a cron deadline passes before sleepPossibly taken @HuaTNA claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
[Bug] HiveDialect shares its colspecs dict with SQLAlchemy's DefaultDialect (python/pyhive)Possibly taken @rusackas claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 80/100
apache/kyuubi#7786 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
[20.0] hr_work_entry: Duration column of Export Time Entries is truncated to whole hoursPossibly taken @odooaktiv claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
fix formatting of the sample database page of the docsPossibly taken @Aaqibhafeezkhan claimed this today. Opendocumentation good first issue help wanted
Difficulty 1/5 Under an hour Newbie friendliness 72/100
chaoss/CollectOSS#544 · 1 comment ·
Maintainers usually reply within 1 day