簡體   English   中英

Numpy 的 FFT 與 Intel MKL

[英]Numpy's FFT with Intel MKL

運行numpy.fft.fft(np.eye(9),norm="ortho)導致TypeError: fft() got an unexpected keyword argument 'norm' 。我正在使用 Intel MKL 運行​​ Numpy。難道是有什么東西圖書館內的鏈接有問題嗎?

我得到了您的聲明,可以使用以下步驟:

  1. 從英特爾網站下載最新的英特爾 Python 發行版(在我的例子中,我使用的是 2022 年 4 月 3 日發布的版本): https ://www.intel.com/content/www/us/en/developer/articles/tool/oneapi -standalone-components.html#python

  2. 使用 conda 激活新的 Intel Python 環境。 例如:

conda activate "C:\Program Files (x86)\Intel\oneAPI\intelpython\python3.9"
  1. 使用 pip 安裝 Intel numpy(請參閱https://pypi.org/project/intel-numpy/ ):
pip install intel-numpy
  1. 如果您在命令行中鍵入python ,您應該會看到 Intel Python 已安裝:
Python 3.9.10 (main, Mar 21 2022, 08:44:00) [MSC v.1916 64 bit (AMD64)] :: Intel Corporation on win32
Type "help", "copyright", "credits" or "license" for more information.
Intel(R) Distribution for Python is brought to you by Intel Corporation.
Please check out: https://software.intel.com/en-us/python-distribution
  1. 現在,如果您import numpy並在新的行類型上輸入numpy.show_config() ,您應該會看到鏈接的 MKL 庫:
blas_mkl_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\include']
blas_opt_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\include']
lapack_mkl_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\include']
lapack_opt_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\include']
Supported SIMD extensions in this NumPy install:
    baseline = SSE,SSE2,SSE3,SSSE3,SSE41,POPCNT,SSE42
    found = AVX512_ICL
    not found =
  1. 如果我運行:
fft = numpy.fft.fft(np.eye(9),norm="ortho)
print(fft)

輸出是:

[[ 0.33333333+0.j          0.33333333-0.j          0.33333333-0.j
   0.33333333-0.j          0.33333333+0.j          0.33333333-0.j
   0.33333333+0.j          0.33333333+0.j          0.33333333+0.j        ]
 [ 0.33333333+0.j          0.25534815-0.21426254j  0.05788273-0.32826925j
  -0.16666667-0.28867513j -0.31323087-0.11400671j -0.31323087+0.11400671j
  -0.16666667+0.28867513j  0.05788273+0.32826925j  0.25534815+0.21426254j]
 [ 0.33333333+0.j          0.05788273-0.32826925j -0.31323087-0.11400671j
  -0.16666667+0.28867513j  0.25534815+0.21426254j  0.25534815-0.21426254j
  -0.16666667-0.28867513j -0.31323087+0.11400671j  0.05788273+0.32826925j]
 [ 0.33333333+0.j         -0.16666667-0.28867513j -0.16666667+0.28867513j
   0.33333333-0.j         -0.16666667-0.28867513j -0.16666667+0.28867513j
   0.33333333+0.j         -0.16666667-0.28867513j -0.16666667+0.28867513j]
 [ 0.33333333+0.j         -0.31323087-0.11400671j  0.25534815+0.21426254j
  -0.16666667-0.28867513j  0.05788273+0.32826925j  0.05788273-0.32826925j
  -0.16666667+0.28867513j  0.25534815-0.21426254j -0.31323087+0.11400671j]
 [ 0.33333333+0.j         -0.31323087+0.11400671j  0.25534815-0.21426254j
  -0.16666667+0.28867513j  0.05788273-0.32826925j  0.05788273+0.32826925j
  -0.16666667-0.28867513j  0.25534815+0.21426254j -0.31323087-0.11400671j]
 [ 0.33333333+0.j         -0.16666667+0.28867513j -0.16666667-0.28867513j
   0.33333333-0.j         -0.16666667+0.28867513j -0.16666667-0.28867513j
   0.33333333+0.j         -0.16666667+0.28867513j -0.16666667-0.28867513j]
 [ 0.33333333+0.j          0.05788273+0.32826925j -0.31323087+0.11400671j
  -0.16666667-0.28867513j  0.25534815-0.21426254j  0.25534815+0.21426254j
  -0.16666667+0.28867513j -0.31323087-0.11400671j  0.05788273-0.32826925j]
 [ 0.33333333+0.j          0.25534815+0.21426254j  0.05788273+0.32826925j
  -0.16666667+0.28867513j -0.31323087+0.11400671j -0.31323087-0.11400671j
  -0.16666667-0.28867513j  0.05788273-0.32826925j  0.25534815-0.21426254j]]

希望這可以幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM