Coder Social home page Coder Social logo

egpu-switcher's Introduction

egpu-switcher

НСслоТный скрипт для ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Π΅ΠΉ Π½ΠΎΡƒΡ‚Π±ΡƒΡ‡Π½Ρ‹Ρ… Π°Π΄Π°ΠΏΡ‚Π΅Ρ€ΠΎΠ² для Π²Π½Π΅ΡˆΠ½ΠΈΡ… Π²ΠΈΠ΄Π΅ΠΎΠΊΠ°Ρ€Ρ‚. ΠŸΡ€ΠΈΠ·Π²Π°Π½ ΡƒΠΏΡ€ΠΎΡΡ‚ΠΈΡ‚ΡŒ Π²Ρ‹Π±ΠΎΡ€ Π²ΠΈΠ΄Π΅ΠΎΠΊΠ°Ρ€Ρ‚Ρ‹ ΠΏΠΎ ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ Π±Π΅Π· ковыряния ΠΊΠΎΠ½Ρ„ΠΈΠ³ΠΎΠ² Ρ€ΡƒΠΊΠ°ΠΌΠΈ.


Description

ЦСль этого скрипта - ΡƒΠΏΡ€ΠΎΡΡ‚ΠΈΡ‚ΡŒ настройку Π°Π΄Π°ΠΏΡ‚Π΅Ρ€Π° eGPU Π² вашСм дистрибутивС Linux. Установка ΠΏΡ€ΠΎΡ…ΠΎΠ΄ΠΈΡ‚ Π² ΠΈΠ½Ρ‚Π΅Ρ€Π°ΠΊΡ‚ΠΈΠ²Π½ΠΎΠΌ Ρ€Π΅ΠΆΠΈΠΌΠ΅ с понятными пояснСниями.

ДостиТСниС Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΎΠ½Π°Π»Π° ΠΊΠ°ΠΊ Π² Windows ΠΏΠΎΠΊΠ° Π½Π΅ прСдставляСтся Π²ΠΎΠ·ΠΌΠΎΠΆΠ½Ρ‹ΠΌ.
Π‘ΠΊΠΎΡ€Π΅Π΅ всСго послС примСнСния скрипта Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΠΎ ΠΏΠ΅Ρ€Π΅Π·Π°Π³Ρ€ΡƒΠ·ΠΈΡ‚ΡŒ ΠΊΠΎΠΌΠΏΡŒΡŽΡ‚Π΅Ρ€ для ΠΏΠΎΠ»Π½ΠΎΠ³ΠΎ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΎΠ½Π°Π»Π° eGPU.
.

Screenshot

Screenshot of setup

Requirements

  1. БистСма Ρ€Π°Π±ΠΎΡ‚Π°Π΅Ρ‚ Π½Π° X-Server.
  2. УстановлСна pciutils 3.3.x ΠΈΠ»ΠΈ Π²Ρ‹ΡˆΠ΅ installed (ΠΏΡ€ΠΎΠ²Π΅Ρ€ΠΈΡ‚ΡŒ ΠΊΠΎΠΌΠ°Π½Π΄ΠΎΠΉ lspci --version).
  3. ΠœΠΈΠ½ΠΈΠΌΡƒΠΌ Bash 4.x ΠΈΠ»ΠΈ Π²Ρ‹ΡˆΠ΅.
  4. НастроСнный физичСски ΠΈ ΠΏΠΎΠ΄ΠΊΠ»ΡŽΡ‡Π΅Π½Ρ‹ΠΉ физичСски ΠΊ Π½ΠΎΡƒΡ‚Π±ΡƒΠΊΡƒ Π°Π΄Π°ΠΏΡ‚Π΅Ρ€ eGPU.
  5. ΠŸΠΎΠ»Π½ΠΎΡΡ‚ΡŒΡŽ установлСнный Π΄Ρ€Π°ΠΉΠ²Π΅Ρ€ Π½Π° ΠΏΠΎΠ΄ΠΊΠ»ΡŽΡ‡Π΅Π½Π½ΡƒΡŽ Ρ‡Π΅Ρ€Π΅Π· eGPU Π²ΠΈΠ΄Π΅ΠΎΠΊΠ°Ρ€Ρ‚Ρƒ.

Installation

Ubuntu (apt)

Установка ΠΈ настройка:

$ sudo add-apt-repository ppa:hertg/egpu-switcher
$ sudo apt update
$ sudo apt install egpu-switcher
$ sudo egpu-switcher setup

Π£Π΄Π°Π»Π΅Π½ΠΈΠ΅:

$ apt remove egpu-switcher

Other

Установка ΠΈ настройка:

$ git clone [email protected]:hertg/egpu-switcher.git
$ cd egpu-switcher
$ make install
$ sudo egpu-switcher setup

Π£Π΄Π°Π»Π΅Π½ΠΈΠ΅:

Π’Π½ΠΈΠΌΠ°Π½ΠΈΠ΅!: НС ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠΉΡ‚Π΅ Π΄Π°Π½Π½Ρ‹ΠΉ ΠΌΠ΅Ρ‚ΠΎΠ΄ Π½Π° вСрсиях Π½ΠΈΠΆΠ΅ 0.10.2!
Π‘Ρ‹Π»Π° критичСская ошибка Π² Makefile, которая удаляСт ΠΏΠ°ΠΏΠΊΡƒ /usr/bin. Π›ΡƒΡ‡ΡˆΠ΅ Π²Ρ€ΡƒΡ‡Π½ΡƒΡŽ ΡƒΠ΄Π°Π»ΠΈΡ‚ΡŒ ΠΏΠ°ΠΏΠΊΡƒ egpu-switcher Π² ΠΊΠ°Ρ‚Π°Π»ΠΎΠ³Π°Ρ… /usr/bin/ ΠΈ /usr/share/.

$ sudo egpu-switcher cleanup
$ make uninstall

Commands

egpu-switcher setup [--override] [--noprompt]
    This will generate the "xorg.conf.egpu" and "xorg.conf.internal" files and
    symlink the "xorg.conf" file to one of them.
    
    It will also create the systemd service, that runs the "switch" command on each bootup.
    
    This will NOT delete any already existing files. If an "xorg.conf" file already exists, 
    it will be backed up to "xorg.conf.backup.{datetime}". This can later be reverted by
    executing the "cleanup" command.

    --override
        If an AMD GPU or open-source NVIDIA drivers are used, the "switch" command 
        will prevent from switching to the eGPU if there are no displays directly attached to it. 
        This flag will make sure to switch to the EGPU even if there are no displays attached.

    --noprompt
        Prevent the setup from prompting for user interaction if there is
        no existing configuration file found. (Is currently only used by the "postinst" script)
egpu-switcher switch auto|egpu|internal [--override]
    Switches to the specified GPU. if the auto parameter is used, the script will check if 
    the eGPU is attached and switch accordingly. 
    
    The computer (or display-manager) needs to be restarted for this to take effect.

    --override
        If an AMD GPU or open-source NVIDIA drivers are used, the "switch" command 
        will prevent from switching to the eGPU if there are no displays directly attached to it. 
        This flag will make sure to switch to the EGPU even if there are no displays attached.
egpu-switcher cleanup [--hard]
    Remove all files egpu-switcher has created previously and restore the backup
    of previous "xorg.conf" files.

    --hard
        Remove configuration files too.
egpu-switcher config
    Prompts the user to specify their external/internal GPU and saves their answer
    to the configuration file.
egpu-switcher remove
    Allows the user to remove their eGPU without a complete reboot.
    This method will still restart the display-manager, and therefore terminate all its child-processes.

Troubleshooting

If you run into problems, please have a look at TROUBLESHOOT.md before reporting any issues.


Background information

A backup of your current xorg.conf will be created, nothing gets deleted. If the script doesn't work for you, you can revert the changes by executing egpu-switcher cleanup or just completely uninstall the script with apt remove egpu-switcher. This will remove all files it has created and also restore your previous xorg.conf file.

This script will create two configuration files in your X-Server folder /etc/X11. The file xorg.conf.egpu holds the settings for your EGPU and the file xorg.conf.internal holds the settings for your internal graphics.

Then a symlink xorg.conf will be generated which points to the corresponding config file, depending on wheter your egpu is connected or not.

Additionally a custom systemd service with the following content will be created.

/etc/systemd/system/egpu.service

[Unit]
Description=EGPU Service
Before=display-manager.service
After=bolt.service

[Service]
Type=oneshot
ExecStart=/usr/bin/egpu-switcher switch auto

[Install]
WantedBy=graphical.target

This will enable the automatic detection wheter your egpu is connected or not on startup.

egpu-switcher's People

Contributors

hertg avatar ewagner12 avatar fennifith avatar tourbour avatar maddocker avatar toumorokoshi avatar xabolcs avatar tbabej avatar marcolaux avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.