IDE CUDA for Jetson TK1

Hi, there is some IDE, like eclipse, that run directly on the Jetson? Now I use “nsight” on the Host PC and cross-compile on the board.

Eclipse, and other do run directly on the TK1 in the graphical environment. I would bet however that doing any stepping through GPU code would cause the graphics to hang.

Maybe something with VirtualGL over some VNC client would allow graphical debug of the GPU. I would guess that maybe something NVIDIA would have to investigte. Shervin?

I don’t think you can debug CUDA directly on the jetson while using a graphical interface on same system … I think rule applies the same on the x86 CUDA Linux.

If I remember correctly, it just refuse with a popup error and then hangs for a bit.
Only the Windows CUDA version lets you.

– I also cannot use IDE on jetson-tk1 to debug cuda directly, but I’m able to remote debug jetson-tk1 from another window PC.
– If you must debug on jetson-tk1 directly, it only use command line as below.

  1. compile and keep the debug synbolnvcc -o xxx_gdb -g vectorAdd_gdb.cu
  2. disable X-window
    copy from snippet from http://docs.nvidia.com/cuda/cuda-gdb/index.html#single-gpu-debugging
 In a single GPU system, CUDA-GDB can be used to debug CUDA applications only if no X11 server (on Linux) or no Aqua desktop manager (on Mac OS X) is running on that system.

On Linux
On Linux you can stop the X11 server by stopping the lightdm service, or the equivalent for the target Linux distribution.

Read more at: http://docs.nvidia.com/cuda/cuda-gdb/index.html#ixzz3TI0FZqOe
Follow us: @GPUComputing on Twitter | NVIDIA on Facebook
–> sudo stop lightdm
–> cuda-gdb xxx_gdb

  1. launch cuda-gdb with specific application
ubuntu@tegra-ubuntu:~/NVIDIA_CUDA-6.5_Samples/temp$ cuda-gdb xxx_gdb
NVIDIA (R) CUDA Debugger
6.5 release
Portions Copyright (C) 2007-2014 NVIDIA Corporation
GNU gdb (GDB) 7.6.2
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-elf-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/ubuntu/NVIDIA_CUDA-6.5_Samples/temp/xxx_gdb...done.
(cuda-gdb) break vectorAdd
Breakpoint 1 at 0xa5b2: file vectorAdd_gdb.cu, line 35.
(cuda-gdb) r
Starting program: /home/ubuntu/NVIDIA_CUDA-6.5_Samples/temp/xxx_gdb
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[Vector addition of 524288 elements]
[New Thread 0xb561b450 (LWP 2123)]
Copy input data from the host memory to the CUDA device
[Switching focus to CUDA kernel 0, grid 1, block (0,0,0), thread (0,0,0), device 0, sm 0, warp 0
, lane 0]

Breakpoint 1, 0x0000000000225690 in vectorAdd(float const*, float const*, float*, int)<<<(1024,1
,1),(512,1,1)>>> ()
(cuda-gdb)
(cuda-gdb) next
Single stepping until exit from function _Z9vectorAddPKfS0_Pfi,
which has no line number information.
[Switching focus to CUDA kernel 0, grid 1, block (0,0,0), thread (288,0,0), device 0, sm 0, warp 9, lane 0]

Breakpoint 1, 0x0000000000225690 in vectorAdd(float const*, float const*, float*, int)<<<(1024,1,1),(512,1,1)>>> ()
(cuda-gdb) next
Single stepping until exit from function _Z9vectorAddPKfS0_Pfi,
which has no line number information.
[Switching focus to CUDA kernel 0, grid 1, block (0,0,0), thread (320,0,0), device 0, sm 0, warp 10, lane 0]

Breakpoint 1, 0x0000000000225690 in vectorAdd(float const*, float const*, float*, int)<<<(1024,1,1),(512,1,1)>>> ()
(cuda-gdb) next
Single stepping until exit from function _Z9vectorAddPKfS0_Pfi,
which has no line number information.
[Switching focus to CUDA kernel 0, grid 1, block (0,0,0), thread (352,0,0), device 0, sm 0, warp 11, lane 0]

Breakpoint 1, 0x0000000000225690 in vectorAdd(float const*, float const*, float*, int)<<<(1024,1,1),(512,1,1)>>> ()
(cuda-gdb) cuda thread 353
[Switching focus to CUDA kernel 0, grid 1, block (0,0,0), thread (353,0,0), device 0, sm 0, warp 11, lane 1]
0x0000000000225690 in vectorAdd(float const*, float const*, float*, int)
   <<<(1024,1,1),(512,1,1)>>> ()
(cuda-gdb) print blockIdx.x
$2 = 0
(cuda-gdb) print threadIdx.x
$3 = 353
(cuda-gdb) backtrace
#0  0x0000000000225690 in vectorAdd(float const*, float const*, float*, int)
   <<<(1024,1,1),(512,1,1)>>> ()
(cuda-gdb)
(cuda-gdb) quit
A debugging session is active.

        Inferior 1 [process 2108] will be killed.

Quit anyway? (y or n) y
ubuntu@tegra-ubuntu:~/NVIDIA_CUDA-6.5_Samples/temp$

Code blocks is a nice IDE which might be more ‘lightweight’ than Eclipse.
See https://devtalk.nvidia.com/default/topic/831131/embedded-systems/code-blocks-ide-available-for-jetson-tk-1-/
You can generate Code blocks project files from CMAKE.
I suppose it works also with NVCC compiler as it uses gcc as the compiler underneath.
You won’t be able to set ‘breakpoints’ in your CUDA kernels (NSIGHT won’t work).

Hi I’m trying to install Pycharm on the Jetson and I receive the following error:

Startup Error: Application cannot start in headless mode

What should I do?

I got same error and i tried some solution like remove headless-jdk,but there always exists even i reinstall a clean jdk.

I don’t know the particular software, but headless implies no monitor. Are you logging in at a GUI terminal, or perhaps remote over ssh? If ssh, try “ssh -Y” to forward X to your current Linux GUI.

Hi mandel.yonatan and shartoo518,

Could you share more information about your problem?
Do you use Jetson directly on the device or via ssh?

More, please try the suggestion of linuxdev in #9 and share the results with us.
Thanks.

Hi, I would like to run an IDE on the Jetson itself for debugging.
Can you please recommend?
Thanks, Yoni

For just debugging I’ve grown to like “cgdb” (“sudo apt-get install cgdb”). It’s a text-based front end to gdb which runs even in consoles without graphics. IMHO it is superior to most overgrown debugger environments…it is clean, easy to see, light weight. It does for gdb what vi did for ex.

A URL for cgdb is:
https://cgdb.github.io/

If instead you download source and build, then you get version 0.7 instead of 0.6 (I use version 0.7). This adds the ability to change how the window splits. In cgdb 0.7 you can change the split from horizontal to vertical with this init file ("~/.cgdb/cgdbrc"), which is wonderful in wide screen (I wish this were the default setting):

set winsplitorientation=vertical

Something like:

cd ~/Downloads
# These may show an error, but you will see "makeinfo" exists after,
# e.g., "which makeinfo" will find it is there.
sudo apt-get install texinfo
# Another compile requirement:
sudo apt-get install libreadline-dev
wget https://cgdb.me/files/cgdb-0.7.0.tar.gz
gunzip < cgdb-0.7.0.tar.gz | tar xv
cd cgdb-0.7.0
./configure --prefix=/usr/local
# Performance is optional:
# EDIT: Using nvpmodel prior to jetson_clocks.sh may be better than the reverse.
nvpmodel -m 0
~ubuntu/jetson_clocks.sh
# Pick "-j #" via the number of cores found in "/proc/cpuinfo".
make -j6
sudo make install
cd ..
# No longer needed:
rm -Rf ./cgdb-0.7.0*
# If "/usr/local/bin" is in your path you will have "/usr/local/bin/cgdb".
# Use it almost like gdb, but the ":" is for the cgdb added commands and
# many commands pass through to gdb, e.g., "ESC" key lets you type to the
# splitter bar, and ":q" from there quits gdb by passing through to gdb.
# The resizing and reorientation commands for the splitter bar are via the
# ":set...." commands.

@mandel.yonatan and @shartoo518,

I have been using PyCharm on Jetson TX2 for quite some time, and if memory serves the “headless mode” error is a Java versioning issue.

Install Java with the following method:

sudo apt-get install openjdk-8-jdk

After that, PyCharm should install just fine using the Linux installer downloaded from JetBeans.

If you have a different version of Java already on your system, then you may encounter difficulty replacing Java with the above version. I once started out with a different version of Java and tried replacing it with the Java install above, but the only way I was able to get PyCharm to run after that was to reflash with JetPack and start from scratch using the Java install above.

Working, thank you !!