1 | |
---|
2 | ========================= |
---|
3 | INSTALLING anuga_parallel |
---|
4 | ========================= |
---|
5 | |
---|
6 | MPI |
---|
7 | === |
---|
8 | |
---|
9 | First thing, you need to install MPI on your system. OPENMPI and MPICH2 |
---|
10 | are supported by pypar (see below) so both should be ok. |
---|
11 | |
---|
12 | Make sure mpi works. You should be able to run a program in parallel. |
---|
13 | |
---|
14 | Try something as simple as |
---|
15 | |
---|
16 | mpirun -np 4 pwd |
---|
17 | |
---|
18 | should produce the output of pwd 4 times. |
---|
19 | |
---|
20 | PYPAR |
---|
21 | ====== |
---|
22 | |
---|
23 | We use pypar as the interface between mpi and python. The most recent |
---|
24 | version of PYPAR is available from |
---|
25 | |
---|
26 | http://code.google.com/p/pypar/ |
---|
27 | |
---|
28 | (There is an old version on sourceforge |
---|
29 | http://sourceforge.net/projects/pypar/) |
---|
30 | |
---|
31 | Install pypar following the instructions in hte download. Should be able |
---|
32 | use standard python setup.py install |
---|
33 | |
---|
34 | Make sure the pypar examples work |
---|
35 | |
---|
36 | |
---|
37 | PYMETIS |
---|
38 | ======= |
---|
39 | |
---|
40 | In the anuga_parallel directory there is a subdirectory pymetis. |
---|
41 | |
---|
42 | Follow the instructions in README to install. Essentially just run make. |
---|
43 | |
---|
44 | From the pymetis directory, test using test_all.py |
---|
45 | |
---|
46 | ANUGA_PARALLEL |
---|
47 | ============== |
---|
48 | |
---|
49 | Should now be ready to run some parallel anuga code. |
---|
50 | |
---|
51 | Go back to the anuga_parallel directory and run test_all.py |
---|
52 | |
---|
53 | Hopefully that all works. |
---|
54 | |
---|
55 | Run run_parallel_sw_merimbula.py |
---|
56 | |
---|
57 | First just run it a sequential program. |
---|
58 | |
---|
59 | Then try a parallel run using a command like |
---|
60 | |
---|
61 | mpirun -np 4 python run_parallel_sw_merimbula.py |
---|
62 | |
---|
63 | That should run on 4 processors |
---|
64 | |
---|
65 | You should look at the code in run_parallel_sw_merimbula.py |
---|
66 | |
---|
67 | Essentially a fairly standard example, with the extra command |
---|
68 | |
---|
69 | domain = distribute(domain) |
---|
70 | |
---|
71 | which sets up all the parallel stuff. |
---|
72 | |
---|
73 | Also for efficiency reasons we only setup the original full sequential mesh |
---|
74 | on processor 0, hence the statement |
---|
75 | |
---|
76 | if myid == 0: |
---|
77 | domain = create_domain_from_file(mesh_filename) |
---|
78 | domain.set_quantity('stage', Set_Stage(x0, x1, 2.0)) |
---|
79 | else: |
---|
80 | domain = None |
---|
81 | |
---|
82 | The output will be an sww file associated to each |
---|
83 | processor. |
---|
84 | |
---|
85 | There is a script anuga/utilities/sww_merge.py which provides |
---|
86 | a function to merge sww files into one sww file for viewing |
---|
87 | with the anuga viewer. |
---|