Forum

WSL - how to instal...
 
Notifications
Clear all

WSL - how to install cuda for tensorflow and gpu computing

1 Posty
1 Users
0 Likes
199 Widok
0
Topic starter

example

1 Answer
0
Topic starter

Based on tensorflow compatibility list and version tensorflow-2.12.0 

apt update
apt install cuda-toolkit-11-8
wget  https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb 
dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-key del 7fa2af80
apt install python3-pip
pip install tensorflow
add-apt-repository ppa:graphics-drivers/ppa
apt-get install cuda-11-8 numactl
apt-get install libcudnn8=8.6.*-1+cuda11.8

Test:

nvidia-smi 
nvcc -V

Then final test:

python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

or check number of gpu's using script test.py

from transformers import GPT2Tokenizer
from transformers import AutoTokenizer
import tensorflow as tf
tokenizer = AutoTokenizer.from_pretrained('sdadas/polish-gpt2-medium')

print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))

text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris et sem interdum, vehicula erat sit amet, aliquet nisl. Phasellus at tellus et turpis viverra bibendum tincidunt eu arcu. Nunc varius venenatis condimentum. Aliquam auctor efficitur ligula."

tokens = tokenizer.encode(text, add_special_tokens=False)
num_tokens = len(tokens)

print("Number of tokens:", num_tokens)

Got troubles with 

libcuinj64-11.5 : Depends: libnvidia-compute-495 (>= 495) but it is not going to be installed or

or

numba.cuda.cudadrv.driver.CudaAPIError: [100] Call to cuInit results in CUDA_ERROR_NO_DEVICE

then try with this commands and test cuda script again

apt-get purge 'nvidia-.*'
apt-get install nvidia-cuda-toolkit
This post was modified 9 miesięcy temu 3 times by mrmucha

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: