-
Notifications
You must be signed in to change notification settings - Fork 3
/
README
139 lines (94 loc) · 3.14 KB
/
README
1
2
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
PyGyro
======
PyGyro is a Python-3 library for parallel gyro-kinetic simulations.
Requirements
============
The following python packages are required:
coverage
h5py
matplotlib
mpi4py
numpy
pytest
scipy
This project requires parallel h5py. The commands to install this are as follows:
```
export CC=mpicc
export HDF5_MPI="ON"
export HDF5_DIR=$HDF5_HOME
pip install --no-binary=h5py h5py
```
On a module based system the following modules must first be loaded:
```
module load impi
module load anaconda/3
module load mpi4py
module load hdf5-mpi
```
If the module based system does not have parallel h5py installed, a virtual environment can be used. In this case the following modules must be loaded:
```
module load impi
module load anaconda/3
module load hdf5-mpi
```
Then the virtual environment with mpi4py and h5py can be created using the following commands:
```
export CC=$(which mpicc)
export HDF5_MPI="ON"
python3 -m venv venv
source venv/bin/activate
python3 -m pip install --no-binary=mpi4py mpi4py
python3 -m pip install --no-binary=h5py h5py
python3 -m pip install -r requirements.txt
```
The virtual environment can be accessed using `source venv/bin/activate` and is deactivated with the command `deactivate`.
Run
===
The pure python code can be run using the command:
python fullSimulation.py
There are 2 obligatory positional arguments. The first is the end time of the simulation. The second is the maximum real-world runtime.
In addition there are 3 optional arguments:
-f foldername
-c constantsFile
-s saveStep
Either a constants file or a folder containing a constants file must be provided.
Example constants files can be found in the testSetups/ folder
Acceleration
============
The code can be run using pure python, using acceleration provided by numba or using acceleration provided by pyccel.
Numba
=====
In order to run pygyro using numba, the numba package must be installed.
The command
```
make ACC=numba numba
```
will compile the code using the numba ahead-of-time compiler.
The code can then be run as previously described for the pure python setup.
Pyccel
======
In order to run pygyro using pyccel, the pyccel package must be installed.
The command
```
make ACC=pycc LANGUAGE=[X] pycc
```
will compile the code which has been generated by pyccel. Where [X] is one of: fortran, c
The code can then be run as previously described for the pure python setup.
When using the pyccel generated code the option `COMP=intel` can also be specified if the intel compiler should be used.
These options can all be specified in the makefile. A simple `make` command defaults to `make ACC=pycc LANGUAGE=fortran pycc COMP=gnu`.
Pythran
=======
In order to run pygyro using pythran, the pythran package must be installed.
The command
```
make ACC=pythran pythran
```
will compile the code using pythran.
The code can then be run as previously described for the pure python setup.
Plotting
========
Several plotting tools are provided inside the plotting/ folder.
Some of these import tools from inside pygyro. In order to use these please run the following command from the pygyro home directory before calling them:
```
export PYTHONPATH=$(pwd)
```