Skip to content

Can not run on GPU #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
outside-BUPT opened this issue Feb 26, 2023 · 1 comment
Open

Can not run on GPU #29

outside-BUPT opened this issue Feb 26, 2023 · 1 comment

Comments

@outside-BUPT
Copy link

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), device_name))
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
Copy link

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}')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants