Setting Up a Jetson Nano Dev Environment

If you’ve followed the directions for writing the OS for the nano you are mostly setup for development. The tools that you must have are already part of the image. But you’ll want to have a code editor.  I chose to use Visual Studio Code on the Nano. While Microosft doesn’t distribute the binary themselves it can be compiled for the ARMs processor.  But I was able to follow the three step instructions available from  code.headmelted.com. To summarize the steps here

  1. Open a termina
  2. Start a sudo session with sudo -s
  3. paste the following into the terminal
    . <( wget -O - https://code.headmelted.com/installers/chromebook.sh )

A few minutes later visual studio code will be installed and available.

I’m using MAKE file for my project. But the first thing I needed to figure out was what compiler should I use and where on the file system is it.  The CUDA compatible file system of choice is nvcc. It can be found at the following path.

/usr/local/cuda/bin/nvcc

To make sure it worked I made a simple hello world program and saved it using the totally wrong file name of helloWorld.cpp. I say “wrong” because the compiler looks at the file extension and treats the file differently based on that extension. Instead of using cpp I should have used cu. With CPP the compiler doesn’t understand the directives for the CUDA code.


__global__ void cuda_hello()
{
    printf("Hello World from GPU!\n");
}

using namespace std;

int main()
{
        cout << "Hello world!" << endl;
        cuda_hello<<<1,1>>>();
        return 0;
}

 

To compile the code I use the following at the command line.

/usr/local/cuda/bin/nvcc helloWorld.cs -o helloWorld

This produces a binary named  helloWorld.  Upon running it I’m greeted with the text.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.