1import config.package 2import os 3 4class Configure(config.package.Package): 5 def __init__(self, framework): 6 config.package.Package.__init__(self, framework) 7 self.includes = ['mkl.h','mkl_spblas.h'] 8 self.functions = ['mkl_dcsrmv'] 9 self.liblist = [[]] # use MKL detected by BlasLapack.py 10 self.precisions = ['single','double'] 11 self.lookforbydefault = 1 12 self.requires32bitint = 1 13 return 14 15 def setupDependencies(self, framework): 16 config.package.Package.setupDependencies(self, framework) 17 self.blasLapack = framework.require('config.packages.BlasLapack',self) 18 self.deps = [self.blasLapack] 19 return 20 21 def checksSupportBaijCrossCase(self): 22 '''Determines if MKL Sparse BLAS create routine returns correct status with zero based indexing and columnMajor block layout''' 23 includes = '''#include <sys/types.h>\n#if STDC_HEADERS\n#include <stdlib.h>\n#include <stdio.h>\n#include <stddef.h>\n#endif\n#include <mkl.h>''' 24 body = '''sparse_matrix_t A;\n 25 int n=1,ia[1],ja[1];\n 26 float a[1]; 27 sparse_status_t status = mkl_sparse_s_create_bsr(&A,SPARSE_INDEX_BASE_ZERO,SPARSE_LAYOUT_COLUMN_MAJOR,n,n,n,ia,ia,ja,a);\n 28 fprintf(output, " '--known-mklspblas-supports-zero-based=%d',\\n",(status != SPARSE_STATUS_NOT_SUPPORTED));\n 29 ''' 30 temp1 = self.compilers.LIBS 31 temp2 = self.compilers.CPPFLAGS 32 self.compilers.LIBS = self.libraries.toString(self.dlib)+' -lm '+self.compilers.LIBS 33 self.compilers.CPPFLAGS += ' '+self.headers.toString(self.dinclude) 34 result = self.blasLapack.runTimeTest('known-mklspblas-supports-zero-based',includes,body) 35 self.compilers.LIBS = temp1 36 self.compilers.CPPFLAGS = temp2 37 if result: 38 result = int(result) 39 if result: self.addDefine('MKL_SUPPORTS_BAIJ_ZERO_BASED', 1) 40 41 def configureLibrary(self): 42 config.package.Package.configureLibrary(self) 43 if self.found: 44 self.executeTest(self.checksSupportBaijCrossCase) 45 46