source: trunk/anuga_core/compile_all.py @ 9293

Last change on this file since 9293 was 9290, checked in by steve, 11 years ago

Getting rid of come prints from get_water_volume.

File size: 3.0 KB
RevLine 
[2778]1import os
[5969]2import time
[8690]3import sys
4import subprocess
[2778]5
6buildroot = os.getcwd()
7
[9085]8
9#--------------------------------------------------
10# Compiling anuga code
11#--------------------------------------------------
[5898]12os.chdir('source')
[3514]13os.chdir('anuga')
14
[2778]15
16print 'Changing to', os.getcwd()       
17
18#entries = listdir('.')
19
[5969]20t0 = time.time()
[2778]21
[7455]22# Attempt to compile all ANUGA extensions
[8835]23execfile('compile_all.py')
[2778]24
[7812]25
[9085]26os.chdir(buildroot)
[7455]27
[9102]28
[9085]29#--------------------------------------------------
30# Compiling anuga_1d code
31#--------------------------------------------------
32os.chdir('source')
33os.chdir('anuga_1d')
34
35
36t0 = time.time()
37
38# Attempt to compile all ANUGA_1D extensions
39execfile('compile_all.py')
40
41
42os.chdir(buildroot)
[9102]43print 'Changing to', os.getcwd()       
[9085]44
45#--------------------------------------------------
[9289]46# Compiling partition code
[9085]47#--------------------------------------------------
48
[8761]49try:
50    print '-----------------------------------------------'
[9290]51    print 'Attempting to compile Metis'
[8761]52    print '-----------------------------------------------'
[7455]53
[8765]54
[9289]55
[8761]56    # Attempt to compile Metis for use with anuga_parallel
57    os.chdir('source')
58    os.chdir('anuga_parallel')
59    os.chdir('pymetis')
[7455]60
[9102]61    print 'Changing to', os.getcwd()       
62
[8761]63    make_logfile = os.path.join(buildroot, 'make_metis.log')
64    options = ''
65    if sys.platform == 'win32':
66        options = 'for_win32'
67    else:
68        if os.name == 'posix':
69            if os.uname()[4] in ['x86_64', 'ia64']:
70                options = ' '
71
72    make_command = 'make %s > %s' % (options, make_logfile)
73    print make_command
74    err = os.system(make_command)
75    if err != 0:
76        msg = 'Could not compile Metis '
77        msg += 'on platform %s, %s\n' % (sys.platform, os.name)
78        msg += 'You need to compile Metis manually '
79        msg += 'if you want to run ANUGA in parallel.'
80        raise Exception, msg
81    else:
82        msg = 'Compiled Metis succesfully. Output from Make is available in %s'\
83            % make_logfile
84        print msg
[9289]85       
86except:
87    print 'pymetis could not compile'
[8761]88
[9289]89
90os.chdir(buildroot)
91print 'Changing to', os.getcwd() 
92
93#--------------------------------------------------
94# Compiling anuga_parallel code
95#--------------------------------------------------
96
97try:
[8761]98    print 
99    print '-----------------------------------------------'
100    print 'Attempting to compile pypar_extras'
101    print '-----------------------------------------------'
102
[9289]103    import pypar
104   
105    os.chdir('source')
106    os.chdir('anuga_parallel')
[8761]107    os.chdir('pypar_extras')
108
109    cmd = 'python anuga_setup.py'
110    print cmd
111    err = os.system(cmd)
112    if err != 0:
113        msg = 'Could not compile pypar_extras '
114        msg += 'on platform %s, %s\n' % (sys.platform, os.name)
115        msg += 'You need to compile pypar_extras manually '
116        msg += 'if you want to run ANUGA in parallel.'
117        raise Exception, msg
118    else:
119        msg = 'Compiled pypar_extras succesfully.'
120        print msg
121except:
[8766]122    print 'anuga_parallel code not compiled as pypar not installed'
[8761]123
124
125
[7457]126print       
[5969]127print 'That took %.3fs' %(time.time() - t0)
[6417]128
[8512]129
130
[8766]131
Note: See TracBrowser for help on using the repository browser.