Multiple Video Cards Usage

Should you have several video cards installed on a physical server, you can create additional findface-extraction-api-gpu or findface-video-worker-gpu instances and distribute them across the video cards, one instance per card.

In this section:

Distribute findface-extraction-api-gpu Instances Across Several Video Cards

To distribute findface-extraction-api-gpu instances across several video cards, do the following:

  1. Stop the initial findface-extraction-api-gpu service.

    sudo service findface-extraction-api stop
    
  2. Create several copies of the findface-extraction-api-gpu configuration file, subject to how many video cards you are going to use for biometric samples extraction. Append the appropriate GPU device numbers to the new configuration files names as shown in the example below (GPU devices #0 and #6).

    /etc/findface-extraction-api@0.ini
    /etc/findface-extraction-api@6.ini
    
  3. Open the new configuration files. Specify the GPU device numbers and adjust the listening ports.

    sudo vi /etc/findface-extraction-api@0.ini
    
    listen: 127.0.0.1:18666
    ...
    
    gpu_device: 0
    ...
    
    sudo vi /etc/findface-extraction-api@6.ini
    
    listen: 127.0.0.1:18667
    ...
    
    gpu_device: 6
    ...
    
  4. Start the new services.

    sudo service findface-extraction-api@0 start
    sudo service findface-extraction-api@6 start
    

Allocate findface-video-worker-gpu to Additional Video Card

To create an additional findface-video-worker-gpu instance and allocate it to a different video card, do the following:

  1. Display the status of the findface-video-worker-gpu primary service by executing:

    sudo systemctl status findface-video-worker-gpu.service
    
  2. Find the full path to the service in the line Loaded: loaded (/usr/lib/systemd/system/findface-video-worker-gpu.service; enabled; vendor preset: enabled. It is findface-video-worker-gpu.service in our example (name may vary). Create a copy of the service under a new name.

    sudo cp /usr/lib/systemd/system/findface-video-worker-gpu.service /usr/lib/systemd/system/findface-video-worker-gpu2.service`
    
  3. In the same manner, create a copy of the primary service configuration file under a new name.

    sudo cp /etc/findface-video-worker-gpu.ini /etc/findface-video-worker-gpu2.ini
    
  4. Open the just created configuration file and actualize the GPU device number to use.

    sudo vim /etc/findface-video-worker-gpu2.ini
    
    ## cuda device number
    device_number = 1
    
  5. Open the new service and specify the just created configuration file.

    sudo vim /usr/lib/systemd/system/findface-video-worker-gpu2.service
    
    ExecStart=/usr/bin/findface-video-worker-gpu --config /etc/findface-video-worker-gpu2.ini
    
  6. Reload the systemd daemon to apply the changes.

    sudo systemctl daemon-reload
    
  7. Enable the new service autostart.

    sudo systemctl enable findface-video-worker-gpu2.service
    
    Created symlink from /etc/systemd/system/multi-user.target.wants/findface-video-worker-gpu2.service to /usr/lib/systemd/system/findface-video-worker-gpu2.service
    
  8. Launch the new service.

    sudo systemctl start findface-video-worker-gpu2.service
    
  9. Check the both findface-video-worker-gpu services status.

    sudo systemctl status findface-video-worker-* | grep -i 'Active:' -B 3
    
    ● findface-video-worker-gpu2.service - findface-video-worker-gpu daemon
      Loaded: loaded (/usr/lib/systemd/system/findface-video-worker-gpu2.service; enabled; vendor preset: enabled)
      Active: active (running) since Thu 2019-07-18 10:32:02 MSK; 1min 11s ago
    
    ...
    
    ● findface-video-worker-gpu.service - findface-video-worker-gpu daemon
      Loaded: loaded (/usr/lib/systemd/system/findface-video-worker-gpu.service; enabled; vendor preset: enabled)
      Active: active (running) since Mon 2019-07-15 15:18:33 MSK; 2 days ago