问题:pytorch版本过低(环境是pytorch1.4),不支持3090.
gpt回复:PyTorch 安装不支持你的 NVIDIA GeForce RTX 3090 GPU。错误提示中提到,PyTorch 当前支持的 CUDA 能力为 sm_37、sm_50、sm_60 和 sm_70,而 RTX 3090 的 CUDA 能力是 sm_86。

(HJDQN) zhouy24@RL-DSlab:~/zhouy24Files/HJDQN/HJQ$ python main.py --algo=hjdqn --env=HalfCheetah-v2 --max_iter=1e6
Compiling /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/cymj.pyx because it changed.
[1/1] Cythonizing /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/cymj.pyx
running build_ext
building 'mujoco_py.cymj' extension
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home/zhouy24
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home/zhouy24/miniconda3
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home/zhouy24/miniconda3/envs
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home/zhouy24/miniconda3/envs/HJDQN
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home/zhouy24/miniconda3/envs/HJDQN/lib
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/gl
gcc -pthread -B /home/zhouy24/miniconda3/envs/HJDQN/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py -I/home/zhouy24/.mujoco/mujoco200/include -I/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/numpy/core/include -I/home/zhouy24/miniconda3/envs/HJDQN/include/python3.6m -c /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/cymj.c -o /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/cymj.o -fopenmp -w
gcc -pthread -B /home/zhouy24/miniconda3/envs/HJDQN/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py -I/home/zhouy24/.mujoco/mujoco200/include -I/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/numpy/core/include -I/home/zhouy24/miniconda3/envs/HJDQN/include/python3.6m -c /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/gl/osmesashim.c -o /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/gl/osmesashim.o -fopenmp -w
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/lib.linux-x86_64-3.6
creating /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/lib.linux-x86_64-3.6/mujoco_py
gcc -pthread -shared -B /home/zhouy24/miniconda3/envs/HJDQN/compiler_compat -L/home/zhouy24/miniconda3/envs/HJDQN/lib -Wl,-rpath=/home/zhouy24/miniconda3/envs/HJDQN/lib -Wl,--no-as-needed -Wl,--sysroot=/ /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/cymj.o /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/gl/osmesashim.o -L/home/zhouy24/.mujoco/mujoco200/bin -Wl,-R/home/zhouy24/.mujoco/mujoco200/bin -lmujoco200 -lglewosmesa -lOSMesa -lGL -o /home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_36_linuxcpuextensionbuilder/lib.linux-x86_64-3.6/mujoco_py/cymj.cpython-36m-x86_64-linux-gnu.so -fopenmp
environment : HalfCheetah-v2
--------------------------------------------------------------------------------
observation dim : 17 / action dim : 6
dt : 0.05
control range : [1. 1. 1. 1. 1. 1.]
--------------------------------------------------------------------------------
agent spec
--------------------------------------------------------------------------------
{'render': False, 'scale_factor': 1.0, 'double': True, 'device': 'cuda', 'smooth': False, 'batch_size': 128, 'buffer_size': 1000000, 'polyak': 0.001, 'lr': 0.0001, 'hidden2': 256, 'hidden1': 256, 'sigma': 0.1, 'L': 30.0, 'h': 0.05, 'gamma': 0.99, 'ctrl_range': array([1., 1., 1., 1., 1., 1.], dtype=float32), 'dimA': 6, 'dimS': 17, 'self': <algorithms.hjdqn.hjdqn_agent.HJDQNAgent object at 0x7fedb32e49b0>}
--------------------------------------------------------------------------------
/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/torch/cuda/__init__.py:143: UserWarning: 
NVIDIA GeForce RTX 3090 with CUDA capability sm_86 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.
If you want to use the NVIDIA GeForce RTX 3090 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

  warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name))
Traceback (most recent call last):
  File "main.py", line 62, in <module>
    render=args.render
  File "/data/zhouy24Files/HJDQN/HJQ/algorithms/hjdqn/hjdqn.py", line 175, in run_hjdqn
    eval_data = agent.eval(test_env, t)
  File "/data/zhouy24Files/HJDQN/HJQ/algorithms/hjdqn/hjdqn_agent.py", line 202, in eval
    action = self.get_action(state, action, noise)      # deterministic action
  File "/data/zhouy24Files/HJDQN/HJQ/algorithms/hjdqn/hjdqn_agent.py", line 104, in get_action
    q = self.Q(s, a)
  File "/home/zhouy24/miniconda3/envs/HJDQN/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/data/zhouy24Files/HJDQN/HJQ/algorithms/model.py", line 42, in forward
    x = torch.cat([state, action], dim=1)
RuntimeError: CUDA error: no kernel image is available for execution on the device
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

解决方法:
提高版本:
选择1.81版本,cuda为11.1
在这里插入图片描述

pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

参考官网:pytorch version

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐