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
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)
1095 slepc 142
if not petscconf.PRECISION in ['double','single','matsingle']:
143
  log.Exit('ERROR: This SLEPc version does not work with '+petscconf.PRECISION+' precision')
1070 slepc 144
if petscconf.RELEASE != '1':
145
  log.Println('WARNING: using PETSc development version')
912 dsic.upv.es!antodo 146
if not check.Link([],[],[]):
923 dsic.upv.es!antodo 147
  log.Exit('ERROR: PETSc is not installed correctly')
912 dsic.upv.es!antodo 148
 
149
# Create architecture directory
150
archdir = os.sep.join([slepcdir,'bmake',petscconf.ARCH])
151
if not os.path.exists(archdir):
152
  try:
153
    os.mkdir(archdir)
154
  except:
923 dsic.upv.es!antodo 155
    log.Exit('ERROR: cannot create architecture directory ' + archdir)
912 dsic.upv.es!antodo 156
 
157
slepcconf = open(os.sep.join([archdir,'slepcconf']),'w')
158
 
159
# Check for missing LAPACK functions
1072 slepc 160
log.Write('='*80)
923 dsic.upv.es!antodo 161
log.Println('Checking LAPACK library...')
912 dsic.upv.es!antodo 162
missing = lapack.Check(slepcconf)
163
 
808 dsic.upv.es!antodo 164
# Check for external packages
165
if havearpack:
912 dsic.upv.es!antodo 166
  arpacklibs = arpack.Check(slepcconf,arpackdir,arpacklibs)
808 dsic.upv.es!antodo 167
if haveblzpack:
912 dsic.upv.es!antodo 168
  blzpacklibs = blzpack.Check(slepcconf,blzpackdir,blzpacklibs)
808 dsic.upv.es!antodo 169
if haveplanso:
912 dsic.upv.es!antodo 170
  plansolibs = planso.Check(slepcconf,plansodir,plansolibs)
808 dsic.upv.es!antodo 171
if havetrlan:
912 dsic.upv.es!antodo 172
  trlanlibs = trlan.Check(slepcconf,trlandir,trlanlibs)
808 dsic.upv.es!antodo 173
 
174
slepcconf.close()
175
 
923 dsic.upv.es!antodo 176
log.Println('')
177
log.Println('='*80)
178
log.Println('SLEPc Configuration')
179
log.Println('='*80)
180
log.Println('')
181
log.Println('SLEPc directory:')
182
log.Println(' '+slepcdir)
183
log.Println('PETSc directory:')
184
log.Println(' '+petscdir)
185
log.Println('Architecture "'+petscconf.ARCH+'" with '+petscconf.PRECISION+' precision '+petscconf.SCALAR+' numbers')
912 dsic.upv.es!antodo 186
if petscconf.MPIUNI:
923 dsic.upv.es!antodo 187
  log.Println('  Uniprocessor version without MPI')
808 dsic.upv.es!antodo 188
if havearpack:
923 dsic.upv.es!antodo 189
  log.Println('ARPACK library flags:')
190
  log.Println(' '+str.join(' ',arpacklibs))
808 dsic.upv.es!antodo 191
if haveblzpack:
923 dsic.upv.es!antodo 192
  log.Println('BLZPACK library flags:')
193
  log.Println(' '+str.join(' ',blzpacklibs))
808 dsic.upv.es!antodo 194
if haveplanso:
923 dsic.upv.es!antodo 195
  log.Println('PLANSO library flags:')
196
  log.Println(' '+str.join(' ',plansolibs))
970 slepc 197
if havetrlan:
198
  log.Println('TRLAN library flags:')
199
  log.Println(' '+str.join(' ',trlanlibs))
808 dsic.upv.es!antodo 200
if missing:
1043 slepc 201
  log.Println('LAPACK missing functions:')
923 dsic.upv.es!antodo 202
  log.Print('  ')
203
  for i in missing: log.Print(i)
204
  log.Println('')
205
  log.Println('')
939 dsic.upv.es!jroman 206
  log.Println('WARNING: Some SLEPc functionality will not be available')
923 dsic.upv.es!antodo 207
  log.Println('PLEASE reconfigure and recompile PETSc with a full LAPACK implementation')
912 dsic.upv.es!antodo 208
print