Failed to create cuda context Illegal adress

Hi all,

Anyone else run into this error message “Failed to create cuda context Illegal address”

Here are my details

blender 2.91.0
Nvidia GeForce RTX 2060 Super driver 460.89

2 Likes

I would usually run into this when I ran out of mem on my card or had bad drivers.

I constantly face this problem. It usually happens after waking up the computer.

My OS is LInux (Kubuntu 20.04)
Nvidia RTX 2060, driver 460.32

If the problem occurs with OptiX denoiser enabled, you add a comment in this report sharing as much information as possible but in summary form. OS, hardware, driver version, Blender version, the error messages obtained, when this happens, etc.

1 Like

Failed to create CUDA context (Illegal address)

I just installed my new Geforce GTX 1050ti and I’m getting this error in 2.91. Nothing renders when I turn on GPU Render. I tried different settings. I turned off Optix in the preferences. That didn’t change anything. GPU Render is grayed out.

I opened up 2.82, and there’s no problem there.

Has anyone come up with a solution to this?
I got this new graphics card, and I’m very disappointed I can’t really use it. I’d like to know if this is a bug or something I can fix by changing a setting or something.

I went back to version 2.83 but I’d like to be able to use the latest features. On the thing I’m working on now, I was using the denoising feature. Interestingly, when I opened my file created in 2.92 in 2.83 it was still giving me denoising, even though 2.83 doesn’t have that feature, and it was really ugly and I couldn’t turn it off because the button to turn it off doesn’t exist in 2.83. I had to go back to 2.92 to change it.

Thanks.

NVIDIA released a new version of the drivers (460.56) that according to the release highlights " Fixes a regression that could cause display corruption when using a scaled resolution after resuming from power management suspend."

That is the exact problem I face on Linux. I will wait few days for the distribution installation to be ready via ubuntu-drivers. But if someone is in a real need to use it right now, you can install the .run provided directly by NVIDIA, and keep us posted.

I’m not sure if this is related, but I’ll put it here in case it helps anyone. I got a new 2060 a few months ago for my Linux Mint system and it worked great in Blender until after a suspend/wake cycle. Using it in any still-open instance of Blender would give a cuda context error, then a new instance would just not detect the gpu at all (preferences/system/cycles-render-device would be empty/cpu-only), until the system was restarted.

This is what I did to resolve this:

(Warning: this was a couple months ago, these steps are based on the notes I left for myself, I am not an expert, I can’t vouch for it still being applicable now/into the future, follow at your own risk, no warranty, make a system backup beforehand, I don’t yet know if/how this interacts with possible future driver or os updates, this may actually be solved/superceded by 460.56 update mentioned above but I don’t know, maybe wait and see first)

  1. You should have a file here:
    file:///usr/share/doc/nvidia-driver-###/html/powermanagement.html
    (replace ### with your current driver version, eg. 460).
    Follow the instructions under systemd Configuration.
    Note: nvidia_glx-1.0/samples doesn’t exist, the service files are actually in
    usr/share/doc/nvidia-driver-###
  2. In etc/modprobe.d add a file nvidia.conf with the text:
    options nvidia NVreg_PreserveVideoMemoryAllocations=1
    Note: root permission required to create/edit file.
  3. Rebuild initramfs with sudo update-initramfs -u.
  4. Reboot.
For convenience, here are all the substeps (assuming driver version 460):
  • Open terminal and run these commands:
    • sudo install /usr/share/doc/nvidia-driver-460/samples/systemd/nvidia-suspend.service /etc/systemd/system
    • sudo install /usr/share/doc/nvidia-driver-460/samples/systemd/nvidia-hibernate.service /etc/systemd/system
    • sudo install /usr/share/doc/nvidia-driver-460/samples/systemd/nvidia-resume.service /etc/systemd/system
    • sudo install /usr/share/doc/nvidia-driver-460/samples/systemd/nvidia /lib/systemd/system-sleep
    • sudo install /usr/share/doc/nvidia-driver-460/samples/systemd/nvidia-sleep.sh /usr/bin
    • sudo systemctl enable nvidia-suspend.service
    • sudo systemctl enable nvidia-hibernate.service
    • sudo systemctl enable nvidia-resume.service
  • In file browser:
    • open etc/modprobe.d as root.
    • create a new file “nvidia.conf”
    • open it in text editor and write:
      options nvidia NVreg_PreserveVideoMemoryAllocations=1
      then save and close.
  • Back in the terminal, run: sudo update-initramfs -u
  • Reboot.

For reference, this was performed on this system setup:
  • OS: Linux Mint 20 Cinnamon (fairly fresh installation)
  • Linux Kernel: 5.8.0-xx series
  • CPU: i7-6700K
  • GPU: EVGA NVIDIA GeForce RTX 2060 SUPER 8GB SC ULTRA GAMING
1 Like

@tomjk Thank you! Your workaround works on my machine. There is some slight corruption of the viewport when resuming, but it quickly goes away once it refreshes.

The instructions need to be adjusted slightly if you’re on Arch and using the nvidia driver packages from the Arch repos.

  1. The systemd service files are already installed. You just need to enable them.
  2. Do not name the modprobe.d file “nvidia.conf”. The reason here is that the nvidia package installs a file already in /usr/lib/modprobe.d. This file disables nouveau so that the nvidia proprietary driver can load. If you name your file with the same name, it will override the one in /usr/lib/modprobe.d. This means that you’ll accidentally be using nouveau instead of nvidia drivers on next boot!
  3. Instead of sudo update-initramfs -u, you need to type sudo mkinitcpio -P.
1 Like

Thank you guys! I think I will try your solutions. Today I just updated to the new Nvidia Driver using the ubuntu repository (v. 460.56 ) and still the problem is there. They did not fix it :frowning:

I’ll keep you posted.

Out of curiosity @tomjk, how did you work out that solution?

Mostly trial-and-error and internet search. Once I stumbled on the driver docs things became fairly straightforward as nearly all the necessary info was there.

I made notes to myself as I went which include a couple links to other resources I used. Here they are if you’re interested (note: I was also trying to solve a problem with Firefox becoming unusable after suspend, as I recall it was the same issue as with Blender).

notes

23 November
Tried turning on persistence mode for GPU to help with suspend/resume. Used sudo nvidia-smi -pm 1 to enable; presumably same with 0 to disable.
Result: doesn’t solve problem, but didn’t appear to do any harm either.
Actually after another restart, nvidia-smi reports persistence is off again. Strange.

24 November
installed nvidia-modprobe package to see if helps. (per https://askubuntu.com/questions/560768/no-cuda-after-nvidia-331-113-update)
Result: firefox still bugs out after suspend-wake, BUT Blender appears able to keep working (that is, tested new instance of blender, did not keep single instance during suspend). That firefox broke but blender didn’t suggests progress.
Actually it looks like tree style tabs specifically might be the thing that breaks firefox.
Actually firefox can still break after seemingly recovering from suspend, and blender will also still randomly lose the gpu. Back to square one…

27 November
GPU CUDA now works following suspend/resume after following instructions in file:///usr/share/doc/nvidia-driver-455/html/powermanagement.html
(note that nvidia_glx-1.0/samples doesn’t exist, the service files are actually in usr/share/doc/nvidia-driver-455).
Nvreg_PreserveVideoMemoryAllocations=1 goes in nvidia.conf file in etc/modprobe.d – root permission required to make/edit file.
It does look like it chucked out some other stuff though, for example the lock screen doesn’t work, so will be timeshifting back to previous state.
Finished. No harm appears to have been done.
Result: now know the gpu/computer is capable of working fine after sleep. Nothing wrong with the card or blender. Will instead wait for these changes to be made officially.

11 December
Have noticed the lock screen not working a few times lately, which was the reason I undid the changes I made earlier in the first place. So giving them another go.

13 December
edited /lib/systemd/system/nvidia-persistenced.service to change –no-persistence-mode to –persistence-mode.

15 December
turns out the NVreg_preserve[…] thing wasn’t actually doing anything. First, it has to be “options nvidia Nvreg_preserve[…]” as per https://www.linuxquestions.org/questions/slackware-14/xorg-issues-with-nvidia-418-113-440-82-on-slack-14-2-current-with-laptop-gtx-1650-on-linux-4-4-14-5-4-45-5-6-17-a-4175676835/. Second, you have to rebuild initramfs for it to actually take effect, like https://forums.linuxmint.com/viewtopic.php?p=1836169&sid=11273401741ad039ab1173c295bba7ea#p1836169. Having done that, Blender does seem able to keep using cuda/optix post-suspend. I could also test Firefox with acceleration but the cpu-pinning when idle problem is still there so won’t bother.

1 Like

I Have the same problem but only in blender 2.92 not in any previous versions and it only happens if I delete a object while in rendered view. I tried all of the solutions above but none have worked, and I came to conclusion that it is only an error in blender 2.92 .

I suggest use “Denoising Node” rather than render time Denoise or OptiX denoise. Much faster and much more flexible.

I wasn’t using denoiser but it was still giving me the error, i downloaded the blender 2.93 beta version and it isn’t a problem there.

What About Windows Users
I’m using windows 10 64bit With Blender 2.92
having the same problem in the viewport

I’have the same problem with win 10
blender 2.92.

Windows 10, Blender 2.93 using Quaddro RTX5000, latest 466 drivers. Same problem, just cropped up. I had a similar spate of this about a year ago with 2.82 then it went away and now back with a vengeance.

i’m not entirely sure 2.93 hasn’t reintroduced something that is causing a problem here.

Frustrating as i personally believe this is due to an issue with an object and its textures somewhere in the scene but i cannot prove it yet. Perhaps its due to how many objects but I don’t think so.

If you are overclocking your CPU or GPU try turning it off. This worked for me both the times it happened for me.

Hi guys, Try to uncheck your processor from preferences/system, it fixed the issue my side.

Hi guys, I may have found a solution, which worked for me, I change my HDR from Linear to Cubic. Maybe it will help futur people looking for answer