USRP Host Performance Tuning Tips and Tricks

From Ettus Knowledge Base
Revision as of 16:46, 19 June 2019 by Ettus (Talk | contribs) (Created page with "==Application Note Number== '''AN-088''' ==Revision History== {| class="wikitable" !Date !Author !Details |- |style="text-align:center;"| 2019-06-19 |style="text-align:center...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Application Note Number

AN-088

Revision History

Date Author Details
2019-06-19 Nate Temple Initial creation

Overview

This application note provides various tips and tricks for tuning your host computer for best performance when working with USRP devices.

CPU Governor

Ensure your CPU governor is set to performance. This can be done with the Linux utility cpufrequtils.

Install cpufrequtils with the command below:

   sudo apt install cpufrequtils

You can then set the CPU governor to performance per core by issuing the command:

   sudo cpufreq-set -c $core_number -g performance

To set the CPU governor to performance for all cores:

   for ((i=0;i<$(nproc);i++)); do sudo cpufreq-set -c $i -r -g performance; done

You can then verify that the CPU governor has been set by running the command:

   cpufreq-info

Thread Priority Scheduling

When UHD spawns a new thread, it may try to boost the thread's scheduling priority. If setting the new priority fails, the UHD software prints a warning to the console, as shown below. This warning is harmless; it simply means that the thread will retain a normal or default scheduling priority.

UHD Warning:
    Unable to set the thread priority. Performance may be negatively affected.
    Please see the general application notes in the manual for instructions.
    EnvironmentError: OSError: error in pthread_setschedparam

To address this issue, non-privileged (non-root) users need to be given special permission to change the scheduling priority. This can be enabled by creating a group usrp, adding your user to it, and then appending the line @usrp - rtprio 99 to the file /etc/security/limits.conf.

   sudo groupadd usrp
   sudo usermod -aG usrp $USER

Then add the line below to end of the file /etc/security/limits.conf:

   @usrp - rtprio  99

You must log out and log back into the account for the settings to take effect. In most Linux distributions, a list of groups and group members can be found in the /etc/group file.

There is further documentation about this in the User Manual at the link below.


Adjust Network Buffers

This applies to Ethernet connected USRPs (N2xx, N3xx, X3xx, E320).

N2xx

   sudo sysctl -w net.core.rmem_max=625000000
   sudo sysctl -w net.core.wmem_max=625000000

X3xx/N3xx/E320

   sudo sysctl -w net.core.wmem_max=576000
   sudo sysctl -w net.core.rmem_max=33554432

Adjust Ethernet MTU

This applies to Ethernet connected USRPs (N2xx, N3xx, X3xx, E320).

For 1 Gigabit connections, the MTU should be set to 1500.

For 10 Gigabit connections, the MTU should be set to 8000.

It is important to set the value and not leave it is automatic

Increasing Ring Buffers

This applies to Ethernet connected USRPs using a 10 Gb interface (X3xx, N3xx, E320).

Increasing the Ring Buffers on the NIC may help prevent flow control errors at higher rates.

   sudo ethtool -G <interface> tx 4096 rx 4096

Disable Hyper-threading

In some applications which require the highest possible CPU performance per core, disabling hyper-threading can provide roughly a 10% increase in core performance, at the cost of having less core threads. Hyper-threading can be disabled within the BIOs and varies by manufacturer.