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