EnergySystemsModellingLab / EnergySystemsModellingLab/MUSE2

Parallelise investment step

Open
#1,101 12 comments 0 reactions 1 assignee Claimed by @dalonsoa View on GitHub
enhancement muse xiii
Dominant language
Rust
Stars
8
Forks
5
Avg merge
1d 2m
Merged PRs (30d)
37

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.