PyTorch for Jetson

Hello Dusty,

i made a test with VPI and its gaussian filter. Well, it’s quite fast !

The results with OpenCV, Pytorch and VPI :

Exec OpenCV : 52.90899899955548
Exec OpenCV : 48.56621299950348
Exec OpenCV : 33.943589000045904
Exec OpenCV : 29.91600800123706
Exec OpenCV : 32.76177900079347
Exec OpenCV : 31.13349900013418
Exec OpenCV : 31.9260550004401

Exec Pytorch : 1066.3996349994704
Exec Pytorch : 54.81155500092427
Exec Pytorch : 1.5405670001200633
Exec Pytorch : 31.09733699966455
Exec Pytorch : 22.13672099969699
Exec Pytorch : 22.723321999364998
Exec Pytorch : 24.03172599952086

Exec VPI : 14.762945000256877
Exec VPI : 7.058123999740928
Exec VPI : 0.12390600022627041
Exec VPI : 0.1917789995786734
Exec VPI : 0.7647800011909567
Exec VPI : 0.526727999385912
Exec VPI : 0.07308899876079522

It would be cool if VPI could get colour images support for the filters.

Concerning OpenCV with Cuda, there is no GaussianFilter function. Anyway, i am not sure OpenCV with Cuda can bring very interesting improvements.

I will think about VPI and TorchVision integration in JetsonSky. If i want to get good flexibility with Windows and Linux system, Pytorch and Torchvision could be the right choice.

But VPI is really fast.

Many thanks for your help.

Alain

OK, thanks for sharing your results Alain! These are consistent with my general understanding. Glad that you got good performance using VPI.

1 Like

I have a problem when I run the command:
pip 3 install numpy`` torch-1.10.0-cp36-cp36m-linux_aarch64.whl

This is the output:
twinrivers@ubuntu:~$ pip3 install numpy torch-1.10.0-cp36-cp36m-linux_aarch64.whl
Defaulting to user installation because normal site-packages is not writeable
WARNING: Requirement ‘torch-1.10.0-cp36-cp36m-linux_aarch64.whl’ looks like a filename, but the file does not exist
Processing ./torch-1.10.0-cp36-cp36m-linux_aarch64.whl
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: ‘/home/twinrivers/torch-1.10.0-cp36-cp36m-linux_aarch64.whl’

my version of jetpack is 4.6.2
Python 2.7.17 (it says python3 is installed when I try to download it)

Hi @moyeraiden1014, are you sure that file exists? Did you download it to that location?

I’m not sure if this is just the forum formatting or not, but there may be a typo and you should run pip3 install numpy torch-1.10.0-cp36-cp36m-linux_aarch64.whl (no space between pip and 3)

I tried it without the space and it was’t working.
I think I found the issues I was having. I had to go back through and click the link to download then move the folder from downlods to the home director. After that become the super user with sudo su then I was able to run the command and it installed fine.

Thank you so much!

Hello,
I met an error “OSError: libcublas.so.10: cannot open shared object file: No such file or directory” when i imported torch.I have installed CUDA toolkit by the command “sudo apt-get install cuda-toolkit-10-2”,but i still couldnt find the libcublas in the system.
My version of JetPack is 4.6
Python is 3.6.9
CUDA tools 10.2.300
Torch is installed from “torch-1.8.0-cp36-cp36m-linux_aarch64.whl”.I also have tired some other versions but met the same error when i import torch.
My device is Jetson Xavier NX.
For some reasons,I have troubles to reflash my device.
I wonder how can i fix the problem without reflashing the system.
Any suggestions would be appreciated. Thank you!

Hi @ddd1231, can you try running sudo apt-get install libcublas-dev ?

Thank for your reply.
I tried running “sudo apt-get install libcublas-dev” and the system told me it has had the newest version(10.2.300).So i ran “sudo apt-get remove libcublas-dev” firstly and ran “sudo apt-get install libcublas-dev” secondly.
I installed libcublas-dev succesfully this time and could find “libcublas.so” and “libcublasLt.so” in “/usr/local/cuda-10.2/lib64”.
But it was strange that i still couldnt find the “libcublas.so.10” or “libcublas.10.2.300” in the system.How can i do at the next time?
Hope for your sugesstions.Thank you!

Hmm I’m not sure why it wasn’t there before, perhaps it was related to your issues reflashing the device. Regardless, glad that you got it working now!

import torch and import torchvision commands shows segmentation fault (core dumped) error.
please suggest a fix…

@adithyakrishnancv can you try running export OPENBLAS_CORETYPE=ARMV8 before? Please see this issue:

Hi,
thank you for the input unfortunately it still shows segmentation fault(core dumped) as error when running import torch.

Can you use gdb to get the backtrace? Also, which PyTorch wheel did you install and what is your version of JetPack-L4T? Does the l4t-pytorch container run for you?

Hi could you provide the commands for gdb. I’m new to this. I used PyTorch v1.10 - torchvision v0.11.1. Also I flashed jetpack v4. 6.3

It looks like it may be easier for you to use Python’s build-in faulthandler module: 27.2. faulthandler — Dump the Python traceback — Python 3.6.15 documentation

Are you able to run python3 -c 'import numpy'?

python3 -c 'import numpy' works.
here is the output using faulthandler

OK thanks, will continue in

Hello,
I am trying to use PyTorch v1.10 and Python 3.8 on a Jetson Nano running JetPack 4.6. Unfortunately, I have no choice but to use this setup so I am trying to build the PyTorch wheel from source.
I have cloned Pytorch v1.10.2 from github, applied the pytorch-1.10 patch, installed all the requirements listed above in the guide, and set the build options as described.
When I try to run setup.py I get the following error:
AttributeError: module ‘distutils’ has no attribute ‘version’


Any help would be appreciated!

Hi @sdteam7, can you try this suggestion from the related PyTorch bug?