Tensorflow not using GPU of Jetson nano

this is the code (h5 was made by colab)

import tensorflow as tf
mnist = tf.keras.datasets.mnist

(x_train,y_train),(x_test,y_test) = mnist.load_data()


x_train,x_test = x_train /255.0 ,x_test /255.0


new_model = tf.keras.models.load_model('mnist.h5')

new_model.evaluate(x_train,y_train, verbose=2)

output:

2023-02-12 19:51:53.162567: W tensorflow/stream_executor/platform/default/dso_loader.cc:65] Could not load dynamic library 'libcudart.so.10.2'; dlerror: libcudart.so.10.2: cannot open shared object file: No such file or directory
2023-02-12 19:51:53.162680: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2023-02-12 19:52:04.767710: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1019] ARM64 does not support NUMA - returning NUMA node zero
2023-02-12 19:52:04.768078: W tensorflow/stream_executor/platform/default/dso_loader.cc:65] Could not load dynamic library 'libcudart.so.10.2'; dlerror: libcudart.so.10.2: cannot open shared object file: No such file or directory
2023-02-12 19:52:04.768396: W tensorflow/stream_executor/platform/default/dso_loader.cc:65] Could not load dynamic library 'libcublas.so.10'; dlerror: libcublas.so.10: cannot open shared object file: No such file or directory
2023-02-12 19:52:04.768708: W tensorflow/stream_executor/platform/default/dso_loader.cc:65] Could not load dynamic library 'libcublasLt.so.10'; dlerror: libcublasLt.so.10: cannot open shared object file: No such file or directory
2023-02-12 19:52:04.769022: W tensorflow/stream_executor/platform/default/dso_loader.cc:65] Could not load dynamic library 'libcufft.so.10'; dlerror: libcufft.so.10: cannot open shared object file: No such file or directory
2023-02-12 19:52:04.769460: W tensorflow/stream_executor/platform/default/dso_loader.cc:65] Could not load dynamic library 'libcurand.so.10'; dlerror: libcurand.so.10: cannot open shared object file: No such file or directory
2023-02-12 19:52:04.769849: W tensorflow/stream_executor/platform/default/dso_loader.cc:65] Could not load dynamic library 'libcusolver.so.10'; dlerror: libcusolver.so.10: cannot open shared object file: No such file or directory
2023-02-12 19:52:04.770194: W tensorflow/stream_executor/platform/default/dso_loader.cc:65] Could not load dynamic library 'libcusparse.so.10'; dlerror: libcusparse.so.10: cannot open shared object file: No such file or directory
2023-02-12 19:52:04.770540: W tensorflow/stream_executor/platform/default/dso_loader.cc:65] Could not load dynamic library 'libcudnn.so.8'; dlerror: libcudnn.so.8: cannot open shared object file: No such file or directory
2023-02-12 19:52:04.770637: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1850] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2023-02-12 19:52:05.392525: W tensorflow/core/framework/cpu_allocator_impl.cc:82] Allocation of 188160000 exceeds 10% of free system memory.
WARNING:tensorflow:AutoGraph could not transform <function Model.make_test_function.<locals>.test_function at 0x7f7e1532f0> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: 'arguments' object has no attribute 'posonlyargs'
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
1875/1875 - 6s - loss: 0.5090 - accuracy: 0.8504 - 6s/epoch - 3ms/step

It works. But it doesn’t seem to be using the GPU.

I am using JetPack 4.6.3

I am having a similar issue on JetPack 4.6.1 where tensorflow does not see the GPU. Running

import tensorflow as tf
tf.test.gpu_device_name()

returns ‘’. Additionally

from tensorflow.python.client import device_lib
device_lib.list_local_devices()

returns

[name: "/device:CPU:0"
...
]

Maybe the environment is not correctly set for CUDA.
You may exit python and try:

export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda/bin:$PATH

Then restart python from same terminal. If this works, you may append the lines above to your user’s default shell config such as .bashrc for bash.

1 Like

Hi,

Could you share how you install the TensorFlow package?

It is recommended to try our package that has CUDA enabled.

Please noted that the command is by default for JetPack 5 users.
You will need to update the JetPack version manually.

Thanks.

My jetson nano dose not support JetPack 5.x.
what should i do?

Hi,

Just update the JP_VERSION to the version you are using.
You can find some examples in the doc.

Thanks.

Hi,

These exports didn’t change anything. What else can I try?

Update 3/5/23: Official TensorFlow for Jetson Nano! - #236 by ALEEF02

Do you have nvidia-jetpack installed ?

sudo apt update
sudo apt install nvidia-jetpack
1 Like

That gives me:

The following packages have unmet dependencies:
  nvidia-jetpack : Depends: nvidia-container (= 4.6.3-b17) but it is not going to be installed

You earlier mentionned JP-4.6.1, but it seems to require version 4.6.3 here.
Try upgrading if possible…seems mixed versions.

I was mistaken. I am on JP 4.6.3. I’ve checked using jtop

Any info about why it cannot install nvidia-container ?

sudo apt search nvidia-container
sudo apt search cuda-runtime

Nope, not a clue… seeing as it’s already installed…

...
nvidia-container/stable 4.6.3-b17 arm64
  NVIDIA Container Meta Package
...

It doesn’t say it’s installed, just available…
Try installing with:

sudo apt install nvidia-container

and post error log from this command if any.

The following packages have unmet dependencies:
  nvidia-container: Depends: nvidia-container-csv-tensorrt (= 8.2) but it is not going to be installed

May be related to this topic ?
I have no Nano for checking, I’m using JP5, so I cannot advise much more. If affordable you may try to use SDKM after deleting any previous downloads, then download latest version and reflash. Obviously reflashing would erase any data, so you would save any work in Jetson before reflashing.

What do I even do after reflashing? I’ve reflashed before, but it got me to the same state I’m in now.

If on host you have already updated to latest SDKM version after deleting old versions downloads/image build, reflashed with no errors and it doesn’t improve, someone more skilled would have to help further.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.