neardws / Game-Theoretic-Deep-Reinforcement-Learning

Code of Paper "Joint Task Offloading and Resource Optimization in NOMA-based Vehicular Edge Computing: A Game-Theoretic DRL Approach", JSA 2022.
https://www.sciencedirect.com/science/article/abs/pii/S138376212200265X
GNU General Public License v3.0
243 stars 49 forks source link

IndexError: list index out of range #15

Closed heguangxue closed 1 year ago

heguangxue commented 1 year ago

你好,我在运行experiment.py时弹出这个错误,请问是为什么? Traceback (most recent call last): File "D:\hgxdm\dm\Game-Theoretic-Deep-Reinforcement-Learning-main\Game\Experiment\experiment.py", line 7, in tf.config.experimental.set_virtual_device_configuration(gpus[0], IndexError: list index out of range

neardws commented 1 year ago

请确认下运行的机器是否具有GPU,gpus[0]表示第一块GPU。

neardws commented 1 year ago

一般来说,可以使用

nvidia-smi -l 1

来参看当前机器GPU的运行情况。

heguangxue commented 1 year ago

你好,谢谢你的回复!按照命令检查了GPU的运行情况,发现没有在运行。结果如下 | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=======================================================================================| | No running processes found | +---------------------------------------------------------------------------------------+ Thu Apr 20 09:33:13 2023 +---------------------------------------------------------------------------------------+ | NVIDIA-SMI 531.14 Driver Version: 531.14 CUDA Version: 12.1 | |-----------------------------------------+----------------------+----------------------+ | GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+======================+======================| | 0 NVIDIA GeForce MX250 WDDM | 00000000:06:00.0 Off | N/A | | N/A 51C P0 N/A / N/A| 0MiB / 2048MiB | 0% Default | | | | N/A | +-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |============================== 但是我已经安装了tensorflower2.10.0+cuda_11.2.0+cudnn-8.1,不知道是哪里出问题了?

neardws commented 1 year ago

可能还是cuda版本不对,可以在以下网站重新安装下cuda,安装的时候注意查看下显卡能支持的cuda版本,如果还是不行,可以考虑重新安装下显卡驱动。

NNNNelson commented 1 year ago

你好,如果设备没有gpu,怎么做

neardws commented 1 year ago

因为我之前也没在CPU上跑过,可以试试修改https://github.com/neardws/Game-Theoretic-Deep-Reinforcement-Learning/blob/main/Experiment/experiment.py 中的代码。

cpus = tf.config.experimental.list_physical_devices('CPU')
heguangxue commented 1 year ago

你好,我在运行experiment.py时出现以下错误: 1.AttributeError: 'function' object has no attribute 'BoundedArray' 2.ModuleNotFoundError: No module named ‘Experiment’ 3.AttributeError: 'function' object has no attribute ’TensorTransformation’ 请问是什么原因?谢谢

neardws commented 1 year ago

可能是当前运行环境不在项目文件夹下?所以找不见Experiment包?不知道你是如何运行的,建议使用VSCode,在VSCode中打开项目文件下后,运行 experiment.py 试试。

NNNNelson commented 1 year ago

你好,这个代码的环境在linux下,还是在windows下,还是二者都可以

neardws commented 1 year ago

最好是在Linux,Windows的话可以考虑安装下Ubuntu for WSL 2

heguangxue commented 1 year ago

请问您是在linux环境下用vscode跑的吗

NNNNelson commented 1 year ago

屏幕截图 2023-05-17 213006

您可以帮我看一下这个报错怎么解决吗

neardws commented 1 year ago

请参考#5

Jadaeu commented 1 year ago

屏幕截图 2023-05-17 213006

您可以帮我看一下这个报错怎么解决吗

试试这个命令:export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/hyh/anaconda3/envs/Game-Theoretic/lib/