Failed to create CUDA context unknown error #88968

Closed
opened 2021-06-08 19:43:11 +02:00 by Rob Betz · 19 comments

System Information
Operating system: Windows 10
Graphics card: RTX 2070 Super

Blender Version
Broken: 2.93.0
Worked: 2.93.0

Changed settings on a project so that my GPU was checked under CUDA. Render times were cut by a factor of 4. No issues on multiple renders. No settings changed, saved project as renamed file. Now it won't render with GPU checked under CUDA at all. Does this regardless of NR settings.

Exact steps for others to reproduce the error
Occurs anytime I try to render with my GPU checked under CUDA.

Drivers are all up to date; this worked perfectly several renders in a row then just stopped working.

I have also rebooted my machine. No change.

**System Information** Operating system: Windows 10 Graphics card: RTX 2070 Super **Blender Version** Broken: 2.93.0 Worked: 2.93.0 Changed settings on a project so that my GPU was checked under CUDA. Render times were cut by a factor of 4. No issues on multiple renders. No settings changed, saved project as renamed file. Now it won't render with GPU checked under CUDA at all. Does this regardless of NR settings. **Exact steps for others to reproduce the error** Occurs anytime I try to render with my GPU checked under CUDA. Drivers are all up to date; this worked perfectly several renders in a row then just stopped working. I have also rebooted my machine. No change.
Author

Added subscriber: @Rob-Betz

Added subscriber: @Rob-Betz

Added subscriber: @ChauHo

Added subscriber: @ChauHo

I get similar error with Google Colaboratory and Blender 2.93.5:

Error: Failed to create CUDA context (Unknown error)
Invalid value in cuCtxDestroy(cuContext) (device_cuda_impl.cpp:252)

System Information: Google Colaboratory (Linux)
• GPU: Telsa K80
• CPU: Intel Xeon CPU @ 2.30GHz

Blender version
• Blender 2.93.5 (hash a791bdabd0 built 2021-10-06 06:26:10)

Exact steps
• run Blender with command line (use any Blender file):

 !sudo ./blender-2.93.5-linux-x64/blender -b $path -noaudio -P '/gdrive/MyDrive/GPU2.py' -E 'CYCLES' -o $renderFileName -s $startRender -e $endRender -a -— -—cycles-device CUDA

• values for command line:

 fileName = 'MT'
 path = '/gdrive/MyDrive/'+fileName+'.blend'
 renderFileName = '//'+fileName+'_####'
 startRender = '85'
 endRender = '100'

/* Source code for GPU2.py */
import bpy
bpy.data.scenes- [x].render.engine = "CYCLES"

Set the device_type

bpy.context.preferences.addons[

  "cycles"

].preferences.compute_device_type = "CUDA" # or "OPTIX"

Set the device and feature set

bpy.context.scene.cycles.device = "GPU"

get_devices() to let Blender detects GPU device

bpy.context.preferences.addons["cycles"].preferences.get_devices()
print(bpy.context.preferences.addons["cycles"].preferences.compute_device_type)
for d in bpy.context.preferences.addons["cycles"].preferences.devices:

  d["use"] = 1 # Using all devices, include GPU and CPU
  print(d["name"], d["use"])
I get similar error with Google Colaboratory and Blender 2.93.5: Error: Failed to create CUDA context (Unknown error) Invalid value in cuCtxDestroy(cuContext) (device_cuda_impl.cpp:252) System Information: Google Colaboratory (Linux) • GPU: Telsa K80 • CPU: Intel Xeon CPU @ 2.30GHz Blender version • Blender 2.93.5 (hash a791bdabd0b2 built 2021-10-06 06:26:10) Exact steps • run Blender with command line (use any Blender file): ``` !sudo ./blender-2.93.5-linux-x64/blender -b $path -noaudio -P '/gdrive/MyDrive/GPU2.py' -E 'CYCLES' -o $renderFileName -s $startRender -e $endRender -a -— -—cycles-device CUDA ``` • values for command line: ``` fileName = 'MT' path = '/gdrive/MyDrive/'+fileName+'.blend' renderFileName = '//'+fileName+'_####' startRender = '85' endRender = '100' ``` /* Source code for GPU2.py */ import bpy bpy.data.scenes- [x].render.engine = "CYCLES" # Set the device_type bpy.context.preferences.addons[ ``` "cycles" ``` ].preferences.compute_device_type = "CUDA" # or "OPTIX" # Set the device and feature set bpy.context.scene.cycles.device = "GPU" # get_devices() to let Blender detects GPU device bpy.context.preferences.addons["cycles"].preferences.get_devices() print(bpy.context.preferences.addons["cycles"].preferences.compute_device_type) for d in bpy.context.preferences.addons["cycles"].preferences.devices: ``` d["use"] = 1 # Using all devices, include GPU and CPU print(d["name"], d["use"])
Contributor

Added subscriber: @Raimund58

Added subscriber: @Raimund58
Contributor

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Contributor

@Rob-Betz Can you please test again with Blender 2.93.5/6 and Blender 3.0 and report back?
Please make sure your GPU drivers are up to date.

@Rob-Betz Can you please test again with Blender 2.93.5/6 and Blender 3.0 and report back? Please make sure your GPU drivers are up to date.
Contributor

@ChauHo Your report is super chaotic. Please try to organise it better so we can understand, what exactly you are doing.
Maybe you can have a look at this script. It might help you to do the things you want.
https://colab.research.google.com/gist/Raimund58/88061f785ea2563d345914d196c15b87/blender_script_for_google_colab_using_the_gpu.ipynb

@ChauHo Your report is super chaotic. Please try to organise it better so we can understand, what exactly you are doing. Maybe you can have a look at this script. It might help you to do the things you want. https://colab.research.google.com/gist/Raimund58/88061f785ea2563d345914d196c15b87/blender_script_for_google_colab_using_the_gpu.ipynb

I use this simple ipynb file
blenderGoogleGPU_2_93_5c.ipynb.txt
and python script for choose gpu
GPU2.py
If remove -p gpu2.py in command line for run Blender in .ipynb file, Blender render use cpu and no error.

I use this simple ipynb file [blenderGoogleGPU_2_93_5c.ipynb.txt](https://archive.blender.org/developer/F11728978/blenderGoogleGPU_2_93_5c.ipynb.txt) and python script for choose gpu [GPU2.py](https://archive.blender.org/developer/F11729000/GPU2.py) If remove -p gpu2.py in command line for run Blender in .ipynb file, Blender render use cpu and no error.

This video show how fix this problem (I will try tomorrow, I use all GPU time of today):
How to Fix Google Colab and Blender CUDA Errors - Blender Tutorial
https://www.youtube.com/watch?v=hMCE6-ddTdY

This video show how fix this problem (I will try tomorrow, I use all GPU time of today): How to Fix Google Colab and Blender CUDA Errors - Blender Tutorial https://www.youtube.com/watch?v=hMCE6-ddTdY

Results:

  1. library fix from video no help, I still have same error

  2. Person create video tell I should not need

    • P 'GPU2.py'
      in command line run Blender because have
    • —cycles-device CUDA
      but Blender never use GPU if no have -P 'GPU2.py'. Blend file is from Blender 2.76b and can't set use GPU in Blender 2.76b because my old computer. I upload test .blend file. Don't open it, send it direct to Colaboratory and test there.
      MT.blend

Before ≈2 weeks ago, I can use GPU (I use Blender 2.93.5 but need -P 'GPU2.py'). Google change some thing.

Results: 1. library fix from video no help, I still have same error 2. Person create video tell I should not need - P 'GPU2.py' in command line run Blender because have - —cycles-device CUDA but Blender never use GPU if no have -P 'GPU2.py'. Blend file is from Blender 2.76b and can't set use GPU in Blender 2.76b because my old computer. I upload test .blend file. Don't open it, send it direct to Colaboratory and test there. [MT.blend](https://archive.blender.org/developer/F11756181/MT.blend) Before ≈2 weeks ago, I can use GPU (I use Blender 2.93.5 but need -P 'GPU2.py'). Google change some thing.
Contributor

@ChauHo Google changed nothing. If you would take a look at my script and maybe run it you will note that everything works fine.
https://colab.research.google.com/gist/Raimund58/88061f785ea2563d345914d196c15b87/blender_script_for_google_colab_using_the_gpu.ipynb

This works fine as well:
-- --cycles-device CUDA

@ChauHo Google changed nothing. If you would take a look at my script and maybe run it you will note that everything works fine. https://colab.research.google.com/gist/Raimund58/88061f785ea2563d345914d196c15b87/blender_script_for_google_colab_using_the_gpu.ipynb This works fine as well: `-- --cycles-device CUDA`

You script work! Ya! But need install many things and still need Python script for set GPU before run Blender. ;)

Google like upgrade and change their sýstem often. Maybe no cause problem for your script. I render several month before problem happen. :) Two days ago Google Drive tell my browser too old and upgrade (can't upgrade because computer and OS too old). Now need use smart phone for upload and download file. :(

You script work! Ya! But need install many things and still need Python script for set GPU before run Blender. ;) Google like upgrade and change their sýstem often. Maybe no cause problem for your script. I render several month before problem happen. :) Two days ago Google Drive tell my browser too old and upgrade (can't upgrade because computer and OS too old). Now need use smart phone for upload and download file. :(
Contributor

Can you not upgrade your OS? Why not? Ever tried Linux?

Can you not upgrade your OS? Why not? Ever tried Linux?

I use old Macintosh from year 2007. Great machine and use for make MacOS and iOS apps. When get enough money buy I think some thing like System76 Meerkat and use Linux Mint (small and easy move).

I use old Macintosh from year 2007. Great machine and use for make MacOS and iOS apps. When get enough money buy I think some thing like System76 Meerkat and use Linux Mint (small and easy move).

Added subscriber: @woojin86

Added subscriber: @woojin86

In #88968#1249913, @Raimund58 wrote:
@ChauHo Google changed nothing. If you would take a look at my script and maybe run it you will note that everything works fine.
https://colab.research.google.com/gist/Raimund58/88061f785ea2563d345914d196c15b87/blender_script_for_google_colab_using_the_gpu.ipynb

This works fine as well:
-- --cycles-device CUDA

Hi, i'll try to run script, but have error msg:

"Blender 3.0.0 (hash f1cca30557 built 2021-12-03 00:34:54)
Error: Cannot read file '/drive/MT.blend': No such file or directory

Blender quit"

Drive already mounted, and file is present.
What i do wrong?

> In #88968#1249913, @Raimund58 wrote: > @ChauHo Google changed nothing. If you would take a look at my script and maybe run it you will note that everything works fine. > https://colab.research.google.com/gist/Raimund58/88061f785ea2563d345914d196c15b87/blender_script_for_google_colab_using_the_gpu.ipynb > > This works fine as well: > `-- --cycles-device CUDA` Hi, i'll try to run script, but have error msg: "Blender 3.0.0 (hash f1cca3055776 built 2021-12-03 00:34:54) Error: Cannot read file '/drive/MT.blend': No such file or directory Blender quit" Drive already mounted, and file is present. What i do wrong?
Contributor

@woojin86 Your Path is probably wrong.
Error: Cannot read file '/drive/MT.blend': No such file or directory
Please seek support somewhere else. This is a bug tracker for Blender development

@woojin86 Your Path is probably wrong. **Error: Cannot read file '/drive/MT.blend': No such file or directory** Please seek support somewhere else. This is a bug tracker for Blender development
Contributor

Changed status from 'Needs User Info' to: 'Archived'

Changed status from 'Needs User Info' to: 'Archived'
Contributor

No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed.

Thanks again for the report. If the problem persists please open a new report with the required information.

No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed. Thanks again for the report. If the problem persists please open a new report with the required information.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#88968
No description provided.