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 | subprocess.call([sys.executable, '..' + os.sep + 'utilities' + os.sep + 'compile.py', 'rand48.c']) |
---|
66 | subprocess.call([sys.executable, '..' + os.sep + 'utilities' + os.sep + 'compile.py', 'ptinpoly.c']) |
---|
67 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
68 | |
---|
69 | |
---|
70 | os.chdir(buildroot) |
---|
71 | |
---|
72 | print '-----------------------------------------------' |
---|
73 | print 'Attempting to compile Metis for parallel ANUGA!' |
---|
74 | print '-----------------------------------------------' |
---|
75 | |
---|
76 | # Attempt to compile Metis for use with anuga_parallel |
---|
77 | os.chdir('source') |
---|
78 | os.chdir('anuga_parallel') |
---|
79 | os.chdir('pymetis') |
---|
80 | |
---|
81 | make_logfile = os.path.join(buildroot, 'make_metis.log') |
---|
82 | options = '' |
---|
83 | if sys.platform == 'win32': |
---|
84 | options = 'for_win32' |
---|
85 | else: |
---|
86 | if os.name == 'posix': |
---|
87 | if os.uname()[4] in ['x86_64', 'ia64']: |
---|
88 | options = ' ' |
---|
89 | |
---|
90 | make_command = 'make %s > %s' % (options, make_logfile) |
---|
91 | print make_command |
---|
92 | err = os.system(make_command) |
---|
93 | if err != 0: |
---|
94 | msg = 'Could not compile Metis ' |
---|
95 | msg += 'on platform %s, %s\n' % (sys.platform, os.name) |
---|
96 | msg += 'You need to compile Metis manually ' |
---|
97 | msg += 'if you want to run ANUGA in parallel.' |
---|
98 | raise Exception, msg |
---|
99 | else: |
---|
100 | msg = 'Compiled Metis succesfully. Output from Make is available in %s'\ |
---|
101 | % make_logfile |
---|
102 | print msg |
---|
103 | |
---|
104 | |
---|
105 | print '-----------------------------------------------' |
---|
106 | print 'Attempting to compile pypar_extras' |
---|
107 | print '-----------------------------------------------' |
---|
108 | |
---|
109 | os.chdir('..') |
---|
110 | os.chdir('pypar_extras') |
---|
111 | |
---|
112 | cmd = 'python anuga_setup.py' |
---|
113 | print cmd |
---|
114 | err = os.system(cmd) |
---|
115 | if err != 0: |
---|
116 | msg = 'Could not compile pypar_extras ' |
---|
117 | msg += 'on platform %s, %s\n' % (sys.platform, os.name) |
---|
118 | msg += 'You need to compile pypar_extras manually ' |
---|
119 | msg += 'if you want to run ANUGA in parallel.' |
---|
120 | raise Exception, msg |
---|
121 | else: |
---|
122 | msg = 'Compiled pypar_extras succesfully.' |
---|
123 | print msg |
---|
124 | |
---|
125 | |
---|
126 | print |
---|
127 | print 'That took %.3fs' %(time.time() - t0) |
---|
128 | |
---|
129 | |
---|
130 | |
---|
131 | if sys.platform == 'win32': |
---|
132 | raw_input('Press the RETURN key') |
---|