Skip to content

Commit

Permalink
JetPack 4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jetsonhacks committed Jul 12, 2020
1 parent 69bc98f commit cb561fb
Show file tree
Hide file tree
Showing 7 changed files with 407 additions and 269 deletions.
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--------------


jetson_variables.sh
See scripts/jetson_variables.sh for full copyright info
Copyright (c) 2020 Raffaello Bonghi.
Part of the jetson_stats package (https://github.com/rbonghi/jetson_stats or http://rnext.it).

11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $ python jetsonInfo.py

or

$ ./jetsonInfo.py
$ ./jetsonInfo.py

The hardware designator is derived from the file: '/proc/cpuinfo'

Expand All @@ -22,8 +22,17 @@ The Ubuntu version is derived from the file: '/etc/os-release'

The Linux kernel version is derived from the file: '/proc/version'

Thank you Raffaello Bonghi @rbonghi for jetson_variables and jetson_libraries scripts

Release Notes:

July, 2020
* v2.1
* Add support for JetPack 4.4
* Fix issue with TX1/Nano identification
Thank you Manu Seth! @mseth10
* Update to @rbonghi jetson_libraries and jetson_variables

January, 2020
* v2.0
* Add support for JetPack 4.3
Expand Down
42 changes: 29 additions & 13 deletions jetsonInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from __future__ import print_function
import os,sys



class terminalColors:
WARNING = '\033[93m'
FAIL = '\033[91m'
Expand All @@ -16,21 +14,21 @@ class terminalColors:
import pprint
import subprocess

command = ['bash', '-c', 'source scripts/jetson_variables && env']
command = ['bash', '-c', 'source scripts/jetson_variables.sh && env']

proc = subprocess.Popen(command, stdout = subprocess.PIPE)

environment_vars = {}
for line in proc.stdout:
(key, _, value) = line.partition("=")
os.environ[key] = value
environment_vars[key] = value

proc.communicate()
proc.communicate()

# Jetson Model
print(" NVIDIA Jetson " + os.environ["JETSON_TYPE"].strip())
print("NVIDIA Jetson " + environment_vars["JETSON_TYPE"].strip())

#L4T Version
print(' L4T ' + os.environ['JETSON_L4T'].strip() + ' [ JetPack ' +os.environ['JETSON_JETPACK'].strip()+' ]')
print(' L4T ' + environment_vars['JETSON_L4T'].strip() + ' [ JetPack ' +environment_vars['JETSON_JETPACK'].strip()+' ]')
# Ubuntu version
if os.path.exists('/etc/os-release'):
with open('/etc/os-release', 'r') as ubuntuVersionFile:
Expand All @@ -39,21 +37,39 @@ class terminalColors:
if 'PRETTY_NAME' in line:
# PRETTY_NAME="Ubuntu 16.04 LTS"
ubuntuRelease=line.split('"')[1]
print(' ' + ubuntuRelease)
print(' ' + ubuntuRelease)
else:
print(terminalColors.FAIL + 'Error: Unable to find Ubuntu Version' + terminalColors.ENDC)
print('Reason: Unable to find file /etc/os-release')



# Kernel Release
if os.path.exists('/proc/version'):
with open('/proc/version', 'r') as versionFile:
versionFileText=versionFile.read()
kernelReleaseArray=versionFileText.split(' ')
print(' Kernel Version: ' + kernelReleaseArray[2])
print(' Kernel Version: ' + kernelReleaseArray[2])
else:
print(terminalColors.FAIL + 'Error: Unable to find Linux kernel version' + terminalColors.ENDC)
print('Reason: Unable to find file /proc/version')

print(' CUDA ' + os.environ['JETSON_CUDA'].strip())

command1 = ['bash', '-c', 'source scripts/jetson_libraries.sh && env']

proc1 = subprocess.Popen(command1, stdout = subprocess.PIPE)
environment_vars = {}
for line in proc1.stdout:
(key, _, value) = line.partition("=")
environment_vars[key] = value



print(' CUDA ' + environment_vars['JETSON_CUDA'].strip())
print(' CUDA Architecture: ' + environment_vars['JETSON_CUDA_ARCH_BIN'].strip())
print(' OpenCV version: ' + environment_vars['JETSON_OPENCV'].strip())
print(' OpenCV Cuda: ' + environment_vars['JETSON_OPENCV_CUDA'].strip())
print(' CUDNN: ' + environment_vars['JETSON_CUDNN'].strip())
print(' TensorRT: ' + environment_vars['JETSON_TENSORRT'].strip())
print(' Vision Works: ' + environment_vars['JETSON_VISIONWORKS'].strip())
print(' VPI: ' + environment_vars['JETSON_VPI'].strip())


121 changes: 121 additions & 0 deletions scripts/jetson_libraries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#!/bin/bash
# This file is part of the jetson_stats package (https://github.com/rbonghi/jetson_stats or http://rnext.it).
# Copyright (c) 2020 Raffaello Bonghi.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.


# Read CUDA version
if [ -f /usr/local/cuda/version.txt ]; then
JETSON_CUDA=$(cat /usr/local/cuda/version.txt | sed 's/\CUDA Version //g')
else
JETSON_CUDA="NOT_INSTALLED"
fi
# Jetson CUDA version
export JETSON_CUDA

# Read from OpenCV if is installed CUDA
opencv_read_cuda()
{
# Red if use CUDA or not
local OPENCV_VERSION_VERBOSE=$(opencv_version --verbose | grep "Use Cuda" )
if [ ! -z "$OPENCV_VERSION_VERBOSE" ]; then
# Read status of CUDA
local OPENCV_CUDA_FLAG=$(echo $OPENCV_VERSION_VERBOSE | cut -f2 -d ':' | cut -f2 -d ' ' )
if [ "$OPENCV_CUDA_FLAG" == "NO" ]; then
# Set NO if cuda is not installed
echo "NO"
else
# Set YES if cuda is installed
echo "YES"
fi
return
fi
# read NVIDIA CUDA version
OPENCV_VERSION_VERBOSE=$(opencv_version --verbose | grep "NVIDIA CUDA" )
if [ ! -z "$OPENCV_VERSION_VERBOSE" ]; then
# get information
local OPENCV_CUDA_FLAG=$(echo $OPENCV_VERSION_VERBOSE | cut -f2 -d ':')
OPENCV_CUDA_FLAG=${OPENCV_CUDA_FLAG//[[:blank:]]/}
# Set YES if cuda is installed
echo "YES"
return
fi
echo "NO"
return
}

if hash opencv_version 2>/dev/null; then
JETSON_OPENCV="$(opencv_version)"
# Read information about cuda status
JETSON_OPENCV_CUDA=$(opencv_read_cuda)
else
JETSON_OPENCV="NOT_INSTALLED"
JETSON_OPENCV_CUDA="NO"
fi
# Opencv variables
export JETSON_OPENCV
export JETSON_OPENCV_CUDA

# Extract cuDNN version
JETSON_CUDNN=$(dpkg -l 2>/dev/null | grep -m1 "libcudnn")
if [ ! -z "$JETSON_CUDNN" ] ; then
JETSON_CUDNN=$(echo $JETSON_CUDNN | sed 's/.*libcudnn[0-9] \([^ ]*\).*/\1/' | cut -d '-' -f1 )
else
JETSON_CUDNN="NOT_INSTALLED"
fi
# Export NVIDIA CuDNN Library
export JETSON_CUDNN

# Extract TensorRT version
JETSON_TENSORRT=$(dpkg -l 2>/dev/null | grep -m1 " tensorrt ")
if [ ! -z "$JETSON_TENSORRT" ] ; then
JETSON_TENSORRT=$(echo $JETSON_TENSORRT | sed 's/.*tensorrt \([^ ]*\).*/\1/' | cut -d '-' -f1 )
else
JETSON_TENSORRT="NOT_INSTALLED"
fi
# Export NVIDIA CuDNN TensorRT
export JETSON_TENSORRT

# Extract Visionworks version
JETSON_VISIONWORKS=$(dpkg -l 2>/dev/null | grep -m1 "libvisionworks")
if [ ! -z "$JETSON_VISIONWORKS" ] ; then
JETSON_VISIONWORKS=$(echo $JETSON_VISIONWORKS | sed 's/.*libvisionworks \([^ ]*\).*/\1/' )
else
JETSON_VISIONWORKS="NOT_INSTALLED"
fi
# Export NVIDIA CuDNN VisionWorks
export JETSON_VISIONWORKS

# Extract VPI
JETSON_VPI=$(dpkg -l 2>/dev/null | grep -m1 "vpi")
if [ ! -z "$JETSON_VPI" ] ; then
JETSON_VPI=$(echo $JETSON_VPI | sed 's/.*vpi \([^ ]*\).*/\1/' )
else
JETSON_VPI="NOT_INSTALLED"
fi
# Export VPI
export JETSON_VPI

# Vulkan
JETSON_VULKAN_INFO=$(which vulkaninfo)
if [ ! -z $JETSON_VULKAN_INFO ] ; then
JETSON_VULKAN_INFO=$($JETSON_VULKAN_INFO | grep -m1 "Vulkan Instance Version")
JETSON_VULKAN_INFO=$(echo $JETSON_VULKAN_INFO | sed 's/.*: \([^ ]*\).*/\1/' )
else
JETSON_VULKAN_INFO="NOT_INSTALLED"
fi
# Export VPI
export JETSON_VULKAN_INFO
#EOF
Loading

0 comments on commit cb561fb

Please sign in to comment.