source: trunk/anuga_core/compile_all.py @ 9454

Last change on this file since 9454 was 9362, checked in by davies, 10 years ago

testing commit from new machine

File size: 3.1 KB
Line 
1import os
2import time
3import sys
4import subprocess
5
6buildroot = os.getcwd()
7
8
9#--------------------------------------------------
10# Compiling anuga code
11#--------------------------------------------------
12os.chdir('source')
13os.chdir('anuga')
14
15
16print 'Changing to', os.getcwd()       
17
18#entries = listdir('.')
19
20t0 = time.time()
21
22# Attempt to compile all ANUGA extensions
23execfile('compile_all.py')
24
25
26os.chdir(buildroot)
27
28
29#--------------------------------------------------
30# Compiling anuga_1d code
31# excluded for the time being
32#--------------------------------------------------
33#os.chdir('anuga_1d')
34
35
36#t0 = time.time()
37
38# Attempt to compile all ANUGA_1D extensions
39#execfile('compile_all.py')
40
41
42os.chdir(buildroot)
43print 'Changing to', os.getcwd()       
44
45#--------------------------------------------------
46# Compiling partition code
47#--------------------------------------------------
48
49try:
50    print '-----------------------------------------------'
51    print 'Attempting to compile Metis'
52    print '-----------------------------------------------'
53
54    import pypar
55
56    # Attempt to compile Metis for use with anuga_parallel
57    os.chdir('source')
58    os.chdir('anuga_parallel')
59    os.chdir('pymetis')
60
61    print 'Changing to', os.getcwd()       
62
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
85       
86except:
87    print 'pymetis could not compile as pypar not installed'
88
89
90os.chdir(buildroot)
91print 'Changing to', os.getcwd() 
92
93#--------------------------------------------------
94# Compiling pypar_extras
95#--------------------------------------------------
96
97try:
98    print 
99    print '-----------------------------------------------'
100    print 'Attempting to compile pypar_extras'
101    print '-----------------------------------------------'
102
103    import pypar
104   
105    os.chdir('source')
106    os.chdir('anuga_parallel')
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 successfully.'
120        print msg
121except:
122    print 'anuga_parallel code not compiled as pypar not installed'
123
124
125
126print       
127print 'That took %.3fs' %(time.time() - t0)
128
129
130
131
Note: See TracBrowser for help on using the repository browser.