File: plot_mpi.py

package info (click to toggle)
amgcl 1.4.4-1
  • links: PTS, VCS
  • area: contrib
  • in suites: sid
  • size: 5,676 kB
  • sloc: cpp: 34,043; python: 747; pascal: 258; f90: 196; makefile: 20
file content (20 lines) | stat: -rwxr-xr-x 418 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python
from pylab import *
from scipy.io import mmread

A = mmread('Serena.mtx')

B = 3
M = 4
n = A.shape[0]
chunk = n // M
if chunk % B:
    chunk += B - chunk % B
domain = [min(n, i*chunk) for i in range(M+1)]

figure(figsize=(8,8))
spy(A, marker='.', markersize=0.25, alpha=0.2)
for i in range(4):
    axhspan(domain[i], domain[i+1], alpha=0.1 * i, zorder=0)
tight_layout()
savefig('Serena_mpi.png')