| 808 |
dsic.upv.es!antodo |
1 |
#!/usr/bin/env python
|
| 1377 |
slepc |
2 |
#
|
|
|
3 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
4 |
# SLEPc - Scalable Library for Eigenvalue Problem Computations
|
|
|
5 |
# Copyright (c) 2002-2007, Universidad Politecnica de Valencia, Spain
|
|
|
6 |
#
|
|
|
7 |
# This file is part of SLEPc. See the README file for conditions of use
|
|
|
8 |
# and additional information.
|
|
|
9 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
10 |
#
|
| 808 |
dsic.upv.es!antodo |
11 |
|
|
|
12 |
import os
|
|
|
13 |
import sys
|
| 939 |
dsic.upv.es!jroman |
14 |
import time
|
| 808 |
dsic.upv.es!antodo |
15 |
|
| 1527 |
slepc |
16 |
import petscversion
|
| 912 |
dsic.upv.es!antodo |
17 |
import petscconf
|
| 923 |
dsic.upv.es!antodo |
18 |
import log
|
| 912 |
dsic.upv.es!antodo |
19 |
import check
|
|
|
20 |
import arpack
|
|
|
21 |
import blzpack
|
|
|
22 |
import trlan
|
|
|
23 |
import lapack
|
| 1187 |
slepc |
24 |
import primme
|
| 808 |
dsic.upv.es!antodo |
25 |
|
| 861 |
dsic.upv.es!antodo |
26 |
if not hasattr(sys, 'version_info') or not sys.version_info[1] >= 2:
|
|
|
27 |
print '**** You must have Python version 2.2 or higher to run config/configure.py ******'
|
|
|
28 |
print '* Python is easy to install for end users or sys-admin. *'
|
|
|
29 |
print '* http://www.python.org/download/ *'
|
|
|
30 |
print '* *'
|
| 912 |
dsic.upv.es!antodo |
31 |
print '* You CANNOT configure SLEPc without Python *'
|
| 861 |
dsic.upv.es!antodo |
32 |
print '*********************************************************************************'
|
|
|
33 |
sys.exit(4)
|
|
|
34 |
|
| 808 |
dsic.upv.es!antodo |
35 |
# support a few standard configure option types
|
|
|
36 |
for l in range(1,len(sys.argv)):
|
|
|
37 |
name = sys.argv[l]
|
|
|
38 |
if name.startswith('--enable'):
|
|
|
39 |
sys.argv[l] = name.replace('--enable','--with')
|
|
|
40 |
if name.find('=') == -1: sys.argv[l] += '=1'
|
|
|
41 |
if name.startswith('--disable'):
|
|
|
42 |
sys.argv[l] = name.replace('--disable','--with')
|
|
|
43 |
if name.find('=') == -1: sys.argv[l] += '=0'
|
|
|
44 |
elif name.endswith('=1'): sys.argv[l].replace('=1','=0')
|
|
|
45 |
if name.startswith('--without'):
|
|
|
46 |
sys.argv[l] = name.replace('--without','--with')
|
|
|
47 |
if name.find('=') == -1: sys.argv[l] += '=0'
|
|
|
48 |
elif name.endswith('=1'): sys.argv[l].replace('=1','=0')
|
|
|
49 |
|
|
|
50 |
# Check configure parameters
|
|
|
51 |
havearpack = 0
|
|
|
52 |
arpackdir = ''
|
|
|
53 |
arpacklibs = []
|
|
|
54 |
haveblzpack = 0
|
|
|
55 |
blzpackdir = ''
|
|
|
56 |
blzpacklibs = []
|
|
|
57 |
havetrlan = 0
|
|
|
58 |
trlandir = ''
|
|
|
59 |
trlanlibs = []
|
| 1187 |
slepc |
60 |
haveprimme = 0
|
|
|
61 |
primmedir = ''
|
| 1189 |
slepc |
62 |
primmelibs = []
|
| 1366 |
slepc |
63 |
prefixdir = ''
|
| 808 |
dsic.upv.es!antodo |
64 |
|
|
|
65 |
for i in sys.argv[1:]:
|
|
|
66 |
if i.startswith('--with-arpack-dir='):
|
|
|
67 |
arpackdir = i.split('=')[1]
|
|
|
68 |
havearpack = 1
|
| 912 |
dsic.upv.es!antodo |
69 |
elif i.startswith('--with-arpack-flags='):
|
| 808 |
dsic.upv.es!antodo |
70 |
arpacklibs = i.split('=')[1].split(',')
|
|
|
71 |
havearpack = 1
|
|
|
72 |
elif i.startswith('--with-arpack'):
|
|
|
73 |
havearpack = not i.endswith('=0')
|
|
|
74 |
elif i.startswith('--with-blzpack-dir='):
|
|
|
75 |
blzpackdir = i.split('=')[1]
|
|
|
76 |
haveblzpack = 1
|
| 912 |
dsic.upv.es!antodo |
77 |
elif i.startswith('--with-blzpack-flags='):
|
| 808 |
dsic.upv.es!antodo |
78 |
blzpacklibs = i.split('=')[1].split(',')
|
|
|
79 |
haveblzpack = 1
|
|
|
80 |
elif i.startswith('--with-blzpack'):
|
|
|
81 |
haveblzpack = not i.endswith('=0')
|
|
|
82 |
elif i.startswith('--with-trlan-dir='):
|
|
|
83 |
trlandir = i.split('=')[1]
|
|
|
84 |
havetrlan = 1
|
| 912 |
dsic.upv.es!antodo |
85 |
elif i.startswith('--with-trlan-flags='):
|
| 808 |
dsic.upv.es!antodo |
86 |
trlanlibs = i.split('=')[1].split(',')
|
|
|
87 |
havetrlan = 1
|
|
|
88 |
elif i.startswith('--with-trlan'):
|
|
|
89 |
havetrlan = not i.endswith('=0')
|
| 1187 |
slepc |
90 |
elif i.startswith('--with-primme-dir'):
|
|
|
91 |
primmedir = i.split('=')[1]
|
|
|
92 |
haveprimme = 1
|
| 1189 |
slepc |
93 |
elif i.startswith('--with-primme-flags='):
|
|
|
94 |
primmelibs = i.split('=')[1].split(',')
|
|
|
95 |
haveprimme = 1
|
| 1239 |
slepc |
96 |
elif i.startswith('--with-primme'):
|
|
|
97 |
haveprimme = not i.endswith('=0')
|
| 1366 |
slepc |
98 |
elif i.startswith('--prefix='):
|
|
|
99 |
prefixdir = i.split('=')[1]
|
| 912 |
dsic.upv.es!antodo |
100 |
elif i.startswith('--h') or i.startswith('-h') or i.startswith('-?'):
|
| 939 |
dsic.upv.es!jroman |
101 |
print 'SLEPc Configure Help'
|
|
|
102 |
print '-'*80
|
| 1368 |
slepc |
103 |
print ' --prefix=<dir> : Specifiy location to install SLEPc (eg. /usr/local)'
|
| 939 |
dsic.upv.es!jroman |
104 |
print 'ARPACK:'
|
|
|
105 |
print ' --with-arpack : Indicate if you wish to test for ARPACK (PARPACK)'
|
|
|
106 |
print ' --with-arpack-dir=<dir> : Indicate the directory for ARPACK libraries'
|
|
|
107 |
print ' --with-arpack-flags=<flags> : Indicate comma-separated flags for linking ARPACK'
|
|
|
108 |
print 'BLZPACK:'
|
|
|
109 |
print ' --with-blzpack : Indicate if you wish to test for BLZPACK'
|
|
|
110 |
print ' --with-blzpack-dir=<dir> : Indicate the directory for BLZPACK libraries'
|
|
|
111 |
print ' --with-blzpack-flags=<flags> : Indicate comma-separated flags for linking BLZPACK'
|
|
|
112 |
print 'TRLAN:'
|
|
|
113 |
print ' --with-trlan : Indicate if you wish to test for TRLAN'
|
|
|
114 |
print ' --with-trlan-dir=<dir> : Indicate the directory for TRLAN libraries'
|
|
|
115 |
print ' --with-trlan-flags=<flags> : Indicate comma-separated flags for linking TRLAN'
|
| 1187 |
slepc |
116 |
print 'PRIMME:'
|
| 1188 |
slepc |
117 |
print ' --with-primme : Indicate if you wish to test for PRIMME'
|
| 1187 |
slepc |
118 |
print ' --with-primme-dir=<dir> : Indicate the directory for PRIMME libraries'
|
| 1189 |
slepc |
119 |
print ' --with-primme-flags=<flags> : Indicate comma-separated flags for linking PRIMME'
|
| 912 |
dsic.upv.es!antodo |
120 |
sys.exit(0)
|
| 861 |
dsic.upv.es!antodo |
121 |
else:
|
| 912 |
dsic.upv.es!antodo |
122 |
sys.exit('ERROR: Invalid argument ' + i +' use -h for help')
|
| 808 |
dsic.upv.es!antodo |
123 |
|
| 912 |
dsic.upv.es!antodo |
124 |
# Check if enviroment is ok
|
|
|
125 |
print 'Checking environment...'
|
|
|
126 |
if 'SLEPC_DIR' not in os.environ:
|
|
|
127 |
sys.exit('ERROR: SLEPC_DIR enviroment variable is not set')
|
|
|
128 |
slepcdir = os.environ['SLEPC_DIR']
|
| 1529 |
slepc |
129 |
if not os.path.exists(slepcdir) or not os.path.exists(os.sep.join([slepcdir,'config'])):
|
| 912 |
dsic.upv.es!antodo |
130 |
sys.exit('ERROR: SLEPC_DIR enviroment variable is not valid')
|
| 1659 |
slepc |
131 |
if os.getcwd() != slepcdir:
|
|
|
132 |
sys.exit('ERROR: SLEPC_DIR is not the current directory')
|
|
|
133 |
|
| 912 |
dsic.upv.es!antodo |
134 |
if 'PETSC_DIR' not in os.environ:
|
|
|
135 |
sys.exit('ERROR: PETSC_DIR enviroment variable is not set')
|
|
|
136 |
petscdir = os.environ['PETSC_DIR']
|
| 1416 |
slepc |
137 |
if not os.path.exists(petscdir):
|
| 912 |
dsic.upv.es!antodo |
138 |
sys.exit('ERROR: PETSC_DIR enviroment variable is not valid')
|
|
|
139 |
|
| 1527 |
slepc |
140 |
# Check PETSc version
|
|
|
141 |
petscversion.Load(petscdir)
|
|
|
142 |
if petscversion.VERSION < '2.3.3':
|
|
|
143 |
sys.exit('ERROR: This SLEPc version is not compatible with PETSc version '+petscversion.VERSION)
|
|
|
144 |
|
| 1105 |
slepc |
145 |
# Check some information about PETSc configuration
|
| 912 |
dsic.upv.es!antodo |
146 |
petscconf.Load(petscdir)
|
| 1105 |
slepc |
147 |
if not petscconf.PRECISION in ['double','single','matsingle']:
|
|
|
148 |
sys.exit('ERROR: This SLEPc version does not work with '+petscconf.PRECISION+' precision')
|
| 1528 |
slepc |
149 |
if prefixdir and not petscconf.ISINSTALL:
|
|
|
150 |
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 |
151 |
|
| 1105 |
slepc |
152 |
# Create architecture directory and configuration file
|
| 1523 |
slepc |
153 |
archdir = os.sep.join([slepcdir,petscconf.ARCH])
|
| 1105 |
slepc |
154 |
if not os.path.exists(archdir):
|
|
|
155 |
try:
|
|
|
156 |
os.mkdir(archdir)
|
|
|
157 |
except:
|
|
|
158 |
sys.exit('ERROR: cannot create architecture directory ' + archdir)
|
| 1523 |
slepc |
159 |
confdir = os.sep.join([archdir,'conf'])
|
|
|
160 |
if not os.path.exists(confdir):
|
|
|
161 |
try:
|
|
|
162 |
os.mkdir(confdir)
|
|
|
163 |
except:
|
|
|
164 |
sys.exit('ERROR: cannot create configuration directory ' + confdir)
|
| 1553 |
slepc |
165 |
incdir = os.sep.join([archdir,'include'])
|
|
|
166 |
if not os.path.exists(incdir):
|
|
|
167 |
try:
|
|
|
168 |
os.mkdir(incdir)
|
|
|
169 |
except:
|
|
|
170 |
sys.exit('ERROR: cannot create include directory ' + incdir)
|
| 1105 |
slepc |
171 |
try:
|
| 1523 |
slepc |
172 |
slepcconf = open(os.sep.join([confdir,'slepcvariables']),'w')
|
| 1366 |
slepc |
173 |
if not prefixdir:
|
| 1527 |
slepc |
174 |
prefixdir = archdir
|
| 1366 |
slepc |
175 |
slepcconf.write('SLEPC_INSTALL_DIR =' + prefixdir +'\n')
|
| 1105 |
slepc |
176 |
except:
|
| 1523 |
slepc |
177 |
sys.exit('ERROR: cannot create configuration file in ' + confdir)
|
| 923 |
dsic.upv.es!antodo |
178 |
|
| 1105 |
slepc |
179 |
# Open log file
|
| 1523 |
slepc |
180 |
log.Open(os.sep.join([confdir,'configure.log']))
|
| 939 |
dsic.upv.es!jroman |
181 |
log.Write('='*80)
|
|
|
182 |
log.Write('Starting Configure Run at '+time.ctime(time.time()))
|
|
|
183 |
log.Write('Configure Options: '+str.join(' ',sys.argv))
|
|
|
184 |
log.Write('Working directory: '+os.getcwd())
|
|
|
185 |
log.Write('Python version:\n' + sys.version)
|
| 1417 |
slepc |
186 |
log.Write('make: ' + petscconf.MAKE)
|
|
|
187 |
log.Write('PETSc source directory: ' + petscdir)
|
|
|
188 |
log.Write('PETSc install directory: ' + petscconf.INSTALL_DIR)
|
| 1527 |
slepc |
189 |
log.Write('PETSc version: ' + petscversion.VERSION)
|
| 1417 |
slepc |
190 |
log.Write('PETSc architecture: ' + petscconf.ARCH)
|
|
|
191 |
log.Write('SLEPc source directory: ' + slepcdir)
|
|
|
192 |
log.Write('SLEPc install directory: ' + prefixdir)
|
| 939 |
dsic.upv.es!jroman |
193 |
log.Write('='*80)
|
|
|
194 |
|
| 912 |
dsic.upv.es!antodo |
195 |
# Check if PETSc is working
|
| 1043 |
slepc |
196 |
log.Println('Checking PETSc installation...')
|
| 1527 |
slepc |
197 |
if petscversion.VERSION > '2.3.3':
|
|
|
198 |
log.Println('WARNING: PETSc version '+petscversion.VERSION+' is newer than SLEPc version')
|
|
|
199 |
if petscversion.RELEASE != '1':
|
| 1070 |
slepc |
200 |
log.Println('WARNING: using PETSc development version')
|
| 1527 |
slepc |
201 |
if petscconf.ISINSTALL:
|
|
|
202 |
if petscconf.INSTALL_DIR != petscdir:
|
|
|
203 |
log.Println('WARNING: PETSC_DIR does not point to PETSc installation path')
|
| 912 |
dsic.upv.es!antodo |
204 |
if not check.Link([],[],[]):
|
| 1105 |
slepc |
205 |
log.Exit('ERROR: Unable to link with PETSc')
|
| 912 |
dsic.upv.es!antodo |
206 |
|
| 808 |
dsic.upv.es!antodo |
207 |
# Check for external packages
|
|
|
208 |
if havearpack:
|
| 912 |
dsic.upv.es!antodo |
209 |
arpacklibs = arpack.Check(slepcconf,arpackdir,arpacklibs)
|
| 808 |
dsic.upv.es!antodo |
210 |
if haveblzpack:
|
| 912 |
dsic.upv.es!antodo |
211 |
blzpacklibs = blzpack.Check(slepcconf,blzpackdir,blzpacklibs)
|
| 808 |
dsic.upv.es!antodo |
212 |
if havetrlan:
|
| 912 |
dsic.upv.es!antodo |
213 |
trlanlibs = trlan.Check(slepcconf,trlandir,trlanlibs)
|
| 1187 |
slepc |
214 |
if haveprimme:
|
| 1189 |
slepc |
215 |
primmelibs = primme.Check(slepcconf,primmedir,primmelibs)
|
| 808 |
dsic.upv.es!antodo |
216 |
|
| 1530 |
slepc |
217 |
# Check for missing LAPACK functions
|
|
|
218 |
missing = lapack.Check(slepcconf)
|
|
|
219 |
|
| 808 |
dsic.upv.es!antodo |
220 |
slepcconf.close()
|
|
|
221 |
|
| 923 |
dsic.upv.es!antodo |
222 |
log.Println('')
|
|
|
223 |
log.Println('='*80)
|
|
|
224 |
log.Println('SLEPc Configuration')
|
|
|
225 |
log.Println('='*80)
|
|
|
226 |
log.Println('')
|
| 1366 |
slepc |
227 |
log.Println('SLEPc source directory:')
|
| 923 |
dsic.upv.es!antodo |
228 |
log.Println(' '+slepcdir)
|
| 1366 |
slepc |
229 |
log.Println('SLEPc install directory:')
|
|
|
230 |
log.Println(' '+prefixdir)
|
| 1375 |
slepc |
231 |
log.Println('PETSc directory:')
|
| 923 |
dsic.upv.es!antodo |
232 |
log.Println(' '+petscdir)
|
|
|
233 |
log.Println('Architecture "'+petscconf.ARCH+'" with '+petscconf.PRECISION+' precision '+petscconf.SCALAR+' numbers')
|
| 808 |
dsic.upv.es!antodo |
234 |
if havearpack:
|
| 923 |
dsic.upv.es!antodo |
235 |
log.Println('ARPACK library flags:')
|
|
|
236 |
log.Println(' '+str.join(' ',arpacklibs))
|
| 808 |
dsic.upv.es!antodo |
237 |
if haveblzpack:
|
| 923 |
dsic.upv.es!antodo |
238 |
log.Println('BLZPACK library flags:')
|
|
|
239 |
log.Println(' '+str.join(' ',blzpacklibs))
|
| 970 |
slepc |
240 |
if havetrlan:
|
|
|
241 |
log.Println('TRLAN library flags:')
|
|
|
242 |
log.Println(' '+str.join(' ',trlanlibs))
|
| 1187 |
slepc |
243 |
if haveprimme:
|
|
|
244 |
log.Println('PRIMME library flags:')
|
|
|
245 |
log.Println(' '+str.join(' ',primmelibs))
|
| 808 |
dsic.upv.es!antodo |
246 |
if missing:
|
| 1043 |
slepc |
247 |
log.Println('LAPACK missing functions:')
|
| 923 |
dsic.upv.es!antodo |
248 |
log.Print(' ')
|
|
|
249 |
for i in missing: log.Print(i)
|
|
|
250 |
log.Println('')
|
|
|
251 |
log.Println('')
|
| 939 |
dsic.upv.es!jroman |
252 |
log.Println('WARNING: Some SLEPc functionality will not be available')
|
| 923 |
dsic.upv.es!antodo |
253 |
log.Println('PLEASE reconfigure and recompile PETSc with a full LAPACK implementation')
|
| 1527 |
slepc |
254 |
if petscconf.ISINSTALL:
|
|
|
255 |
log.Println('')
|
|
|
256 |
log.Println(' **')
|
|
|
257 |
log.Println(' ** Before running "make" your PETSC_ARCH must be specified with:')
|
|
|
258 |
log.Println(' ** ** setenv PETSC_ARCH '+petscconf.ARCH+' (csh/tcsh)')
|
|
|
259 |
log.Println(' ** ** PETSC_ARCH='+petscconf.ARCH+' ; export PETSC_ARCH (sh/bash)')
|
|
|
260 |
log.Println(' **')
|
| 912 |
dsic.upv.es!antodo |
261 |
print
|