RuntimeError: CUDA error: out of memoryCUDA 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.Compile with `TORCH_USE_CUDA_DSA` to enab..

2024. 3. 11. 20:39·Error
반응형

문제

GPU 상의 cache를 정리해주기 위해 torch.cuda.empty_cache() 사용 시 에러

torch.cuda.empty_cache()

>> RuntimeError: CUDA error: out of memoryCUDA 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.Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

 

해결

with torch.cuda.device('cuda:0'):
	torch.cuda.empty_cache()

 

참고

Out of memory when I use torch.cuda.empty_cache - PyTorch Forums

반응형

'Error' 카테고리의 다른 글

cs231n [collectSubmission.sh/makepdf.py] FileNotFoundError: [Errno 2] No such file or directory: 'knn.pdf'  (0) 2024.12.12
Error(s) in loading state_dict for model: Missing Key(s) in state_dict: "xxxx", Unexpected Key(s) in state_dict: "aa.xxxx"  (0) 2024.03.15
The remote host may not meet VS Code Server's prerequisites for glibc and libstdc++  (0) 2024.02.11
'Error' 카테고리의 다른 글
  • cs231n [collectSubmission.sh/makepdf.py] FileNotFoundError: [Errno 2] No such file or directory: 'knn.pdf'
  • Error(s) in loading state_dict for model: Missing Key(s) in state_dict: "xxxx", Unexpected Key(s) in state_dict: "aa.xxxx"
  • The remote host may not meet VS Code Server's prerequisites for glibc and libstdc++
hangyuwon
hangyuwon
  • hangyuwon
    191
    hangyuwon
  • 전체
    오늘
    어제
  • 글쓰기 관리
    • 분류 전체보기 (38)
      • 기타 (1)
      • Stanford CS231n (19)
      • 논문 리뷰 (5)
      • Error (4)
      • 알고리즘 (2)
      • Linux (1)
      • 잡동사니 (2)
      • 딥러닝 (4)
  • 인기 글

  • 태그

    논문 리뷰
    error
    알고리즘
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.0
hangyuwon
RuntimeError: CUDA error: out of memoryCUDA 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.Compile with `TORCH_USE_CUDA_DSA` to enab..
상단으로

티스토리툴바