Skip to content

Commit 110c42f

Browse files
authored
Merge branch 'dev' into multiscale_outputs_struct_rework
2 parents 15331aa + a644219 commit 110c42f

15 files changed

Lines changed: 99 additions & 110 deletions

.github/workflows/benchmarks_and_downstream.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ name: Benchmarks
22
on:
33
push:
44
branches:
5-
- main
6-
- Outputs-filtering2
7-
- PSE-multiscale-outputs-structure-change
5+
- dev
6+
- benchmarks-github-action
87
tags: "*"
98
pull_request:
109
workflow_dispatch:
@@ -30,8 +29,8 @@ jobs:
3029
arch:
3130
- x64
3231
package:
33-
- {user: PalmStudio, repo: XPalm.jl, branch: PSE-multiscale-outputs-structure-change}
34-
- {user: VEZY, repo: PlantBioPhysics.jl, branch: PSE-multiscale-outputs-structure-change}
32+
# the group setting is unused atm
33+
- {user: VEZY, repo: PlantSimEngine.jl, group: Downstream}
3534
steps:
3635
- uses: actions/checkout@v4
3736
- uses: julia-actions/setup-julia@v2
@@ -51,8 +50,7 @@ jobs:
5150
run: |
5251
cd test/downstream
5352
julia --project --threads 4 --color=yes -e '
54-
using Pkg;
55-
Pkg.instantiate();
53+
using Pkg;
5654
include("test-all-benchmarks.jl")'
5755
rm Manifest.toml
5856
- name: Store benchmark result

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PlantSimEngine"
22
uuid = "9a576370-710b-4269-adf9-4f603a9c6423"
33
authors = ["Rémi Vezy <VEZY@users.noreply.github.com> and contributors"]
4-
version = "0.11.3"
4+
version = "0.12.0"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"

docs/make.jl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,12 @@ makedocs(;
2222
), pages=[
2323
"Home" => "index.md",
2424
"Introduction" => [
25-
#"Organization of the documentation ?"
2625
"Why PlantSimEngine ?" => "./introduction/why_plantsimengine.md",
2726
"Why Julia ?" => "./introduction/why_julia.md",
28-
#"Overview ?"
29-
#"Feature list ? Companion packages ?"
3027
],
3128
"Prerequisites" => [
3229
"Installing and running PlantSimEngine" => "./prerequisites/installing_plantsimengine.md",
33-
"Key Concepts" => "./prerequisites/key_concepts.md", # Key concepts vs terminology ?
34-
#"Setup" ?",
30+
"Key Concepts" => "./prerequisites/key_concepts.md",
3531
"Julia language basics" => "./prerequisites/julia_basics.md",
3632
],
3733
"Step by step - Single-scale simulations" => [
@@ -62,7 +58,7 @@ makedocs(;
6258
"Building a simple plant" => [
6359
"A rudimentary plant simulation" => "./multiscale/multiscale_example_1.md",
6460
"Expanding the plant simulation" => "./multiscale/multiscale_example_2.md",
65-
"Fixing bugs in the plant simulation"=> "./multiscale/multiscale_example_3.md", # TODO illustrate outputs filtering to find the bug
61+
"Fixing bugs in the plant simulation"=> "./multiscale/multiscale_example_3.md",
6662
],
6763
"Visualizing our toy plant with PlantGeom"=> "./multiscale/multiscale_example_4.md",
6864
], "Troubleshooting and testing" => [
@@ -74,14 +70,11 @@ makedocs(;
7470
"Public API" => "./API/API_public.md",
7571
"Example models" => "./API/API_examples.md",
7672
"Internal API" => "./API/API_private.md",],
77-
"Credits" => "credits.md",
7873
"Improving our documentation" => "documentation_improvement.md",
7974
"Developer guidelines" => "developers.md",
8075
"Planned features" => "planned_features.md",
81-
#"developer section TODO"
8276
]
8377
)
84-
# move repeated examples listing to a specific page ?
8578

8679
deploydocs(;
8780
repo="github.com/VirtualPlantLab/PlantSimEngine.jl.git",

docs/src/credits.md

Whitespace-only changes.

docs/src/developers.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Developer guidelines
1+
# Developer guidelines
22

33
This page is intended for people who wish to contribute to PlantSimEngine, and indicates the various parts to bear in mind when adding in new code.
44

55
## Working on PlantSimEngine
66

77
Instructions are no different than for any other package. Use git to clone the repository [https://github.com/VirtualPlantLab/PlantSimEngine.jl](https://github.com/VirtualPlantLab/PlantSimEngine.jl).
88

9-
When testing your changes, your environement will need to use a command such as `Pkg.develop("PlantSimEngine")` to make use of your code.
9+
When testing your changes, your environement will need to use a command such as `Pkg.develop("PlantSimEngine")` to make use of your code.
1010

1111
We work with VSCode and are most comfortable with that IDE for Julia development. We mostly follow the manual's [Julia style guide](https://docs.julialang.org/en/v1/manual/style-guide/)
1212

@@ -21,6 +21,7 @@ Other details and questions can be posted on our issues page, or as part of your
2121
### Testing environments
2222

2323
PlantSimEngine has several developer environements:
24+
2425
- `/PlantSimEngine/test`, to check for non-regressions
2526
- `/PlantSimEngine/test/downstream`, whose folder contains a few benchmarks on PlantSimEngine, PlantBioPhysics and XPalm, run as a Github Action, to ensure changes don't cause performance regressions in packages depending on PlantSimEngine. You’ll need to have a version of those packages accessible if you wish to test them locally. Those are distinct from the Github Action that does some integration checks to ensure no unexpected breaking changes occurs.
2627
`/PlantSimEngine/docs`, to build the documentation. The documentation runs code, and some of the functions' documentation for the API are also tested as `jldoctest` instances
@@ -41,35 +42,34 @@ In the `/PlantSimEngine/docs` environment, run `/PlantSimEngine/docs/make.jl`. I
4142

4243
### Editing benchmarks
4344

44-
If you wish for a branch to be benchmarked after every commit, then you need to declare it in the Github Action for benchmarks's yml file : [https://github.com/VirtualPlantLab/PlantSimEngine.jl/blob/main/.github/workflows/benchmarks_and_downstream.yml](https://github.com/VirtualPlantLab/PlantSimEngine.jl/blob/main/.github/workflows/benchmarks_and_downstream.yml) and add your branch to the `on: push:` section.
45-
You can view benchmarks here: https://virtualplantlab.github.io/PlantSimEngine.jl/dev/bench/index.html. They are still somewhat WIP and not yet battle-tested.
46-
You may occasionally need to update or delete a benchmark, in which case you will need to manually delete it in the **gh-pages** branch, in `dev/bench/index.html`
47-
The actual benchmark list is located in the `test/downstream` folder.
45+
If you wish for a branch to be benchmarked after every commit, then you need to declare it in the Github Action for benchmarks's yml file : [https://github.com/VirtualPlantLab/PlantSimEngine.jl/blob/main/.github/workflows/benchmarks_and_downstream.yml](https://github.com/VirtualPlantLab/PlantSimEngine.jl/blob/main/.github/workflows/benchmarks_and_downstream.yml) and add your branch to the `on: push:` section.
46+
You can view benchmarks here: <https://virtualplantlab.github.io/PlantSimEngine.jl/dev/bench/index.html>. They are still somewhat WIP and not yet battle-tested.
47+
You may occasionally need to update or delete a benchmark, in which case you will need to manually delete it in the **gh-pages** branch, in `dev/bench/index.html`
48+
The actual benchmark list is located in the `test/downstream` folder.
4849

4950
## Things to keep an eye out for
5051

51-
### Downstream tests
52+
### Check downstream tests
5253

53-
If your changes affect the API, then they might affect a package depending on PlantSimEngine. Benchmarks can be a way to check, as some benchmarks run other packages. Otherwise, a specific GitHub action, [https://github.com/VirtualPlantLab/PlantSimEngine.jl/blob/main/.github/workflows/Integration.yml] runs other packages’ test suites. If this action fails, then it is likely some breaking change was introduced that hasn’t been accounted for in the downstream package. If you expected a breaking change and labelled your release as such, there will be no action failure
54-
Note that those tests don’t build the doc (iirc), so they don’t cover that.
55-
API changes can also affect downstream packages’ documentation and tests...
54+
If your changes affect the API, then they might affect a package depending on PlantSimEngine. Benchmarks can be a way to check, as some benchmarks run other packages. Otherwise, a specific GitHub action, [https://github.com/VirtualPlantLab/PlantSimEngine.jl/blob/main/.github/workflows/Integration.yml] runs other packages’ test suites. If this action fails, then it is likely some breaking change was introduced that hasn’t been accounted for in the downstream package. If you expected a breaking change and labelled your release as such, there will be no action failure
55+
Note that those tests don’t build the doc (iirc), so they don’t cover that.
56+
API changes can also affect downstream packages’ documentation and tests...
5657

5758
### Which documentation pages may be affected by changes
5859

5960
You may impact several specific documentation pages depending on what you changed. Features and API changes affect whatever they might affect, but there are some less obvious ramifications:
6061

61-
Improving user errors may impact the **Troubleshooting** page.
62-
Extra features might also expand the **Tips and workarounds** page, as well as the ‘implicit contracts’ page.
63-
Some experimental features might be worth documenting in the dedicated **API** page, once it's added
64-
The roadmap "**Planned features**" page needs updating
65-
Potentially, other pages such as the **Credits** page, **Key Concepts**, etc. If the API makes use of new Julia features or syntax, the **Julia basics** page is probably also worth updating.
66-
New examples are worth making doctests of.
62+
Improving user errors may impact the **Troubleshooting** page.
63+
Extra features might also expand the **Tips and workarounds** page, as well as the ‘implicit contracts’ page.
64+
Some experimental features might be worth documenting in the dedicated **API** page, once it's added
65+
The roadmap "**Planned features**" page needs updating
66+
Potentially, other pages such as the **Credits** page, **Key Concepts**, etc. If the API makes use of new Julia features or syntax, the **Julia basics** page is probably also worth updating.
67+
New examples are worth making doctests of.
6768

6869
### Previewing documentation
6970

7071
You can preview generated documentation (assuming it was able to build) relating to your PR (example given with #128) by checking the related link: [https://virtualplantlab.github.io/PlantSimEngine.jl/previews/PR128/](https://virtualplantlab.github.io/PlantSimEngine.jl/previews/PR128/)
7172

72-
7373
## Checklist before submitting PRs
7474

7575
⁃ Ensure your code, uh, works
@@ -80,12 +80,12 @@ You can preview generated documentation (assuming it was able to build) relating
8080
⁃ Build the PSE doc and update whatever doc tests were broken
8181
⁃ Push your commit, and let the Github Actions run their course
8282
⁃ Check the 'CI' GitHub action and fix if necessary
83-
⁃ Check downstream and benchmark GitHub actions:
84-
If benchmarks tanked, then fix your code. If you need to add/update/delete benchmarks, do so.
85-
If you broke an integration/downstream test, you’ll need to investigate it
86-
If API changes were made, also check downstream packages’ documentation
83+
⁃ Check downstream and benchmark GitHub actions:
84+
- If benchmarks tanked, then fix your code. If you need to add/update/delete benchmarks, do so.
85+
- If you broke an integration/downstream test, you’ll need to investigate it
86+
- If API changes were made, also check downstream packages’ documentation
8787

88-
It’s probably now safe to request a merge.
88+
It’s probably now safe to request a merge.
8989

9090
### A few extra things worth doing
9191

@@ -102,11 +102,11 @@ It’s probably now safe to request a merge.
102102

103103
### Automatic model generation
104104

105-
A specific feature requires generating models on the fly, to enable passing vectors to `Status` objects in multi-scale simulations. There may be more features that wish to generate models.
105+
A specific feature requires generating models on the fly, to enable passing vectors to `Status` objects in multi-scale simulations. There may be more features that wish to generate models.
106106

107107
The solution makes use of a somewhat brittle feature, `eval()`, with some subtleties. You can read more about the related world age problem [here](https://arxiv.org/abs/2010.07516), or [here](https://discourse.julialang.org/t/world-age-problem-explanation/9714/15).
108108

109-
The related file is `model_generation_from_status_vectors.jl`, which has some additional comments.
109+
The related file is `model_generation_from_status_vectors.jl`, which has some additional comments.
110110

111111
What is important to bear in mind, is that if you call functions which generate models via `eval()`, you will need to return to top-level scope for those changes to become visible. You can see an example in `tests/helper_functions.jl` with the functions `test_filtered_output_begin` and `test_filtered_output`. The first function calls `modellist_to_mapping`, which creates some models on the fly to convert status vectors between a ModelList and its equivalent pseudo-multiscale mapping. The function is split in two so that it is possible to return to global scope and make the `eval()` changes publicly available. The second function then is able to run the simulations on the mapping with its generated models, and complete the test successfully.
112112

@@ -122,4 +122,4 @@ Not all combinations of weather data structure/weather dataset size/status sizes
122122

123123
They were briefly mentioned earlier in the page, but the test banks to increase the number of combinations tested for in terms of weather data, modellists/mappings and tracked outputs, could definitely be improved upon.
124124

125-
TODO extra section on memory allocations, type stability etc.
125+
Some additional work and tests regarding tracking memory allocations, type stability etc. would also be worth implementing/documenting.

docs/src/model_execution.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Model execution
1+
# Model execution
22

3-
## Simulation order
3+
## Simulation order
44

55
`PlantSimEngine.jl` uses the [`ModelList`](@ref) to automatically compute a dependency graph between the models and run the simulation in the correct order. When running a simulation with [`run!`](@ref), the models are then executed following this simple set of rules:
66

7-
1. Independent models are run first. A model is independent if it can be run independently from other models, only using initializations (or nothing).
7+
1. Independent models are run first. A model is independent if it can be run independently from other models, only using initializations (or nothing).
88
2. Then, models that have a dependency on other models are run. The first ones are the ones that depend on an independent model. Then the ones that are children of the second ones, and then their children ... until no children are found anymore. There are two types of children models (*i.e.* dependencies): hard and soft dependencies:
9-
1. Hard dependencies are always run before soft dependencies. A hard dependency is a model that list dependencies in their own method for `dep`. See [this example](https://github.com/VirtualPlantLab/PlantSimEngine.jl/blob/3d91bb053ddbd087d38dcffcedd33a9db35a0fcc/examples/dummy.jl#L39) that shows `Process2Model` defining a hard dependency on any model that simulate `process1`. Inner hard dependency graphs (*i.e.* consecutive hard-dependency children) are considered as a single soft dependency.
10-
2. Soft dependencies are then run sequentially. A model has a soft dependency on another model if one or more of its inputs is computed by another model. If a soft dependency has several parent nodes (*e.g.* two different models compute two inputs of the model), it is run only if all its parent nodes have been run already. In practice, when we visit a node that has one of its parent that did not run already, we stop the visit of this branch. The node will eventually be visited from the branch of the last parent that was run.
9+
1. Hard dependencies are always run before soft dependencies. A hard dependency is a model that is directly called by another model. It is declared as such by its parent that lists its hard-dependencies as `dep`. See [this example](https://github.com/VirtualPlantLab/PlantSimEngine.jl/blob/3d91bb053ddbd087d38dcffcedd33a9db35a0fcc/examples/dummy.jl#L39) that shows `Process2Model` defining a hard dependency on any model that simulates `process1`.
10+
2. Soft dependencies are then run sequentially. A model has a soft dependency on another model if one or more of its inputs is computed by another model. If a soft dependency has several parent nodes (*e.g.* two different models compute two inputs of the model), it is run only if all its parent nodes have been run already. In practice, when we visit a node that has one of its parent that did not run already, we stop the visit of this branch. The node will eventually be visited from the branch of the last parent that was run.

docs/src/planned_features.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
### Varying timesteps
66

7-
Currently, all models are required to make use of the same timestep. Some physiological phenomenae within a plant tend to run on an hourly basis, others are slower. Weather data is often provided daily. Enabling different timesteps depending on the model is on the roadmap.
7+
Currently, all models are required to make use of the same timestep. Some physiological phenomenae within a plant tend to run on an hourly basis, others are slower. Weather data is often provided daily. Enabling different timesteps depending on the model is on the roadmap, and is planned as the next milestone.
88

99
### Multi-plant/Multi-species simulations
1010

1111
A goal for PlantSimEngine down the line is to be able to simulate complex scenes with data comprising several plants, possibly of different species, for agroforestry purposes.
1212

13-
Its current state doesn't enable practical declaration of several plant species, or multiple plants relying on similar subsets of models with partially different models or parameters.
13+
Its current state doesn't enable practical declaration of several plant species, or multiple plants relying on similar subsets of models with partially different models or parameters.
1414

1515
## Minor features
1616

@@ -34,23 +34,22 @@ Its current state doesn't enable practical declaration of several plant species,
3434

3535
## Possible features (likely not a priority)
3636

37-
- API enabling iterative builds and validation of mappings and modellists
38-
- Improved parallelisation
37+
- API enabling iterative builds and validation of mappings and ModelLists
38+
- Build step for the models, *i.e.* a function that would write a mapping or ModelList into a Julia script for validation, improved readability and (maybe) performance (no need to traverse the dependency graph anymore).
39+
- Improved parallelisation
3940
- Reintroduce multi-object parallelisation in single-scale
4041

4142
## Other minor points
4243

4344
- Examples/solutions for floating-point accumulation errors
4445
- More examples for fitting/type conversion/error propagation
45-
- MTG couple of new features #106
46+
- MTG couple of new features #106
4647
- Other minor bugs
4748
- Unrolling the run! function
4849

4950
## Other
5051

51-
- Reproducing another FSPM ?
52-
- Diffusion model example ?
52+
- Reproducing another FSPM?
53+
- Diffusion model example?
5354

54-
The full list of issues can be found [here](https://github.com/VirtualPlantLab/PlantSimEngine.jl/issues)
55-
56-
TODO Detail other related packages' roadmaps (mostly stuff like PlantGeom's mtg reference mesh linking) ? PBP updates ?
55+
The full list of issues can be found [here](https://github.com/VirtualPlantLab/PlantSimEngine.jl/issues)

docs/src/prerequisites/julia_basics.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,4 @@ Also of importance:
5252

5353
Many of these are also briefly presented in [this Julia Data Science](https://juliadatascience.io/julia_basics) guide, which also happens to focus on the DataFrames.jl package.
5454

55-
Understanding more about methods, parametric types and the typing system is usually worthwhile, when working with Julia packages.
56-
57-
TODO point to Rémi's videos ? Other videos ?
58-
TODO extra concepts useful for developers ?
59-
55+
Understanding more about methods, parametric types and the typing system is usually worthwhile, when working with Julia packages.

0 commit comments

Comments
 (0)