Skip to content
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

CUDA error: an illegal memory access was encontered #13

Closed
kmaeii opened this issue Jan 5, 2020 · 5 comments
Closed

CUDA error: an illegal memory access was encontered #13

kmaeii opened this issue Jan 5, 2020 · 5 comments

Comments

@kmaeii
Copy link

kmaeii commented Jan 5, 2020

Thanks for your great work!
When i run train.py at my dataset, i got this error. I got my dataset by
python prepare_data.py --out '/data/kmaeii/dataset/stylegan2/bag_texture_mdb' --n_worker 16 --size 128,256 '/data/kmaeii/dataset/stylegan2'
image

@kmaeii
Copy link
Author

kmaeii commented Jan 5, 2020

By the way, when i run train.py again, this error happened at different places.
image

@rosinality
Copy link
Owner

Maybe custom op related error. Could let me know your GPUs, CUDA & pytorch version?

Also, if you set CUDA_LAUNCH_BLOCKING=1 before run the train.py, then it will be easier to spot the location of the error.

@kmaeii
Copy link
Author

kmaeii commented Jan 5, 2020

Thanks for your response.
I am runing this code with 1 TITAN Xp GPU and the CUDA version is 10.0.130, the pytroch version is 1.3.1。

I fixed this error by add the code 'torch.cuda.set_device(1)', because i only want to run this code on the GPU 1.

Before i just change " device = 'cuda' " to " device = 'cuda:1' ", and then found GPU 0 and GPU 1 both are used, so, i got the error above.

Once again, thanks for your great work!!

@rosinality
Copy link
Owner

rosinality commented Jan 5, 2020

Glad to hear that the problem is resolved. By the way, wouldn't it be simpler to use CUDA_VISIBLE_DEVICES?

@kmaeii
Copy link
Author

kmaeii commented Jan 5, 2020

I try "os.environ['CUDA_VISIBLE_DEVICES'] = '1' " first, but the error still appears.

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