Newer
Older
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
This repository serves as an example on the conversion of OASIS components from Fortran to Python (using [pyOASIS](https://gitlab.com/cerfacs/oasis3-mct/-/tree/master/pyOASIS)). More precisely, this "toy model" is taken from the `spoc/spoc_communication` example from the [OASIS3-MCT4.0 branch](https://gitlab.com/cerfacs/oasis3-mct/-/tree/OASIS3-MCT_4.0/examples/spoc/spoc_communication). This toy model consists of two components (ocean and atmos) and implements basic coupling exchanges between them.
## Table of contents <!-- omit in toc -->
- [Running the example](#running-the-example)
- [Requirements](#requirements)
- [Compile](#compile)
- [Run](#run)
- [Running the tests](#running-the-tests)
### Running the example
#### Requirements
This documentation assumes you are running an UNIX-based OS with Python3 in the PATH, understand the basics of OASIS and are able to compile and run pyOASIS.
#### Compile
In the root folder of this repository there is a [Makefile](./Makefile) which serves as a root makefile for both the Fortran and Python examples. Each of the example codes is located in its respect folder ([`fortran/`](./fortran/) and [`python/`](./python/)) with their unique Makefile.
By executing the following command in the root folder of this repository, you will compile OASIS, pyOASIS and the Fortran implementation of this model.
```bash
make
```
If this is the first time you are compiling pyOASIS, you must issue the command
```bash
source /home/rapsss/oasis3-mct/../compile_oa3-mct/python/init.sh
```
```bash
source /home/rapsss/oasis3-mct/../compile_oa3-mct/python/init.csh
```
Alternatively, these lines could be added to your `~/.bashrc` or `~/.cshrc` file.
**IMPORTANT NOTICE**: These Makefiles depend on a file named `make.inc`, provided in the OASIS3-MCT repository, and assume its location is `../../../util/make_dir/make.inc`. Feel free to make the necessary changes to these files in order to make it work in your setup.
#### Run
In order to run the example code with your desired programming language you must execute `run.example`. Here is an example on how to run the example with ocean running in Fortran and atmos running in Python, both in 4 MPI processes.
```bash
bash ./run_example.sh fortran python 4 4
```
Here is the complete specification for the script:
```bash
./run_example.sh <ocean_lang> <atmos_lang> <ocean_nproc> <atmos_nproc>
```
Running this script will create a new folder in the root folder of this repository called `work_<ocean_lang>_<atmos_lang>_<ocean_nproc>_<atmos_nproc>` with all the output and debug information from the run.
### Running the tests
Execute the following command in your shell to run all tests (make sure to meet all the [requirements](#requirements) stated above).
```bash
bash run_tests.sh
```
This command will run all combinations (Fortran-Fortran, Python-Fortran, Fortran-Python and Python-Python) of the components and check if all of them result in the same output. Here is an example on a successfull test run:
```
Checking results...
atmos PASSED
ocean PASSED
```