MCPcopy Create free account
hub / github.com/numpy/numpy / mkl_info

Class mkl_info

numpy/distutils/system_info.py:1259–1325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1257
1258
1259class mkl_info(system_info):
1260 section = 'mkl'
1261 dir_env_var = 'MKLROOT'
1262 _lib_mkl = ['mkl_rt']
1263
1264 def get_mkl_rootdir(self):
1265 mklroot = os.environ.get('MKLROOT', None)
1266 if mklroot is not None:
1267 return mklroot
1268 paths = os.environ.get('LD_LIBRARY_PATH', '').split(os.pathsep)
1269 ld_so_conf = '/etc/ld.so.conf'
1270 if os.path.isfile(ld_so_conf):
1271 with open(ld_so_conf) as f:
1272 for d in f:
1273 d = d.strip()
1274 if d:
1275 paths.append(d)
1276 intel_mkl_dirs = []
1277 for path in paths:
1278 path_atoms = path.split(os.sep)
1279 for m in path_atoms:
1280 if m.startswith('mkl'):
1281 d = os.sep.join(path_atoms[:path_atoms.index(m) + 2])
1282 intel_mkl_dirs.append(d)
1283 break
1284 for d in paths:
1285 dirs = glob(os.path.join(d, 'mkl', '*'))
1286 dirs += glob(os.path.join(d, 'mkl*'))
1287 for sub_dir in dirs:
1288 if os.path.isdir(os.path.join(sub_dir, 'lib')):
1289 return sub_dir
1290 return None
1291
1292 def __init__(self):
1293 mklroot = self.get_mkl_rootdir()
1294 if mklroot is None:
1295 system_info.__init__(self)
1296 else:
1297 from .cpuinfo import cpu
1298 if cpu.is_Itanium():
1299 plt = '64'
1300 elif cpu.is_Intel() and cpu.is_64bit():
1301 plt = 'intel64'
1302 else:
1303 plt = '32'
1304 system_info.__init__(
1305 self,
1306 default_lib_dirs=[os.path.join(mklroot, 'lib', plt)],
1307 default_include_dirs=[os.path.join(mklroot, 'include')])
1308
1309 def calc_info(self):
1310 lib_dirs = self.get_lib_dirs()
1311 incl_dirs = self.get_include_dirs()
1312 opt = self.get_option_single('mkl_libs', 'libraries')
1313 mkl_libs = self.get_libs(opt, self._lib_mkl)
1314 info = self.check_libs2(lib_dirs, mkl_libs)
1315 if info is None:
1316 return

Callers 2

test_overridesMethod · 0.90

Calls

no outgoing calls

Tested by 1

test_overridesMethod · 0.72