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