Askannz / optimus-manager

A Linux program to handle GPU switching on Optimus laptops.
MIT License
2.27k stars 165 forks source link

Missing option to select which nvidia card to use (nvidia eGPU vs nvidia iGPU) #472

Open hnsl opened 2 years ago

hnsl commented 2 years ago

Describe the bug I have two Nvidia GPUs. Sometimes I have my Nvidia eGPU connected. I am using optimus-manager to switch between my eGPU and internal GPU. However, when I have both GPUs connected, optimus-manager doesn't have any flag to say what Nvidia card to use. Instead it just prints "Multiple nvidia GPUs found ! Picking the last enumerated one." This heuristic is wrong for me as I always want it to pick the eGPU if it's connected, which comes later in the list.

I did an ugly hack where I just manually patched pci.py to pick the one last in the list instead. But preferably this should be solved with a flag (like --prefer_gpu) or better heuristic (e.g. use most powerful) although this is bound to be wrong for some use-cases.

Note that this is a critical feature and not a "nice to have". This is the primary reason why I am using optimus-manager and this bug is breaking the usefulness of this tool for me, but thankfully I could just patch the code as a workaround.

System info Please include :

Logs Run optimus-manager --status in a console, and if an error message appears, post it here. The message should also point you to a log path, attach it here as well. If there is no error message but you are still experiencing issues, grab the most recent files in /var/log/optimus-manager/switch/ and /var/log/optimus-manager/daemon/.

jamincollins commented 4 months ago

I just ran into this myself and can definitely say I would love an option (other than patching the code) to indicate which to select if multiples are present. For now I too have altered pci.py to return the last one:

        if len(ids_list) > 0:                                                                                          
            #bus_ids[manufacturer] = ids_list[0]                                                                       
            bus_ids[manufacturer] = ids_list[-1]