Nvidia jetson xavier随手记录

2019-07-22  本文已影响0人  ryan_ren
  1. 查看GPU信息,不是使用nvidia-smi,而是使用tegrastats
  2. 让docker使用gpu,使用下面的代码来代替docker命令,将下面的代码保存为txdocker.sh文件,加入执行权限。
#!/bin/bash
#Jason T. 2-6-2018

# Check specifically for the run command
if [[ $# -ge 2 && $1 == "run" ]]; then
    # Tell docker to share the following folders with the base system
    # This allows the docker containers to find CUDA, cuDNN, TensorRT
    LIB_MAPS="/usr/lib/aarch64-linux-gnu \
              /usr/local/cuda \
              /usr/local/cuda/lib64"
         
    # GPU device sharing is for a docker container to have access to
    # system devices as found in the /dev directory
    DEVICES="/dev/nvhost-ctrl \
             /dev/nvhost-ctrl-gpu \
             /dev/nvhost-prof-gpu \
             /dev/nvmap \
             /dev/nvhost-gpu \
             /dev/nvhost-as-gpu"
    
    # There is a need to map the libraries inside the container
    # in the exact way programs would expect to find them as
    # though the TX2 were operating without containers
    LIBS=""
    for lib in $LIB_MAPS; do
        LIBS="$LIBS -v $lib:$lib"
    done
    
    DEVS=""
    for dev in $DEVICES; do
        DEVS="$DEVS --device=$dev"
    done
    
    #echo "docker run $LIBS $DEVS ${@:2}"
    docker run $LIBS $DEVS ${@:2}
else
    # Run command not found, run everything straight through docker
    #echo "docker $@"
    docker $@
fi
  1. 在更换软件源的时候,需要注意,清华源中格式为
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse

应该将其改成

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse

加一个-ports,这是因为xavier中自带的源的格式就是这样的

  1. bazel 安装
    与在linux下的安装不同,bazel需要从源码进行编译
    首先要安装java
sudo apt-get install openjdk-8-jdk

然后下载bazel的源码包

wget https://github.com/bazelbuild/bazel/releases/download/0.19.2/bazel-0.19.2-dist.zip

此处我使用的是0.19.2版本
然后就是编译了

unzip bazel-0.19.2-dist.zip
cd bazel
./compile.sh
sudo cp output/bazel /usr/local/bin
  1. tensorflow安装
    首先是安装依赖
$ sudo apt-get install autoconf automake libtool curl make # Protobuf Dependencies
$ sudo apt-get install python-numpy swig python-dev python-wheel      # TensorFlow Dependencies

然后按照下面教程进行安装就好
https://devtalk.nvidia.com/default/topic/1055131/jetson-agx-xavier/building-tensorflow-1-13-on-jetson-xavier/post/5355747/#5355747

上一篇下一篇

猜你喜欢

热点阅读