| 808 |
dsic.upv.es!antodo |
1 |
#!/usr/bin/env python
|
| 1377 |
slepc |
2 |
#
|
|
|
3 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| 1672 |
slepc |
4 |
# SLEPc - Scalable Library for Eigenvalue Problem Computations
|
| 2116 |
eromero |
5 |
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
|
| 1377 |
slepc |
6 |
#
|
| 1672 |
slepc |
7 |
# This file is part of SLEPc.
|
|
|
8 |
#
|
|
|
9 |
# SLEPc is free software: you can redistribute it and/or modify it under the
|
|
|
10 |
# terms of version 3 of the GNU Lesser General Public License as published by
|
|
|
11 |
# the Free Software Foundation.
|
|
|
12 |
#
|
|
|
13 |
# SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
14 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
15 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
|
|
|
16 |
# more details.
|
|
|
17 |
#
|
|
|
18 |
# You should have received a copy of the GNU Lesser General Public License
|
|
|
19 |
# along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
|
| 1377 |
slepc |
20 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
21 |
#
|
| 808 |
dsic.upv.es!antodo |
22 |
|
|
|
23 |
import os
|
|
|
24 |
import sys
|
| 939 |
dsic.upv.es!jroman |
25 |
import time
|
| 808 |
dsic.upv.es!antodo |
26 |
|
| 2211 |
jroman |
27 |
# should be run from the toplevel
|
|
|
28 |
configDir = os.path.abspath('config')
|
|
|
29 |
if not os.path.isdir(configDir):
|
|
|
30 |
raise RuntimeError('Run configure from $SLEPC_DIR, not '+os.path.abspath('.'))
|
|
|
31 |
sys.path.insert(0, configDir)
|
|
|
32 |
|
| 1527 |
slepc |
33 |
import petscversion
|
| 912 |
dsic.upv.es!antodo |
34 |
import petscconf
|
| 923 |
dsic.upv.es!antodo |
35 |
import log
|
| 912 |
dsic.upv.es!antodo |
36 |
import check
|
|
|
37 |
import arpack
|
|
|
38 |
import blzpack
|
|
|
39 |
import trlan
|
|
|
40 |
import lapack
|
| 1187 |
slepc |
41 |
import primme
|
| 1714 |
jroman |
42 |
import slepc4py
|
| 808 |
dsic.upv.es!antodo |
43 |
|
| 861 |
dsic.upv.es!antodo |
44 |
if not hasattr(sys, 'version_info') or not sys.version_info[1] >= 2:
|
|
|
45 |
print '**** You must have Python version 2.2 or higher to run config/configure.py ******'
|
|
|
46 |
print '* Python is easy to install for end users or sys-admin. *'
|
|
|
47 |
print '* http://www.python.org/download/ *'
|
|
|
48 |
print '* *'
|
| 912 |
dsic.upv.es!antodo |
49 |
print '* You CANNOT configure SLEPc without Python *'
|
| 861 |
dsic.upv.es!antodo |
50 |
print '*********************************************************************************'
|
|
|
51 |
sys.exit(4)
|
|
|
52 |
|
| 808 |
dsic.upv.es!antodo |
53 |
# support a few standard configure option types
|
|
|
54 |
for l in range(1,len(sys.argv)):
|
|
|
55 |
name = sys.argv[l]
|
|
|
56 |
if name.startswith('--enable'):
|
|
|
57 |
sys.argv[l] = name.replace('--enable','--with')
|
|
|
58 |
if name.find('=') == -1: sys.argv[l] += '=1'
|
|
|
59 |
if name.startswith('--disable'):
|
|
|
60 |
sys.argv[l] = name.replace('--disable','--with')
|
|
|
61 |
if name.find('=') == -1: sys.argv[l] += '=0'
|
|
|
62 |
elif name.endswith('=1'): sys.argv[l].replace('=1','=0')
|
|
|
63 |
if name.startswith('--without'):
|
|
|
64 |
sys.argv[l] = name.replace('--without','--with')
|
|
|
65 |
if name.find('=') == -1: sys.argv[l] += '=0'
|
|
|
66 |
elif name.endswith('=1'): sys.argv[l].replace('=1','=0')
|
|
|
67 |
|
|
|
68 |
# Check configure parameters
|
|
|
69 |
havearpack = 0
|
|
|
70 |
arpackdir = ''
|
|
|
71 |
arpacklibs = []
|
|
|
72 |
haveblzpack = 0
|
|
|
73 |
blzpackdir = ''
|
|
|
74 |
blzpacklibs = []
|
|
|
75 |
havetrlan = 0
|
|
|
76 |
trlandir = ''
|
|
|
77 |
trlanlibs = []
|
| 1187 |
slepc |
78 |
haveprimme = 0
|
|
|
79 |
primmedir = ''
|
| 1189 |
slepc |
80 |
primmelibs = []
|
| 1714 |
jroman |
81 |
getslepc4py = 0
|
| 1366 |
slepc |
82 |
prefixdir = ''
|
| 808 |
dsic.upv.es!antodo |
83 |
|
|
|
84 |
for i in sys.argv[1:]:
|
|
|
85 |
if i.startswith('--with-arpack-dir='):
|
|
|
86 |
arpackdir = i.split('=')[1]
|
|
|
87 |
havearpack = 1
|
| 912 |
dsic.upv.es!antodo |
88 |
elif i.startswith('--with-arpack-flags='):
|
| 808 |
dsic.upv.es!antodo |
89 |
arpacklibs = i.split('=')[1].split(',')
|
|
|
90 |
havearpack = 1
|
|
|
91 |
elif i.startswith('--with-arpack'):
|
|
|
92 |
havearpack = not i.endswith('=0')
|
|
|
93 |
elif i.startswith('--with-blzpack-dir='):
|
|
|
94 |
blzpackdir = i.split('=')[1]
|
|
|
95 |
haveblzpack = 1
|
| 912 |
dsic.upv.es!antodo |
96 |
elif i.startswith('--with-blzpack-flags='):
|
| 808 |
dsic.upv.es!antodo |
97 |
blzpacklibs = i.split('=')[1].split(',')
|
|
|
98 |
haveblzpack = 1
|
|
|
99 |
elif i.startswith('--with-blzpack'):
|
|
|
100 |
haveblzpack = not i.endswith('=0')
|
|
|
101 |
elif i.startswith('--with-trlan-dir='):
|
|
|
102 |
trlandir = i.split('=')[1]
|
|
|
103 |
havetrlan = 1
|
| 912 |
dsic.upv.es!antodo |
104 |
elif i.startswith('--with-trlan-flags='):
|
| 808 |
dsic.upv.es!antodo |
105 |
trlanlibs = i.split('=')[1].split(',')
|
|
|
106 |
havetrlan = 1
|
|
|
107 |
elif i.startswith('--with-trlan'):
|
|
|
108 |
havetrlan = not i.endswith('=0')
|
| 1187 |
slepc |
109 |
elif i.startswith('--with-primme-dir'):
|
|
|
110 |
primmedir = i.split('=')[1]
|
|
|
111 |
haveprimme = 1
|
| 1189 |
slepc |
112 |
elif i.startswith('--with-primme-flags='):
|
|
|
113 |
primmelibs = i.split('=')[1].split(',')
|
|
|
114 |
haveprimme = 1
|
| 1239 |
slepc |
115 |
elif i.startswith('--with-primme'):
|
|
|
116 |
haveprimme = not i.endswith('=0')
|
| 1714 |
jroman |
117 |
elif i.startswith('--download-slepc4py'):
|
|
|
118 |
getslepc4py = not i.endswith('=0')
|
| 1366 |
slepc |
119 |
elif i.startswith('--prefix='):
|
|
|
120 |
prefixdir = i.split('=')[1]
|
| 912 |
dsic.upv.es!antodo |
121 |
elif i.startswith('--h') or i.startswith('-h') or i.startswith('-?'):
|
| 939 |
dsic.upv.es!jroman |
122 |
print 'SLEPc Configure Help'
|
|
|
123 |
print '-'*80
|
| 2157 |
jroman |
124 |
print ' --prefix=<dir> : Specifiy location to install SLEPc (e.g., /usr/local)'
|
| 939 |
dsic.upv.es!jroman |
125 |
print 'ARPACK:'
|
|
|
126 |
print ' --with-arpack : Indicate if you wish to test for ARPACK (PARPACK)'
|
|
|
127 |
print ' --with-arpack-dir=<dir> : Indicate the directory for ARPACK libraries'
|
|
|
128 |
print ' --with-arpack-flags=<flags> : Indicate comma-separated flags for linking ARPACK'
|
|
|
129 |
print 'BLZPACK:'
|
|
|
130 |
print ' --with-blzpack : Indicate if you wish to test for BLZPACK'
|
|
|
131 |
print ' --with-blzpack-dir=<dir> : Indicate the directory for BLZPACK libraries'
|
|
|
132 |
print ' --with-blzpack-flags=<flags> : Indicate comma-separated flags for linking BLZPACK'
|
|
|
133 |
print 'TRLAN:'
|
|
|
134 |
print ' --with-trlan : Indicate if you wish to test for TRLAN'
|
|
|
135 |
print ' --with-trlan-dir=<dir> : Indicate the directory for TRLAN libraries'
|
|
|
136 |
print ' --with-trlan-flags=<flags> : Indicate comma-separated flags for linking TRLAN'
|
| 1187 |
slepc |
137 |
print 'PRIMME:'
|
| 1188 |
slepc |
138 |
print ' --with-primme : Indicate if you wish to test for PRIMME'
|
| 1187 |
slepc |
139 |
print ' --with-primme-dir=<dir> : Indicate the directory for PRIMME libraries'
|
| 1189 |
slepc |
140 |
print ' --with-primme-flags=<flags> : Indicate comma-separated flags for linking PRIMME'
|
| 1714 |
jroman |
141 |
print 'slepc4py:'
|
|
|
142 |
print ' --download-slepc4py : Download and install slepc4py in SLEPc directory'
|
| 912 |
dsic.upv.es!antodo |
143 |
sys.exit(0)
|
| 861 |
dsic.upv.es!antodo |
144 |
else:
|
| 2157 |
jroman |
145 |
sys.exit('ERROR: Invalid argument ' + i +'. Use -h for help')
|
| 808 |
dsic.upv.es!antodo |
146 |
|
| 1871 |
antodo |
147 |
prefixinstall = not prefixdir==''
|
|
|
148 |
|
| 912 |
dsic.upv.es!antodo |
149 |
# Check if enviroment is ok
|
|
|
150 |
print 'Checking environment...'
|
| 1871 |
antodo |
151 |
if 'SLEPC_DIR' in os.environ:
|
|
|
152 |
slepcdir = os.environ['SLEPC_DIR']
|
|
|
153 |
if not os.path.exists(slepcdir) or not os.path.exists(os.sep.join([slepcdir,'config'])):
|
|
|
154 |
sys.exit('ERROR: SLEPC_DIR enviroment variable is not valid')
|
|
|
155 |
if os.path.realpath(os.getcwd()) != os.path.realpath(slepcdir):
|
|
|
156 |
sys.exit('ERROR: SLEPC_DIR is not the current directory')
|
|
|
157 |
else:
|
|
|
158 |
slepcdir = os.getcwd();
|
|
|
159 |
if not os.path.exists(os.sep.join([slepcdir,'config'])):
|
|
|
160 |
sys.exit('ERROR: Current directory is not valid')
|
| 1659 |
slepc |
161 |
|
| 1871 |
antodo |
162 |
if 'PETSC_DIR' in os.environ:
|
|
|
163 |
petscdir = os.environ['PETSC_DIR']
|
|
|
164 |
if not os.path.exists(petscdir):
|
|
|
165 |
sys.exit('ERROR: PETSC_DIR enviroment variable is not valid')
|
|
|
166 |
else:
|
|
|
167 |
if prefixdir:
|
|
|
168 |
petscdir = prefixdir
|
|
|
169 |
os.environ['PETSC_DIR'] = petscdir
|
|
|
170 |
else:
|
|
|
171 |
sys.exit('ERROR: PETSC_DIR enviroment variable is not set')
|
| 912 |
dsic.upv.es!antodo |
172 |
|
| 1527 |
slepc |
173 |
# Check PETSc version
|
|
|
174 |
petscversion.Load(petscdir)
|
| 2121 |
jroman |
175 |
if petscversion.VERSION < '3.1':
|
| 1527 |
slepc |
176 |
sys.exit('ERROR: This SLEPc version is not compatible with PETSc version '+petscversion.VERSION)
|
| 2138 |
jroman |
177 |
if petscversion.PATCHLEVEL < '4' and petscversion.RELEASE == '1':
|
| 2137 |
jroman |
178 |
sys.exit('ERROR: PETSc 3.1 patchlevel 4 required. Please upgrade to petsc-3.1-p4 or later')
|
| 1527 |
slepc |
179 |
|
| 1105 |
slepc |
180 |
# Check some information about PETSc configuration
|
| 912 |
dsic.upv.es!antodo |
181 |
petscconf.Load(petscdir)
|
| 1105 |
slepc |
182 |
if not petscconf.PRECISION in ['double','single','matsingle']:
|
|
|
183 |
sys.exit('ERROR: This SLEPc version does not work with '+petscconf.PRECISION+' precision')
|
| 2157 |
jroman |
184 |
if prefixinstall and not petscconf.ISINSTALL:
|
| 1528 |
slepc |
185 |
sys.exit('ERROR: SLEPc cannot be configured for non-source installation if PETSc is not configured in the same way.')
|
| 912 |
dsic.upv.es!antodo |
186 |
|
| 1714 |
jroman |
187 |
# Create architecture directory and configuration files
|
| 1523 |
slepc |
188 |
archdir = os.sep.join([slepcdir,petscconf.ARCH])
|
| 1105 |
slepc |
189 |
if not os.path.exists(archdir):
|
|
|
190 |
try:
|
|
|
191 |
os.mkdir(archdir)
|
|
|
192 |
except:
|
|
|
193 |
sys.exit('ERROR: cannot create architecture directory ' + archdir)
|
| 1523 |
slepc |
194 |
confdir = os.sep.join([archdir,'conf'])
|
|
|
195 |
if not os.path.exists(confdir):
|
|
|
196 |
try:
|
|
|
197 |
os.mkdir(confdir)
|
|
|
198 |
except:
|
|
|
199 |
sys.exit('ERROR: cannot create configuration directory ' + confdir)
|
| 1553 |
slepc |
200 |
incdir = os.sep.join([archdir,'include'])
|
|
|
201 |
if not os.path.exists(incdir):
|
|
|
202 |
try:
|
|
|
203 |
os.mkdir(incdir)
|
|
|
204 |
except:
|
|
|
205 |
sys.exit('ERROR: cannot create include directory ' + incdir)
|
| 1105 |
slepc |
206 |
try:
|
| 1523 |
slepc |
207 |
slepcconf = open(os.sep.join([confdir,'slepcvariables']),'w')
|
| 1366 |
slepc |
208 |
if not prefixdir:
|
| 1527 |
slepc |
209 |
prefixdir = archdir
|
| 1366 |
slepc |
210 |
slepcconf.write('SLEPC_INSTALL_DIR =' + prefixdir +'\n')
|
| 1105 |
slepc |
211 |
except:
|
| 1523 |
slepc |
212 |
sys.exit('ERROR: cannot create configuration file in ' + confdir)
|
| 1714 |
jroman |
213 |
try:
|
|
|
214 |
slepcrules = open(os.sep.join([confdir,'slepcrules']),'w')
|
|
|
215 |
except:
|
|
|
216 |
sys.exit('ERROR: cannot create rules file in ' + confdir)
|
| 2159 |
jroman |
217 |
if prefixinstall and os.path.isfile(os.sep.join([prefixdir,'include','slepc.h'])):
|
| 1955 |
jroman |
218 |
sys.exit('ERROR: prefix directory ' + prefixdir + ' contains files from a previous installation')
|
| 923 |
dsic.upv.es!antodo |
219 |
|
| 1105 |
slepc |
220 |
# Open log file
|
| 1523 |
slepc |
221 |
log.Open(os.sep.join([confdir,'configure.log']))
|
| 939 |
dsic.upv.es!jroman |
222 |
log.Write('='*80)
|
|
|
223 |
log.Write('Starting Configure Run at '+time.ctime(time.time()))
|
|
|
224 |
log.Write('Configure Options: '+str.join(' ',sys.argv))
|
|
|
225 |
log.Write('Working directory: '+os.getcwd())
|
|
|
226 |
log.Write('Python version:\n' + sys.version)
|
| 1417 |
slepc |
227 |
log.Write('make: ' + petscconf.MAKE)
|
|
|
228 |
log.Write('PETSc source directory: ' + petscdir)
|
|
|
229 |
log.Write('PETSc install directory: ' + petscconf.INSTALL_DIR)
|
| 1527 |
slepc |
230 |
log.Write('PETSc version: ' + petscversion.VERSION)
|
| 1417 |
slepc |
231 |
log.Write('PETSc architecture: ' + petscconf.ARCH)
|
|
|
232 |
log.Write('SLEPc source directory: ' + slepcdir)
|
|
|
233 |
log.Write('SLEPc install directory: ' + prefixdir)
|
| 939 |
dsic.upv.es!jroman |
234 |
log.Write('='*80)
|
|
|
235 |
|
| 912 |
dsic.upv.es!antodo |
236 |
# Check if PETSc is working
|
| 1043 |
slepc |
237 |
log.Println('Checking PETSc installation...')
|
| 2121 |
jroman |
238 |
if petscversion.VERSION > '3.1':
|
| 1527 |
slepc |
239 |
log.Println('WARNING: PETSc version '+petscversion.VERSION+' is newer than SLEPc version')
|
|
|
240 |
if petscversion.RELEASE != '1':
|
| 1070 |
slepc |
241 |
log.Println('WARNING: using PETSc development version')
|
| 1527 |
slepc |
242 |
if petscconf.ISINSTALL:
|
| 1816 |
jroman |
243 |
if os.path.realpath(petscconf.INSTALL_DIR) != os.path.realpath(petscdir):
|
| 1527 |
slepc |
244 |
log.Println('WARNING: PETSC_DIR does not point to PETSc installation path')
|
| 912 |
dsic.upv.es!antodo |
245 |
if not check.Link([],[],[]):
|
| 1105 |
slepc |
246 |
log.Exit('ERROR: Unable to link with PETSc')
|
| 912 |
dsic.upv.es!antodo |
247 |
|
| 808 |
dsic.upv.es!antodo |
248 |
# Check for external packages
|
|
|
249 |
if havearpack:
|
| 912 |
dsic.upv.es!antodo |
250 |
arpacklibs = arpack.Check(slepcconf,arpackdir,arpacklibs)
|
| 808 |
dsic.upv.es!antodo |
251 |
if haveblzpack:
|
| 912 |
dsic.upv.es!antodo |
252 |
blzpacklibs = blzpack.Check(slepcconf,blzpackdir,blzpacklibs)
|
| 808 |
dsic.upv.es!antodo |
253 |
if havetrlan:
|
| 912 |
dsic.upv.es!antodo |
254 |
trlanlibs = trlan.Check(slepcconf,trlandir,trlanlibs)
|
| 1187 |
slepc |
255 |
if haveprimme:
|
| 1189 |
slepc |
256 |
primmelibs = primme.Check(slepcconf,primmedir,primmelibs)
|
| 808 |
dsic.upv.es!antodo |
257 |
|
| 1530 |
slepc |
258 |
# Check for missing LAPACK functions
|
|
|
259 |
missing = lapack.Check(slepcconf)
|
|
|
260 |
|
| 1714 |
jroman |
261 |
# Download and install slepc4py
|
|
|
262 |
if getslepc4py:
|
|
|
263 |
slepc4py.Install()
|
| 1717 |
jroman |
264 |
slepc4py.addMakeRule(slepcrules,prefixdir,prefixinstall,getslepc4py)
|
| 1714 |
jroman |
265 |
|
| 808 |
dsic.upv.es!antodo |
266 |
slepcconf.close()
|
| 1714 |
jroman |
267 |
slepcrules.close()
|
| 808 |
dsic.upv.es!antodo |
268 |
|
| 923 |
dsic.upv.es!antodo |
269 |
log.Println('')
|
|
|
270 |
log.Println('='*80)
|
|
|
271 |
log.Println('SLEPc Configuration')
|
|
|
272 |
log.Println('='*80)
|
|
|
273 |
log.Println('')
|
| 1366 |
slepc |
274 |
log.Println('SLEPc source directory:')
|
| 923 |
dsic.upv.es!antodo |
275 |
log.Println(' '+slepcdir)
|
| 1366 |
slepc |
276 |
log.Println('SLEPc install directory:')
|
|
|
277 |
log.Println(' '+prefixdir)
|
| 1375 |
slepc |
278 |
log.Println('PETSc directory:')
|
| 923 |
dsic.upv.es!antodo |
279 |
log.Println(' '+petscdir)
|
|
|
280 |
log.Println('Architecture "'+petscconf.ARCH+'" with '+petscconf.PRECISION+' precision '+petscconf.SCALAR+' numbers')
|
| 808 |
dsic.upv.es!antodo |
281 |
if havearpack:
|
| 923 |
dsic.upv.es!antodo |
282 |
log.Println('ARPACK library flags:')
|
|
|
283 |
log.Println(' '+str.join(' ',arpacklibs))
|
| 808 |
dsic.upv.es!antodo |
284 |
if haveblzpack:
|
| 923 |
dsic.upv.es!antodo |
285 |
log.Println('BLZPACK library flags:')
|
|
|
286 |
log.Println(' '+str.join(' ',blzpacklibs))
|
| 970 |
slepc |
287 |
if havetrlan:
|
|
|
288 |
log.Println('TRLAN library flags:')
|
|
|
289 |
log.Println(' '+str.join(' ',trlanlibs))
|
| 1187 |
slepc |
290 |
if haveprimme:
|
|
|
291 |
log.Println('PRIMME library flags:')
|
|
|
292 |
log.Println(' '+str.join(' ',primmelibs))
|
| 808 |
dsic.upv.es!antodo |
293 |
if missing:
|
| 1043 |
slepc |
294 |
log.Println('LAPACK missing functions:')
|
| 923 |
dsic.upv.es!antodo |
295 |
log.Print(' ')
|
|
|
296 |
for i in missing: log.Print(i)
|
|
|
297 |
log.Println('')
|
|
|
298 |
log.Println('')
|
| 939 |
dsic.upv.es!jroman |
299 |
log.Println('WARNING: Some SLEPc functionality will not be available')
|
| 923 |
dsic.upv.es!antodo |
300 |
log.Println('PLEASE reconfigure and recompile PETSc with a full LAPACK implementation')
|
| 1527 |
slepc |
301 |
if petscconf.ISINSTALL:
|
|
|
302 |
log.Println('')
|
|
|
303 |
log.Println(' **')
|
|
|
304 |
log.Println(' ** Before running "make" your PETSC_ARCH must be specified with:')
|
|
|
305 |
log.Println(' ** ** setenv PETSC_ARCH '+petscconf.ARCH+' (csh/tcsh)')
|
|
|
306 |
log.Println(' ** ** PETSC_ARCH='+petscconf.ARCH+' ; export PETSC_ARCH (sh/bash)')
|
|
|
307 |
log.Println(' **')
|
| 912 |
dsic.upv.es!antodo |
308 |
print
|