In the early days of the computer era, the satisfaction of a geek was largely rooted in the ability to DIY a machine. In the era of deep learning, the preceding sentence is still right.
Origin
In 2013, MIT Technology Review ranked deep learning as the top ten technological breakthroughs of the year. The reason is that the model has its huge network structure, enough parameters, strong learning ability, can match the big data to achieve amazing results. Moreover, can automatically learn the characteristic, avoids "the characteristic project" This tedious manual labor. is of great significance for the field of image, audio and word processing. Because I recently tried to do text mining with deep learning, I needed a deep learning server (believe me, if you run with the CPU, your life looks very short).
Then there are three options:
A, buy assembled servers, such as Nvidia DIGITS Devbox
B. Buy cloud services, such as Amazon's GPU services
C, save yourself a deep learning server.
Item A is not cost-effective, and is not necessarily bought. The B-Item cloud service is also more expensive to study the exploratory nature of the work, machine configuration is not necessarily appropriate, so we have C.
Hardware selection: The basic idea is to supports the machine, keep the upgrade space
Video card selection:
First of all, why does deep learning require graphics card computing?
The GPU is optimized for large-scale parallel operations;
On the GPU more is the arithmetic unit (integer, floating point multiplication unit, special operation unit and so on);
GPUs tend to have a greater bandwidth of memory, so they also have good performance in high-throughput applications.
Here's an interesting explanation video explaining the computational differences between GPU and CPU.
So the choice of graphics card is most important, because the preparation of Cuda-based computing (Cuda (Compute Unified Device Architecture) is an nvidia-developed GPU parallel computing environment. ), so only the Nvida series can be selected. In the Nvidia product line, there is the GeForce series in the Consumer field, the Quadro series in the field of professional cartography, and the Tesla series in the field of high performance computing, how to choose?
There is a paper study, too high accuracy for deep learning error rate is not improved, and most of the environmental framework only support single-precision, so double-precision floating point calculation is not necessary, the Tesla series have been removed. From the performance indicators of the graphics card, Cuda core number of more, GPU frequency, memory to large, high bandwidth. In this way, the newest Titan x is a cheap and sufficient choice.
CPU Selection:
In the deep learning task, the CPU is not responsible for the main task, the single-card computing only one core to reach 100% load, so the core number of CPUs and the number of graphics cards are consistent, too much is not necessary, but the bandwidth to handle PCIe to 40.
Motherboard selection:
Requires support for the X99 architecture, support for PCIe3.0, and support for 4-channel DDR4 memory architectures. If you want to make four video cards in parallel, PCIe bandwidth support is up to 40 and supports 4-way Nvida SLI technology.
Memory:
Up to twice times the video memory, of course, the bigger the money, the better.
Power problem: A video card power is close to 300W, four graphics card recommended power over 1500W, in order to expand later, the selection of 1600W power.
Chassis heat Dissipation:
Because of the size of the various components, a large chassis with good thermal dissipation is required, and the TT Thermaltake Core V51 chassis is selected, with 3 12cm fans as standard. In the future, if necessary, water-cooled equipment can be installed.
The above is the main hardware environment selection and installation.
Software Environment Installation:
The main installed Ubuntu system, CUDA Environment, and Theano, Keras environment
1. Install Ubuntu 14.04 (do not install Kylin version)
Download the ISO file on the official website to burn the USB flash drive installation and install it automatically on the SSD drive.
2. Installing Cuda 7.5 deb file (with video driver)
2.1 Get Cuda installation package and download the local Deb file on Nvidia official website.
2.2 Perform the following command installation:
$ sudo dpkg-i cuda-repo-ubuntu1410-7-0-local_7.0-28_amd64.deb
$ sudo apt-get update
$ sudo apt-get install Cuda
2.3 Setting environment variables: sudo gedit/etc/profile
$ export Path=/usr/local/cuda-7.5/bin: $PATH
$ export ld_library_path=/usr/local/cuda-7.5/lib64: $LD _library_path
2.4 Restart the machine: Use one of the examples to verify the test
$ cuda-install-samples-7.5.sh ~
$ CD ~/nvidia_cuda-samples_7.5/5_simulations/nbody
$ make
$./nbody
Or make the test project 1_utility in the sample directory, and then run./devicequery
3. Install Python and Theano tools
3.1 Direct download installs the Anaconda Kit 64-bit version.
Download and upgrade to the latest with Conda. Anaconda comes with Openblas to maximize performance for NumPy and Theano calculations
3.2 Modified the Theano configuration file to be run by the GPU by default
Create a new. theanorc file in the home directory
Enter the following in the. theanorc
[Cuda]
root=/usr/local/cuda/bin/
[Global]
Floatx = float32
device = Gpu0
[NVCC]
Fastmath = True
3.3 After the installation is completed, refer to the following address for testing
Theano_flags=floatx=float32,device=gpu python ' python-c ' import OS, THEANO; Print Os.path.dirname (theano.__file__) "'/misc/check_blas.py
3.4 Installing Keras
Install Pip install Keras via Anaconda
Note that the Theano that Keras relies on is the dev version and needs to be installed from the source on GitHub. Note that this system has two python at this time, so write a path
Sudo/home/user/anaconda/bin/python setup.py Develop
4. Set the remote server call
4.1 Installing SSH, starting the service
4.2 Setting up Notebook server
The following command sets the password in Ipython:
From IPython.lib import passwd
passwd ()
Make a note of the generated string.
Create a Ipython configuration file, such as the name MyServer
Ipython Profile Create MyServer
Vim ~/.ipython/profile_myserver/ipython_notebook_config.py
To edit a file, add the following:
c = Get_config ()
C.ipkernelapp.pylab = ' inline ' #启动inline模式
C.notebookapp.ip = ' * '
C.notebookapp.open_browser = False
C.notebookapp.password = U ' Sha1:yourhashedpassword ' #把第二步的密码考进来
C.notebookapp.port = 6868 #自己设一个端口号
Start the service
Ipython Notebook--profile=myserver
4.3 Remote Browser calls
Remote in the browser login http://192.168.3.31:6868/, enter the password, you can enter the Ipython notebook.
If you need to keep the connection,
Nohup Ipython Notebook--profile=myserver
Kill the Connection
Lsof Nohup.out
Kill-9 "PID"
Completed!
The final hardware configuration:
Cpu:intel X99 Platform i7 5960K
Memory: DDR4 2800 32G (8g*4)
Motherboard: GIGABYTE X99-UD4
Video card: GTX Titan X
Hard disk: ssd+ ordinary hard disk
Systems and Software
Operating system: Ubuntu 14.04.3 x64
cuda:7.5
Anaconda 2.3
Theano 7.0
Keras 2.0
Resources:
http://timdettmers.com/2014/08/14/which-gpu-for-deep-learning/
http://timdettmers.com/2015/03/09/deep-learning-hardware-guide/
http://graphific.github.io/posts/running-a-deep-learning-dream-machine/
Http://docs.nvidia.com/cuda/cuda-quick-start-guide/index.html#ubuntu-x86_64-deb
Http://deeplearning.net/software/theano/tutorial/using_gpu.html#cuda
Before finding another way to install Theano on the Web is to install the components yourself. But the attempt is unsuccessful, it may be because the CPU and other hardware, may need to compile their own installation openblas,numpy, scipy, Theano and other environments, extremely cumbersome. Finally, it is convenient to use anaconda directly.
Build a deeplearning server