Skip to content
GitLab
Explore
Sign in
Jussi Enkovaara
MPI
Compare revisions
68f01118b79a3c3272290270453ece63c1cf9806 to d13f38ea4c056b6b63bc3343dccb713a4915735a
Commits on Source (3)
Use same defaults as with C and Fortran
· 138520d6
Jussi Enkovaara
authored
Jul 04, 2018
138520d6
Add few notes about Python implementation and building the Cython
· 6f30a5fe
Jussi Enkovaara
authored
Jul 04, 2018
kernels
6f30a5fe
Merge branch 'master' of
https://repository.prace-ri.eu/git/jussi.enkovaara/MPI
· d13f38ea
Jussi Enkovaara
authored
Jul 04, 2018
d13f38ea
Hide whitespace changes
Inline
Side-by-side
heat-equation/python/README.md
0 → 100644
View file @
d13f38ea
# Python implementation
The Python implementation utilizes NumPy and mpi4py for computation and
communication, as well as matplotlib for outputting images. The main program
is implemented in
[
heat.py
](
heat.py
)
, and the whole program can be executed as
mpirun -np xxx python heat.py
## Using Cython kernel
By default, the code uses pure NumPy for evaluating the time evolution
step. In addition, a Cython version for the main computational kernels
is provided in
[
evolve.pyx
](
evolve.pyx
)
. The Cython kernels can be built
into Python extension in current directory with
python setup.py build_ext --inplace
After building the Cython kernels main program can be executed as previously.
heat-equation/python/heat_setup.py
View file @
d13f38ea
...
...
@@ -8,8 +8,8 @@ from heat_io import read_restart, read_field
def
initialize
():
timesteps
=
500
# Number of time-steps to evolve system
nx
=
1
000
ny
=
1
000
nx
=
2
000
ny
=
2
000
if
isfile
(
'
HEAT_RESTART.dat
'
):
field
,
field0
,
parallel
,
iter0
=
read_restart
()
...
...
@@ -31,7 +31,7 @@ def initialize():
iter0
=
0
return
field
,
field0
,
parallel
,
iter0
,
timesteps
return
field
,
parallel
,
iter0
,
timesteps
def
generate_field
(
nx
,
ny
):
...
...