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
1377 slepc 1
#
2
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1672 slepc 3
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
2575 eromero 4
#  Copyright (c) 2002-2011, Universitat Politecnica de Valencia, Spain
1377 slepc 5
#
1672 slepc 6
#  This file is part of SLEPc.
7
#    
8
#  SLEPc is free software: you can redistribute it and/or modify it under  the
9
#  terms of version 3 of the GNU Lesser General Public License as published by
10
#  the Free Software Foundation.
11
#
12
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
13
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
14
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
15
#  more details.
16
#
17
#  You  should have received a copy of the GNU Lesser General  Public  License
18
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
1377 slepc 19
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
20
#
21
 
808 dsic.upv.es!antodo 22
import os
23
import sys
24
 
912 dsic.upv.es!antodo 25
import petscconf
923 dsic.upv.es!antodo 26
import log
912 dsic.upv.es!antodo 27
import check
808 dsic.upv.es!antodo 28
 
2478 jroman 29
def Check(conf,vars,cmake,tmpdir):
2257 jroman 30
  log.write('='*80)
1105 slepc 31
  log.Println('Checking LAPACK library...')
808 dsic.upv.es!antodo 32
 
1530 slepc 33
  # LAPACK standard functions
2735 jroman 34
  l = ['laev2','gehrd','lanhs','lange','getri','trexc','trevc','geevx','ggevx','gelqf','gesdd','tgexc','tgevc','geqrf','pbtrf']
808 dsic.upv.es!antodo 35
 
1530 slepc 36
  # LAPACK functions with different real and complex versions
912 dsic.upv.es!antodo 37
  if petscconf.SCALAR == 'real':
2738 jroman 38
    l += ['orghr','syevr','sygvd','ormlq','orgqr']
1091 slepc 39
    if petscconf.PRECISION == 'single':
40
      prefix = 's'
2486 jroman 41
    if petscconf.PRECISION == '__float128':
42
      prefix = 'q'
1091 slepc 43
    else:
808 dsic.upv.es!antodo 44
      prefix = 'd'
45
  else:
2738 jroman 46
    l += ['unghr','heevr','hegvd','unmlq','ungqr']
1091 slepc 47
    if petscconf.PRECISION == 'single':
48
      prefix = 'c'
2486 jroman 49
    if petscconf.PRECISION == '__float128':
50
      prefix = 'w'
1091 slepc 51
    else:
808 dsic.upv.es!antodo 52
      prefix = 'z'
1530 slepc 53
 
54
  # add prefix to LAPACK names  
55
  functions = []
56
  for i in l:
57
    functions.append(prefix + i)
58
 
2737 eromero 59
  # in this case, the real name represents both versions
2738 jroman 60
  namesubst = {'unghr':'orghr', 'heevr':'syevr', 'hegvd':'sygvd', 'unmlq':'ormlq', 'ungqr':'orgqr'}
2737 eromero 61
 
1530 slepc 62
  # LAPACK functions which are always used in real version
63
  if petscconf.PRECISION == 'single':
2680 jroman 64
    functions += ['sstevr','sbdsdc','ssteqr','sorgtr','ssytrd','slamch','slag2','slasv2']
2486 jroman 65
  elif petscconf.PRECISION == '__float128':
2680 jroman 66
    functions += ['qstevr','qbdsdc','qsteqr','qorgtr','qsytrd','qlamch','qlag2','qlasv2']
1530 slepc 67
  else:
2680 jroman 68
    functions += ['dstevr','dbdsdc','dsteqr','dorgtr','dsytrd','dlamch','dlag2','dlasv2']
1530 slepc 69
 
70
  # check for all functions at once
71
  all = []
808 dsic.upv.es!antodo 72
  for i in functions:
1554 slepc 73
    f =  '#if defined(PETSC_BLASLAPACK_UNDERSCORE)\n'
1530 slepc 74
    f += i + '_\n'
1554 slepc 75
    f += '#elif defined(PETSC_BLASLAPACK_CAPS) || defined(PETSC_BLASLAPACK_STDCALL)\n'
1530 slepc 76
    f += i.upper() + '\n'
808 dsic.upv.es!antodo 77
    f += '#else\n'
1530 slepc 78
    f += i + '\n'
808 dsic.upv.es!antodo 79
    f += '#endif\n'
1530 slepc 80
    all.append(f)
899 dsic.upv.es!antodo 81
 
2257 jroman 82
  log.write('=== Checking all LAPACK functions...')
2478 jroman 83
  if check.Link(tmpdir,all,[],[]):
1530 slepc 84
    return []
899 dsic.upv.es!antodo 85
 
1530 slepc 86
  # check functions one by one
87
  missing = []
899 dsic.upv.es!antodo 88
  for i in functions:
1554 slepc 89
    f =  '#if defined(PETSC_BLASLAPACK_UNDERSCORE)\n'
1530 slepc 90
    f += i + '_\n'
1554 slepc 91
    f += '#elif defined(PETSC_BLASLAPACK_CAPS) || defined(PETSC_BLASLAPACK_STDCALL)\n'
1530 slepc 92
    f += i.upper() + '\n'
899 dsic.upv.es!antodo 93
    f += '#else\n'
1530 slepc 94
    f += i + '\n'
899 dsic.upv.es!antodo 95
    f += '#endif\n'
1530 slepc 96
 
2257 jroman 97
    log.write('=== Checking LAPACK '+i+' function...')
2478 jroman 98
    if not check.Link(tmpdir,[f],[],[]):
1530 slepc 99
      missing.append(i)
2737 eromero 100
      # some complex functions are represented by their real names
101
      if i[1:] in namesubst:
102
        nf = namesubst[i[1:]]
103
      else:
104
        nf = i[1:]
105
      conf.write('#ifndef SLEPC_MISSING_LAPACK_' + nf.upper() + '\n#define SLEPC_MISSING_LAPACK_' + nf.upper() + ' 1\n#endif\n\n')
106
      cmake.write('set (SLEPC_MISSING_LAPACK_' + nf.upper() + ' YES)\n')
1530 slepc 107
 
2250 jroman 108
  if missing:
109
    cmake.write('mark_as_advanced (' + ''.join([s.upper()+' ' for s in missing]) + ')\n')
948 dsic.upv.es!jroman 110
  return missing