PlaidML을 통해 AMD GPU 사용하기 (macOS)
R로 Deep Learning을 macbook의 GPU를 활용해서 분석하기 위한 환경설정.
Miniconda 설치 (reticulate 릍 통해)
https://onesixx.com/miniconda/
가상환경 설치 (ex. sixxDL)
condaenv 선택 (reticulate 릍 통해)
Keras 설치
추가 모듈 설치
Keras 란
Keras란, High-level neural networks API written in Python
for using TensorFlow, CNTK, or Theano
> install.packages("keras") Installing package into '/home/oschung_skcc/R/x86_64-pc-linux-gnu-library/3.6' (as 'lib' is unspecified) also installing the dependencies 'config', 'tensorflow', 'tfruns', 'zeallot' ....
GPU 버전 설치 (miniconda의 가상환경에 설치)
condadev에 설치하기위해 아래 사용. (miniconda 없으면 먼저 설치하고, r-reticulate 가상환경에 설치됨)
설치후 확인 작업
> install_keras(method="conda", tensorflow="gpu") Collecting package metadata (current_repodata.json): ...working... done Solving environment: ...working... done ## Package Plan ## environment location: /home/oschung_skcc/.local/share/r-miniconda/envs/sixxDL added / updated specs: - python=3.6 The following packages will be downloaded: package | build ---------------------------|----------------- certifi-2020.6.20 | py36_0 156 KB python-3.6.10 | hcf32534_1 29.7 MB setuptools-49.2.0 | py36_0 748 KB ------------------------------------------------------------ Total: 30.6 MB The following packages will be REMOVED: python_abi-3.8-1_cp38 The following packages will be UPDATED: ca-certificates conda-forge::ca-certificates-2020.6.2~ --> pkgs/main::ca-certificates-2020.6.24-0 The following packages will be SUPERSEDED by a higher-priority channel: certifi conda-forge::certifi-2020.6.20-py38h3~ --> pkgs/main::certifi-2020.6.20-py36_0 openssl conda-forge::openssl-1.1.1g-h516909a_1 --> pkgs/main::openssl-1.1.1g-h7b6447c_0 python conda-forge::python-3.8.5-h4d41432_2_~ --> pkgs/main::python-3.6.10-hcf32534_1 setuptools conda-forge::setuptools-49.2.1-py38h3~ --> pkgs/main::setuptools-49.2.0-py36_0 Downloading and Extracting Packages certifi-2020.6.20 | 156 KB | ########## | 100% python-3.6.10 | 29.7 MB | ########## | 100% setuptools-49.2.0 | 748 KB | ########## | 100% Preparing transaction: ...working... done Verifying transaction: ...working... done Executing transaction: ...working... done Collecting tensorflow-gpu==2.2.0 Downloading tensorflow_gpu-2.2.0-cp36-cp36m-manylinux2010_x86_64.whl (516.2 MB) Collecting keras Downloading Keras-2.4.3-py2.py3-none-any.whl (36 kB) Collecting tensorflow-hub Downloading tensorflow_hub-0.8.0-py2.py3-none-any.whl (101 kB) Collecting h5py Downloading h5py-2.10.0-cp36-cp36m-manylinux1_x86_64.whl (2.9 MB) Collecting pyyaml==3.12 Downloading PyYAML-3.12.tar.gz (253 kB) Collecting requests Downloading requests-2.24.0-py2.py3-none-any.whl (61 kB) Collecting Pillow Downloading Pillow-7.2.0-cp36-cp36m-manylinux1_x86_64.whl (2.2 MB) Collecting scipy Downloading scipy-1.5.2-cp36-cp36m-manylinux1_x86_64.whl (25.9 MB) Collecting astunparse==1.6.3 Downloading astunparse-1.6.3-py2.py3-none-any.whl (12 kB) Collecting google-pasta>=0.1.8 Downloading google_pasta-0.2.0-py3-none-any.whl (57 kB) Collecting keras-preprocessing>=1.1.0 Downloading Keras_Preprocessing-1.1.2-py2.py3-none-any.whl (42 kB) Collecting tensorboard<2.3.0,>=2.2.0 Downloading tensorboard-2.2.2-py3-none-any.whl (3.0 MB) Collecting termcolor>=1.1.0 Downloading termcolor-1.1.0.tar.gz (3.9 kB) Collecting six>=1.12.0 Downloading six-1.15.0-py2.py3-none-any.whl (10 kB) Collecting opt-einsum>=2.3.2 Downloading opt_einsum-3.3.0-py3-none-any.whl (65 kB) Collecting absl-py>=0.7.0 Downloading absl-py-0.9.0.tar.gz (104 kB) Collecting grpcio>=1.8.6 Downloading grpcio-1.31.0-cp36-cp36m-manylinux2014_x86_64.whl (3.4 MB) Collecting gast==0.3.3 Downloading gast-0.3.3-py2.py3-none-any.whl (9.7 kB) Collecting protobuf>=3.8.0 Downloading protobuf-3.12.4-cp36-cp36m-manylinux1_x86_64.whl (1.3 MB) Collecting tensorflow-estimator<2.3.0,>=2.2.0 Downloading tensorflow_estimator-2.2.0-py2.py3-none-any.whl (454 kB) Requirement already satisfied, skipping upgrade: wheel>=0.26; python_version >= "3" in /home/oschung_skcc/.local/share/r-miniconda/envs/sixxDL/lib/python3.6/site-packages (from tensorflow-gpu==2.2.0) (0.34.2) Collecting numpy<2.0,>=1.16.0 Downloading numpy-1.19.1-cp36-cp36m-manylinux2010_x86_64.whl (14.5 MB) Collecting wrapt>=1.11.1 Downloading wrapt-1.12.1.tar.gz (27 kB) Collecting idna<3,>=2.5 Downloading idna-2.10-py2.py3-none-any.whl (58 kB) Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 Downloading urllib3-1.25.10-py2.py3-none-any.whl (127 kB) Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /home/oschung_skcc/.local/share/r-miniconda/envs/sixxDL/lib/python3.6/site-packages (from requests) (2020.6.20) Collecting chardet<4,>=3.0.2 Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB) Collecting werkzeug>=0.11.15 Downloading Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB) Requirement already satisfied, skipping upgrade: setuptools>=41.0.0 in /home/oschung_skcc/.local/share/r-miniconda/envs/sixxDL/lib/python3.6/site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow-gpu==2.2.0) (49.2.0.post20200714) Collecting google-auth-oauthlib<0.5,>=0.4.1 Downloading google_auth_oauthlib-0.4.1-py2.py3-none-any.whl (18 kB) Collecting markdown>=2.6.8 Downloading Markdown-3.2.2-py3-none-any.whl (88 kB) Collecting google-auth<2,>=1.6.3 Downloading google_auth-1.20.0-py2.py3-none-any.whl (91 kB) Collecting tensorboard-plugin-wit>=1.6.0 Downloading tensorboard_plugin_wit-1.7.0-py3-none-any.whl (779 kB) Collecting requests-oauthlib>=0.7.0 Downloading requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB) Collecting importlib-metadata; python_version < "3.8" Downloading importlib_metadata-1.7.0-py2.py3-none-any.whl (31 kB) Collecting cachetools<5.0,>=2.0.0 Downloading cachetools-4.1.1-py3-none-any.whl (10 kB) Collecting pyasn1-modules>=0.2.1 Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB) Collecting rsa<5,>=3.1.4; python_version >= "3.5" Downloading rsa-4.6-py3-none-any.whl (47 kB) Collecting oauthlib>=3.0.0 Downloading oauthlib-3.1.0-py2.py3-none-any.whl (147 kB) Collecting zipp>=0.5 Downloading zipp-3.1.0-py3-none-any.whl (4.9 kB) Collecting pyasn1<0.5.0,>=0.4.6 Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB) Building wheels for collected packages: pyyaml, termcolor, absl-py, wrapt Building wheel for pyyaml (setup.py): started Building wheel for pyyaml (setup.py): finished with status 'done' Created wheel for pyyaml: filename=PyYAML-3.12-cp36-cp36m-linux_x86_64.whl size=43058 sha256=45b3408336f39c507fb9adf0c315b9207c17a175b68574df5a2dbaadb2aa1bbd Stored in directory: /home/oschung_skcc/.cache/pip/wheels/40/06/c3/a48dc77c7d8f60b64eaf0fffd5ee5ab8abce5d13893b73109b Building wheel for termcolor (setup.py): started Building wheel for termcolor (setup.py): finished with status 'done' Created wheel for termcolor: filename=termcolor-1.1.0-py3-none-any.whl size=4830 sha256=0d0066fbd9c799fceafe5b1cb4d56401073038bda6fcddd5c56d6739596d64c8 Stored in directory: /home/oschung_skcc/.cache/pip/wheels/93/2a/eb/e58dbcbc963549ee4f065ff80a59f274cc7210b6eab962acdc Building wheel for absl-py (setup.py): started Building wheel for absl-py (setup.py): finished with status 'done' Created wheel for absl-py: filename=absl_py-0.9.0-py3-none-any.whl size=121931 sha256=9a43044398ebd2078b7713cac330118bcce02aac04f9a3a07a9a286b49689d7e Stored in directory: /home/oschung_skcc/.cache/pip/wheels/c3/af/84/3962a6af7b4ab336e951b7877dcfb758cf94548bb1771e0679 Building wheel for wrapt (setup.py): started Building wheel for wrapt (setup.py): finished with status 'done' Created wheel for wrapt: filename=wrapt-1.12.1-cp36-cp36m-linux_x86_64.whl size=69791 sha256=3f52189b8c53754c6004277272bae334624efee34b1ccfbcdf3be260e7cc31a9 Stored in directory: /home/oschung_skcc/.cache/pip/wheels/32/42/7f/23cae9ff6ef66798d00dc5d659088e57dbba01566f6c60db63 Successfully built pyyaml termcolor absl-py wrapt Installing collected packages: six, astunparse, google-pasta, numpy, keras-preprocessing, absl-py, werkzeug, protobuf, idna, urllib3, chardet, requests, oauthlib, requests-oauthlib, cachetools, pyasn1, pyasn1-modules, rsa, google-auth, google-auth-oauthlib, grpcio, zipp, importlib-metadata, markdown, tensorboard-plugin-wit, tensorboard, scipy, termcolor, h5py, opt-einsum, gast, tensorflow-estimator, wrapt, tensorflow-gpu, pyyaml, keras, tensorflow-hub, Pillow ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts. We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. tensorflow-gpu 2.2.0 requires scipy==1.4.1; python_version >= "3", but you'll have scipy 1.5.2 which is incompatible. Successfully installed Pillow-7.2.0 absl-py-0.9.0 astunparse-1.6.3 cachetools-4.1.1 chardet-3.0.4 gast-0.3.3 google-auth-1.20.0 google-auth-oauthlib-0.4.1 google-pasta-0.2.0 grpcio-1.31.0 h5py-2.10.0 idna-2.10 importlib-metadata-1.7.0 keras-2.4.3 keras-preprocessing-1.1.2 markdown-3.2.2 numpy-1.19.1 oauthlib-3.1.0 opt-einsum-3.3.0 protobuf-3.12.4 pyasn1-0.4.8 pyasn1-modules-0.2.8 pyyaml-3.12 requests-2.24.0 requests-oauthlib-1.3.0 rsa-4.6 scipy-1.5.2 six-1.15.0 tensorboard-2.2.2 tensorboard-plugin-wit-1.7.0 tensorflow-estimator-2.2.0 tensorflow-gpu-2.2.0 tensorflow-hub-0.8.0 termcolor-1.1.0 urllib3-1.25.10 werkzeug-1.0.1 wrapt-1.12.1 zipp-3.1.0 Installation complete. Restarting R session...
CPU버전 설치
Collecting tensorflow==2.0.0 Using cached tensorflow-2.0.0-cp36-cp36m-macosx_10_11_x86_64.whl (102.7 MB) Collecting keras Using cached Keras-2.3.1-py2.py3-none-any.whl (377 kB) Collecting tensorflow-hub Using cached tensorflow_hub-0.8.0-py2.py3-none-any.whl (101 kB) Collecting h5py Using cached h5py-2.10.0-cp36-cp36m-macosx_10_6_intel.whl (3.0 MB) Processing /Users/onesixx/Library/Caches/pip/wheels/e5/9d/ad/2ee53cf262cba1ffd8afe1487eef788ea3f260b7e6232a80fc/PyYAML-5.3.1-cp36-cp36m-macosx_10_9_x86_64.whl Collecting requests Using cached requests-2.23.0-py2.py3-none-any.whl (58 kB) Collecting Pillow Using cached Pillow-7.1.1-cp36-cp36m-macosx_10_10_x86_64.whl (2.2 MB) Collecting scipy Using cached scipy-1.4.1-cp36-cp36m-macosx_10_6_intel.whl (28.5 MB) Requirement already satisfied, skipping upgrade: six>=1.10.0 in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow==2.0.0) (1.14.0) Processing /Users/onesixx/Library/Caches/pip/wheels/c3/af/84/3962a6af7b4ab336e951b7877dcfb758cf94548bb1771e0679/absl_py-0.9.0-py3-none-any.whl Collecting keras-preprocessing>=1.0.5 Using cached Keras_Preprocessing-1.1.0-py2.py3-none-any.whl (41 kB) Collecting google-pasta>=0.1.6 Using cached google_pasta-0.2.0-py3-none-any.whl (57 kB) Processing /Users/onesixx/Library/Caches/pip/wheels/93/2a/eb/e58dbcbc963549ee4f065ff80a59f274cc7210b6eab962acdc/termcolor-1.1.0-py3-none-any.whl Processing /Users/onesixx/Library/Caches/pip/wheels/32/42/7f/23cae9ff6ef66798d00dc5d659088e57dbba01566f6c60db63/wrapt-1.12.1-cp36-cp36m-macosx_10_9_x86_64.whl Requirement already satisfied, skipping upgrade: wheel>=0.26 in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow==2.0.0) (0.34.2) Processing /Users/onesixx/Library/Caches/pip/wheels/19/a7/b9/0740c7a3a7d1d348f04823339274b90de25fbcd217b2ee1fbe/gast-0.2.2-py3-none-any.whl Collecting protobuf>=3.6.1 Using cached protobuf-3.11.3-cp36-cp36m-macosx_10_9_x86_64.whl (1.3 MB) Collecting tensorboard<2.1.0,>=2.0.0 Using cached tensorboard-2.0.2-py3-none-any.whl (3.8 MB) Collecting grpcio>=1.8.6 Using cached grpcio-1.28.1-cp36-cp36m-macosx_10_9_x86_64.whl (2.6 MB) Requirement already satisfied, skipping upgrade: numpy<2.0,>=1.16.0 in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow==2.0.0) (1.18.1) Collecting opt-einsum>=2.3.2 Using cached opt_einsum-3.2.1-py3-none-any.whl (63 kB) Collecting keras-applications>=1.0.8 Using cached Keras_Applications-1.0.8-py3-none-any.whl (50 kB) Collecting tensorflow-estimator<2.1.0,>=2.0.0 Using cached tensorflow_estimator-2.0.1-py2.py3-none-any.whl (449 kB) Collecting astor>=0.6.0 Using cached astor-0.8.1-py2.py3-none-any.whl (27 kB) Collecting idna<3,>=2.5 Using cached idna-2.9-py2.py3-none-any.whl (58 kB) Collecting chardet<4,>=3.0.2 Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB) Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from requests) (2020.4.5.1) Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 Using cached urllib3-1.25.9-py2.py3-none-any.whl (126 kB) Requirement already satisfied, skipping upgrade: setuptools in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from protobuf>=3.6.1->tensorflow==2.0.0) (46.1.3.post20200330) Collecting google-auth<2,>=1.6.3 Using cached google_auth-1.14.1-py2.py3-none-any.whl (89 kB) Collecting google-auth-oauthlib<0.5,>=0.4.1 Using cached google_auth_oauthlib-0.4.1-py2.py3-none-any.whl (18 kB) Collecting werkzeug>=0.11.15 Using cached Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB) Collecting markdown>=2.6.8 Using cached Markdown-3.2.1-py2.py3-none-any.whl (88 kB) Collecting rsa<4.1,>=3.1.4 Using cached rsa-4.0-py2.py3-none-any.whl (38 kB) Collecting cachetools<5.0,>=2.0.0 Using cached cachetools-4.1.0-py3-none-any.whl (10 kB) Collecting pyasn1-modules>=0.2.1 Using cached pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB) Collecting requests-oauthlib>=0.7.0 Using cached requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB) Collecting pyasn1>=0.1.3 Using cached pyasn1-0.4.8-py2.py3-none-any.whl (77 kB) Collecting oauthlib>=3.0.0 Using cached oauthlib-3.1.0-py2.py3-none-any.whl (147 kB) Installing collected packages: absl-py, keras-preprocessing, google-pasta, termcolor, wrapt, gast, protobuf, pyasn1, rsa, cachetools, pyasn1-modules, google-auth, idna, chardet, urllib3, requests, oauthlib, requests-oauthlib, google-auth-oauthlib, werkzeug, grpcio, markdown, tensorboard, opt-einsum, h5py, keras-applications, tensorflow-estimator, astor, tensorflow, scipy, pyyaml, keras, tensorflow-hub, Pillow Successfully installed Pillow-7.1.1 absl-py-0.9.0 astor-0.8.1 cachetools-4.1.0 chardet-3.0.4 gast-0.2.2 google-auth-1.14.1 google-auth-oauthlib-0.4.1 google-pasta-0.2.0 grpcio-1.28.1 h5py-2.10.0 idna-2.9 keras-2.3.1 keras-applications-1.0.8 keras-preprocessing-1.1.0 markdown-3.2.1 oauthlib-3.1.0 opt-einsum-3.2.1 protobuf-3.11.3 pyasn1-0.4.8 pyasn1-modules-0.2.8 pyyaml-5.3.1 requests-2.23.0 requests-oauthlib-1.3.0 rsa-4.0 scipy-1.4.1 tensorboard-2.0.2 tensorflow-2.0.0 tensorflow-estimator-2.0.1 tensorflow-hub-0.8.0 termcolor-1.1.0 urllib3-1.25.9 werkzeug-1.0.1 wrapt-1.12.1 Installation complete. Restarting R session...
plaidML (an OpenCL compatible backend)
https://github.com/plaidml/plaidml/
https://plaidml.github.io/plaidml/docs/install.html
https://rpubs.com/siero5335/399690 – Install Keras and PlaidML
https://towardsdatascience.com/deep-learning-using-gpu-on-your-macbook-c9becba7c43
https://tree.rocks/python/mac-amd-gpu-keras-accelerate/
https://keras.rstudio.com/articles/faq.html#how-can-i-use-the-plaidml-backend
https://community.rstudio.com/t/reticulate-1-14-together-with-miniconda3-and-tensorflow-not-working/49180/3

macos 설정 확인

https://onesixx.com/opencl/

PlaidML 설치
PlaidML 설정
PlaidML라이브러리가 Metal(OpenCL)을 통해 Keras의 backend를 책임질 수 있게 설정
PlaidML Setup (0.7.0) Thanks for using PlaidML! The feedback we have received from our users indicates an ever-increasing need for performance, programmability, and portability. During the past few months, we have been restructuring PlaidML to address those needs. To make all the changes we need to make while supporting our current user base, all development of PlaidML has moved to a branch — plaidml-v1. We will continue to maintain and support the master branch of PlaidML and the stable 0.7.0 release. Read more here: https://github.com/plaidml/plaidml Some Notes: * Bugs and other issues: https://github.com/plaidml/plaidml/issues * Questions: https://stackoverflow.com/questions/tagged/plaidml * Say hello: https://groups.google.com/forum/#!forum/plaidml-dev * PlaidML is licensed under the Apache License 2.0
experimental device는 굳이 enable하지 않고,
3 : metal_amd_radeon_pro_560.0 으로 default device 설정 후
해당 설정은 ~/.plaidml 에 저장
Default Config Devices: llvm_cpu.0 : CPU (via LLVM) metal_intel(r)_hd_graphics_630.0 : Intel(R) HD Graphics 630 (Metal) metal_amd_radeon_pro_560.0 : AMD Radeon Pro 560 (Metal) Experimental Config Devices: llvm_cpu.0 : CPU (via LLVM) opencl_amd_radeon_pro_560_compute_engine.0 : AMD AMD Radeon Pro 560 Compute Engine (OpenCL) opencl_intel_hd_graphics_630.0 : Intel Inc. Intel(R) HD Graphics 630 (OpenCL) metal_intel(r)_hd_graphics_630.0 : Intel(R) HD Graphics 630 (Metal) metal_amd_radeon_pro_560.0 : AMD Radeon Pro 560 (Metal) Using experimental devices can cause poor performance, crashes, and other nastiness. Enable experimental device support? (y,n)[n]:n Multiple devices detected (You can override by setting PLAIDML_DEVICE_IDS). Please choose a default device: 1 : llvm_cpu.0 2 : metal_intel(r)_hd_graphics_630.0 3 : metal_amd_radeon_pro_560.0 Default device? (1,2,3)[1]:3 Selected device: metal_amd_radeon_pro_560.0 Almost done. Multiplying some matrices... Tile code: function (B[X,Z], C[Z,Y]) -> (A) { A[x,y : X,Y] = +(B[x,z] * C[z,y]); } Whew. That worked. Save settings to /Users/onesixx/.plaidml? (y,n)[y]:y Success!
{ "PLAIDML_DEVICE_IDS":[ "metal_amd_radeon_pro_560.0" ], "PLAIDML_EXPERIMENTAL":false }
테스트
MobileNet in plaidbench를 설치하고, 이를 활용하여 TEST한다.
Requirement already satisfied: plaidml-keras in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (0.7.0) Collecting plaidbench Using cached plaidbench-0.7.0-py2.py3-none-any.whl (10.1 MB) Requirement already satisfied: six in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from plaidml-keras) (1.14.0) Requirement already satisfied: keras==2.2.4 in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from plaidml-keras) (2.2.4) Requirement already satisfied: plaidml in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from plaidml-keras) (0.7.0) Requirement already satisfied: enum34>=1.1.6 in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from plaidbench) (1.1.10) Collecting click>=6.0.0 Using cached click-7.1.1-py2.py3-none-any.whl (82 kB) Collecting colorama Using cached colorama-0.4.3-py2.py3-none-any.whl (15 kB) Requirement already satisfied: numpy in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from plaidbench)(1.18.1) Requirement already satisfied: h5py>=2.7.0 in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from plaidbench) (2.10.0) Requirement already satisfied: keras-preprocessing>=1.0.5 in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from keras==2.2.4->plaidml-keras) (1.1.0) Requirement already satisfied: scipy>=0.14 in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from keras==2.2.4->plaidml-keras) (1.4.1) Requirement already satisfied: pyyaml in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from keras==2.2.4->plaidml-keras) (5.3.1) Requirement already satisfied: keras-applications>=1.0.6 in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from keras==2.2.4->plaidml-keras) (1.0.8) Requirement already satisfied: cffi in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from plaidml->plaidml-keras) (1.14.0) Requirement already satisfied: pycparser in /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from cffi->plaidml->plaidml-keras) (2.20) Installing collected packages: click, colorama, plaidbench Successfully installed click-7.1.1 colorama-0.4.3 plaidbench-0.7.0
Running 1024 examples with mobilenet, batch size 1, on backend plaid INFO:plaidml:Opening device "metal_amd_radeon_pro_560.0" Compiling network... Warming up... Running... Example finished, elapsed: 0.494s (compile), 8.796s (execution) ----------------------------------------------------------------------------------------- Network Name Inference Latency Time / FPS ----------------------------------------------------------------------------------------- mobilenet 8.59 ms 0.00 ms / 1000000000.00 fps Correctness: PASS, max_error: 1.675534622336272e-05, max_abs_error: 7.674098014831543e-07, fail_ratio: 0.0
Activity Monitor로 GPU사용 확인
Windows – GPU history ( cmd+4 )
(Mac용 활성 상태 보기 앱> 윈도우 > GPU 기록)

GPU사용 환경 확인 in R
> py_config() python: /Users/onesixx/Library/r-miniconda/envs/r-reticulate/bin/python libpython: /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/libpython3.6m.dylib pythonhome: /Users/onesixx/Library/r-miniconda/envs/r-reticulate:/Users/onesixx/Library/r-miniconda/envs/r-reticulate version: 3.6.10 |Anaconda, Inc.| (default, Mar 25 2020, 18:53:43) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] numpy: /Users/onesixx/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/numpy numpy_version: 1.18.1 > conda_list() name python 1 r-miniconda /Users/onesixx/Library/r-miniconda/bin/python 2 r-reticulate /Users/onesixx/Library/r-miniconda/envs/r-reticulate/bin/python
> tf_config() TensorFlow v2.0.0 () Python v3.6 (~/Library/r-miniconda/envs/r-reticulate/bin/python) > is_keras_available() [1] TRUE
TEST using mnist_cnn
https://rpubs.com/siero5335/399690
https://onesixx.com/tutorial-started-with-keras/
ex)


thank you very much. It worked for me!
감사합니다