Exemple #1
0
def get_mkl_dirs_and_libs_like_numpy(config, lib_dir, extension):
    try:
        import numpy
    except ImportError:
        raise Exception("MKL autodetection failed: NumPy could not "
                        "be imported. Specify MKL location manually")
    numpy_path = numpy.__file__ # path to numpy/__init__.pyc
    numpy_dir = os.path.dirname(numpy_path)
    lapack_lite_path = os.path.join(numpy_dir,
                                    "linalg/lapack_lite.so")
    if not os.path.isfile(lapack_lite_path):
        raise Exception("MKL autodetection failed: '"+lapack_lite_path+
                        "' is not a file. Specify MKL location manually")
    if sys.platform.startswith('darwin'):
        otool_output = tools.check_output(['otool','-L',lapack_lite_path])
        mkl_dirs,mkl_libs = parse_otool_output(otool_output)
    else: # 'linux' -- we've checked that its 'darwin' or 'linux' before
        env = os.environ.copy()
        # Fix for Canopy 1.0.3: ensure that LD_LIBRARY_PATH contains the
        # appdata/canopy-*/lib directory
        if "VENV_LD_LIBRARY_PATH" in env:
            env["LD_LIBRARY_PATH"] = env["VENV_LD_LIBRARY_PATH"]
        ldd_output = tools.check_output(['ldd',lapack_lite_path],env=env)
        mkl_dirs,mkl_libs = parse_ldd_output(ldd_output)
    return mkl_dirs,mkl_libs
Exemple #2
0
def get_mkl_dirs_and_libs_like_numpy(config, lib_dir, extension):
    try:
        import numpy
    except ImportError:
        raise Exception("MKL autodetection failed: NumPy could not "
                        "be imported. Specify MKL location manually")
    numpy_path = numpy.__file__  # path to numpy/__init__.pyc
    numpy_dir = os.path.dirname(numpy_path)
    lapack_lite_path = os.path.join(numpy_dir, "linalg/lapack_lite.so")
    if not os.path.isfile(lapack_lite_path):
        raise Exception("MKL autodetection failed: '" + lapack_lite_path +
                        "' is not a file. Specify MKL location manually")
    if sys.platform.startswith('darwin'):
        otool_output = tools.check_output(['otool', '-L', lapack_lite_path])
        mkl_dirs, mkl_libs = parse_otool_output(otool_output)
    else:  # 'linux' -- we've checked that its 'darwin' or 'linux' before
        ldd_output = tools.check_output(['ldd', lapack_lite_path])
        mkl_dirs, mkl_libs = parse_ldd_output(ldd_output)
    return mkl_dirs, mkl_libs
Exemple #3
0
def get_mkl_dirs_and_libs_like_numpy(config, lib_dir, extension):
    try:
        import numpy
    except ImportError:
        raise Exception("MKL autodetection failed: NumPy could not "
                        "be imported. Specify MKL location manually")
    numpy_path = numpy.__file__ # path to numpy/__init__.pyc
    numpy_dir = os.path.dirname(numpy_path)
    lapack_lite_path = os.path.join(numpy_dir,
                                    "linalg/lapack_lite.so")
    if not os.path.isfile(lapack_lite_path):
        raise Exception("MKL autodetection failed: '"+lapack_lite_path+
                        "' is not a file. Specify MKL location manually")
    if sys.platform.startswith('darwin'):
        otool_output = tools.check_output(['otool','-L',lapack_lite_path])
        mkl_dirs,mkl_libs = parse_otool_output(otool_output)
    else: # 'linux' -- we've checked that its 'darwin' or 'linux' before
        ldd_output = tools.check_output(['ldd',lapack_lite_path])
        mkl_dirs,mkl_libs = parse_ldd_output(ldd_output)
    return mkl_dirs,mkl_libs