1 | import os |
---|
2 | import time |
---|
3 | import sys |
---|
4 | import subprocess |
---|
5 | |
---|
6 | buildroot = os.getcwd() |
---|
7 | |
---|
8 | os.chdir('source') |
---|
9 | os.chdir('anuga') |
---|
10 | |
---|
11 | |
---|
12 | print 'Changing to', os.getcwd() |
---|
13 | |
---|
14 | #entries = listdir('.') |
---|
15 | |
---|
16 | t0 = time.time() |
---|
17 | |
---|
18 | # Attempt to compile all ANUGA extensions |
---|
19 | |
---|
20 | os.chdir('utilities') |
---|
21 | subprocess.call([sys.executable, 'compile.py', 'quad_tree.c']) |
---|
22 | subprocess.call([sys.executable, 'compile.py', 'sparse_dok.c']) |
---|
23 | subprocess.call([sys.executable, 'compile.py', 'sparse_csr.c']) |
---|
24 | execfile('compile.py') |
---|
25 | |
---|
26 | os.chdir('..') |
---|
27 | os.chdir('advection') |
---|
28 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
29 | |
---|
30 | os.chdir('..') |
---|
31 | os.chdir('operators') |
---|
32 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
33 | |
---|
34 | os.chdir('..') |
---|
35 | os.chdir('file_conversion') |
---|
36 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
37 | |
---|
38 | os.chdir('..') |
---|
39 | os.chdir('geometry') |
---|
40 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
41 | |
---|
42 | os.chdir('..') |
---|
43 | os.chdir('structures') |
---|
44 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
45 | |
---|
46 | os.chdir('..') |
---|
47 | os.chdir('abstract_2d_finite_volumes') |
---|
48 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
49 | |
---|
50 | os.chdir('..') |
---|
51 | os.chdir('file') |
---|
52 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
53 | |
---|
54 | os.chdir('..') |
---|
55 | os.chdir('shallow_water') |
---|
56 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
57 | |
---|
58 | |
---|
59 | os.chdir('..') |
---|
60 | os.chdir('mesh_engine') |
---|
61 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
62 | |
---|
63 | os.chdir('..') |
---|
64 | os.chdir('fit_interpolate') |
---|
65 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
66 | |
---|
67 | |
---|
68 | os.chdir(buildroot) |
---|
69 | |
---|
70 | print '-----------------------------------------------' |
---|
71 | print 'Attempting to compile Metis for parallel ANUGA!' |
---|
72 | print '-----------------------------------------------' |
---|
73 | |
---|
74 | # Attempt to compile Metis for use with anuga_parallel |
---|
75 | os.chdir('source') |
---|
76 | os.chdir('anuga_parallel') |
---|
77 | os.chdir('pymetis') |
---|
78 | |
---|
79 | make_logfile = os.path.join(buildroot, 'make_metis.log') |
---|
80 | options = '' |
---|
81 | if sys.platform == 'win32': |
---|
82 | options = 'for_win32' |
---|
83 | else: |
---|
84 | if os.name == 'posix': |
---|
85 | if os.uname()[4] in ['x86_64', 'ia64']: |
---|
86 | options = ' ' |
---|
87 | |
---|
88 | make_command = 'make %s > %s' % (options, make_logfile) |
---|
89 | print make_command |
---|
90 | err = os.system(make_command) |
---|
91 | if err != 0: |
---|
92 | msg = 'Could not compile Metis ' |
---|
93 | msg += 'on platform %s, %s\n' % (sys.platform, os.name) |
---|
94 | msg += 'You need to compile Metis manually ' |
---|
95 | msg += 'if you want to run ANUGA in parallel.' |
---|
96 | raise Exception, msg |
---|
97 | else: |
---|
98 | msg = 'Compiled Metis succesfully. Output from Make is available in %s'\ |
---|
99 | % make_logfile |
---|
100 | print msg |
---|
101 | |
---|
102 | |
---|
103 | print '-----------------------------------------------' |
---|
104 | print 'Attempting to compile pypar_extras' |
---|
105 | print '-----------------------------------------------' |
---|
106 | |
---|
107 | os.chdir('..') |
---|
108 | os.chdir('pypar_extras') |
---|
109 | |
---|
110 | cmd = 'python anuga_setup.py' |
---|
111 | print cmd |
---|
112 | err = os.system(cmd) |
---|
113 | if err != 0: |
---|
114 | msg = 'Could not compile pypar_extras ' |
---|
115 | msg += 'on platform %s, %s\n' % (sys.platform, os.name) |
---|
116 | msg += 'You need to compile pypar_extras manually ' |
---|
117 | msg += 'if you want to run ANUGA in parallel.' |
---|
118 | raise Exception, msg |
---|
119 | else: |
---|
120 | msg = 'Compiled pypar_extras succesfully.' |
---|
121 | print msg |
---|
122 | |
---|
123 | |
---|
124 | print |
---|
125 | print 'That took %.3fs' %(time.time() - t0) |
---|
126 | |
---|
127 | |
---|
128 | |
---|
129 | if sys.platform == 'win32': |
---|
130 | raw_input('Press the RETURN key') |
---|