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('abstract_2d_finite_volumes') |
---|
23 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
24 | |
---|
25 | os.chdir('..') |
---|
26 | os.chdir('advection') |
---|
27 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
28 | |
---|
29 | |
---|
30 | os.chdir('..') |
---|
31 | os.chdir('shallow_water') |
---|
32 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
33 | |
---|
34 | os.chdir('..') |
---|
35 | os.chdir('mesh_engine') |
---|
36 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
37 | |
---|
38 | os.chdir(buildroot) |
---|
39 | |
---|
40 | print '-----------------------------------------------' |
---|
41 | print 'Attempting to compile Metis for parallel ANUGA!' |
---|
42 | print '-----------------------------------------------' |
---|
43 | |
---|
44 | # Attempt to compile Metis for use with anuga_parallel |
---|
45 | os.chdir('source') |
---|
46 | os.chdir('pymetis') |
---|
47 | |
---|
48 | make_logfile = os.path.join(buildroot, 'make_metis.log') |
---|
49 | options = '' |
---|
50 | if sys.platform == 'win32': |
---|
51 | options = 'for_win32' |
---|
52 | else: |
---|
53 | if os.name == 'posix': |
---|
54 | if os.uname()[4] in ['x86_64', 'ia64']: |
---|
55 | options = 'COPTIONS="-fPIC"' |
---|
56 | |
---|
57 | make_command = 'make %s > %s' % (options, make_logfile) |
---|
58 | print make_command |
---|
59 | err = os.system(make_command) |
---|
60 | if err != 0: |
---|
61 | msg = 'Could not compile Metis ' |
---|
62 | msg += 'on platform %s, %s\n' % (sys.platform, os.name) |
---|
63 | msg += 'You need to compile Metis manually ' |
---|
64 | msg += 'if you want to run ANUGA in parallel.' |
---|
65 | raise Exception, msg |
---|
66 | else: |
---|
67 | msg = 'Compiled Metis succesfully. Output from Make is available in %s'\ |
---|
68 | % make_logfile |
---|
69 | print msg |
---|
70 | |
---|
71 | print |
---|
72 | print 'That took %.3fs' %(time.time() - t0) |
---|
73 | |
---|
74 | if sys.platform == 'win32': |
---|
75 | raw_input('Press the RETURN key') |
---|