Skip to content

Commit e5dacfe

Browse files
authored
Merge pull request #280 from precice/micro-manager-v0.10.0
Release v0.10.0
2 parents 9d329c1 + cac136d commit e5dacfe

17 files changed

Lines changed: 498 additions & 129 deletions
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build OpenMPI cache
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
pull_request:
9+
branches:
10+
- "*"
11+
workflow_dispatch:
12+
13+
jobs:
14+
build_cache:
15+
name: Build and cache OpenMPI 5
16+
runs-on: ubuntu-latest
17+
container: precice/precice:nightly
18+
steps:
19+
- name: Install build dependencies
20+
run: |
21+
apt-get -qq update
22+
apt-get -qq install wget build-essential
23+
24+
- name: Load Cache OpenMPI 5
25+
id: ompi-cache-load
26+
uses: actions/cache/restore@v5
27+
with:
28+
path: ~/openmpi
29+
key: openmpi-5.0.5-${{ runner.os }}-build
30+
31+
- name: Build OpenMPI 5
32+
if: steps.ompi-cache-load.outputs.cache-hit != 'true'
33+
run: |
34+
wget https://download.open-mpi.org/release/open-mpi/v5.0/openmpi-5.0.5.tar.gz
35+
tar -xzf openmpi-5.0.5.tar.gz
36+
cd openmpi-5.0.5
37+
mkdir -p ~/openmpi
38+
./configure --prefix=$HOME/openmpi
39+
make -j$(nproc)
40+
make install
41+
42+
- name: Save OpenMPI 5 to cache
43+
if: steps.ompi-cache-load.outputs.cache-hit != 'true'
44+
uses: actions/cache/save@v5
45+
with:
46+
path: ~/openmpi
47+
key: openmpi-5.0.5-${{ runner.os }}-build
48+
49+
- name: Verify OpenMPI installation
50+
run: |
51+
if [ ! -d ~/openmpi ]; then
52+
echo "::error::OpenMPI cache directory not found"
53+
exit 1
54+
fi
55+
cp -r ~/openmpi/* /usr/local/
56+
ldconfig
57+
mpiexec --version

.github/workflows/check-coverage.yml

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,42 @@
11
name: Check test coverage
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
- develop
8-
pull_request:
9-
branches:
10-
- "*"
4+
workflow_run:
5+
workflows: [Build OpenMPI cache]
6+
types:
7+
- completed
118

129
jobs:
1310
coverage:
1411
name: Run test coverage check
12+
if: github.event.workflow_run.conclusion == 'success'
1513
runs-on: ubuntu-latest
1614
container: precice/precice:nightly
1715
steps:
1816
- name: Checkout repository
1917
uses: actions/checkout@v6
2018
with:
2119
path: micro-manager
20+
ref: ${{ github.event.workflow_run.head_sha }}
2221

2322
- name: Install dependencies
2423
run: |
2524
apt-get -qq update
2625
apt-get -qq install python3-dev python3-venv git pkg-config
27-
apt-get -qq install wget build-essential
2826
2927
- name: Load Cache OpenMPI 5
3028
id: ompi-cache-load
3129
uses: actions/cache/restore@v5
3230
with:
3331
path: ~/openmpi
34-
key: openmpi-v5-${{ runner.os }}-build
35-
36-
- name: Build OpenMPI 5
37-
if: steps.ompi-cache-load.outputs.cache-hit != 'true'
38-
run: |
39-
wget https://download.open-mpi.org/release/open-mpi/v5.0/openmpi-5.0.5.tar.gz
40-
tar -xzf openmpi-5.0.5.tar.gz
41-
cd openmpi-5.0.5
42-
mkdir -p ~/openmpi
43-
./configure --prefix=$HOME/openmpi
44-
make -j$(nproc)
45-
make install
46-
47-
- name: Save OpenMPI 5 to cache
48-
if: steps.ompi-cache-load.outputs.cache-hit != 'true'
49-
uses: actions/cache/save@v5
50-
with:
51-
path: ~/openmpi
52-
key: openmpi-v5-${{ runner.os }}-build
32+
key: openmpi-5.0.5-${{ runner.os }}-build
5333

5434
- name: Configure OpenMPI
5535
run: |
36+
if [ ! -d ~/openmpi ]; then
37+
echo "::error::OpenMPI cache not found. The cache workflow may have failed."
38+
exit 1
39+
fi
5640
cp -r ~/openmpi/* /usr/local/
5741
ldconfig
5842
which mpiexec

.github/workflows/run-adaptivity-tests-parallel.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
name: Test adaptivity functionality in parallel
22
on:
3-
push:
4-
branches:
5-
- main
6-
- develop
7-
pull_request:
8-
branches:
9-
- "*"
3+
workflow_run:
4+
workflows: [Build OpenMPI cache]
5+
types:
6+
- completed
107
jobs:
118
integration_tests:
129
name: Integration tests
10+
if: github.event.workflow_run.conclusion == 'success'
1311
runs-on: ubuntu-latest
1412
container: precice/precice:nightly
1513
steps:
1614
- name: Checkout repository
1715
uses: actions/checkout@v6
1816
with:
1917
path: micro-manager
18+
ref: ${{ github.event.workflow_run.head_sha }}
2019

2120
- name: Install sudo for MPI
2221
working-directory: micro-manager
@@ -51,24 +50,29 @@ jobs:
5150
5251
unit_tests:
5352
name: Unit tests
53+
if: github.event.workflow_run.conclusion == 'success'
5454
runs-on: ubuntu-latest
5555
container: precice/precice:nightly
5656
steps:
5757
- name: Checkout Repository
5858
uses: actions/checkout@v6
5959
with:
6060
path: micro-manager
61+
ref: ${{ github.event.workflow_run.head_sha }}
6162

6263
- name: Load Cache OpenMPI 5
6364
id: ompi-cache-load
6465
uses: actions/cache/restore@v5
6566
with:
6667
path: ~/openmpi
67-
key: openmpi-v5-${{ runner.os }}-build
68-
# If this fails, cache gets built in run-unit-tests
68+
key: openmpi-5.0.5-${{ runner.os }}-build
6969

7070
- name: Configure OpenMPI
7171
run: |
72+
if [ ! -d ~/openmpi ]; then
73+
echo "::error::OpenMPI cache not found. The cache workflow may have failed."
74+
exit 1
75+
fi
7276
cp -r ~/openmpi/* /usr/local/
7377
ldconfig
7478
which mpiexec

.github/workflows/run-unit-tests.yml

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,38 @@
11
name: Run unit tests for user-side functions
22
on:
3-
push:
4-
branches:
5-
- main
6-
- develop
7-
pull_request:
8-
branches:
9-
- "*"
3+
workflow_run:
4+
workflows: [Build OpenMPI cache]
5+
types:
6+
- completed
107
jobs:
118
unit_tests:
9+
if: github.event.workflow_run.conclusion == 'success'
1210
runs-on: ubuntu-latest
1311
container: precice/precice:nightly
1412
steps:
1513
- uses: actions/checkout@v6
1614
with:
1715
path: micro-manager
16+
ref: ${{ github.event.workflow_run.head_sha }}
1817

1918
- name: Install dependencies
2019
run: |
2120
apt-get -qq update
2221
apt-get -qq install python3-dev python3-venv git pkg-config
23-
apt-get -qq install wget build-essential
2422
2523
- name: Load Cache OpenMPI 5
2624
id: ompi-cache-load
2725
uses: actions/cache/restore@v5
2826
with:
2927
path: ~/openmpi
30-
key: openmpi-v5-${{ runner.os }}-build
31-
32-
- name: Build OpenMPI 5
33-
if: steps.ompi-cache-load.outputs.cache-hit != 'true'
34-
run: |
35-
wget https://download.open-mpi.org/release/open-mpi/v5.0/openmpi-5.0.5.tar.gz
36-
tar -xzf openmpi-5.0.5.tar.gz
37-
cd openmpi-5.0.5
38-
mkdir -p ~/openmpi
39-
./configure --prefix=$HOME/openmpi
40-
make -j$(nproc)
41-
make install
42-
43-
- name: Save OpenMPI 5 to cache
44-
if: steps.ompi-cache.outputs.cache-hit != 'true'
45-
id: ompi-cache-store
46-
uses: actions/cache/save@v5
47-
with:
48-
path: ~/openmpi
49-
key: openmpi-v5-${{ runner.os }}-build
28+
key: openmpi-5.0.5-${{ runner.os }}-build
5029

5130
- name: Configure OpenMPI
5231
run: |
32+
if [ ! -d ~/openmpi ]; then
33+
echo "::error::OpenMPI cache not found. The cache workflow may have failed."
34+
exit 1
35+
fi
5336
cp -r ~/openmpi/* /usr/local/
5437
ldconfig
5538
which mpiexec
@@ -71,6 +54,13 @@ jobs:
7154
cd tests/unit
7255
python3 -m unittest test_micro_manager.py
7356
57+
- name: Run model adaptivity unit tests
58+
working-directory: micro-manager
59+
run: |
60+
. .venv/bin/activate
61+
cd tests/unit
62+
python3 -m unittest test_model_adaptivity.py
63+
7464
- name: Install Micro Manager and run tasking unit test
7565
working-directory: micro-manager
7666
env:

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Micro Manager changelog
22

3+
## v0.10.0
4+
5+
- Fixed load balancing for case where number of sims to send and recv are not the same [#276](https://github.com/precice/micro-manager/pull/276)
6+
- Fixed CI OpenMPI cache miss by centralizing the MPI build into a dedicated workflow [#263](https://github.com/precice/micro-manager/pull/263)
7+
- Fixed naming of variables tracking active simulations in the `MicroManager` [#273](https://github.com/precice/micro-manager/pull/273)
8+
- Improved load balancing of inactive simulations by tracking a small amount of time [#272](https://github.com/precice/micro-manager/pull/272)
9+
- Added the exported field `model_resolution` when using model adaptivity [#271](https://github.com/precice/micro-manager/pull/271)
10+
- Fixed model adaptivity active simulation mask generation for 0 local simulations [#270](https://github.com/precice/micro-manager/pull/270)
11+
- Allow `initialize()` to return data that is not used by the adaptivity [#261](https://github.com/precice/micro-manager/pull/261)
12+
- Fixed `MicroSimulation` initialization requiring positional parameters [#255](https://github.com/precice/micro-manager/pull/255)
13+
- Fixed model adaptivity convergence at resolution boundaries to prevent infinite loops for out-of-range switching requests [#252](https://github.com/precice/micro-manager/pull/252)
14+
- Add function `set_global_id` to the dummies and the example in the integration test [#247](https://github.com/precice/micro-manager/pull/247)
15+
316
## v0.9.0
417

518
- Refactored `DomainDecomposer` class and added a new variant of non-uniform decomposition [#243](https://github.com/precice/micro-manager/pull/243)

docs/configuration.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,28 @@ summary: Provide a JSON file to configure the Micro Manager.
77

88
{% note %} In the preCICE XML configuration the Micro Manager is a participant with the name `Micro-Manager`. {% endnote %}
99

10-
The Micro Manager is configured with a JSON file. Several parameters can be set.
10+
The Micro Manager is configured with a [JSON](https://en.wikipedia.org/wiki/JSON#Syntax) file. Several parameters can be set, in different sections. For example:
11+
12+
```json
13+
{
14+
"micro_file_name": "python/micro.py",
15+
"coupling_params": {
16+
"precice_config_file_name": "precice-config.xml",
17+
"macro_mesh_name": "Macro-Mesh",
18+
"read_data_names": ["Macro-Scalar", "Macro-Vector"],
19+
"write_data_names": ["Micro-Scalar", "Micro-Vector"]
20+
},
21+
"simulation_params": {
22+
"micro_dt": 1.0,
23+
"macro_domain_bounds": [0.0, 1.0, 0.0, 1.0, 0.0, 1.0]
24+
}
25+
}
26+
```
1127

1228
## Micro Manager Configuration
1329

30+
These parameters are in the outer section.
31+
1432
| Parameter | Description | Default |
1533
|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
1634
| `micro_file_name` | Path to the file containing the Python importable micro simulation class. If the file is not in the working directory, give the relative path from the directory where the Micro Manager is executed. | - |
@@ -25,6 +43,8 @@ Apart from the base settings, there are three main sections in the configuration
2543

2644
## Coupling Parameters
2745

46+
These parameters are in the section `coupling_params`.
47+
2848
| Parameter | Description |
2949
|----------------------------|--------------------------------------------------------------------------------|
3050
| `precice_config_file_name` | Path to the preCICE XML configuration file from the current working directory. |
@@ -34,6 +54,8 @@ Apart from the base settings, there are three main sections in the configuration
3454

3555
## Simulation Parameters
3656

57+
These parameters are in the section `simulation_params`.
58+
3759
| Parameter | Description | Default |
3860
| --- | --- | --- |
3961
| `macro_domain_bounds` | Minimum and maximum bounds of the macro-domain, having the format `[xmin, xmax, ymin, ymax, zmin, zmax]` in 3D and `[xmin, xmax, ymin, ymax]` in 2D. | - |
@@ -50,6 +72,8 @@ Non-uniform domain decomposition is based on a geometric progression.
5072

5173
## Diagnostics
5274

75+
These parameters are in the section `diagnostics`.
76+
5377
| Parameter | Description | Default |
5478
|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|---------|
5579
| `data_from_micro_sims` | Dictionary with the names of the data from the micro simulation to be written to VTK files as keys and `"scalar"` or `"vector"` as values. | - |
@@ -117,7 +141,7 @@ To turn on model adaptivity, set `"model_adaptivity": true` in `simulation_param
117141

118142
| Parameter | Description |
119143
|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
120-
| `micro_file_names` | List of paths to the files containing the Python importable micro simulation classes. If the files are not in the working directory, give the relative path from the directory where the Micro Manager is executed. Requires a minimum of 2 files. |
144+
| `micro_file_names` | List of paths to the files containing the Python importable micro simulation classes, in order of decreasing model fidelity. If the files are not in the working directory, give the relative path from the directory where the Micro Manager is executed. Requires a minimum of 2 files. |
121145
| `switching_function` | Path to the file containing the Python importable switching function. If the file is not in the working directory, give the relative path from the directory where the Micro Manager is executed. |
122146
| `micro_stateless` | List of boolean values, whether the respective micro simulation model is stateless and can use model instancing. |
123147

@@ -161,7 +185,7 @@ The Micro Manager uses the output functionality of preCICE, hence these data set
161185
## Load balancing
162186

163187
Load balancing can be activated by setting `load_balancing` to true.
164-
It balances based on either the elapsed time required to solve the prior iteration `type="time""` or the number of active simulations `type=active`.
188+
It balances based on either the elapsed time required to solve the prior iteration `type="time"` or the number of active simulations `type="active"`.
165189
One Initial load balancing step is performed, prior to any computation (assuming equal workload for time based load balancing or the current active counts for `active` load balancing.).
166190
Subsequently, in the following iteration another load balancing step is performed based. (This is mainly for the time based balancing to use the just acquired timings.)
167191
Afterwards balancing is performed `every_n_time_windows`.

docs/micro-simulation-convert-to-library.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,21 @@ class MicroSimulation: # Name is fixed
6969
It will be called with frequency set by configuration option `simulation_params: micro_output_n`
7070
This function is *optional*.
7171
"""
72+
73+
def set_global_id(self, sim_id):
74+
"""
75+
Reset the global ID of the micro simulation.
76+
77+
Parameters
78+
----------
79+
sim_id : int
80+
New global ID of the simulation instance.
81+
"""
82+
83+
def get_global_id(self):
84+
"""
85+
Return the global ID of the simulation.
86+
"""
7287
```
7388

7489
A dummy code of a sample MicroSimulation class can be found in the [examples/python-dummy/micro_dummy.py](https://github.com/precice/micro-manager/blob/develop/examples/python-dummy/micro_dummy.py) directory.

docs/model-adaptivity.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,5 @@ The output is expected to be an integer and is interpreted in the following mann
169169
| 0 | No resolution change |
170170
| -1 | Increase model fidelity by one (go back one in list) |
171171
| 1 | Decrease model fidelity by one (go one ahead in list) |
172+
173+
If the switching function requests a change beyond the available resolution range, the request is ignored and does not trigger another model-adaptivity iteration.

0 commit comments

Comments
 (0)