Skip to content

Commit

Permalink
Compatibility Numpy 1.26.0
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier committed Sep 19, 2023
1 parent 02c41fb commit af4b641
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
10 changes: 3 additions & 7 deletions bench/check_openmp.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# OMP_NUM_THREADS=1 python check_openmp.py
# OMP_NUM_THREADS=$(nproc) python check_openmp.py
import sys
import timeit

from numpy.distutils.system_info import get_info
import timeit

import numpy as np

info = get_info('blas_opt')
print('BLAS info:')
for kk, vv in info.items():
print(' * ' + kk + ' ' + str(vv))
np.show_config()


setup = (
Expand Down
23 changes: 14 additions & 9 deletions setup_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,22 @@ def create_ext(base_name):


def base_names_from_config(config):
from numpy.__config__ import get_info

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:
# only works with old Numpy (<1.26.0)
from numpy.__config__ import get_info
# see https://stackoverflow.com/a/68991641
except ImportError:
use_mkl_intel = False
else:
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

base_names = []
if config["fftw3"]["use"]:
Expand Down

0 comments on commit af4b641

Please sign in to comment.