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 | execfile('compile_all.py') |
---|
20 | |
---|
21 | |
---|
22 | os.chdir(buildroot) |
---|
23 | |
---|
24 | try: |
---|
25 | print '-----------------------------------------------' |
---|
26 | print 'Attempting to compile Metis for parallel ANUGA!' |
---|
27 | print '-----------------------------------------------' |
---|
28 | |
---|
29 | import pypar |
---|
30 | |
---|
31 | # Attempt to compile Metis for use with anuga_parallel |
---|
32 | os.chdir('source') |
---|
33 | os.chdir('anuga_parallel') |
---|
34 | os.chdir('pymetis') |
---|
35 | |
---|
36 | make_logfile = os.path.join(buildroot, 'make_metis.log') |
---|
37 | options = '' |
---|
38 | if sys.platform == 'win32': |
---|
39 | options = 'for_win32' |
---|
40 | else: |
---|
41 | if os.name == 'posix': |
---|
42 | if os.uname()[4] in ['x86_64', 'ia64']: |
---|
43 | options = ' ' |
---|
44 | |
---|
45 | make_command = 'make %s > %s' % (options, make_logfile) |
---|
46 | print make_command |
---|
47 | err = os.system(make_command) |
---|
48 | if err != 0: |
---|
49 | msg = 'Could not compile Metis ' |
---|
50 | msg += 'on platform %s, %s\n' % (sys.platform, os.name) |
---|
51 | msg += 'You need to compile Metis manually ' |
---|
52 | msg += 'if you want to run ANUGA in parallel.' |
---|
53 | raise Exception, msg |
---|
54 | else: |
---|
55 | msg = 'Compiled Metis succesfully. Output from Make is available in %s'\ |
---|
56 | % make_logfile |
---|
57 | print msg |
---|
58 | |
---|
59 | print |
---|
60 | print '-----------------------------------------------' |
---|
61 | print 'Attempting to compile pypar_extras' |
---|
62 | print '-----------------------------------------------' |
---|
63 | |
---|
64 | os.chdir('..') |
---|
65 | os.chdir('pypar_extras') |
---|
66 | |
---|
67 | cmd = 'python anuga_setup.py' |
---|
68 | print cmd |
---|
69 | err = os.system(cmd) |
---|
70 | if err != 0: |
---|
71 | msg = 'Could not compile pypar_extras ' |
---|
72 | msg += 'on platform %s, %s\n' % (sys.platform, os.name) |
---|
73 | msg += 'You need to compile pypar_extras manually ' |
---|
74 | msg += 'if you want to run ANUGA in parallel.' |
---|
75 | raise Exception, msg |
---|
76 | else: |
---|
77 | msg = 'Compiled pypar_extras succesfully.' |
---|
78 | print msg |
---|
79 | except: |
---|
80 | print 'anuga_parallel code not compiled as pypar not installed' |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | print |
---|
85 | print 'That took %.3fs' %(time.time() - t0) |
---|
86 | |
---|
87 | |
---|
88 | |
---|
89 | |
---|