| 808 |
dsic.upv.es!antodo |
1 |
#!/usr/bin/env python
|
|
|
2 |
|
|
|
3 |
import os
|
|
|
4 |
import sys
|
| 939 |
dsic.upv.es!jroman |
5 |
import time
|
| 808 |
dsic.upv.es!antodo |
6 |
|
| 912 |
dsic.upv.es!antodo |
7 |
import petscconf
|
| 923 |
dsic.upv.es!antodo |
8 |
import log
|
| 912 |
dsic.upv.es!antodo |
9 |
import check
|
|
|
10 |
import arpack
|
|
|
11 |
import blzpack
|
|
|
12 |
import planso
|
|
|
13 |
import trlan
|
|
|
14 |
import lapack
|
| 808 |
dsic.upv.es!antodo |
15 |
|
| 861 |
dsic.upv.es!antodo |
16 |
if not hasattr(sys, 'version_info') or not sys.version_info[1] >= 2:
|
|
|
17 |
print '**** You must have Python version 2.2 or higher to run config/configure.py ******'
|
|
|
18 |
print '* Python is easy to install for end users or sys-admin. *'
|
|
|
19 |
print '* http://www.python.org/download/ *'
|
|
|
20 |
print '* *'
|
| 912 |
dsic.upv.es!antodo |
21 |
print '* You CANNOT configure SLEPc without Python *'
|
| 861 |
dsic.upv.es!antodo |
22 |
print '*********************************************************************************'
|
|
|
23 |
sys.exit(4)
|
|
|
24 |
|
| 808 |
dsic.upv.es!antodo |
25 |
# support a few standard configure option types
|
|
|
26 |
for l in range(1,len(sys.argv)):
|
|
|
27 |
name = sys.argv[l]
|
|
|
28 |
if name.startswith('--enable'):
|
|
|
29 |
sys.argv[l] = name.replace('--enable','--with')
|
|
|
30 |
if name.find('=') == -1: sys.argv[l] += '=1'
|
|
|
31 |
if name.startswith('--disable'):
|
|
|
32 |
sys.argv[l] = name.replace('--disable','--with')
|
|
|
33 |
if name.find('=') == -1: sys.argv[l] += '=0'
|
|
|
34 |
elif name.endswith('=1'): sys.argv[l].replace('=1','=0')
|
|
|
35 |
if name.startswith('--without'):
|
|
|
36 |
sys.argv[l] = name.replace('--without','--with')
|
|
|
37 |
if name.find('=') == -1: sys.argv[l] += '=0'
|
|
|
38 |
elif name.endswith('=1'): sys.argv[l].replace('=1','=0')
|
|
|
39 |
|
|
|
40 |
# Check configure parameters
|
|
|
41 |
havearpack = 0
|
|
|
42 |
arpackdir = ''
|
|
|
43 |
arpacklibs = []
|
|
|
44 |
haveblzpack = 0
|
|
|
45 |
blzpackdir = ''
|
|
|
46 |
blzpacklibs = []
|
|
|
47 |
haveplanso = 0
|
|
|
48 |
plansodir = ''
|
|
|
49 |
plansolibs = []
|
|
|
50 |
havetrlan = 0
|
|
|
51 |
trlandir = ''
|
|
|
52 |
trlanlibs = []
|
|
|
53 |
|
|
|
54 |
for i in sys.argv[1:]:
|
|
|
55 |
if i.startswith('--with-arpack-dir='):
|
|
|
56 |
arpackdir = i.split('=')[1]
|
|
|
57 |
havearpack = 1
|
| 912 |
dsic.upv.es!antodo |
58 |
elif i.startswith('--with-arpack-flags='):
|
| 808 |
dsic.upv.es!antodo |
59 |
arpacklibs = i.split('=')[1].split(',')
|
|
|
60 |
havearpack = 1
|
|
|
61 |
elif i.startswith('--with-arpack'):
|
|
|
62 |
havearpack = not i.endswith('=0')
|
|
|
63 |
elif i.startswith('--with-blzpack-dir='):
|
|
|
64 |
blzpackdir = i.split('=')[1]
|
|
|
65 |
haveblzpack = 1
|
| 912 |
dsic.upv.es!antodo |
66 |
elif i.startswith('--with-blzpack-flags='):
|
| 808 |
dsic.upv.es!antodo |
67 |
blzpacklibs = i.split('=')[1].split(',')
|
|
|
68 |
haveblzpack = 1
|
|
|
69 |
elif i.startswith('--with-blzpack'):
|
|
|
70 |
haveblzpack = not i.endswith('=0')
|
|
|
71 |
elif i.startswith('--with-planso-dir='):
|
|
|
72 |
plansodir = i.split('=')[1]
|
|
|
73 |
haveplanso = 1
|
| 912 |
dsic.upv.es!antodo |
74 |
elif i.startswith('--with-planso-flags='):
|
| 808 |
dsic.upv.es!antodo |
75 |
plansolibs = i.split('=')[1].split(',')
|
|
|
76 |
haveplanso = 1
|
|
|
77 |
elif i.startswith('--with-planso'):
|
|
|
78 |
haveplanso = not i.endswith('=0')
|
|
|
79 |
elif i.startswith('--with-trlan-dir='):
|
|
|
80 |
trlandir = i.split('=')[1]
|
|
|
81 |
havetrlan = 1
|
| 912 |
dsic.upv.es!antodo |
82 |
elif i.startswith('--with-trlan-flags='):
|
| 808 |
dsic.upv.es!antodo |
83 |
trlanlibs = i.split('=')[1].split(',')
|
|
|
84 |
havetrlan = 1
|
|
|
85 |
elif i.startswith('--with-trlan'):
|
|
|
86 |
havetrlan = not i.endswith('=0')
|
| 912 |
dsic.upv.es!antodo |
87 |
elif i.startswith('--h') or i.startswith('-h') or i.startswith('-?'):
|
| 939 |
dsic.upv.es!jroman |
88 |
print 'SLEPc Configure Help'
|
|
|
89 |
print '-'*80
|
|
|
90 |
print 'ARPACK:'
|
|
|
91 |
print ' --with-arpack : Indicate if you wish to test for ARPACK (PARPACK)'
|
|
|
92 |
print ' --with-arpack-dir=<dir> : Indicate the directory for ARPACK libraries'
|
|
|
93 |
print ' --with-arpack-flags=<flags> : Indicate comma-separated flags for linking ARPACK'
|
|
|
94 |
print 'BLZPACK:'
|
|
|
95 |
print ' --with-blzpack : Indicate if you wish to test for BLZPACK'
|
|
|
96 |
print ' --with-blzpack-dir=<dir> : Indicate the directory for BLZPACK libraries'
|
|
|
97 |
print ' --with-blzpack-flags=<flags> : Indicate comma-separated flags for linking BLZPACK'
|
|
|
98 |
print 'PLANSO:'
|
|
|
99 |
print ' --with-planso : Indicate if you wish to test for PLANSO'
|
|
|
100 |
print ' --with-planso-dir=<dir> : Indicate the directory for PLANSO libraries'
|
|
|
101 |
print ' --with-planso-flags=<flags> : Indicate comma-separated flags for linking PLANSO'
|
|
|
102 |
print 'TRLAN:'
|
|
|
103 |
print ' --with-trlan : Indicate if you wish to test for TRLAN'
|
|
|
104 |
print ' --with-trlan-dir=<dir> : Indicate the directory for TRLAN libraries'
|
|
|
105 |
print ' --with-trlan-flags=<flags> : Indicate comma-separated flags for linking TRLAN'
|
| 912 |
dsic.upv.es!antodo |
106 |
sys.exit(0)
|
| 861 |
dsic.upv.es!antodo |
107 |
else:
|
| 912 |
dsic.upv.es!antodo |
108 |
sys.exit('ERROR: Invalid argument ' + i +' use -h for help')
|
| 808 |
dsic.upv.es!antodo |
109 |
|
| 912 |
dsic.upv.es!antodo |
110 |
# Check if enviroment is ok
|
|
|
111 |
# and get some information about PETSc configuration
|
|
|
112 |
print 'Checking environment...'
|
|
|
113 |
|
|
|
114 |
if 'SLEPC_DIR' not in os.environ:
|
|
|
115 |
sys.exit('ERROR: SLEPC_DIR enviroment variable is not set')
|
|
|
116 |
slepcdir = os.environ['SLEPC_DIR']
|
|
|
117 |
if not os.path.exists(slepcdir) or not os.path.exists(os.sep.join([slepcdir,'bmake'])):
|
|
|
118 |
sys.exit('ERROR: SLEPC_DIR enviroment variable is not valid')
|
|
|
119 |
os.chdir(slepcdir);
|
|
|
120 |
|
|
|
121 |
if 'PETSC_DIR' not in os.environ:
|
|
|
122 |
sys.exit('ERROR: PETSC_DIR enviroment variable is not set')
|
|
|
123 |
petscdir = os.environ['PETSC_DIR']
|
|
|
124 |
if not os.path.exists(petscdir) or not os.path.exists(os.sep.join([petscdir,'bmake'])):
|
|
|
125 |
sys.exit('ERROR: PETSC_DIR enviroment variable is not valid')
|
|
|
126 |
|
|
|
127 |
petscconf.Load(petscdir)
|
|
|
128 |
|
| 923 |
dsic.upv.es!antodo |
129 |
log.Open('configure_log_' + petscconf.ARCH)
|
|
|
130 |
|
| 939 |
dsic.upv.es!jroman |
131 |
log.Write('='*80)
|
|
|
132 |
log.Write('Starting Configure Run at '+time.ctime(time.time()))
|
|
|
133 |
log.Write('Configure Options: '+str.join(' ',sys.argv))
|
|
|
134 |
log.Write('Working directory: '+os.getcwd())
|
|
|
135 |
log.Write('Python version:\n' + sys.version)
|
|
|
136 |
log.Write('='*80)
|
|
|
137 |
|
| 912 |
dsic.upv.es!antodo |
138 |
# Check if PETSc is working
|
| 1043 |
slepc |
139 |
log.Println('Checking PETSc installation...')
|
| 1070 |
slepc |
140 |
if petscconf.VERSION != '2.3.1':
|
|
|
141 |
log.Exit('ERROR: This SLEPc version is not compatible with PETSc version '+petscconf.VERSION)
|
|
|
142 |
if petscconf.RELEASE != '1':
|
|
|
143 |
log.Println('WARNING: using PETSc development version')
|
| 912 |
dsic.upv.es!antodo |
144 |
if not check.Link([],[],[]):
|
| 923 |
dsic.upv.es!antodo |
145 |
log.Exit('ERROR: PETSc is not installed correctly')
|
| 912 |
dsic.upv.es!antodo |
146 |
|
|
|
147 |
# Create architecture directory
|
|
|
148 |
archdir = os.sep.join([slepcdir,'bmake',petscconf.ARCH])
|
|
|
149 |
if not os.path.exists(archdir):
|
|
|
150 |
try:
|
|
|
151 |
os.mkdir(archdir)
|
|
|
152 |
except:
|
| 923 |
dsic.upv.es!antodo |
153 |
log.Exit('ERROR: cannot create architecture directory ' + archdir)
|
| 912 |
dsic.upv.es!antodo |
154 |
|
|
|
155 |
slepcconf = open(os.sep.join([archdir,'slepcconf']),'w')
|
|
|
156 |
|
|
|
157 |
# Check for missing LAPACK functions
|
| 1072 |
slepc |
158 |
log.Write('='*80)
|
| 923 |
dsic.upv.es!antodo |
159 |
log.Println('Checking LAPACK library...')
|
| 912 |
dsic.upv.es!antodo |
160 |
missing = lapack.Check(slepcconf)
|
|
|
161 |
|
| 808 |
dsic.upv.es!antodo |
162 |
# Check for external packages
|
|
|
163 |
if havearpack:
|
| 912 |
dsic.upv.es!antodo |
164 |
arpacklibs = arpack.Check(slepcconf,arpackdir,arpacklibs)
|
| 808 |
dsic.upv.es!antodo |
165 |
if haveblzpack:
|
| 912 |
dsic.upv.es!antodo |
166 |
blzpacklibs = blzpack.Check(slepcconf,blzpackdir,blzpacklibs)
|
| 808 |
dsic.upv.es!antodo |
167 |
if haveplanso:
|
| 912 |
dsic.upv.es!antodo |
168 |
plansolibs = planso.Check(slepcconf,plansodir,plansolibs)
|
| 808 |
dsic.upv.es!antodo |
169 |
if havetrlan:
|
| 912 |
dsic.upv.es!antodo |
170 |
trlanlibs = trlan.Check(slepcconf,trlandir,trlanlibs)
|
| 808 |
dsic.upv.es!antodo |
171 |
|
|
|
172 |
slepcconf.close()
|
|
|
173 |
|
| 923 |
dsic.upv.es!antodo |
174 |
log.Println('')
|
|
|
175 |
log.Println('='*80)
|
|
|
176 |
log.Println('SLEPc Configuration')
|
|
|
177 |
log.Println('='*80)
|
|
|
178 |
log.Println('')
|
|
|
179 |
log.Println('SLEPc directory:')
|
|
|
180 |
log.Println(' '+slepcdir)
|
|
|
181 |
log.Println('PETSc directory:')
|
|
|
182 |
log.Println(' '+petscdir)
|
|
|
183 |
log.Println('Architecture "'+petscconf.ARCH+'" with '+petscconf.PRECISION+' precision '+petscconf.SCALAR+' numbers')
|
| 912 |
dsic.upv.es!antodo |
184 |
if petscconf.MPIUNI:
|
| 923 |
dsic.upv.es!antodo |
185 |
log.Println(' Uniprocessor version without MPI')
|
| 808 |
dsic.upv.es!antodo |
186 |
if havearpack:
|
| 923 |
dsic.upv.es!antodo |
187 |
log.Println('ARPACK library flags:')
|
|
|
188 |
log.Println(' '+str.join(' ',arpacklibs))
|
| 808 |
dsic.upv.es!antodo |
189 |
if haveblzpack:
|
| 923 |
dsic.upv.es!antodo |
190 |
log.Println('BLZPACK library flags:')
|
|
|
191 |
log.Println(' '+str.join(' ',blzpacklibs))
|
| 808 |
dsic.upv.es!antodo |
192 |
if haveplanso:
|
| 923 |
dsic.upv.es!antodo |
193 |
log.Println('PLANSO library flags:')
|
|
|
194 |
log.Println(' '+str.join(' ',plansolibs))
|
| 970 |
slepc |
195 |
if havetrlan:
|
|
|
196 |
log.Println('TRLAN library flags:')
|
|
|
197 |
log.Println(' '+str.join(' ',trlanlibs))
|
| 808 |
dsic.upv.es!antodo |
198 |
if missing:
|
| 1043 |
slepc |
199 |
log.Println('LAPACK missing functions:')
|
| 923 |
dsic.upv.es!antodo |
200 |
log.Print(' ')
|
|
|
201 |
for i in missing: log.Print(i)
|
|
|
202 |
log.Println('')
|
|
|
203 |
log.Println('')
|
| 939 |
dsic.upv.es!jroman |
204 |
log.Println('WARNING: Some SLEPc functionality will not be available')
|
| 923 |
dsic.upv.es!antodo |
205 |
log.Println('PLEASE reconfigure and recompile PETSc with a full LAPACK implementation')
|
| 912 |
dsic.upv.es!antodo |
206 |
print
|