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
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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')
1105 slepc 131
os.chdir(slepcdir)
912 dsic.upv.es!antodo 132
if 'PETSC_DIR' not in os.environ:
133
  sys.exit('ERROR: PETSC_DIR enviroment variable is not set')
134
petscdir = os.environ['PETSC_DIR']
1416 slepc 135
if not os.path.exists(petscdir):
912 dsic.upv.es!antodo 136
  sys.exit('ERROR: PETSC_DIR enviroment variable is not valid')
137
 
1527 slepc 138
# Check PETSc version
139
petscversion.Load(petscdir)
140
if petscversion.VERSION < '2.3.3':
141
  sys.exit('ERROR: This SLEPc version is not compatible with PETSc version '+petscversion.VERSION)
142
 
1105 slepc 143
# Check some information about PETSc configuration
912 dsic.upv.es!antodo 144
petscconf.Load(petscdir)
1105 slepc 145
if not petscconf.PRECISION in ['double','single','matsingle']:
146
  sys.exit('ERROR: This SLEPc version does not work with '+petscconf.PRECISION+' precision')
1528 slepc 147
if prefixdir and not petscconf.ISINSTALL:
148
  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 149
 
1105 slepc 150
# Create architecture directory and configuration file
1523 slepc 151
archdir = os.sep.join([slepcdir,petscconf.ARCH])
1105 slepc 152
if not os.path.exists(archdir):
153
  try:
154
    os.mkdir(archdir)
155
  except:
156
    sys.exit('ERROR: cannot create architecture directory ' + archdir)
1523 slepc 157
confdir = os.sep.join([archdir,'conf'])
158
if not os.path.exists(confdir):
159
  try:
160
    os.mkdir(confdir)
161
  except:
162
    sys.exit('ERROR: cannot create configuration directory ' + confdir)
1105 slepc 163
try:
1523 slepc 164
  slepcconf = open(os.sep.join([confdir,'slepcvariables']),'w')
1366 slepc 165
  if not prefixdir:
1527 slepc 166
    prefixdir = archdir
1366 slepc 167
  slepcconf.write('SLEPC_INSTALL_DIR =' + prefixdir +'\n')
1105 slepc 168
except:
1523 slepc 169
  sys.exit('ERROR: cannot create configuration file in ' + confdir)
923 dsic.upv.es!antodo 170
 
1105 slepc 171
# Open log file
1523 slepc 172
log.Open(os.sep.join([confdir,'configure.log']))
939 dsic.upv.es!jroman 173
log.Write('='*80)
174
log.Write('Starting Configure Run at '+time.ctime(time.time()))
175
log.Write('Configure Options: '+str.join(' ',sys.argv))
176
log.Write('Working directory: '+os.getcwd())
177
log.Write('Python version:\n' + sys.version)
1417 slepc 178
log.Write('make: ' + petscconf.MAKE)
179
log.Write('PETSc source directory: ' + petscdir)
180
log.Write('PETSc install directory: ' + petscconf.INSTALL_DIR)
1527 slepc 181
log.Write('PETSc version: ' + petscversion.VERSION)
1417 slepc 182
log.Write('PETSc architecture: ' + petscconf.ARCH)
183
log.Write('SLEPc source directory: ' + slepcdir)
184
log.Write('SLEPc install directory: ' + prefixdir)
939 dsic.upv.es!jroman 185
log.Write('='*80)
186
 
912 dsic.upv.es!antodo 187
# Check if PETSc is working
1043 slepc 188
log.Println('Checking PETSc installation...')
1527 slepc 189
if petscversion.VERSION > '2.3.3':
190
  log.Println('WARNING: PETSc version '+petscversion.VERSION+' is newer than SLEPc version')
191
if petscversion.RELEASE != '1':
1070 slepc 192
  log.Println('WARNING: using PETSc development version')
1527 slepc 193
if petscconf.ISINSTALL:
194
  if petscconf.INSTALL_DIR != petscdir:
195
    log.Println('WARNING: PETSC_DIR does not point to PETSc installation path')
912 dsic.upv.es!antodo 196
if not check.Link([],[],[]):
1105 slepc 197
  log.Exit('ERROR: Unable to link with PETSc')
912 dsic.upv.es!antodo 198
 
199
# Check for missing LAPACK functions
200
missing = lapack.Check(slepcconf)
201
 
808 dsic.upv.es!antodo 202
# Check for external packages
203
if havearpack:
912 dsic.upv.es!antodo 204
  arpacklibs = arpack.Check(slepcconf,arpackdir,arpacklibs)
808 dsic.upv.es!antodo 205
if haveblzpack:
912 dsic.upv.es!antodo 206
  blzpacklibs = blzpack.Check(slepcconf,blzpackdir,blzpacklibs)
808 dsic.upv.es!antodo 207
if havetrlan:
912 dsic.upv.es!antodo 208
  trlanlibs = trlan.Check(slepcconf,trlandir,trlanlibs)
1187 slepc 209
if haveprimme:
1189 slepc 210
  primmelibs = primme.Check(slepcconf,primmedir,primmelibs)
808 dsic.upv.es!antodo 211
 
212
slepcconf.close()
213
 
923 dsic.upv.es!antodo 214
log.Println('')
215
log.Println('='*80)
216
log.Println('SLEPc Configuration')
217
log.Println('='*80)
218
log.Println('')
1366 slepc 219
log.Println('SLEPc source directory:')
923 dsic.upv.es!antodo 220
log.Println(' '+slepcdir)
1366 slepc 221
log.Println('SLEPc install directory:')
222
log.Println(' '+prefixdir)  
1375 slepc 223
log.Println('PETSc directory:')
923 dsic.upv.es!antodo 224
log.Println(' '+petscdir)
225
log.Println('Architecture "'+petscconf.ARCH+'" with '+petscconf.PRECISION+' precision '+petscconf.SCALAR+' numbers')
912 dsic.upv.es!antodo 226
if petscconf.MPIUNI:
923 dsic.upv.es!antodo 227
  log.Println('  Uniprocessor version without MPI')
808 dsic.upv.es!antodo 228
if havearpack:
923 dsic.upv.es!antodo 229
  log.Println('ARPACK library flags:')
230
  log.Println(' '+str.join(' ',arpacklibs))
808 dsic.upv.es!antodo 231
if haveblzpack:
923 dsic.upv.es!antodo 232
  log.Println('BLZPACK library flags:')
233
  log.Println(' '+str.join(' ',blzpacklibs))
970 slepc 234
if havetrlan:
235
  log.Println('TRLAN library flags:')
236
  log.Println(' '+str.join(' ',trlanlibs))
1187 slepc 237
if haveprimme:
238
  log.Println('PRIMME library flags:')
239
  log.Println(' '+str.join(' ',primmelibs))
808 dsic.upv.es!antodo 240
if missing:
1043 slepc 241
  log.Println('LAPACK missing functions:')
923 dsic.upv.es!antodo 242
  log.Print('  ')
243
  for i in missing: log.Print(i)
244
  log.Println('')
245
  log.Println('')
939 dsic.upv.es!jroman 246
  log.Println('WARNING: Some SLEPc functionality will not be available')
923 dsic.upv.es!antodo 247
  log.Println('PLEASE reconfigure and recompile PETSc with a full LAPACK implementation')
1527 slepc 248
if petscconf.ISINSTALL:  
249
  log.Println('')
250
  log.Println('  **')
251
  log.Println('  ** Before running "make" your PETSC_ARCH must be specified with:')
252
  log.Println('  **  ** setenv PETSC_ARCH '+petscconf.ARCH+' (csh/tcsh)')
253
  log.Println('  **  ** PETSC_ARCH='+petscconf.ARCH+' ; export PETSC_ARCH (sh/bash)')
254
  log.Println('  **')
912 dsic.upv.es!antodo 255
print