1import config.package 2 3class Configure(config.package.Package): 4 def __init__(self, framework): 5 config.package.Package.__init__(self, framework) 6 self.download = ['http://crd.lbl.gov/~xiaoye/SuperLU/superlu_4.3.tar.gz', 7 'http://ftp.mcs.anl.gov/pub/petsc/externalpackages/superlu_4.3.tar.gz'] 8 self.functions = ['set_default_options'] 9 self.includes = ['slu_ddefs.h'] 10 self.liblist = [['libsuperlu_4.3.a']] 11 # SuperLU has NO support for 64 bit integers, use SuperLU_Dist if you need that 12 self.requires32bitint = 1; # 1 means that the package will not work with 64 bit integers 13 self.excludedDirs = ['SuperLU_DIST','SuperLU_MT'] 14 # SuperLU does not work with --download-fblaslapack with Compaqf90 compiler on windows. 15 # However it should work with intel ifort. 16 self.downloadonWindows= 1 17 return 18 19 def setupDependencies(self, framework): 20 config.package.Package.setupDependencies(self, framework) 21 self.blasLapack = self.framework.require('config.packages.BlasLapack',self) 22 self.deps = [self.blasLapack] 23 return 24 25 def Install(self): 26 import os 27 # Get the SUPERLU directories 28 29 g = open(os.path.join(self.packageDir,'make.inc'),'w') 30 g.write('SuperLUroot = '+self.packageDir+'\n') 31 g.write('TMGLIB = tmglib.'+self.setCompilers.AR_LIB_SUFFIX+'\n') 32 g.write('SUPERLULIB = $(SuperLUroot)/lib/libsuperlu_4.3.'+self.setCompilers.AR_LIB_SUFFIX+'\n') 33 g.write('BLASLIB = '+self.libraries.toString(self.blasLapack.dlib)+'\n') 34 g.write('BLASDEF = -DUSE_VENDOR_BLAS\n') 35 g.write('LIBS = $(SUPERLULIB) $(BLASLIB)\n') 36 g.write('ARCH = '+self.setCompilers.AR+'\n') 37 g.write('ARCHFLAGS = '+self.setCompilers.AR_FLAGS+'\n') 38 g.write('RANLIB = '+self.setCompilers.RANLIB+'\n') 39 self.setCompilers.pushLanguage('C') 40 g.write('CC = '+self.setCompilers.getCompiler()+'\n') 41 g.write('CFLAGS = '+self.setCompilers.getCompilerFlags()+'\n') 42 g.write('LOADER = '+self.setCompilers.getLinker()+'\n') 43 g.write('LOADOPTS = \n') 44 self.setCompilers.popLanguage() 45 46 # set blas name mangling 47 if self.blasLapack.mangling == 'underscore': 48 g.write('CDEFS = -DAdd_') 49 elif self.blasLapack.mangling == 'caps': 50 g.write('CDEFS = -DUpCase') 51 else: 52 g.write('CDEFS = -DNoChange') 53 g.write('\n') 54 55 g.write('MATLAB =\n') 56 g.write('NOOPTS = '+self.getSharedFlag(self.setCompilers.getCompilerFlags())+' '+self.getPointerSizeFlag(self.setCompilers.getCompilerFlags())+' '+self.getWindowsNonOptFlags(self.setCompilers.getCompilerFlags())+'\n') 57 g.close() 58 if self.installNeeded('make.inc'): 59 try: 60 self.logPrintBox('Compiling and installing superlu; this may take several minutes') 61 self.installDirProvider.printSudoPasswordMessage() 62 output,err,ret = config.package.Package.executeShellCommand(self.installSudo+'mkdir -p '+os.path.join(self.installDir,'lib'), timeout=2500, log=self.log) 63 output,err,ret = config.package.Package.executeShellCommand(self.installSudo+'mkdir -p '+os.path.join(self.installDir,'include'), timeout=2500, log=self.log) 64 if not os.path.exists(os.path.join(self.packageDir,'lib')): 65 os.makedirs(os.path.join(self.packageDir,'lib')) 66 output,err,ret = config.package.Package.executeShellCommand('cd '+self.packageDir+' && make clean && make superlulib LAAUX="" SLASRC="" DLASRC="" CLASRC="" ZLASRC="" SCLAUX="" DZLAUX="" && '+self.installSudo+'cp -f lib/*.'+self.setCompilers.AR_LIB_SUFFIX+' '+os.path.join(self.installDir,self.libdir,'')+' && '+self.installSudo+'cp -f SRC/*.h '+os.path.join(self.installDir,self.includedir,''), timeout=2500, log = self.log) 67 except RuntimeError, e: 68 raise RuntimeError('Error running make on SUPERLU: '+str(e)) 69 self.postInstall(output+err,'make.inc') 70 return self.installDir 71 72 def consistencyChecks(self): 73 config.package.Package.consistencyChecks(self) 74 if self.argDB['with-'+self.package]: 75 if not self.blasLapack.checkForRoutine('slamch'): 76 raise RuntimeError('SuperLU requires the LAPACK routine slamch()') 77 self.log.write('Found slamch() in Lapack library as needed by SuperLU\n') 78 79 if not self.blasLapack.checkForRoutine('dlamch'): 80 raise RuntimeError('SuperLU requires the LAPACK routine dlamch()') 81 self.log.write('Found dlamch() in Lapack library as needed by SuperLU\n') 82 83 if not self.blasLapack.checkForRoutine('xerbla'): 84 raise RuntimeError('SuperLU requires the BLAS routine xerbla()') 85 self.log.write('Found xerbla() in BLAS library as needed by SuperLU\n') 86 return 87