VisionWorks Toolkit Reference

April 8, 2016 | 1.4 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Platform and Hardware Information

The following sections describe the system requirements to run NVIDIA® VisionWorks™.


Supported Platforms

For information about supported system software and the corresponding versions of OpenCV and NVIDIA® CUDA®, see the release notes.


Jetson TK1 Performance/Power Management

This section discusses various Tegra CPU and GPU performance topics. The power draw of the Tegra processor and the overall embedded board are closely related to the performance of the Tegra processor; therefore, you must choose carefully when deciding which features:

  • Must run at high performance settings (for maximum speed)
  • Should run at low performance settings (for lower power draw and heat)
  • To disable completely.

To control CPU performance

Note
debugfs and non-upstream sysfs nodes may change in future NVIDIA® Tegra® Linux Driver Package releases.

Tegra K1 is designed for mobile and embedded use-cases and thus contains a significant number of power reduction systems to control—based on runtime use—when parts of the hardware run faster, slower, or are turned off. This works well for most use cases because the default settings give high performance for many intense projects and lower power draw for many light tasks; however, there may be use cases where developers want to force a lower or higher performance on some parts of the hardware, such as to run benchmarks of the peak performance or enforce lower power draw.

To automatically turn on and off the 4 main CPU cores and the 5th companion core, applications can use cpuquiet in the kernel in NVIDIA® Tegra® Linux Driver Package (also known as "Linux for Tegra" or L4T). This is the mechanism for dynamically hot-plugging CPU cores based on workload and policy. There are many ways to adjust the performance and power behavior at runtime or always-on booting.

Generally, the CPU performance and power options are the following (from the highest power draw to the lowest):

  • Force all 4 CPU cores to maximum performance by disabling the hot-plug scaling mechanism.
  • Use the default settings for automatic run-time switching on and off each of the 4 main CPU cores and the 5th low-power companion core.
  • Limit the maximum clock rate of the 4 main CPU cores to a low speed to reduce power (automatic switching of the main cores on and off and the 5th low-power companion core when suitable).
  • Turn some CPU cores on and some off based on what works best for your particular use case.
  • Turn off all 4 main CPU cores to force all CPU code to run on the 5th "LP" low-power shadow companion core for maximum power reduction.
Note
You can use various listed below commands to decrease or increase performance or power draw. You must have root privileges to execute these commands. Use the sudo command or run su to log in as root user.

To maximize CPU performance

To obtain full CPU performance (for example, for performance measurement, benchmarking, or when power draw is not important), disable CPU scaling and force the four main CPU cores to run always at maximum performance until rebooting:

# echo 0 > /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable
# echo 1 > /sys/devices/system/cpu/cpu0/online
# echo 1 > /sys/devices/system/cpu/cpu1/online
# echo 1 > /sys/devices/system/cpu/cpu2/online
# echo 1 > /sys/devices/system/cpu/cpu3/online
# echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

To turn some CPU cores on and some off

To turn each CPU core online manually, execute:

# echo 1 > /sys/devices/system/cpu/cpu0/online
# echo 1 > /sys/devices/system/cpu/cpu1/online
# echo 1 > /sys/devices/system/cpu/cpu2/online
# echo 1 > /sys/devices/system/cpu/cpu3/online
Note
If you get an "invalid argument" message, you can ignore it. This message is issued at a request to change from online or offline state to the current state.

To restrict usage only to the low-power core

Restricting the CPU usage to the low-power companion core can significantly reduce peak power (for example, when running on a power-limited battery pack). The fifth companion core in Tegra K1 is a Cortex-A15 core with NEON and 32KB L1 cache and 512KB L2 private cache, but runs at lower performance than any of the main cores. To use just the low-power core, run this commands as root:

# echo 0 > /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable
# echo LP > /sys/kernel/cluster/active

Controlling GPU performance

To manually control the clock frequencies of the GPU, first determine the rates supported (listed by sysfs in kHz):

# cat /sys/kernel/debug/clock/gbus/possible_rates
72000 108000 180000 252000 324000 396000 468000 540000 612000 648000 684000 708000 756000 804000 852000 (kHz)

Then set a rate (for example, the maximum of 852000 kHz), specified in Hz:

# echo 852000000 > /sys/kernel/debug/clock/override.gbus/rate
# echo 1 > /sys/kernel/debug/clock/override.gbus/state

Finally, verify the rate:

# cat /sys/kernel/debug/clock/gbus/rate
852000

The gbus sysfs nodes control the GPU's core clock. To control the GPU's memory clock, substitute emc for gbus:

# cat /sys/kernel/debug/clock/emc/possible_rates
12750 20400 40800 68000 102000 204000 300000 396000 528000 600000 792000 924000 (kHz)

# echo 924000000 > /sys/kernel/debug/clock/override.emc/rate
# echo 1 > /sys/kernel/debug/clock/override.emc/state

# cat /sys/kernel/debug/clock/emc/rate
924000000

Links

For more information, see the Jetson TK1 guides at:


Jetson TX1 Performance/Power Management

Jetson TX1 performance is controlled via the following script:

#!/bin/bash

MODE=${1:-max}

#
# Turns on the fan for safety.
#

do_fan()
{
    if [ ! -w /sys/kernel/debug/tegra_fan/target_pwm ] ; then
        return
    fi

    echo "Turn on fan for safety"

    FAN_SPEED=255
    echo "${FAN_SPEED}" > /sys/kernel/debug/tegra_fan/target_pwm
}

#
# Enables main 4-core CPU cluster.
#

do_clusterswitch()
{
    if [ ! -d /sys/kernel/cluster ] ; then
        return
    fi

    if [ "${MODE}" == "max" ] ; then
        echo "Enable main 4-core CPU cluster"

        echo 1 > /sys/kernel/cluster/immediate
        echo 1 > /sys/kernel/cluster/force
        echo G > /sys/kernel/cluster/active
    else
        echo "Disable main 4-core CPU cluster"

        echo 0 > /sys/kernel/cluster/immediate
        echo 0 > /sys/kernel/cluster/force
        echo G > /sys/kernel/cluster/active
    fi
}

#
# Makes all CPUs online.
#

do_hotplug()
{
    if [ "${MODE}" == "max" ] ; then
        echo 0 > /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable

        echo "Make all CPUs online"

        for file in /sys/devices/system/cpu/cpu*/online; do
            if [ "$(cat "${file}")" -eq 0 ]; then
                echo 1 > "${file}"
            fi
        done
    else
        echo "Enable tegra quiet mode"

        echo 1 > /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable
    fi
}

#
# Sets CPUs to max freq (perf governor not enabled on L4T yet).
#

do_cpus()
{
    echo "Set CPUs clocks"

    if [ "${MODE}" == "max" ] ; then
        echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
        CPU_MAX_FREQ=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq)
        echo "${CPU_MAX_FREQ}" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
    else
        echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    fi
}

#
# Sets the GPU clock (reads from debugfs).
#

do_gpu()
{
    echo "Set GPU clocks"

    if [ "${MODE}" == "max" ] ; then
        GPU_MAX_FREQ=$(cat /sys/kernel/debug/clock/override.gbus/max)
        echo "${GPU_MAX_FREQ}" > /sys/kernel/debug/clock/override.gbus/rate
        echo 1 > /sys/kernel/debug/clock/override.gbus/state
    else
        echo 0 > /sys/kernel/debug/clock/override.gbus/state
    fi
}

#
# Sets the EMC clock (reads from debugfs)
#

do_emc()
{
    echo "Set EMC clocks"

    if [ "${MODE}" == "max" ] ; then
        EMC_MAX_FREQ=$(cat /sys/kernel/debug/clock/override.emc/max)
        echo "${EMC_MAX_FREQ}" > /sys/kernel/debug/clock/override.emc/rate
        echo 1 > /sys/kernel/debug/clock/override.emc/state
    else
        echo 0 > /sys/kernel/debug/clock/override.emc/state
    fi
}

#
# Shows information about the system.
#

show()
{
    if [ -w /sys/kernel/debug/tegra_fan/target_pwm ] ; then
        echo "Fan speed: $(cat /sys/kernel/debug/tegra_fan/target_pwm)"
        echo ""
    fi

    if [ -d /sys/kernel/cluster ] ; then
        CLUS=$(cat /sys/kernel/cluster/active)
    else
        CLUS="(switching disabled)"
    fi
    echo "CPU Cluster Switching: ${CLUS}"
    echo ""

    echo "CPU Governor: $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"
    echo "CPU HOTPLUG: $(cat /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable)"
    echo "Online CPUs: $(cat /sys/devices/system/cpu/online)"
    echo ""

    for folder in /sys/devices/system/cpu/cpu[0-9]; do
        if [ -e "${folder}/cpufreq/scaling_cur_freq" ] ; then
            CPU=$(echo "${folder}" | cut -c 25-)
            echo "${CPU}: $(cat "${folder}/cpufreq/scaling_cur_freq")"
        fi
    done
    echo ""

    echo "CPU Frequency Governor: $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"
    echo "CPU Min Frequency: $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq)"
    echo "CPU Max Frequency: $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq)"
    echo "CPU Current Frequency: $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)"
    echo ""

    echo "GPU Frequency Override: $(cat /sys/kernel/debug/clock/override.gbus/state)"
    echo "GPU Min Frequency: $(cat /sys/kernel/debug/clock/override.gbus/min)"
    echo "GPU Max Frequency: $(cat /sys/kernel/debug/clock/override.gbus/max)"
    echo "GPU Current Frequency: $(cat /sys/kernel/debug/clock/override.gbus/rate)"
    echo ""

    echo "EMC Frequency Override: $(cat /sys/kernel/debug/clock/override.emc/state)"
    echo "EMC Min Frequency: $(cat /sys/kernel/debug/clock/override.emc/min)"
    echo "EMC Max Frequency: $(cat /sys/kernel/debug/clock/override.emc/max)"
    echo "EMC Current Frequency: $(cat /sys/kernel/debug/clock/override.emc/rate)"
    echo ""
}

#
# main
#

if [ "${MODE}" != "show" ] ; then
    if [ "${MODE}" == "max" ] ; then
        echo "Enabling max clocks"
    else
        echo "Disabling max clocks"
    fi

    do_fan
    do_clusterswitch
    do_hotplug
    do_cpus
    do_gpu
    do_emc

    echo ""
fi

show

The script can be used to maximize performance of the TX1 board:

$ sudo freq_control_tx1.sh max

or to enable dynamic frequencies scaling:

$ sudo freq_control_tx1.sh default

Links

For more information, see the Jetson TX1 guides at: