[2778] | 1 | import os |
---|
[5969] | 2 | import time |
---|
[2778] | 3 | |
---|
| 4 | buildroot = os.getcwd() |
---|
| 5 | |
---|
[5898] | 6 | os.chdir('source') |
---|
[3514] | 7 | os.chdir('anuga') |
---|
| 8 | |
---|
[2778] | 9 | |
---|
| 10 | print 'Changing to', os.getcwd() |
---|
| 11 | |
---|
| 12 | #entries = listdir('.') |
---|
| 13 | |
---|
[5969] | 14 | t0 = time.time() |
---|
[2778] | 15 | |
---|
[7455] | 16 | # Attempt to compile all ANUGA extensions |
---|
[2778] | 17 | |
---|
| 18 | os.chdir('utilities') |
---|
| 19 | execfile('compile.py') |
---|
| 20 | |
---|
| 21 | os.chdir('..') |
---|
[3560] | 22 | os.chdir('abstract_2d_finite_volumes') |
---|
[2778] | 23 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
| 24 | |
---|
| 25 | os.chdir('..') |
---|
[4978] | 26 | os.chdir('advection') |
---|
| 27 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | os.chdir('..') |
---|
[3563] | 31 | os.chdir('shallow_water') |
---|
| 32 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
| 33 | |
---|
| 34 | os.chdir('..') |
---|
[3027] | 35 | os.chdir('mesh_engine') |
---|
[4447] | 36 | execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py') |
---|
[2778] | 37 | |
---|
| 38 | os.chdir(buildroot) |
---|
[7455] | 39 | |
---|
[7456] | 40 | print '-----------------------------------------------' |
---|
| 41 | print 'Attempting to compile Metis for parallel ANUGA!' |
---|
| 42 | print '-----------------------------------------------' |
---|
[7455] | 43 | |
---|
| 44 | # Attempt to compile Metis for use with anuga_parallel |
---|
| 45 | os.chdir('source') |
---|
| 46 | os.chdir('pymetis') |
---|
| 47 | |
---|
[7458] | 48 | make_logfile = os.path.join(buildroot, 'make_metis.log') |
---|
[7456] | 49 | options = '' |
---|
[7455] | 50 | if sys.platform == 'win32': |
---|
[7456] | 51 | options = 'for_win32' |
---|
[7455] | 52 | else: |
---|
| 53 | if os.name == 'posix': |
---|
| 54 | if os.uname()[4] in ['x86_64', 'ia64']: |
---|
[7456] | 55 | options = 'COPTIONS="-fPIC"' |
---|
[7455] | 56 | |
---|
[7456] | 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'\ |
---|
[7457] | 68 | % make_logfile |
---|
| 69 | print msg |
---|
| 70 | |
---|
| 71 | print |
---|
[5969] | 72 | print 'That took %.3fs' %(time.time() - t0) |
---|
[6417] | 73 | |
---|
| 74 | if sys.platform == 'win32': |
---|
[6718] | 75 | raw_input('Press the RETURN key') |
---|