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