admin管理员组文章数量:1026062
出现如下报错:
RuntimeError: CUDA error: invalid device ordinal
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.
原因:选择GPU设备时torch没有识别到。
解决方法:
加一句torch.cuda.device_count()
代码
import torch
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
torch.cuda.device_count()
出现如下报错:
RuntimeError: CUDA error: invalid device ordinal
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.
原因:选择GPU设备时torch没有识别到。
解决方法:
加一句torch.cuda.device_count()
代码
import torch
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
torch.cuda.device_count()
本文标签: 报错DebuggingCUDALAUNCHBLOCKINGpassing
版权声明:本文标题:报错 For debugging consider passing CUDA_LAUNCH_BLOCKING=1 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/jiaocheng/1738332906a1562152.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论