CUDA sample throwing error

same problem here. I tried everything as said in manual, but nothing works out. NVIDIA team please solve.

Board: Jetson AGX XAVIER
Jetpack: 4.4.1

Dear, this time everything went well!
After the new update of Windows 10 Insider Preview 21286.1000 (rs_prerelease) and as well as the NVIDA driver to 465.21, I decided to try again, performing the following steps:
Note: You must already be enrolled in the Windows Insider Program.

  1. Uninstall all linux distributions.
  2. Uninstall WSL (right-click on the windows start logo> App and Features> Enable or disable windows features> uncheck the box for Windows Subsystem for Linux).
  3. Restart the computer.
  4. Open PowerShell in administrator mode and perform the simplified installation of WSL, as it already (i) enables the optional WSL and Virtual Machine Platform components, (ii) downloads and installs the latest Linux kernel, (iii) defines WSL 2 as the default and (iv) download and install an Ubuntu distribution (Just to inform you, I had previously performed the manual installation):

PS C:\Users\sanam> wsl.exe --install
PS C:\Users\sanam> exit

  1. Restart your computer, and wait while Ubuntu boots.
  2. Within Ubuntu, enter the new user account and password.
  3. Run the commands for installing and configuring the CUDA Toolkit:

$ sudo su

Enter your password to have root access and update Ubuntu.

/home/san# apt update
/home/san# apt upgrade

  1. Then, follow the CUDA Toolkit Documentation > CUDA on WSL tutorial at 1. NVIDIA GPU Accelerated Computing on WSL 2 — CUDA on WSL 12.3 documentation, which is the same as the video "GPU Accelerated Machine Learning with WSL 2 "from Youtube:

/home/san# apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub

/home/san# sh -c ‘echo “deb Index of /compute/cuda/repos/ubuntu1804/x86_64 /”> /etc/apt/sources.list.d/cuda.list’

/home/san# apt-get update

/home/san# apt-get install -y cuda-toolkit-11-0

  1. Running a CUDA application:

/home/san# cd /usr/local /cuda/samples/4_Finance/BlackScholes

/usr/local /cuda/samples/4_Finance/BlackScholes# make

/usr/local /cuda/samples/4_Finance/BlackScholes# ./BlackScholes

Ok. All right !!!
Thank you all!
Obrigado a todos!

3 Likes

I installed cuda-toolkit-11-2 from the ubuntu2004 repo, and am getting the error you previously had. Maybe the older version is the one required (it’s also what the guide instructs us to install, as you followed)

Uninstalled cuda-toolkit-11-2 and replaced with the older version, cuda-toolkit-11-0, which fixed the problem. Also I don’t think there’s a difference between the 1804 and 2004 repos, at least in regards to the toolkit and its dependencies

Upgrading to cuda-toolkit-11-2 breaks it for me. Downgrading to cuda-toolkit-11-0 fixes it. There’s some sort of change that breaks WSL support in the newer version.

Just pulling info from the other thread on the devicequery sample, I was mucking around with it and there’s something that’s not working in the latest 11-2, but i’m running 11-1 without issue (posted this over on https://forums.developer.nvidia.com/t/devicequery-sample-fails-to-run/163871/8?u=anthony.tan)

After 2-3 days of trouble shooting, this finally worked for me! Specifically using apt-get install -y cuda-toolkit-11-0 instead of $ apt-get install -y cuda. This was confusing, because the instructions here which specifically target WSL, says only cuda, but this is wrong.

I first had to uninstall cuda-11.2, using the instructions found here. I am on WSL, but used the instructions for Ubuntu (then finally manually deleted the /usr/local/cuda-11.2 directory).

I had also forgot to add the following lines to my .bashrc:
export PATH="/usr/local/cuda-11.0/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-11.0/lib64:$LD_LIBRARY_PATH"

Ah, yeah, there’s that. If you install the CUDA toolkit 11-2, it’ll install the samples to /usr/local/cuda-11.2 and symlink over /usr/local/cuda to that directory (via /etc/alternatives).

Depending on what you’re doing, instead of PATH patching, you might find it easier to grab the a Makefiles from the samples area for 11-1 and using that - you should see at the top the toolkit is defined with a conditional, so you could do:

make CUDA_PATH=/usr/local/specific/location/of/toolkit

(I haven’t done much playing with this other than getting the samples to work/run so can’t comment on the LD_LIBRARY_PATH thing though)

I did somewhat a similar process. Reinstalled the Linux distro and reinstall. I found in my case I had to reinstall the Nvidia driver again. Until I did that - kept getting the error. No clue why.

1 Like

I solved this problem by making sure my Windows Insider Program was set to the Dev Channel. It’s not super clear in the Nvidia installation guide that this is required. Thanks all for the suggestions and help.

Other notes:
As of March 2, 2021 - cuda toolkit 11.2 worked with BlackScholes:
apt-get install -y cuda-toolkit-11-2

I had problems with the benchmark Cuda container but the the TensorFlow Jupyter notebook ran fine

docker run -it --gpus all -p 8888:8888 tensorflow/tensorflow:latest-gpu-py3-jupyter

Good luck!

Reinstalling the Windows host’s graphics driver did the trick for me as well.
EDIT: One restart of the host later, it doesn’t work just like before.

Awesome, thanks, this worked for me. Realized I did the same (installed driver before the windows insiders build), so re-installed the driver and it works.

This worked for me. Thanks!

Latest driver fixes this issue. See Stderr: nvidia-container-cli: initialization error: driver error: failed to process request\\\\n\\\"\"": unknown - #32 by onomatopellan

This command DOES NOT run !

Why can’t NVIDIA do this for us !!! They packaged everything but this…!

1 Like

It is weird, on the CUDA help they explicitly say that you need to be in the "Release Preview Channel " (and not the “Dev Channel”)

on newest windows 10 + WSL2 with RTX 3050 Ti, followed instruction strictly(installed studio driver for rtx3050ti, rebooted windows, then installed meta packages as described at: CUDA on WSL :: CUDA Toolkit Documentation (4.2.6 option2, and 4.2.7), when run ./BlackScholes I still got:

CUDA error at …/…/common/inc/h"…, 123CUDA error at …/…/common/inc/helper_cuda.h:779 code=35(cudaErrorInsufficientDriver) "cudaGetDeviceCount(&device_count)

UPDATE: upgrade windows 10 to 22H2 fixed the problem, no sample CUDA code runs as expected.

I reinstall the cuda dervice in window using the same version to solve the problem-my window version is window10 21H2 19044 1645 Release Preview ,cuda -11.6