PETSC

From GHER

Jump to: navigation, search

Contents

Installation of PETSC

Necessary packages on Ubuntu

sudo apt-get install valgrind gfortran build-essential libopenmpi-dev openmpi-bin libblas-dev liblapack-dev

Sources are available from http://www.mcs.anl.gov/petsc/index.html.


wget http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.3-p2.tar.gz
tar -xzf petsc-lite-3.3-p2.tar.gz
cd petsc-3.3-p2/
./configure
# compilation
make PETSC_DIR=$HOME/Downloads/petsc-3.3-p2 PETSC_ARCH=arch-linux2-c-debug all
# tests
make PETSC_DIR=$HOME/Downloads/petsc-3.3-p2 PETSC_ARCH=arch-linux2-c-debug test


The test run returns the following output:

Running test examples to verify correct installation
Using PETSC_DIR=/home/abarth/Downloads/petsc-3.3-p2 and PETSC_ARCH=arch-linux2-c-debug
C/C++ example src/snes/examples/tutorials/ex19 run successfully with 1 MPI process
C/C++ example src/snes/examples/tutorials/ex19 run successfully with 2 MPI processes
Fortran example src/snes/examples/tutorials/ex5f run successfully with 1 MPI process
Completed test examples


Examples related to DIVA

in src/ksp/ksp/examples/tutorials

ex2f.F
Poisson's equation in 2D (real)

Compilation

make PETSC_DIR=$HOME/Downloads/petsc-3.3-p2 PETSC_ARCH=arch-linux2-c-debug ex2f

Run

Domain size of 100 x 100:

$ mpirun -np 2 ex2f -m 100 -n 100
Norm of error  0.3148E-01 iterations    89

Preconditioner benchmark

bjacobi is the default preconditioner. The preconditioner can be set using the command line option -pc_type.

(for pc in none jacobi pbjacobi bjacobi sor lu mg eisenstat ilu icc cholesky asm gasm ksp redundant mat redistribute svd gamg; do
  out=$(TIME="%U" time mpirun -np 1 ex2f  -ksp_rtol 1e-8 -m 150 -n 150 -pc_type $pc 2>&1 )
  echo $pc: $out
done) | tee result.txt


Preconditioner residulal norm iterations CPU time
none0.2788E-03211211.85
jacobi0.2788E-03211212.10
pbjacobi0.2788E-03211212.02
bjacobi0.3343E-041861.51
sor0.6871E-042942.11
lu0.5432E-1110.50
mg0.3697E-041181.60
eisenstat0.9703E-042951.94
ilu0.3343E-041861.30
icc0.3343E-041861.32
cholesky0.1742E-1016.06
asm0.3343E-041861.61
gasm0.3343E-041861.61
ksp0.1236E-0433.09
redundant0.5432E-1110.48
mat0.1315E+031000073.92
redistribute0.1236E-0433.21
gamg0.3208E-05291.26

The following PCs failed: shell composite nn fieldsplit galerkin exotic hmpi asa cp lsc tfs and the pc svd used may to much memory.


Scalability

Case 300x300 for 1 to 10 CPUs on gher-dineof01 (Intel Core i7-3930K CPU @ 3.20GHz; 12 cores; gcc 4.6.3; Ubuntu 12.04).

(for i in $(seq 1 10); do out=$(TIME="%e" time mpirun -np $i ex2f  -ksp_rtol 1e-8 -m 300 -n 300 -pc_type bjacobi 2>&1); echo $i $out ; done) | tee out


Case 600x600


Case 1200x1200

Personal tools