0

我按照以下说明操作: https ://plaidml.github.io/plaidml/docs/install#macos

并运行以

from os import environ
environ["KERAS_BACKEND"] = "plaidml.keras.backend"


import keras
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam

设置使用哪个 GPU 后

Default Config Devices:
   llvm_cpu.0 : CPU (via LLVM)
   metal_intel(r)_uhd_graphics_630.0 : Intel(R) UHD Graphics 630 (Metal)
   metal_amd_radeon_pro_5300m.0 : AMD Radeon Pro 5300M (Metal)

Experimental Config Devices:
   llvm_cpu.0 : CPU (via LLVM)
   opencl_amd_radeon_pro_5300m_compute_engine.0 : AMD AMD Radeon Pro 5300M Compute Engine (OpenCL)
   metal_intel(r)_uhd_graphics_630.0 : Intel(R) UHD Graphics 630 (Metal)
   opencl_intel_uhd_graphics_630.0 : Intel Inc. Intel(R) UHD Graphics 630 (OpenCL)
   metal_amd_radeon_pro_5300m.0 : AMD Radeon Pro 5300M (Metal)

Using experimental devices can cause poor performance, crashes, and other nastiness.

Enable experimental device support? (y,n)[n]:y

Multiple devices detected (You can override by setting PLAIDML_DEVICE_IDS).
Please choose a default device:

   1 : llvm_cpu.0
   2 : opencl_amd_radeon_pro_5300m_compute_engine.0
   3 : metal_intel(r)_uhd_graphics_630.0
   4 : opencl_intel_uhd_graphics_630.0
   5 : metal_amd_radeon_pro_5300m.0

Default device? (1,2,3,4,5)[1]:2

Selected device:
    opencl_amd_radeon_pro_5300m_compute_engine.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.```


I ran the jupyter notebook and codes the shell showed

(plaidml-venv) tom@TomdeMacBook-Pro ~ % jupyter notebook
[I 00:33:57.459 NotebookApp] [jupyter_nbextensions_configurator] enabled 0.4.1
[I 00:33:57.460 NotebookApp] Serving notebooks from local directory: /Users/tom
[I 00:33:57.460 NotebookApp] The Jupyter Notebook is running at:
....
....
[I 00:34:14.427 NotebookApp] Kernel started: 85afcfbd-f2a5-4c2a-b5ef-0b5d2bd13c67
[I 00:34:21.789 NotebookApp] Starting buffering for 85afcfbd-f2a5-4c2a-b5ef-0b5d2bd13c67:2e235bb3866a4a8785f81f761cca51b7
[I 00:34:22.002 NotebookApp] Kernel restarted: 85afcfbd-f2a5-4c2a-b5ef-0b5d2bd13c67
[I 00:34:22.461 NotebookApp] Restoring connection for 85afcfbd-f2a5-4c2a-b5ef-0b5d2bd13c67:2e235bb3866a4a8785f81f761cca51b7
[I 00:34:22.461 NotebookApp] Replaying 3 buffered messages
2021-05-05 00:34:27.072860: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-05-05 00:34:27.073059: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-05-05 00:34:30.750011: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:116] None of the MLIR optimization passes are enabled (registered 2)

我选择作为目标的 AMD GPU 没有显示任何活动。

在此处输入图片描述 您能帮我吗?

4

1 回答 1

0

我有同样的问题,我使用与你相同的配置。尝试像这样选择第四个选项“4:metal_amd_radeon_pro_5300m.0”

这个

它对我有用,这是屏幕截图

截屏

于 2021-10-02T06:16:50.607 回答