Subversion Repositories slepc-dev

Rev

Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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