[SOLVED] Blender Ubuntu not detecting new GPU after switch

Hello again,

So I recently bought 2 Nvidia p106-100 cards (the headless ones meant for mining) to use with Blender. The first one I put in my main rig next to my GTX-1070 running Win10, and it worked straight out of the box. All I had to do was tick the checkbox and bam I had a GTX-1060 for about $70

However, I put the second one in my Headless render server this morning and ran into an issue. I used to have a GTX-970 in it, but when I swapped it out with the p106, and run

import bpy
prefs = bpy.context.user_preferences.addons['cycles'].preferences
devices = prefs.devices
print(prefs.compute_device_type)    # Prints out if CUDA is enabled

for d in devices:
        print(d.name)    # Prints out each device

I get the following output

CUDA                                 # CUDA is enabled
AMD FX(tm)-6350 Six-Core Processor   # correct system processor 
GeForce GTX 970 (Display)            # Previous graphics card that isn't even part of the system anymore

I know the system is detecting the p106 because it’s listed when I run lspci -v

01:00.0 3D controller: NVIDIA Corporation GP106 [P106-100] (rev a1)
        Subsystem: Gigabyte Technology Co., Ltd GP106 [P106-100]
        Flags: bus master, fast devsel, latency 0, IRQ 33, NUMA node 0
        Memory at fd000000 (32-bit, non-prefetchable) [size=16M]
        Memory at c0000000 (64-bit, prefetchable) [size=256M]
        Memory at d0000000 (64-bit, prefetchable) [size=32M]
        Capabilities: <access denied>
        Kernel driver in use: nvidia
        Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia

It’s still showing the GTX-970 as my graphics card, but I am literally staring at the 970 sitting on the table next to me. I’ve tried rebooting, and reinstalling the Nvidia and CUDA drivers, but same issue. Any Ideas?

Perhaps it’s the device listed as ‘CUDA’ ?

Sorry, perhaps I should have explained that script better. The first line isn’t a device, it’s just checking to see if CUDA is enabled, which it is. The FX-6350 is the CPU, and the GTX-970 is the graphics card that isn’t even part of the system anymore.

It seems that Blender doesn’t erase old devices from wherever it stores them. I used to have the same GTX-970 that is in the render rig in my main workstation rig, so when I run the same code on my Win10 machine it says that I have:

GeForce GTX 970 (Display)
GeForce GTX 1070 (Display)
Intel Core i7-6700K CPU @ 4.00GHz

So on Win10 it lists the p106 card with no problem, but also displays the old 970 card that isn’t in the system anymore. Running with “–factory-startup” seems to remove the old card, so I will play around with it later when I have time to see if I can get it working.

Ok, figured it out. Thankfully on my remote machine I didn’t install any addons or change the user preferences, so I just ran the following

blender -b --python-console              # Start python console
>> import bpy
>> bpy.ops.wm.read_factory_settings()    # Load factory settings
>> bpy.ops.wm.save_userpref()            # Save factory settings

I was then able to open the python console again and simply set the CUDA device and graphics card using the method from this thread like I did before: Thread

After doing this the script I used displayed the following (correct) results:

AMD FX(tm)-6350 Six-Core Processor

And GPU rendering worked perfectly.