def has_mkl_numpy(): """Has numpy been installed and linked against MKL""" try: from numpy.__config__ import get_info return any("mkl" in lib for lib in get_info("blas_mkl").get("libraries", {})) except ImportError as e: if "mkl" in str(e): # numpy seems to be installed and linked against MKL, # but mkl was not found. raise ImportError( "Trying to import numpy for MKL check, but obtained an " "import error indicating a missing MKL dependency. " "Did you load the MKL modules properly?" ) from e # This indicates a missing numpy or a big error in numpy. It's best # to assume MKL is not there and (potentially) install the non-mkl # version from pypi return False
os.system("python setup.py sdist upload") sys.exit() # Default compile arguments. compile_args = dict(libraries=[], define_macros=[("NDEBUG", None)]) if os.name == "posix": compile_args["libraries"].append("m") localincl = os.path.join("genrp", "include") compile_args["include_dirs"] = [ localincl, numpy.get_include(), ] # Figure out numpy's LAPACK configuration. info = npconf.get_info("blas_opt_info") print("Found LAPACK linking info:") pprint.pprint(info) for k, v in info.items(): try: compile_args[k] = compile_args.get(k, []) + v except TypeError: continue # Check for the Cython source (development mode) and compile it if it # exists. solver_fn = os.path.join("genrp", "_genrp") if os.path.exists(solver_fn + ".pyx"): import shutil from Cython.Build import cythonize print("In dev mode...")
make_pythran_extensions, fluidfft_build_ext, ) try: from config import parse_config except ImportError: # solve a bug... Useful when there is already a module config imported... here = os.path.abspath(os.path.dirname(__file__)) d = run_path(os.path.join(here, "config.py")) parse_config = d["parse_config"] monkeypatch_parallel_build() try: blas_libs = get_info("blas_opt")["libraries"] use_mkl_intel = "mkl_intel_lp64" in blas_libs or "mkl_rt" in blas_libs # Note: No symbol clash occurs if 'mkl_rt' appears in numpy libraries # instead. # P.S.: If 'mkl_rt' is detected, use FFTW libraries, not Intel's MKL/FFTW # implementation. except KeyError: use_mkl_intel = False from fluidpythran.dist import make_pythran_files here = Path(__file__).parent.absolute() paths = ["fluidfft/fft2d/operators.py", "fluidfft/fft3d/operators.py"] make_pythran_files( [here / path for path in paths], mocked_modules=("fluiddyn.util", "fluiddyn.util.mpi"),