Unable to access GPU using cuda in jetson

i am trying to run yolo v7 algorithm on jetson nano, but i am unable to use gpu, i am using cuda 11.
getting this error

    assert torch.cuda.is_available(), f'CUDA unavailable, invalid device {device} requested'  # check availability
AssertionError: CUDA unavailable, invalid device 0 requested

here’s the CUDA version:

 nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Mon_May__3_19:15:10_PDT_2021
Cuda compilation tools, release 11.3, V11.3.109
Build cuda_11.3.r11.3/compiler.29920130_0

I am beginner
Please help me !

I’m guessing you installed content with some method other than JetPack/SDK Manager. nvidia-smi is for PCI-based GPUs, but Jetson GPUs are directly integrated with the memory controller. That software (and drivers) will fail with non-PCI GPUs.

You’ll need to remove anything which was not for the Jetson, and add via JetPack/SDKM instead (use the release currently installed).

Noted! , can you please tell me how can i remove which is not for the jetson

I will recommend flashing and reinstalling if you don’t need what is present. However, here are some general tips:

  • To find out the full path of a program, e.g., nvidia-smi:
    which nvidia-smi
  • To search for the package owning a program:
    dpkg -S /usr/bin/nvidia-smi
  • To both find and search in one command (remove the backslash “\”, I have those to escape the forum’s use of the single backquote and it won’t let me type it in correctly…basically the first “which nvidia-smi” surrounded by single backquote):
    dpkg -S \`which nvidia-smi\`
  • To remove a package, for example “nvidia-utils-450” (which happens to be a desktop version and not intended for a Jetson):
    sudo apt remove nvidia-utils-450
  • To see which L4T release runs on your Jetson:
    head -n 1 /etc/nv_tegra_release
  • To find the correct software for installing to a Jetson (including flash, but you can uncheck everything except for the package you want to install to the Jetson):
    (each L4T release is tied to a single JetPack/SDKM release)

Additional note for when you’ll have clean up as advised by @linuxdev :

You can get similar information as from nvidia-smi from other tools with Jetson;

  • Get GPU capabilities: you can get that from deviceQuery. Just build as root the sample in /usr/local/cuda/samples/1_Utilities/deviceQuery and run it.

  • Get GPU usage and temperature : You may use tool tegrastats. GPU is referred as GR3D, you would see usage and current clock frequency. For temperature, you would further see something like: GPU@40.875C

  • For memory usage, Jetsons have an iGPU sharing physical memory with the system.

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