Python 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
NvRmMemInitNvmap failed with Permission denied
549: Memory Manager Not supported
****NvRmMemInit failed**** error type: 196626
*** NvRmMemInit failed NvRmMemConstructor
/usr/local/lib/python3.8/dist-packages/torch/cuda/__init__.py:115: UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 801: operation not supported (Triggered internally at /opt/pytorch/pytorch/c10/cuda/CUDAFunctions.cpp:108.)
return torch._C._cuda_getDeviceCount() > 0
False
docker: nvcr.io/nvidia/l4t-tensorrt:r8.5.2.2-devel
PyTorch installation method: Installing PyTorch for Jetson Platform - NVIDIA Docs
start docker command:
docker run -it --rm --runtime=nvidia --gpus all nvcr.io/nvidia/l4t-tensorrt:r8.5.2.2-devel
If it is the root user, it can get the correct result.
I created a user named “walker” and it cannot be used under that user, resulting in the above error.
The command to create a user is as follows:
USER=walker
useradd --create-home --user-group --groups sudo --shell /bin/bash "$USER"
# Add sudo permission for $USER
mkdir -p /etc/sudoers.d
printf '%s ALL=(ALL:ALL) NOPASSWD: ALL\n' "$USER" | \
tee /etc/sudoers.d/nopasswd
chmod 440 /etc/sudoers.d/nopasswd
mkdir -p /var/lib/sudo/lectured/
touch /var/lib/sudo/lectured/"$USER"
chmod 600 /var/lib/sudo/lectured/"$USER"