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