Sources

Gringer@Gitlab
ONT

In this list I'll try to recapitulate the steps I took to get GPU-basecalling working with Guppy version 6.2.11 running under MinKNOW version 22.08.9

  1. Install aptitude
    $ sudo apt install aptitude
    
  2. remove older version of MinKNOW and Guppy
    # clear out minion-nc and associated packages
    $ sudo aptitude purge minion-nc
    # clear out existing configuration files
    $ sudo aptitude purge 'minknow ~c' 'minion ~c' 'guppy ~c'
    # remove the minknow installation directory
    $ sudo rm -rf /opt/ont/minknow
    # remove guppy service files
    $ sudo rm -i /lib/systemd/system/guppyd.service
    
  3. reinstall MinKNOW
    $ sudo aptitude install minion-nc
    
  4. install the Nvidia proprietory drivers
    GUI: Start menu --> Software & Updates --> Tab: Additional drivers --> NVIDIA driver meta packages
    Here for me version 510 was already selected (installed) but mvidia-smi, exectuted in the command window, gave an error message so I switched to version 515 which than automatically installed
  5. You can check your current version of guppy with the command:
    $ guppy_basecaller -v
    
    1. download the GPU-guppy version 6.2.11 package from https://mirror.oxfordnanoportal.com/software/analysis/ont-guppy_6.2.11_linux64.tar.gz
      For other versions just exchange the number (6.2.11) with the desired version number.
    2. unpack into a new folder
      $ mkdir -p /opt/ont/guppy/ont-guppy_6.2.11
      $ tar -C /opt/ont/guppy/ont-guppy_6.2.11 -xf ont-guppy_6.2.11_linux64.tar.gz
      
    3. The subfolders under "/opt/ont/guppy/ont-guppy_6.2.11" should be named "bin", "data" and "lib". If you get a subfolder named "guppy" you have to move the tree subfolders on level down.
    4. Make a link to the current version that was just unpacked. If you are updating you have to remove the old link first. By using the link you can keep older versions and just point to the current version.
      $ cd /opt/ont/guppy/
      $ ln -s ont-guppy_6.2.11 ont-guppy_current
      
    5. export the path to a variable that is used in the upcoming configuration steps
      $ export installDir="/opt/ont/guppy/ont-guppy_current"
      
  6. Create a backup of the configuration files marked by date and store them in the home folder:
    $ mkdir -p ~/ont_conf_backups
    $ sudo cp /opt/ont/minknow/conf/app_conf ~/ont_conf_backups/app_conf.$(date +%Y-%b-%d)
    $ sudo cp /etc/systemd/system/guppyd.service ~/ont_conf_backups/guppyd.service.$(date +%Y-%b-%d)
    
    If the `guppyd.service` file doesn't exist, it can be copied from the `guppyd-cpu.service` file in `/lib/systemd/system`.
    I did not do this step and re-used the 'guppyd-cpu.service', just changed it to point to the GPU-basecalling version of Guppy instead. For the future it may be better to copy the "guppyd-cpu" service as "guppyd-gpu" service to clearly define them.
    $ sudo cp /lib/systemd/system/guppyd-cpu.service /etc/systemd/system/guppyd.service
    $ sudo cp /etc/systemd/system/guppyd.service ~/ont_conf_backups/guppyd.service.$(date +%Y-%b-%d)
    
    Now your new service name is "guppyd.service", I continued, as stated before, with "guppyd-cpu.service"!
  7. Stop the relevant services.
    $ sudo service minknow stop
    $ sudo service guppyd-cpu stop
    
    I usually use "htop" to check if a program is running. In htop press F4 to filter for a specific keyword.
  8. Update the MinKNOW settings to use GPU calling using the previously defined variable "$installDir":
     ($ export installDir="/opt/ont/guppy/ont-guppy_current") <-- optional here as already defined before
     $ sudo /opt/ont/minknow/bin/config_editor --conf application \
          --filename /opt/ont/minknow/conf/app_conf \
          --set guppy.server_config.server_executable="${installDir}/bin/guppy_basecall_server" \
          --set guppy.client_executable="${installDir}/bin/guppy_basecall_client" \
          --set guppy.barcoding_executable="${installDir}/bin/guppy_barcoder" \
          --set guppy.alignment_executable="${installDir}/bin/guppy_aligner" \
          --set guppy.minimap_executable="${installDir}/bin/minimap2" \
          --set guppy.connection.use_tcp=1 \
          --set guppy.server_config.gpu_calling=1
    
  9. Now comes the part that was most important for me because one must change the settings for the service. Unfortunately this new settings are currently (2022-10) not reported on the above mentions ONT-website.
    (If you are not comfortable with the default editor in Linux, probably "nano", you can install for example "tilde":
    $ sudo apt install tilde
          
    Open the service configuraton file and change the line starting with "ExecStart".
    To open the configuration file run:
    $ sudo systemctl edit guppyd-cpu.service --full
    
    Add to the line starting with "ExecStart":
    --use_tcp
    and add
    --device "cuda:all"
    and replace (!!!) the string "/tmp/.guppy/5555" with only
    5555
    This last step will change the port that is to be used. I missed this step before and got the error message:
    "Error binding server to port: /tmp/.guppy/5555. Aborting."
    
    when trying to start the guppy service.
    Also, don't forget to change the path in the beginning of the line. I changed it from:
    /opt/ont/guppy/bin/guppy_basecall_server
    to
    /opt/ont/guppy/ont-guppy_current/ont-guppy/bin/guppy_basecall_server
    to point to the right guppy :)
    Now you have also to remove the guppyd-cpu override configuration because it will point to the original guppy version.
    $ sudo rm -f /etc/systemd/system/guppyd-cpu.service.d/override.conf
    
    Reload systemctl to register the configuration file changes you made, then restart the guppyd-cpu and minknow services:
    $ sudo systemctl daemon-reload
    $ sudo service guppyd-cpu start
    $ sudo service minknow start
    
    When now running:
    $ nvidia-smi
    it should report the guppy process "guppy_basecall_server" running on you GPU.
    +-----------------------------------------------------------------------------+
    | Processes:                                                                  |
    |  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
    |        ID   ID                                                   Usage      |
    |=============================================================================|
    |    0   N/A  N/A      1312      G   /usr/lib/xorg/Xorg                259MiB |
    |    0   N/A  N/A      1678      G   xfwm4                               3MiB |
    |    0   N/A  N/A      2289      G   /usr/lib/firefox/firefox          180MiB |
    |    0   N/A  N/A      4807      C   ...bin/guppy_basecall_server     2492MiB |
    |    0   N/A  N/A      5041      G   ...AAAAAAAAA= --shared-files       21MiB |
    +-----------------------------------------------------------------------------+
    
    To have a GUI-view on the activity of the GPU-basecalling I like the use the Phyton script nvidia-smi-gui which is available at Github https://github.com/imkzh/nvidia-smi-gui
  10. You can stop the services, only if you need to, by running:
    $ sudo service minknow stop
    $ sudo service guppyd-cpu stop
    
  11. Check in MinKNOW if you are connected to your MinION.

Hopefully everything is now working. :)

The End.