running an R script on a gpu (ubunto)

I want to run my R script on a GPU server. My script trains a regression model by Keras. to speed up the process, I used parallelization. Then I have done the below steps and then run my model:
First I installed a miniconda,
*Creating a Conda environment
*activated the conda invironment
*Installing PyTorch, pip, and tensorflow by (conda install tensorflow-gpu):
**conda install cudatoolkit=11.2 -c conda-forge
**pip install torch
**conda install tensorflow-gpu
**conda install cudatoolkit=11.1 pytorch=1.8.1 python=3.8 torchvision -c pytorch -c conda-forge
**pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.8.0+cu111.html

Then I ran my script.
The problem is, that GPU is not active, because of Tensorflow. So It is like a CPU and the running time is too long. These are the warning over running the script:
As far as I know I coudnt install tensorflow-gpu which is related to R!

#####---
2022-09-12 13:13:30.434379: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudnn.so.8'; dlerror: libcudnn.so.8: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/lib/R/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server:/usr/lib/R/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server

2022-09-12 13:13:30.434395: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1850] 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 GPU 支援  |  TensorFlow for how to download and setup the required libraries for your platform.

Skipping registering GPU devices...

2022-09-12 13:13:30.434750: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F AVX512_VNNI FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
###-------

I need to mention the script did run but I couldn't improve the running time because I couldn't use the GPU because of the above warnings.

Is there anybody who knows how to fix the problem?
Should I add my code here?

I think this is a clue. I recommend you google to read about how to install libcudnn on the system

1 Like

This library is missing - you should be able to add it to your conda env via conda install cudnn (cf. Cudnn :: Anaconda.org)

1 Like

Thank you, I installed that one but I got those errors again. I need to mention it showed me some line that this package is in conflict with other packages, but finally, showed the version of the installed package, please see the

update:
I fixed the previous error but I got this one:
failed to create cublas handle: CUBLAS_STATUS_NOT_INITIALIZED

tensorflow.python.framework.errors_impl.InternalError: Blas GEMM launch failed : a.shape=(4, 440), b.shape=(440, 221), m=4, n=221, k=440 [[node sequential/dense_1/MatMul (defined at /keras/engine/training.py:1100) ]] [Op:__inference_train_function_594]
Do you have any ideas?