| 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() |