[使用Intel的SDK和pip在Windows上安装PyOpenCL

问题描述 投票:0回答:2

these instructions之后,我已经从here下载并安装了英特尔的OpenCL™SDK(英特尔®System Studio)。 cl.h文件在文件夹中

C:\ Program Files(x86)\ IntelSWTools \ system_studio_2020 \ OpenCL \ sdk \ include \ CL

但是运行时

pip install pyopencl

我收到以下错误消息:>

  Building wheel for pyopencl (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\python38\python.exe' 'c:\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\fsfar\AppData\Local\Temp\tmpsufv5353'
       cwd: C:\Users\fsfar\AppData\Local\Temp\pip-install-cthadcch\pyopencl
  Complete output (95 lines):
  ---------------------------------------------------------------------------
  Mako is not installed.
  ---------------------------------------------------------------------------
  That is not a problem, as most of PyOpenCL will be just fine
  without it. Some higher-level parts of pyopencl (such as
  pyopencl.reduction) will not function without the templating engine
  Mako [1] being installed. If you would like this functionality to
  work, you might want to install Mako after you finish
  installing PyOpenCL.

  Simply type
  python -m pip install mako
  either now or after the installation completes to fix this.

  [1] http://www.makotemplates.org/
  ---------------------------------------------------------------------------
  Hit Ctrl-C now if you'd like to think about the situation.
  ---------------------------------------------------------------------------
  Continuing in 1 seconds...
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.8
  creating build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\algorithm.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\array.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\bitonic_sort.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\bitonic_sort_templates.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\cache.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\capture_call.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\clmath.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\clrandom.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\cltypes.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\elementwise.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\invoker.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\ipython_ext.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\reduction.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\scan.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\tools.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\version.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\_buffers.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\_cluda.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\_mymako.py -> build\lib.win-amd64-3.8\pyopencl
  copying pyopencl\__init__.py -> build\lib.win-amd64-3.8\pyopencl
  creating build\lib.win-amd64-3.8\pyopencl\characterize
  copying pyopencl\characterize\performance.py -> build\lib.win-amd64-3.8\pyopencl\characterize
  copying pyopencl\characterize\__init__.py -> build\lib.win-amd64-3.8\pyopencl\characterize
  creating build\lib.win-amd64-3.8\pyopencl\compyte
  copying pyopencl\compyte\array.py -> build\lib.win-amd64-3.8\pyopencl\compyte
  copying pyopencl\compyte\dtypes.py -> build\lib.win-amd64-3.8\pyopencl\compyte
  copying pyopencl\compyte\__init__.py -> build\lib.win-amd64-3.8\pyopencl\compyte
  creating build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
  copying pyopencl\compyte\ndarray\gen_elemwise.py -> build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
  copying pyopencl\compyte\ndarray\gen_reduction.py -> build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
  copying pyopencl\compyte\ndarray\setup_opencl.py -> build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
  copying pyopencl\compyte\ndarray\test_gpu_elemwise.py -> build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
  copying pyopencl\compyte\ndarray\test_gpu_ndarray.py -> build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
  copying pyopencl\compyte\ndarray\__init__.py -> build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
  running egg_info
  writing pyopencl.egg-info\PKG-INFO
  writing dependency_links to pyopencl.egg-info\dependency_links.txt
  writing requirements to pyopencl.egg-info\requires.txt
  writing top-level names to pyopencl.egg-info\top_level.txt
  reading manifest file 'pyopencl.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no files found matching '*.h'
  warning: no files found matching 'doc\_static\*.css'
  warning: no files found matching 'doc\_templates\*.html'
  warning: no files found matching '*.py.in'
  writing manifest file 'pyopencl.egg-info\SOURCES.txt'
  creating build\lib.win-amd64-3.8\pyopencl\cl
  copying pyopencl\cl\pyopencl-airy.cl -> build\lib.win-amd64-3.8\pyopencl\cl
  copying pyopencl\cl\pyopencl-bessel-j-complex.cl -> build\lib.win-amd64-3.8\pyopencl\cl
  copying pyopencl\cl\pyopencl-bessel-j.cl -> build\lib.win-amd64-3.8\pyopencl\cl
  copying pyopencl\cl\pyopencl-bessel-y.cl -> build\lib.win-amd64-3.8\pyopencl\cl
  copying pyopencl\cl\pyopencl-complex.h -> build\lib.win-amd64-3.8\pyopencl\cl
  copying pyopencl\cl\pyopencl-eval-tbl.cl -> build\lib.win-amd64-3.8\pyopencl\cl
  copying pyopencl\cl\pyopencl-hankel-complex.cl -> build\lib.win-amd64-3.8\pyopencl\cl
  copying pyopencl\cl\pyopencl-ranluxcl.cl -> build\lib.win-amd64-3.8\pyopencl\cl
  creating build\lib.win-amd64-3.8\pyopencl\cl\pyopencl-random123
  copying pyopencl\cl\pyopencl-random123\array.h -> build\lib.win-amd64-3.8\pyopencl\cl\pyopencl-random123
  copying pyopencl\cl\pyopencl-random123\openclfeatures.h -> build\lib.win-amd64-3.8\pyopencl\cl\pyopencl-random123
  copying pyopencl\cl\pyopencl-random123\philox.cl -> build\lib.win-amd64-3.8\pyopencl\cl\pyopencl-random123
  copying pyopencl\cl\pyopencl-random123\threefry.cl -> build\lib.win-amd64-3.8\pyopencl\cl\pyopencl-random123
  running build_ext
  building 'pyopencl._cl' extension
  creating build\temp.win-amd64-3.8
  creating build\temp.win-amd64-3.8\Release
  creating build\temp.win-amd64-3.8\Release\src
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYGPU_PACKAGE=pyopencl -DPYGPU_PYOPENCL=1 -Ipybind11/include -IC:\Users\fsfar\AppData\Local\Temp\pip-build-env-gqyddbnz\overlay\Lib\site-packages\pybind11\include -IC:\Users\fsfar\AppData\Local\Temp\pip-build-env-gqyddbnz\overlay\Lib\site-packages\pybind11\include -IC:\Users\fsfar\AppData\Local\Temp\pip-build-env-gqyddbnz\overlay\Lib\site-packages\numpy\core\include -Ic:\python38\include -Ic:\python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tpsrc/wrap_constants.cpp /Fobuild\temp.win-amd64-3.8\Release\src/wrap_constants.obj -fvisibility=hidden /EHsc /DVERSION_INFO=\"2020.1\"
  cl : Command line warning D9002 : ignoring unknown option '-fvisibility=hidden'
  wrap_constants.cpp
  c:\users\fsfar\appdata\local\temp\pip-install-cthadcch\pyopencl\src\wrap_cl.hpp(57): fatal error C1083: Cannot open include file: 'CL/cl.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
  ----------------------------------------
  ERROR: Failed building wheel for pyopencl
Failed to build pyopencl
ERROR: Could not build wheels for pyopencl which use PEP 517 and cannot be installed directly

P.S.1。

一个半相关的问题也发布了here

P.S.2。

根据thisthis的帖子,应该有一个siteconf.py文件,我可以在其中指定环境变量,例如CL_INC_DIRCL_LIB_DIR。但是,我在硬盘驱动器上找不到上述文件,而且不确定使用pip软件包管理器时是否可以更改环境变量。我尝试过
set CL_INC_DIR = [r'C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\include']

cmd中无济于事。

P.S.3。

我尝试使用pipwin:]安装
pip install pipwin
pipwin install pyopencl

但是在python中运行import pyopencl时,出现错误信息

c:\python38\lib\site-packages\pyopencl\__init__.py in <module>
     37 
     38 try:
---> 39     import pyopencl._cl as _cl
     40 except ImportError:
     41     import os

ImportError: DLL load failed while importing _cl: The specified procedure could not be found.

P.S.4。

我尝试按照说明here,但是命令
pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy

返回

查看索引:https://pypi.anaconda.org/carlkl/simple错误:找不到满足mingwpy要求的版本(来自版本:无)错误:找不到mingwpy的匹配分布

按照这些说明,我从这里下载并安装了英特尔的OpenCL™SDK(英特尔®System Studio)。 cl.h文件位于文件夹C:\ Program Files(x86)\ IntelSWTools \ ...

python pip opencl intel pyopencl
2个回答
1
投票

几年前,我在Ubuntu上遇到了类似的问题,以下问题帮助了我:

pip install --global-option=build_ext --global-option="-I/opt/AMDAPPSDK-3.0/include" --global-option="-L/opt/AMDAPPSDK-3.0/lib/x86_64" pyopencl

0
投票

今天早上我经历了这个确切的问题。我终于可以按照这里的说明进行操作:http://www.minho-kim.com/courses/17sp43.635/pyopencl.html

© www.soinside.com 2019 - 2024. All rights reserved.