Score:1

Setting up tensorflow with gpu support on Ubuntu 20.04

cn flag

I followed this link here to download tensorflow with gpu support on my Ubuntu 20.04 OS. Here is a snapshot of my .bashrc that I suspect may be the problem but I cannot verify this.

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/weiss/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/weiss/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/home/weiss/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/weiss/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

export LD_LIBRARY_PATH=/usr/lib/cuda/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/lib/cuda/include:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-11.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.0/include:$LD_LIBRARY_PATH
echo 'export LD_LIBRARY_PATH=/usr/lib/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
    echo 'export LD_LIBRARY_PATH=/usr/lib/cuda/include:$LD_LIBRARY_PATH' >> ~/.bashrc



export LD_LIBRARY_PATH=/usr/lib/cuda/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/lib/cuda/include:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/lib/cuda/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/lib/cuda/include:$LD_LIBRARY_PATH

When I run this command

 tf.config.list_physical_devices('GPU')

I get the following

2021-09-15 18:11:46.561864: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-15 18:11:46.564618: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcusolver.so.11'; dlerror: libcusolver.so.11: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/lib/cuda/include:/usr/lib/cuda/lib64:/usr/local/cuda-11.0/include:/usr/local/cuda-11.0/lib64:/usr/local/cuda/lib64:/usr/local/cuda-11.0/lib64:/usr/lib/cuda/include:/usr/lib/cuda/lib64:
2021-09-15 18:11:46.565065: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1835] 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...
[]

I have tried a number of other potential setups but nothing works. Any help or suggestions is appreciated.

Here is also a snapshot of nvidia-smi

+---------------------------------------------+
| NVIDIA-SMI 460.91.03    Driver Version: 460.91.03    CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 1070    Off  | 00000000:01:00.0  On |                  N/A |
|  0%   53C    P0    34W / 200W |   1175MiB /  8085MiB |      2%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+---------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A       934      G   /usr/lib/xorg/Xorg                198MiB |
|    0   N/A  N/A      1542      G   /usr/lib/xorg/Xorg                515MiB |
|    0   N/A  N/A      1674      G   /usr/bin/gnome-shell              227MiB |
|    0   N/A  N/A      2843      G   /usr/lib/firefox/firefox          219MiB |
+---------------------------------------------+
cc flag
The Nvidia instructions have you add the PATH and LD_LIBRARY_PATH modifications to your .profile, not .bashrc. In doing that, get rid of the dups, the non-existent dirs (e.g./usr/lib/cuda...) and don't put the ...include in the LD_LIBRARY_PATH. After CUDA works (run the samples), install CDNN and run its samples, then install tensorflow. The tensorflow you select may have specific CUDA and DNN version requirements.
justanewb avatar
cn flag
@ubfan1 Thank you for your comment. You seem pretty well versed in this, would you mind providing a detailed answer?
cc flag
Search this site for CUDA. Terrance has a nice answer at https://askubuntu.com/questions/1077061/how-do-i-install-nvidia-and-cuda-drivers-into-ubuntu/1077063#1077063
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.