microsoft / StemGNN

Spectral Temporal Graph Neural Network (StemGNN in short) for Multivariate Time-series Forecasting
511 stars 116 forks source link

Can not run on GPU #29

Open outside-BUPT opened 1 year ago

outside-BUPT commented 1 year ago

Hi, thank you for sharing your code! But, I can not run it on GPU. The cmd line like python main.py --device 'cuda:0', and the Traceback message likes: Training configs: Namespace(batch_size=32, dataset='PeMS07', decay_rate=0.5, device='cuda:0', dropout_rate=0.5, early_stop=False, epoch=25, evaluate=True, exponential_decay_step=5, horizon=12, leakyrelu_rate=0.2, lr=0.0001, multi_layer=5, norm_method='z_score', optimizer='RMSProp', test_length=1, train=True, train_length=7, valid_length=2, validate_freq=1, window_size=3) /home/cll/anaconda3/envs/torch17/lib/python3.7/site-packages/torch/cuda/init.py:104: UserWarning: NVIDIA RTX A6000 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 sm_75. If you want to use the NVIDIA RTX A6000 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), devicename)) Traceback (most recent call last): File "main.py", line 57, in , normalize_statistic = train(train_data, valid_data, args, result_train_file) File "/home/cll/SD-GLN/baseline_220/StemGNN-master/models/handler.py", line 106, in train model.to(args.device) File "/home/cll/anaconda3/envs/torch17/lib/python3.7/site-packages/torch/nn/modules/module.py", line 612, in to return self._apply(convert) File "/home/cll/anaconda3/envs/torch17/lib/python3.7/site-packages/torch/nn/modules/module.py", line 359, in _apply module._apply(fn) File "/home/cll/anaconda3/envs/torch17/lib/python3.7/site-packages/torch/nn/modules/rnn.py", line 162, in _apply self.flatten_parameters() File "/home/cll/anaconda3/envs/torch17/lib/python3.7/site-packages/torch/nn/modules/rnn.py", line 152, in flatten_parameters self.batch_first, bool(self.bidirectional)) RuntimeError: CUDA error: no kernel image is available for execution on the device

Meanwhile, the dependencies like: Python 3.7.13 (default, Mar 29 2022, 02:18:16) [GCC 7.5.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information.

import torch t>>> torch.version '1.7.1'

Waiting for your reply! Thanks a lot~

Man-Yacan commented 2 months ago

I think you should first check whether your GPU can be called in other programs. If so, it should be directly usable.


# 传递输入参数并打印
args = parser.parse_args()
args.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')  # 查询GPU可用信息
print(f'Training configs: {args}')