- Install cudnn ubuntu 18.04 cuda 10 install#
- Install cudnn ubuntu 18.04 cuda 10 update#
- Install cudnn ubuntu 18.04 cuda 10 driver#
- Install cudnn ubuntu 18.04 cuda 10 download#
reshape ( - 1 ), predict, rownames =, colnames = )) def one_img_predict ( model, n ): predict = model. evaluate ( x_test, y_test ) print ( 'Loss:', loss ) print ( 'Accuracy:', accuracy ) predict = model. show () def all_img_predict ( model ): print ( model. save ( './CNN_Mnist.h5' ) # Load Model model = load_model ( './CNN_Mnist.h5' ) # Display def plot_img ( n ): plt. evaluate ( x_test, y_test ) print ( 'Test:' ) print ( 'Loss: %s \n Accuracy: %s ' % ( loss, accuracy )) # Save model model. fit ( x_train, y_train, epochs = 10, batch_size = 64, verbose = 1 ) # Test loss, accuracy = model. compile ( loss = 'categorical_crossentropy', optimizer = 'adam', metrics = ) model. add ( Dense ( 10, activation = 'softmax' )) print ( model. add ( Dense ( 256, activation = 'relu' )) model. add ( MaxPool2D ( pool_size = 2, data_format = 'channels_first' )) model. add ( Conv2D ( filters = 32, kernel_size = 3, input_shape = ( 1, 28, 28 ), activation = 'relu', padding = 'same' )) model. to_categorical ( Y_test ) # Model Structure model = Sequential () model. to_categorical ( Y_train ) y_test = np_utils. # coding: utf-8 import os from keras.models import Sequential, load_model from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPool2D from keras.utils import np_utils, plot_model from keras.datasets import mnist import matplotlib.pyplot as plt import pandas as pd # Mnist Dataset ( X_train, Y_train ), ( X_test, Y_test ) = mnist.
Install cudnn ubuntu 18.04 cuda 10 install#
I don't know if I can train the model, how can I feel at ease? Here is a simple sample code to test whether the GPU is useful.įirst we may need to install the following packages: sudo pip3 install tensorflow-gpuĪfter installation, you should be able to execute the following code: sudo dpkg -i libcudnn7_7.6.4.38+cuda10.0_bĪfter the installation is complete, reboot again.
Install cudnn ubuntu 18.04 cuda 10 download#
deb file, after we come to the download path, we need to install it with the following command. Here choose your own operating system, and then choose the version suitable for CUDA 10.0 (if you really installed CUDA 10.0 as I did before).Īfter the download is complete, if it is a.
Install cudnn ubuntu 18.04 cuda 10 driver#
Of course you can choose the version you want.Īfter downloading, go to the downloaded path and install: sudo sh cuda_10.0.130_410.48_nĭuring the installation process, because the GPU driver has been installed in advance, here, we don’t need to install the GPU driver anymore.ĭownloading CuDNN is troublesome, we need to register as a developer member. nvidia-smiġ0.0 is recommended because my program is relatively stable in CUDA 10.0. sudo rebootĪfter rebooting, use the following command to confirm that the driver is installed successfully.
Until the kernel is installed, we restart the computer. I'm not sure why there is no such message, but I have seen a discussion on the forum saying " This is a joke made by Nvidia engineers! Test your determination to install!" I encountered this message the first time (and every time afterwards) I installed the driver. Maybe you will see a message is: The distribution-provided pre-install script failed! Are you sure you want to continue? For example, I have a 2080Ti GPU in my computer, and I am a 64-bit Ubuntu, so my choice is as shown in the picture above.Īfter downloading, go to the download path and use the following command to install: sudo sh NVIDIA-Linux-x86_64-430.50.run Select the GPU version you need and download.
You need to go to the NVIDIA official website to download your gpu driver: Just copy and paste it in terminal, as long as the output is 6.x, you're done. Sudo update-alternatives -install /usr/bin/gcc gcc /usr/bin/gcc-6 60 -slave /usr/bin/g++ g++ /usr/bin/g++-6 & \
Sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y & \ Sudo apt-get install build-essential software-properties-common -y & \
Install cudnn ubuntu 18.04 cuda 10 update#
The reason why it is recommended to install the gcc 6.x version instead of the default gcc 7.x of Ubuntu 18.04 is because gcc 6.x is relatively smooth when compiling some CUDA packages later, I have encountered gcc 7.x error problem.įor the installation of gcc 6.x, I refer to here: sudo apt-get update & \ Search your error message on Internet, and you will usually find some solution.īelow, I began to record my installation steps.
Download and install CuDNN (the following example is 7.6.4)īefore we start, I need to remind you: You may encounter different problems during the installation process.Download and install CUDA (the following example is 10.0).If your gcc version is 7.x, we need to switch to gcc 6.x.If we want to use GPU for deep learning ( for example, through Tensorflow or Keras), the installation environment is not really complicated, and it usually only takes a few hours to complete the environment in the first time.