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