python:pyopencl

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
python:pyopencl [2020/06/11 07:07] – [PyOpenCL のインストール] ともやんpython:pyopencl [2023/09/27 08:05] (現在) ともやん
行 1: 行 1:
-<html> +~~CLOSETOC~~
-  <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> +
-   +
-  <style> +
-    #result pre, #mincode pre { +
-      overflow: hidden; +
-      font-size: 10px; +
-    } +
-    #result_long pre, #mincode_long pre { +
-      height: 250px; +
-      overflow: scroll; +
-      overflow-x: hidden; +
-      font-size: 10px; +
-    } +
-    #mintbl table { +
-      font-size: 12px; +
-    } +
-    #mintbl td pre { +
-      margin: 0; +
-    } +
-    #img_long { +
-      height: 400px; +
-      overflow: scroll; +
-      overflow-x: hidden; +
-    } +
-    .dokuwiki .plugin_wrap table { +
-      width: auto; +
-    } +
-    #logo { +
-      background-color: white; +
-      padding: 10px; +
-      width: fit-content; +
-    } +
-    #logo p { +
-      margin: 0; +
-    } +
-  </style> +
-</html>+
 ====== PyOpenCL のインストール ====== ====== PyOpenCL のインストール ======
 ここでは、以下の CPU および GPU を使用してベンチマークを行った。\\ ここでは、以下の CPU および GPU を使用してベンチマークを行った。\\
行 47: 行 10:
  
 <html> <html>
-  <div id="chart_divstyle="width: 640px; height: 400px; overflow-x: scroll;"></div> +  <iframe width="640height="400src="//jsfiddle.net/tomoyan596/o57z9trf/embedded/result,js,html,css,resources/dark/" allowfullscreen="allowfullscreen" allowpaymentrequest frameborder="0"></iframe>
-  <script> +
-    google.charts.load('current'+
-      packages: ['corechart''bar'+
-    }); +
-    google.charts.setOnLoadCallback(drawMultSeries); +
-     +
-    function drawMultSeries() { +
-      let data = google.visualization.arrayToDataTable([ +
-        ['モデル''実行時間'], +
-        ['AMD® GPU Radeon\nHD 5870', +
-          {v: 0.0000072220, f: 0.0000072220}], +
-        ['Intel® GPU HD Graphics 4000', +
-          {v: 0.0007947200, f: 0.0007947200}], +
-        ['NVIDIA® Tesla® T4\n(Google Colab)', +
-          {v: 0.0010557440, f: 0.0010557440}], +
-        ['AMD® CPU Phenom™ II X6 1100T Processor', +
-          {v: 0.0010633330, f: 0.0010633330}], +
-        ['Intel® CPU Core™ i7-3517U CPU @ 1.90GHz', +
-          {v: 0.0011095000, f: 0.0011095000}], +
-        ['NVIDIA® GPU GeForce GT 640M', +
-          {v: 0.0015742400, f: 0.0015742400}] +
-      ]); +
-       +
-      let options = { +
-        title: 'OpenCL ベンチマーク - benchmark-all.py 実行時間(秒)', +
-        chartArea: { +
-          width: '50%', +
-        }, +
-        width: 600, +
-        height: 400, +
-        is3D: true, +
-        hAxis: { +
-          title: '<- fast | slow ->', +
-          minValue: 0, +
-          scaleType: 'log' +
-        }, +
-        vAxis: { +
-          title: 'モデル' +
-        }, +
-        explorer: {  +
-          actions: ['dragToZoom', 'rightClickToReset'], +
-          axis: 'horizontal', +
-          keepInBounds: true, +
-          maxZoomIn: 4.0 +
-        } +
-      }; +
-       +
-      let chart = new google.visualization.BarChart(document.getElementById('chart_div')); +
-      chart.draw(data, options); +
-    } +
-  </script>+
 </html> </html>
 +
 +本家: [[https://documen.tician.de/pyopencl/|Home - pyopencl 2021.2.6 documentation]]\\
 +OpenCL本家: [[https://www.khronos.org/opencl/|OpenCL - The Open Standard for Parallel Programming of Heterogeneous Systems]]\\
 +
 +===== OpenCL 開発環境 =====
 +OpenCL を利用するには OS プラットフォームに関係なく、[[c_cpp:opencl_sdk|OpenCL 開発環境構築]] が必要である。\\
 +
 ===== Windows ===== ===== Windows =====
 PyOpenCL をインストールするには、[[windows:visualstudio|Microsoft Visual Studio]]、および、[[c_cpp:opencl_sdk|OpenCL 開発環境構築]] が必要である。\\ PyOpenCL をインストールするには、[[windows:visualstudio|Microsoft Visual Studio]]、および、[[c_cpp:opencl_sdk|OpenCL 開発環境構築]] が必要である。\\
-\\+ 
 +PyOpenCL 仮想環境の作成を行う。(任意)\\ 
 +<WRAP prewrap 100% #result> 
 +<code> 
 +$ python -m venv py38opencl 
 +$ . py38opencl\Scripts\activate 
 +(py38opencl) $ python -m pip install --upgrade pip 
 +Collecting pip 
 +  Downloading pip-20.2.3-py2.py3-none-any.whl (1.5 MB) 
 +     |████████████████████████████████| 1.5 MB 656 kB/s 
 +Installing collected packages: pip 
 +  Attempting uninstall: pip 
 +    Found existing installation: pip 20.1.1 
 +    Uninstalling pip-20.1.1: 
 +      Successfully uninstalled pip-20.1.1 
 +Successfully installed pip-20.2.3 
 +</code> 
 +</WRAP> 
 pybind11、Mako をインストールする。\\ pybind11、Mako をインストールする。\\
 <WRAP prewrap 100% #result> <WRAP prewrap 100% #result>
 <code> <code>
-> pip install pybind11 Mako+> pip install pybind11 mako
 Collecting pybind11 Collecting pybind11
-  Downloading https://files.pythonhosted.org/packages/5d/85/c7a8dffda52ce25a8bcfe9a28b6861bdd52da59ae001fdd4173e054b7d9b/pybind11-2.3.0-py2.py3-none-any.whl (147kB+  Downloading pybind11-2.5.0-py2.py3-none-any.whl (296 kB
-     |████████████████████████████████| 153kB 1.3MB/s +     |████████████████████████████████| 296 kB 652 kB/s 
-Collecting Mako +Collecting mako 
-  Downloading https://files.pythonhosted.org/packages/1b/a5/023aba3d69aacef6bfc13797bdc3dd03c6fb4ae2dcd2fde7dffc37233924/Mako-1.0.14.tar.gz (462kB+  Downloading Mako-1.1.3-py2.py3-none-any.whl (75 kB
-     |████████████████████████████████| 471kB 3.3MB/s +     |████████████████████████████████| 75 kB 414 kB/s 
-Collecting MarkupSafe>=0.9.2 (from Mako) +Collecting MarkupSafe>=0.9.2 
-  Downloading https://files.pythonhosted.org/packages/65/c6/2399700d236d1dd681af8aebff1725558cddfd6e43d7a5184a675f4711f5/MarkupSafe-1.1.1-cp37-cp37m-win_amd64.whl +  Downloading MarkupSafe-1.1.1-cp38-cp38-win_amd64.whl (16 kB) 
-Installing collected packages: pybind11, MarkupSafe, Mako +Installing collected packages: pybind11, MarkupSafe, mako 
-  Running setup.py install for Mako ... done +Successfully installed MarkupSafe-1.1.1 mako-1.1.pybind11-2.5.0
-Successfully installed Mako-1.0.14 MarkupSafe-1.1.pybind11-2.3.0+
 </code> </code>
 </WRAP> </WRAP>
 +
 PyOpenCL をインストールする。\\ PyOpenCL をインストールする。\\
 <code> <code>
行 127: 行 64:
 <code> <code>
 Collecting pyopencl Collecting pyopencl
-  Downloading https://files.pythonhosted.org/packages/1b/0e/f49c0507610aae0bc2aba6ad1e79f87992d9e74e6ea55af23e436075502e/pyopencl-2019.1.tar.gz (341kB+  Downloading pyopencl-2020.2.2.tar.gz (352 kB
-     |████████████████████████████████| 348kB 384kB/s +     |████████████████████████████████| 352 kB 544 kB/s 
-Collecting numpy (from pyopencl) +Collecting numpy 
-  Downloading https://files.pythonhosted.org/packages/26/26/73ba03b2206371cdef62afebb877e9ba90a1f0dc3d9de22680a3970f5a50/numpy-1.17.0-cp37-cp37m-win_amd64.whl (12.8MB) +  Using cached numpy-1.19.2-cp38-cp38-win_amd64.whl (13.0 MB
-     |████████████████████████████████| 12.8MB 656kB/s +Collecting pytools>=2017.6 
-Collecting pytools>=2017.6 (from pyopencl) +  Downloading pytools-2020.4.tar.gz (67 kB
-  Downloading https://files.pythonhosted.org/packages/00/96/00416762a3eda8876a17d007df4a946f46b2e4ee1057e0b9714926472ef8/pytools-2019.1.1.tar.gz (58kB+     |████████████████████████████████| 67 kB 828 kB/s 
-     |████████████████████████████████| 61kB 2.0MB/s +Collecting decorator>=3.2.0 
-Collecting decorator>=3.2.0 (from pyopencl) +  Downloading decorator-4.4.2-py2.py3-none-any.whl (9.2 kB) 
-  Downloading https://files.pythonhosted.org/packages/5f/88/0075e461560a1e750a0dcbf77f1d9de775028c37a19a346a6c565a257399/decorator-4.4.0-py2.py3-none-any.whl +Collecting appdirs>=1.4.0 
-Collecting appdirs>=1.4.0 (from pyopencl) +  Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB) 
-  Downloading https://files.pythonhosted.org/packages/56/eb/810e700ed1349edde4cbdc1b2a21e28cdf115f9faf263f6bbf8447c1abf3/appdirs-1.4.3-py2.py3-none-any.whl +Collecting six>=1.8.0 
-Collecting six>=1.9.0 (from pyopencl) +  Downloading six-1.15.0-py2.py3-none-any.whl (10 kB) 
-  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl+Using legacy 'setup.py install' for pyopencl, since package 'wheel' is not installed. 
 +Using legacy 'setup.py install' for pytools, since package 'wheel' is not installed.
 Installing collected packages: numpy, decorator, appdirs, six, pytools, pyopencl Installing collected packages: numpy, decorator, appdirs, six, pytools, pyopencl
-  Running setup.py install for pytools ... done +    Running setup.py install for pytools ... done 
-  Running setup.py install for pyopencl ... done +    Running setup.py install for pyopencl ... done 
-Successfully installed appdirs-1.4.decorator-4.4.numpy-1.17.pyopencl-2019.pytools-2019.1.1 six-1.12.0+Successfully installed appdirs-1.4.decorator-4.4.numpy-1.19.pyopencl-2020.2.2 pytools-2020.six-1.15.0
 </code> </code>
 </WRAP> </WRAP>
行 403: 行 341:
 > pip install pyopencl > pip install pyopencl
 </code> </code>
-<WRAP prewrap 100% #result>+<WRAP prewrap 100% #result_long>
 <code> <code>
 Collecting pyopencl Collecting pyopencl
行 546: 行 484:
 </code> </code>
 </WRAP> </WRAP>
 +
 +==== error: Microsoft Visual C++ 14.0 is required. が発生する ====
 +<code>
 +> pip install pyopencl
 +</code>
 +
 +<WRAP prewrap 100% #result_long>
 +<code>
 +Collecting pyopencl
 +  Using cached pyopencl-2020.2.1.tar.gz (352 kB)
 +Requirement already satisfied: numpy in c:\users\tomoyan\py38_opencl\lib\site-packages (from pyopencl) (1.19.1)
 +Requirement already satisfied: pytools>=2017.6 in c:\users\tomoyan\py38_opencl\lib\site-packages (from pyopencl) (2020.4)
 +Requirement already satisfied: decorator>=3.2.0 in c:\users\tomoyan\py38_opencl\lib\site-packages (from pyopencl) (4.4.2)
 +Requirement already satisfied: appdirs>=1.4.0 in c:\users\tomoyan\py38_opencl\lib\site-packages (from pyopencl) (1.4.4)
 +Requirement already satisfied: six>=1.9.0 in c:\users\tomoyan\py38_opencl\lib\site-packages (from pyopencl) (1.15.0)
 +Using legacy setup.py install for pyopencl, since package 'wheel' is not installed.
 +Installing collected packages: pyopencl
 +    Running setup.py install for pyopencl ... error
 +    ERROR: Command errored out with exit status 1:
 +     command: 'c:\users\tomoyan\py38_opencl\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\tomoyan\\AppData\\Local\\Temp\\pip-install-kysbgjhb\\pyopencl\\setup.py'"'"'; __file__='"'"'C:\\Users\\tomoyan\\AppData\\Local\\Temp\\pip-install-kysbgjhb\\pyopencl\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\tomoyan\AppData\Local\Temp\pip-record-u_d5qgvn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\tomoyan\py38_opencl\include\site\python3.8\pyopencl'
 +         cwd: C:\Users\tomoyan\AppData\Local\Temp\pip-install-kysbgjhb\pyopencl\
 +    Complete output (70 lines):
 +    running install
 +    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'
 +    warning: no files found matching 'pyproject.toml'
 +    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
 +    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
 +    ----------------------------------------
 +ERROR: Command errored out with exit status 1: 'c:\users\tomoyan\py38_opencl\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\tomoyan\\AppData\\Local\\Temp\\pip-install-kysbgjhb\\pyopencl\\setup.py'"'"'; __file__='"'"'C:\\Users\\tomoyan\\AppData\\Local\\Temp\\pip-install-kysbgjhb\\pyopencl\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\tomoyan\AppData\Local\Temp\pip-record-u_d5qgvn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\tomoyan\py38_opencl\include\site\python3.8\pyopencl' Check the logs for full command output.
 +</code>
 +</WRAP>
 +手軽に済ませたい場合は [[windows:build_tools_for_visual_studio|Build Tools for Visual Studio]] をインストールする。\\
  
 ==== fatal error C1083: include ファイルを開けません。'CL/cl.h':No such file or directory が発生する ==== ==== fatal error C1083: include ファイルを開けません。'CL/cl.h':No such file or directory が発生する ====
行 551: 行 586:
 > pip install pyopencl > pip install pyopencl
 </code> </code>
-<WRAP prewrap 100% #result>+<WRAP prewrap 100% #result_long>
 <code> <code>
 Collecting pyopencl Collecting pyopencl
  • python/pyopencl.1591826833.txt.gz
  • 最終更新: 2020/06/11 07:07
  • by ともやん