EnergySystemsModellingLab / EnergySystemsModellingLab/MUSE2
Parallelise investment step
- Lingua principale
- Rust
- Stelle
- 8
- Fork
- 5
- Merge medio
- 1g 2m
- PR unite (30g)
- 37
Descrizione
Currently we don't have any parallel code, which keeps things simple, though we are leaving some performance on the floor, particularly for larger models.
Much of the investment code could be easily parallelised. The usual library for doing this in Rust is [`rayon`](https://docs.rs/rayon/latest/rayon/), which provides convenient interfaces for parallel for loops etc. You can nest these parallel for loops and the jobs will be divided between cores appropriately.
Considerations:
- **If** we are sharing data structures between threads, we might need to change to variants which allow this in some places (e.g. `Arc` rather than `Rc`)
- As HiGHS already runs in parallel, with the number of threads set to the number of CPU cores by default, we **may** want to constrain this (this might take experimentation). At the very least, we should constrain it to [`rayon::current_num_threads()`](https://docs.rs/rayon/1.11.0/rayon/fn.current_num_threads.html).
We should find a big model (preferably a realistic one) to benchmark the code with before and after.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.