Skip to content

Commit 3f84816

Browse files
authored
Merge pull request #5 from CMCC-Foundation/free_numdom
Run with any number of MPI processes.
2 parents 481c891 + 9f3de22 commit 3f84816

File tree

3 files changed

+273
-193
lines changed

3 files changed

+273
-193
lines changed

README.md

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,32 @@ conda env create -f environment.yml
2121
conda activate nemo_rebuild
2222
```
2323

24-
In order to avoid issues during later updates, It is necessary to pin the netCDF4 python module in the anaconda environment :
24+
In order to avoid issues during later updates, it is necessary to pin the netCDF4 and MPICH python modules in the anaconda environment :
2525

2626
```
27-
echo 'netcdf4 *mpich*' >> ${CONDA_PREFIX}/conda-meta/pinned
27+
echo 'netcdf4 * *mpich*' >> ${CONDA_PREFIX}/conda-meta/pinned
28+
echo 'mpich * *external*' >> ${CONDA_PREFIX}/conda-meta/pinned
2829
```
2930

31+
The choice of the external build of the MPICH package enable the use of the MPI library installed on the HPC platform (Intel MPI, etc...), provided that the environment is properly set up (e.g. module load impi-2021.6.0/2021.6.0).
32+
3033
### Usage of nemo\_rebuild.py
3134

35+
First of all the correct environment needs to be set up with:
36+
```
37+
module load impi-2021.6.0/2021.6.0 # or whatever MPI library is available on the HPC platoform
38+
conda activate nemo_rebuild
39+
```
40+
Once the environment is properly set up the script nemo_rebuild.py can be run:
41+
3242
```
3343
python nemo_rebuild.py -h
34-
usage: mpirun -n N python nemo_rebuild.py [-h] -i IN_FILE [-o OUT_FILE]
35-
[-n NUMDOM] [-f FILL] [-v VARIABLES]
36-
[-r] [--verbose]
44+
usage: mpirun -n N python nemo_rebuild.py [-h] -i IN_FILE [-o OUT_FILE] [-n NUMDOM] [-f FILL] [-v VARIABLES] [-r] [-c]
45+
[--verbose] [-V]
3746
3847
NEMO output/restart file rebuilder
3948
40-
optional arguments:
49+
options:
4150
-h, --help show this help message and exit
4251
-i IN_FILE, --input IN_FILE
4352
input file name
@@ -49,7 +58,9 @@ optional arguments:
4958
-v VARIABLES, --variable VARIABLES
5059
Variable(s) to rebuild
5160
-r, --remove_halo Remove global domain halo (rebuilt restart file won't work)
61+
-c, --classic use NetCDF4 Classic format (default: False)
5262
--verbose Verbose mode
63+
-V, --version show program's version number and exit
5364
5465
Rebuild NEMO/XIOS multiple output/restart files in a single file
5566
```
@@ -61,24 +72,30 @@ Rebuild NEMO/XIOS multiple output/restart files in a single file
6172
Examples
6273
--------
6374

64-
#### The rebuild script can be run either sequentially or using MPI parallelization as described below.
75+
The rebuild script can be run either sequentially or using MPI parallelization as described below.
76+
77+
### Sequential run
6578

66-
We want to rebuild a set of nemo restart files from ORCA1 configuration. The minimal command line to perform a simple **sequential** reconstruction is
79+
We want to rebuild a set of NEMO restart files from ORCA1 configuration. The minimal command line to perform a simple **sequential** reconstruction is
6780
```
6881
python nemo_rebuild.py -i ORCA1_01305240_restart
6982
```
7083
and the script will automatically detect the number of subdomain files.
84+
In this case it's not mandatory to set up the MPI environment (module load ...).
7185

72-
Let's rebuild nemo output files from ORCA025 configuration by using the **MPI** interface to speed up things ...
86+
### Parallel run
87+
88+
Let's rebuild NEMO output files from ORCA025 configuration by using the **MPI** interface to speed up things ...
7389
```
7490
mpirun -n N python nemo_rebuild.py -i ORCA025_1m_20000101_20000131_grid_T
7591
```
7692
where N is the number of MPI tasks required.
93+
The number N of MPI tasks cannot exceed the number of subdomains and does not necessarily have to be an integer divisor of the number of subdomains.
7794

78-
Install package
79-
---------------
95+
Install as a package
96+
--------------------
8097

81-
When installed as package, an executable names nemo\_rebuild\_py will be added to your path, so you can call it from wherever which executees the main python function of the script. The package can be installed by launching
98+
When installed as a package, an executable named nemo\_rebuild\_py will be added to your path, so one can call it from anywhere, provided that the conda and MPI environments are properly set up. The package can be installed by launching:
8299
```
83100
pip install .
84101
```

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ dependencies:
77
# Multi language support:
88
- python>=3.6
99
- netcdf4=*=mpi_mpich*
10+
- mpich=*=*external*
1011
- mpi4py

0 commit comments

Comments
 (0)