PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.08k stars 5.55k forks source link

Cuda error(700), an illegal memory access was encountered #33854

Closed shingstone-lu closed 3 years ago

shingstone-lu commented 3 years ago

paddle的版本是2.1.0 win10操作系统 程序如下: import numpy as np import paddle

程序段1

x=np.random.uniform(high=20,size=(2,1,500,500)) x = paddle.to_tensor(x,dtype='int32') result1 = paddle.max(x) print(result1)

程序段2

x=np.random.uniform(high=20,size=(2,1,500,500)) x = paddle.to_tensor(x,dtype='int64') result1 = paddle.max(x) print(result1)

程序段1可以正常执行,但是将程序段1改为程序段2('int32'->'int64')就会出现下面的错误: Traceback (most recent call last): File "e:/luqinghua/ICNet/测试代码.py", line 281, in print(result1) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\paddle\fluid\dygraph\varbase_patch_methods.py", line 464, in str return to_string(self) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\paddle\tensor\to_string.py", line 205, in to_string np_var = var.numpy() OSError: (External) Cuda error(700), an illegal memory access was encountered. [Advise: Please search for the error code(700) on website( https://docs.nvidia.com/cuda/archive/10.0/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1g3f51e3575c2178246db0a94a430e0038 ) to get Nvidia's official solution about CUDA Error.] (at C:\home\workspace\Paddle_release\paddle\fluid\platform\gpu_info.cc:394)

感觉有点内存不够用了。 后续的程序中我需要用到paddle.nn.functional.cross_entropy计算predict和label的交叉熵, predict的形状为[N,2,504,504],label的形状为[N,1,504,504] 如果label使用int64,就会出现上面的错误;如果使用int32就可以避免上面的错误,但是cross_entropy在use_softmax=True和soft_label=False的情况下要求输入的label为int64。

paddle-bot-old[bot] commented 3 years ago

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

Aurelius84 commented 3 years ago

你好,请问你的显存有多大?

shingstone-lu commented 3 years ago

你好,请问你的显存有多大?

8192MB

zhwesky2010 commented 3 years ago

@shingstone-lu 你好,我在Windows 2080Ti显卡上目前没有复现这个问题,显存是11G,CUDA10.2

shingstone-lu commented 3 years ago

@shingstone-lu 你好,我在Windows 2080Ti显卡上目前没有复现这个问题,显存是11G,CUDA10.2

我的是1080显卡,CUDA11.1,我把CUDA降到10.2再试试。

zhwesky2010 commented 3 years ago

@shingstone-lu Paddle目前还没有发布CUDA11.1的版本,请问你安装的paddle是哪个版本呢,这个需要对应

shingstone-lu commented 3 years ago

@shingstone-lu Paddle目前还没有发布CUDA11.1的版本,请问你安装的paddle是哪个版本呢,这个需要对应

2.1.0

zhwesky2010 commented 3 years ago

@shingstone-lu 安装的CUDA版本,因为目前官方没有发布CUDA11.1,默认会下载CUDA10.2,可以通过==2.1.0.post110 指定其他版本

shingstone-lu commented 3 years ago

@shingstone-lu 安装的CUDA版本,因为目前官方没有发布CUDA11.1,默认会下载CUDA10.2,可以通过==2.1.0.post110 指定其他版本

我刚才确认了,通过nvcc -V可以查到10.2版本的Runtime API,但是通过nvidia-smi可以查到11.1版本的Driver API。 10.2版本是我安装的。 paddle2.1.0是需要Runtime的版本还是Driver的版本?

shingstone-lu commented 3 years ago

我重装了CUDA的Runtime API和Driver API,现在两者都是10.2了,另外cuDNN的版本是cudnn-10.2-windows10-x64-v7.6.5.32,重新运行程序还是报上面的错误。

zhwesky2010 commented 3 years ago

@shingstone-lu 需要的都是Runtime的版本,Driver的版本不用管。看来可能是显存的问题