Preface
Lao Huang and his nuclear bombs
Development environment at a glance
Graphics driver installation
Download driver
Disable nouveau
install driver
Install CUDA8.0
reference
At last
Installing the driver under Linux is really not a simple thing. I finally set up the GPU programming environment after experiencing countless tortures. I am very fond of it, but I still want to say " So, Nvidia: FUCK YOU!" (Father of Linux) (Manually funny).
Father of Linux
Lao Huang's entrepreneurial road has not been smooth sailing, and now the ruined GTX 1080 Ti and even RTX 2080 will not be born in a day.
1993 In April 2015, Lao Huang (Huang Renxun) from the integrated circuit manufacturer LSI Logic, and two young Sun engineers-Chris Malachowsky and Curtis Priem co-founded Nvidia. Their original intention was to develop a special chip , Used to speed up the rendering speed of 3D images in video games and bring more realistic display effects.
Two years later, the first nuclear bomb was launched, oh no, the product, the first multimedia accelerator for game consoles--NV1. This accelerator integrates graphics processing, sound card, and game joystick functions. Once released, it attracted The eyes of Sega, the largest game manufacturer at the time. Sega decided to use NV1 on its sixth-generation home game console "Saturn" and personal computers. Of course, Sega now is just a third party. Basically Dafa (Sony), old Ren (Nintendo) and Microsoft are in three parts. Dafa that my uncle is still in is really thriving, and now I’m resigning, I don’t know if Dafa will continue to lead the game console market. But be careful, here is the old Ren who was already declining. It is related to Nvidia, I will talk about it later.
But in the same year, the still giant Microsoft launched Windows 95, the mainstream graphics chip market shifted from game consoles to PCs, and at the same time released the Direct3D standard. NVIDIA uses quadratic equation texture mapping as a three-dimensional graphics implementation method, which is not compatible with industry common standards , Therefore, the market sales have dropped rapidly.
Two years later, NVIDIA successively launched RIVA128, RIVA128ZX, RIVATNT and other graphics processors. These new products not only support Microsoft's Direct3D and OpenGL standards, but also surpass competitors 3Dfx's Voodoo and ATI's Rage Pro in terms of energy efficiency, plus low prices. Gradually won the favor of the whole machine factory. In January 1999, it was listed on the Nasdaq. In August of the same year, Nvidia launched the first graphics core named after GeForce-GeForce 256, and proposed GPU for the first time Concept. At the end of the following year, Nvidia used $70 million in cash and 1 million shares of company stock to acquire 3Dfx and officially became the industry leader.
At this point, Lao Huang is about to dominate the rivers and lakes. The good times are not long, it is still related to the giants.
As we all know, JH has spent a lot of money to enter the game console industry. In 2000, JH asked Nvidia to develop Xbox graphics chips, SoundStorm sound chips and motherboard solutions. But the JH’s time limit was only one year, two months before Xbox was released Started production. In the end, Microsoft was forced to postpone the first launch, missed the opportunity, and lost to the Sony PS2, but the PS2 won not only the first launch, but also the number and quality of the game are much ahead. This is also the point where PS3 later lost. , And the point of the return of the PS4 king. The giant missed the opportunity and could only suppress Nvidia, and then there were quality control problems. The giant gave the order to NVIDIA’s competitor ATI (later acquired by AMD). This time The failure of the cooperation caused Nvidia to pay a heavy price. Not only did its revenue decrease in 2003, but it also missed the important news of the establishment of Microsoft's DirectX 9 specification, which directly caused the GeForce FX launched that year to lose to ATI's Radeon 9700 due to compatibility issues. The crash of the NV1 is very similar. More unfortunately, GeForce FX still has the problem of excessively high operating temperature, causing multiple spontaneous combustion accidents. Huang Renxun was once ridiculed by gamers as "the champion of the two bombs". The previous explosion of Samsung Note7 was also ruined The entire Chinese market. But the reason is more complicated, everyone understands. In addition to the giant hard, toothpaste factory (Intel) has also begun to support ATI. In order to achieve a breakthrough, NVIDIA actively seeks the giant hard to settle on the one hand, and strive to cooperate again; on the other hand Lost the Xbox order, and worked hard to win the Sony PS3 order. In addition, continue to introduce high-performance chips to overwhelm ATI, and also reached a patent cross-licensing agreement with Intel. It can be said to be a dare.
Seeing that the old Huang who wants to dominate the rivers and lakes is so suppressed by the giant hard and toothpaste factory that he can't speak. So even in Silicon Valley, starting a business is very difficult.
2007 In 1988, David Kirk, the chief scientist of NVIDIA, convinced Lao Huang to invest a lot of resources to develop the CUDA (Compute Unified Device Architecture) technology that can make GPUs universal, which is the core of GPU programming today, and makes every NVIDIA GPU Support CUDA. The cost of this crazy move is huge. Because the relevant CUDA logic circuit must be added to the hardware product design, the chip area increases, the heat dissipation increases, the cost rises, and the failure rate increases; at the same time, it is necessary to ensure the software driver of each product They all support CUDA, which simply doesn’t give Nvidia’s programmers a way to survive, so what’s the meaning of programmers? How fun to be a scientist (manually funny). In 2008, AMD acquired NVIDIA’s old rival ATI, forming a new solution for CPU integration with GPU. . But unfortunately, AMD abacus can fly, but now it is toothpaste factory CPU + Nvidia GPU. The red-green battle began, or the opponent changed the name.
Intel also terminated the cooperation with Nvidia, and integrated a 3D graphics accelerator in its own chipset, which is now called the integrated display or nuclear display, and found an excuse for the fruit machine not to use Nvidia. This is also helpless to buy a second-hand Shenzhou instead. The reason for rmbp to develop GPU, "So, Intel & Apple: FUCK YOU!".
2012 In 2015, deep neural network technology achieved major breakthroughs with the support of general-purpose GPUs, including computer vision, speech recognition, natural language processing, and artificial intelligence technologies in various fields have all been conditions for rapid development. NVIDIA data The central business is also booming, providing powerful computing support for companies large and small.
Then on October 20, 2016, Nintendo released the Switch, using the Tegra X1 system chip customized by Nvidia. To be honest, if there is no switch, it is not a world of three, and the old man can only entertain himself in the handheld area Be happy. Attention, switch is not a handheld but a host, although many people play as a handheld.
So it’s hard to say whether deep learning gave Lao Huang the opportunity, or Lao Huang gave the deep learning opportunity. In short, the third wave of AI and the arrival of the AI era, Lao Huang is indispensable. But even if you don’t talk about AI, there is no Nvidia, There will never be any current 3A masterpieces, let alone super 3A masterpieces.
Whether Lao Huang can finally defeat AMD and take the remaining PC market share, or even the majority of the host market that is still in the hands of AMD, is actually not important. Because now is the mobile era, I think the AI era has come completely Before, grabbing Qualcomm's share was the key. Looking at what Huawei and Apple have done, there is still a lot to do for Lao Huang to go further, not to mention that Google is eyeing it (manually afraid).
Do not use the graphics card driver provided in the UBUNTU additional driver!!!
Do not use the graphics card driver provided in the UBUNTU additional driver!!!
Do not use the graphics card driver provided in the UBUNTU additional driver!!!
Generally speaking, you will encounter some strange problems, of course, Koi will not have problems (manually funny).
This is the first pit, and there are roughly three ways to show it:
nvidia-smi
Okay, let's talk about my practice:
First, go to Official Website to download the graphics card driver. For example, I am GT 750M and the operating system is 64-bit Linux. I will find the corresponding version to download.
Download driver
Delete the previous driver. Note that even if you have nothing installed, this step is harmless.
sudo apt-get remove --purge nvidia*
Update and install some required libraries, first install so many, and then install CUDA there is still a wave.
sudo apt-get update
sudo apt-get install dkms build-essential linux-headers-generic
Open blacklist.conf and add the setting to disable nouveau at the end, as shown in the figure:
sudo vim /etc/modprobe.d/blacklist.conf
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
Disable nouveau
Disable nouveau kernel module
echo options nouveau modeset=0
sudo update-initramfs -u
Restart. If you run the following command It's useless to print anything, congratulations, you have successfully disabled nouveau.
lsmod | grep nouveau
Go to tty1 (shortcut key ctrl + alt + f1, if there is no response, try f1-f7 one by one, different Linux, the keys will be slightly different). Close the graphical interface:
sudo service lightdm stop
Install the driver, pay attention to there is a pit, be sure to add --no-opengl-files, even if the installation is successful without this, there will be an unlimited login problem.
sudo chmod u+x NVIDIA-Linux-x86_64-390.87.run
sudo ./NVIDIA-Linux-x86_64-390.87.run –no-opengl-files
If you have installed it, but did not add --no-opengl-files, follow the steps below to save it.
sudo ./NVIDIA-Linux-x86_64-390.87.run –uninstall
sudo ./NVIDIA-Linux-x86_64-390.87.run –no-opengl-files
Restart. Try it with the nvidia-smi command. If you see something like the picture below, congratulations, the driver is installed successfully. Or you can see the additional driver display Continue to use the manually installed driver.
nvidia-smi
Additional driver
Let's make up the library first.
sudo apt-get install freeglut3-dev libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
Go to official website to download the desired CUDA version, here is 8.0 second version, download the runfile(local) version, as shown below:
Install CUDA8.0
Check md5, download it again if it is unqualified. The following picture is my test result:
md5sum cuda_8.0.61_375.26_linux.run
md5 detection
Close the graphical interface again
sudo service lightdm stop
You still need to add the --no-opengl-files parameter during installation, and then just keep the space first, and then the default is all the way.
sudo sh cuda_8.0.61_375.26_linux.run –no-opengl-files
Then you will see three installed.
Open the graphical interface
sudo service lightdm start
There is another pit here, if it is 14.04.5, I can't open it at this step, and later changed to 14.04.In short, the kernel must be carefully selected.
Run the following command, if the 3 folders shown in Figure 3 are displayed, congratulations.
ls /dev/nvidia*
If it is missing or cannot be found, there are still some operations to do. Create a xxx.sh (any name) with vim, and enter the following:
#! /bin/bash
/sbin/modprobe nvidia
if["$?"-eq 0]; then
# Count the number of NVIDIA controllers found.
NVDEVS=`lspci | grep -i NVIDIA`
N3D=`echo "$NVDEVS" | grep "3D controller" | wc -l`
NVGA=`echo "$NVDEVS" | grep "VGA compatible controller" | wc -l`
N=`expr $N3D + $NVGA - 1`for i in`seq 0 $N`;do
mknod -m 666/dev/nvidia$i c 195 $i
done
mknod -m 666/dev/nvidiactl c 195255else
exit 1
fi
/sbin/modprobe nvidia-uvm
if["$?"-eq 0]; then
# Find out the major device number used by the nvidia-uvm driver
D=`grep nvidia-uvm /proc/devices | awk '{print $1}'`
mknod -m 666/dev/nvidia-uvm c $D 0else
exit 1
fi
After running, you will see 3 folders.
sudo chmod +x xxx.sh
sudo ./xxx.sh
ls /dev/nvidia*/dev/nvidia0 /dev/nvidiactl /dev/nvidia-uvm
Then write to rc.local, as shown in the figure:
sudo vim /etc/rc.local
rc.local
Open the environment configuration file
sudo vim /etc/profile
Finally write:
export PATH=/usr/local/cuda-8.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH
Save and exit, and it will take effect.
source /etc/profile
Then you can see it.
Run some detection commands, if they are similar to what I showed, congratulations, the environment configuration is complete.
cat /proc/driver/nvidia/version
nvcc -V
Detect
I have referred to a lot of articles, and some of them have brought me a pit, I will not write it. Okay, forgive you (manually helpless). The following are very useful articles.
https://zh.wikipedia.org/wiki/NVIDIA
https://gist.github.com/dangbiao1991/7825db1d17df9231f4101f034ecd5a2b
http://ifenxi.com/archives/1103
https://www.jianshu.com/p/35c7fde85968?from=singlemessage
https://blog.csdn.net/qjk19940101/article/details/78927109
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/#abstract
Nowadays, parallel programming and GPU programming are the foundation. It is important to learn to build a CUDA programming environment.On this basis, you can continue to build deep learning, Tensorflow, etc.
Recommended Posts