您现在的位置是:首页 >其他 >RuntimeError: Unsupported device target GPU. This process only supports one of the [‘CPU‘]. Please c网站首页其他

RuntimeError: Unsupported device target GPU. This process only supports one of the [‘CPU‘]. Please c

努力coding的米羊羊 2025-07-11 00:01:03
简介RuntimeError: Unsupported device target GPU. This process only supports one of the [‘CPU‘]. Please c

复现代码使用mindspore报错:

/home/bingxing2/home/scx7588/.conda/envs/PVQD/lib/python3.8/site-packages/numpy/core/getlimits.py:499: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
/home/bingxing2/home/scx7588/.conda/envs/PVQD/lib/python3.8/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
[ERROR] ME(977786:70381871384144,MainProcess):2025-02-07-20:42:52.427.210 [mindspore/run_check/_check_version.py:219] libcuda.so (need by mindspore-gpu) is not found. Please confirm that libmindspore_gpu.so is in directory:/home/bingxing2/home/scx7588/.conda/envs/PVQD/lib/python3.8/site-packages/mindspore/run_check/../lib/plugin and the correct cuda version has been installed, you can refer to the installation guidelines: https://www.mindspore.cn/install
[ERROR] ME(977786:70381871384144,MainProcess):2025-02-07-20:42:52.436.754 [mindspore/run_check/_check_version.py:219] libcudnn.so (need by mindspore-gpu) is not found. Please confirm that libmindspore_gpu.so is in directory:/home/bingxing2/home/scx7588/.conda/envs/PVQD/lib/python3.8/site-packages/mindspore/run_check/../lib/plugin and the correct cuda version has been installed, you can refer to the installation guidelines: https://www.mindspore.cn/install
Traceback (most recent call last):
  File "inference_pdbf_data.py", line 27, in <module>
    set_context(device_target="GPU")
  File "/home/bingxing2/home/scx7588/.conda/envs/PVQD/lib/python3.8/site-packages/mindspore/_checkparam.py", line 1352, in wrapper
    return func(*args, **kwargs)
  File "/home/bingxing2/home/scx7588/.conda/envs/PVQD/lib/python3.8/site-packages/mindspore/context.py", line 1769, in set_context
    ctx.set_device_target(kwargs['device_target'])
  File "/home/bingxing2/home/scx7588/.conda/envs/PVQD/lib/python3.8/site-packages/mindspore/context.py", line 457, in set_device_target
    self.set_param(ms_ctx_param.device_target, target)
  File "/home/bingxing2/home/scx7588/.conda/envs/PVQD/lib/python3.8/site-packages/mindspore/context.py", line 187, in set_param
    self._context_handle.set_param(param, value)
RuntimeError: Unsupported device target GPU. This process only supports one of the ['CPU']. Please check whether the GPU environment is installed and configured correctly, and check whether current mindspore wheel package was built with "-e GPU". For details, please refer to "Device load error message".

----------------------------------------------------
- Device load error message:
----------------------------------------------------
Load dynamic library: libmindspore_ascend.so.2 failed. libge_runner.so: cannot open shared object file: No such file or directory

----------------------------------------------------
- C++ Call Stack: (For framework developers)
----------------------------------------------------
mindspore/core/utils/ms_context.cc:282 SetDeviceTargetFromInner

解决方法:

mindspore默认的版本只支持cpu和Ascend两种计算,需要从官网选择支持gpu计算的库https://www.mindspore.cn/install/下载对应的mindspore

风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。