Tristan Sweeney

← Back to blog

Jetson at Home

Published on 2017-12-14 by Tristan Sweeney

photo by NVIDIA
I have a couple of CUDA-capable devices though my house

Jetson at Home

I have a couple of CUDA-capable devices though my house (go NVIDIA!) but they mostly are running Windows (because Microsoft Office and Video games) or have wimpy laptop GPUs. I had a homework assignment dictating I wrote a CUDA program and the system we had access to was slammed with users, which led to me stressing over how to get the work done. Was I going to have to download CUDA on a Windows machine and deal with development on Windows?

NVIDIA Jetson

Jetson to the rescue! I got a TX1 for free at SC15 because I was fanboying real hard, and it’s saving my academic bacon.

Flashing the Jetpack

You can follow Huy Le’s tutorial over at Sloth Paradise on how to install the Jetpack on the Jetson. The CUDA version in the l4t folder is 8.0 on the latest Jetpack release, but the post is otherwise spot-on. Huy and I were part of a supercomputing team out of Boston, he knows his stuff.

Linux Modules

Checkout my jetson-lmod repo which sets up the lmod (lua-modules) package, allowing users to load and unload ‘environment modules’. These modules set environment variables when loaded to add software to the current environment, and unset those variables when unloaded to remove that software from the environment. It’s a bit like adding environment variables to the tail end of a bashrc file, but infinitely more powerful and flexible.

That repo includes a sample module that can be loaded and unloaded to add and remove the CUDA installation to/from the path. For some healthy reading on how to write modules, here’s the documentation.

Accessing the GPU

If you add a user, you’ll be troubled to find that any attempt to run CUDA by them is met with a friendly “No device found” error. This was due to the user not being a member of the video group, which controls access to the graphics devices.

To fix this, simply sudo usermod <username> -a -G video and relogin to the system, but we’ll still need to perform this fix whenever a new user is added. Given this is a dev-board that only trusted people can access, we can instead configure adduser to provide new users access to all the hardware in the system. To do this, open /etc/adduser.conf and uncomment/set the below values. You could also add sudo to that list of default groups, but that’s playing with fire.

Terminal window
EXTRA_GROUPS="dialout cdrom floppy audio video plugdev users"
ADD_EXTRA_GROUPS=1

Setup the Login Node

As discussed by Huy, to flash the Jetpack onto the TX1, you’ll need a Ubuntu 14.04 host machine. Rather than a VM, I just loaded 14.04 onto an old laptop to use as an access node for my home LAN. I forwarded TCP port 22 (the ssh port) from my router to that laptop, from which I could access the TX1 freely. You could directly forward the port to the Jetson, but I didn’t want to have a specialized device be the gateway to my LAN.

You’ll need to ensure openssh-server, or another ssh server application is installed on the login node (it’ll be installed by Jetpack on the jetson). On Ubuntu this is as simple as:

Terminal window
sudo apt install openssh-server

Affectionately named ‘craptop’ to distinguish it in my home DNS from the laptop I regularly use.

This information is Verizon-FIOS router model G1100 specific, if you have a different router you’ll need to do some research.

First, we’ll have to pin down the IP address assigned to the login-node in the DHCP server running on the router. Without doing this, a device could be reassigned a different address and no longer be properly forwarded ports.

advanced

Head to myfiosgateway.com, and login with the credentials on the side of your router. Click into Advanced, IP Address Distribution, Connection list to see the current DHCP leases.

connections

Find your device, and click the pencil icon to edit it’s lease. Find the checkbox labeled “Static Lease Type” and check it, which will pin that IP address in the local range to that MAC address. This permanently assigns that IP address to the device currently connected to it.

dns

If when browsing for the device in the DHCP connections list you found that it had a name different from what you wanted it to be assigned in the DNS server, head back to the advanced tab, click into DNS Server, and click the pencil icon next to the name you want to change (you’ll notice a record must be statically assigned to modify it’s name). From there, simply enter a new hostname and click apply.

main

Click back to the main menu, then into port forwarding under quick links.

ports

Select the login node from the ‘Select IP from menu’ dropdown and ‘Custom Ports’ from the ‘Application to forward’ menu. In the new context that appears, select TCP port 22, and hit add.

Testing the Connection

Find your public IP address (The address of the router in the global internet) on the main page of the router’s screen or by other means, and attempt to SSH into it. If your connection was forwarded, huzzah! Otherwise… not huzzah? Check if the login node and Jetson properly have openssh-server installed by locally attempting to ssh into the machines, and check your port forwarding. If things look good and it’s still not working, ensure you set a static IP for the login-node.

To improve your quality of life, you can create an A Name Record with a DNS provider for your router if you pay to lease a domain name. I created a subdomain within one I own to save on dough, but the world is your oyster. It’s unlikely your router’s IP will change, but if it does, you can use a dynamic DNS service to update your DNS records on-the-fly as your provider changes your public IP.

Written by Tristan Sweeney

← Back to blog
  • Favicon Fun

    9/17/2024
    Favicon Fun
    photo by Astro

    I love the Astro homepage favicon effect, and replicated it on my site.

  • Ransom Note

    5/3/2020
    Ransom Note
    photo by Jamie Eckle

    Given the text for a ransom note, determine if enough letters exist in a magazine to create it.

  • Breaking down Subsum Equals K

    4/29/2020
    Breaking down Subsum Equals K
    photo by Meghan Vestal

    given an array of integers, find the number of continuous subarrays equal to `k`.

  • Revivifying the Blog

    4/11/2020
    Revivifying the Blog

    I recently had a friend come across my blog, and was promptly shamed for having a certificate more out of date than the VCR. Such an embarrassment couldn't rest, and so I cleaned up my act a bit.

  • Apt install on a Disconnected Wireless System

    6/8/2018
    Apt install on a Disconnected Wireless System
    photo by Google

    I just was installing ubuntu on a platform that only has wireless capabilities, and decided to install the server edition to minimize overhead / avoid having an X server + desktop environment to disable. Woe, the server edition of Ubuntu ships with no wireless utilities, because nobody in their right mind would run a wireless server.

  • Let's Encrypt HTTPS on DD-WRT

    6/5/2018
    Let's Encrypt HTTPS on DD-WRT
    photo by DD-WRT

    I run a DD-WRT router on a Netgear WNDR4500 router. It's been in my life since I can remember, and came along with me to college. A while back I loaded the DD-WRT firmware onto it, and it's been serving like a champ ever since.