Python 4 HPC
Python 4 HPC
Ariel Lozano
CÉCI training
primes = primes_upto ( 25 )
print ( primes )
$ python sieve01.py
real 0m10.419s
user 0m10.192s
sys 0m0.217s
I using timeit module to average several runs
$ python -m timeit -n 3 -r 3 -s "import sieve01" \
> "sieve01.primes_upto(30000000)"
import numpy as np
real 0m2.593s
user 0m2.222s
sys 0m0.294s
Parallel processing
I multiprocessing module
I allows to use process- and thread-based parallel processing
I allows to share memory among processes
I constrained to single-machine multicore parallelism
I mpi4py
I Python bindings to the MPI-1/2/3 interfaces
I if you know MPI on C/Fortran you already know mpi4py
I can make use equivalently of multiple cores on a single-machine
or distributed
I each process has a separate address space, no possibility to
share memory between them
I we covered it in the MPI session
Further information on the topic