Ubuntu14.04 configure cuda-convnet and cuda-convnet

Source: Internet
Author: User
Tags cuda toolkit

Ubuntu14.04 configure cuda-convnet and cuda-convnet

Reprinted Please note: http://blog.csdn.net/stdcoutzyx/article/details/39722999

In the previous Link, I configured cuda and had a powerful GPU. Naturally, the resources could not be completely idle, So I configured a convolutional neural network to run the program. As for the principle of the convolutional neural network, write it later. I plan to write the usage of the database first, then write the principle, and drive the pursuit of theory with action.

Let's not talk much about it.

1. Pre-Description

About cuda-convnet, originated from a classic paper ①, the paper for ILSVRC-2010 Data experiments, and then published the code used in the experiment, the link is ②. However, the fact is often different from the paper, and the code in link ② cannot reproduce the results in the paper. I found it a long time after I used the Linked Library. I think it is very difficult. I hope that later users will be cautious.

The reason for this problem is that the multi-GPU and dropout features mentioned in this paper are not implemented, and the 8-layer convolutional neural network configuration file in this paper is not provided. In short, it cannot be used directly and needs to be explored by yourself.

Even so, there is always better than none. After all, the convolutional Neural Network implemented by this library is well encapsulated. The contributions of the great gods in this paper are beyond my reach. Give the gods 32 likes.

This article only describes the cuda-convnet and the configuration of the cuda-convnet2, the author of the paper also published other versions of the library, not used, so do not mention the press.

2. Cuda-convnet configuration 2.1. Download the source code.

Refer to link ② to download the source code first.

svn checkout http://cuda-convnet.googlecode.com/svn/trunk/ cuda-convnet-read-only

The retrieved version is 562.

2.2. install necessary Libraries

Then, install the required library. I am using the ubuntu system. Therefore, the command is

sudo apt-get install python-dev python-numpy python-magic python-matplotlib libatlas-base-dev

Of course, make sure that you have installed cuda. I installed cuda6.5 in the/usr/local/directory, as shown below:

$ ls /usr/localbin  cuda  cuda-6.5  etc  games  include  lib  man  sbin  share  src

2.3. Change build. sh

Go to the cuda-convnet-read-only directory you just downloaded and change the configuration path in the build. sh file. As follows:

# CUDA toolkit installation directory.export CUDA_INSTALL_PATH=/usr/local/cuda # CUDA SDK installation directory.export CUDA_SDK_PATH=/usr/local/cuda-6.5/samples/common/inc # Python include directory. This should contain the file Python.h, among others.export PYTHON_INCLUDE_PATH=/usr/include/python2.7 # Numpy include directory. This should contain the file arrayobject.h, among others.export NUMPY_INCLUDE_PATH=/usr/lib/python2.7/dist-packages/numpy/core/include/numpy # ATLAS library directory. This should contain the file libcblas.so, among others.export ATLAS_LIB_PATH=/usr/lib/atlas-base make $*


Follow the tutorials on the official website to complete the build. sh configuration and then you can compile it. However, errors may occur. You need to modify the following information.

2.4. Add a header file

If you compile the file directly, the cutil_inline.h header file cannot be found. The reason may be that this header file was originally available. Later, the header file function was implemented in other header files.

In the include sub-folder, enter the cutil_inline.h file and the content.

#include "helper_cuda.h"#define cutilCheckMsg(a) getLastCudaError(a)#define cutGetMaxGflopsDeviceId() gpuGetMaxGflopsDeviceId()#define MIN(a,b) (a) < (b) ? (a) : (b)

2.5. MakeFile file changes

The MakeFile contains the following lines:

INCLUDES :=  -I$(PYTHON_INCLUDE_PATH) -I$(NUMPY_INCLUDE_PATH) -I./include -I./include/common -I./include/cudaconv2 -I./include/nvmatrix

Add the cuda path as follows:

INCLUDES :=  -I$(PYTHON_INCLUDE_PATH) -I$(NUMPY_INCLUDE_PATH) -I$(CUDA_SDK_PATH) -I./include -I./include/common -I./include/cudaconv2 -I./include/nvmatrix

Save it.

2.6. The last Library link is incorrect.

After completing the above changes, you can compile the database. However, a library Link error occurs at the end. You don't have to worry about it. comment out the database directly.

On the 332 lines of the common-gcc-cuda-4.0.mk file. Comment directly.

# LIB += -lcutil_$(LIB_ARCH) $(LIBSUFFIX) -lshrutil_$(LIB_ARCH) $(LIBSUFFIX)

Now, you can complete the cuda-convnet compilation.

3. Cuda-convnet2 Configuration

As the name suggests, this is cuda-convnet version 2.0 that supports multi-GPU running.

3.1. Download source code

Git clone https://code.google.com/p/cuda-convnet2/

3.2. Necessary Libraries

sudo apt-get install python-dev python-numpy python-scipy python-magic python-matplotlib libatlas-base-dev libjpeg-dev libopencv-dev

3.3. Configuration

I can only say that this version is more user-friendly than the previous version, and the build. sh version is directly like this.

# CUDA toolkit installation directory.export CUDA_INSTALL_PATH=/usr/local/cuda # Python include directory. This should contain the file Python.h, among others.export PYTHON_INCLUDE_PATH=/usr/include/python2.7 # Numpy include directory. This should contain the file arrayobject.h, among others.export NUMPY_INCLUDE_PATH=/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ # ATLAS library directory. This should contain the file libcblas.so, among others.export ATLAS_LIB_PATH=/usr/lib/atlas-base # You don't have to change these:export LD_LIBRARY_PATH=$CUDA_INSTALL_PATH/lib64:$LD_LIBRARY_PATHexport CUDA_SDK_PATH=$CUDA_INSTALL_PATH/samplesexport PATH=$PATH:$CUDA_INSTALL_PATH/bin

If it is in ubuntu, the path has been configured correctly.

3.4. Link error

However, if you compile directly, you will still encounter errors, as shown below:

cd ./bin/ && g++  -O3   -DNUMPY_INTERFACE -shared -Wl,-no-undefined -o libutilpy.so src/matrix.o -L/usr/lib/atlas-base -latlas -lcblas -lpython2.7/usr/bin/ld: cannot find -latlas/usr/bin/ld: cannot find -lcblascollect2: error: ld returned 1 exit status

This is mainly because the atlas library does not contain libatlas. so and libctlas. so. View the directory discovery structure of atlas as follows:

:/Usr/lib/atlas-base $ ls-l total usage 4292drwxr-xr-x 2 root 4096 September 22 11:41 atlaslrwxrwxrwx 1 root 15 February 4 2014 libatlas. so.3-> libatlas. so.3.0-rw-r -- 1 root 3746968 2014 libatlas. so.3.0lrwxrwxrwx 1 root 15 February 4 2014 libcblas. so.3-> libcblas. so.3.0-rw-r -- 1 root 135376 2014 libcblas. so.3.0lrwxrwxrwx 1 root 17 August February 4 2014 libf77blas. so.3-> libf77blas. so.3.0-rw-r -- 1 root 131000 February 4 2014 libf77blas. so.3.0lrwxrwxrwx 1 root 22 February 4 2014 liblapack_atlas.so.3-> liblapack_atlas.so.3.0-rw-r -- r -- 1 root 369472 February 4 2014 liblapack_atlas.so.3.0

Add two soft links and run the following command:

sudo ln -s libatlas.so.3.0 libatlas.sosudo ln -s libcblas.so.3.0 libcblas.so

The directory structure is changed to this:

/Usr/lib/atlas-base $ ls-l total usage of 4292drwxr-xr-x 2 root 4096 September 22 11:41 atlaslrwxrwxrwx 1 root 15 October 1 22:35 libatlas. so-> libatlas. so.3.0lrwxrwxrwx 1 root 15 February 4 2014 libatlas. so.3-> libatlas. so.3.0-rw-r -- 1 root 3746968 2014 libatlas. so.3.0lrwxrwxrwx 1 root 15 October 1 22:36 libcblas. so-> libcblas. so.3.0lrwxrwxrwx 1 root 15 February 4 2014 libcblas. so.3-> libcblas. so.3.0-rw-r -- 1 root 135376 2014 libcblas. so.3.0lrwxrwxrwx 1 root 17 August February 4 2014 libf77blas. so.3-> libf77blas. so.3.0-rw-r -- 1 root 131000 February 4 2014 libf77blas. so.3.0lrwxrwxrwx 1 root 22 February 4 2014 liblapack_atlas.so.3-> liblapack_atlas.so.3.0-rw-r -- r -- 1 root 369472 February 4 2014 liblapack_atlas.so.3.0

Then you can compile it normally.

References

① ImageNet Classification with Deep Convolutional Neural Networks

② Https://code.google.com/p/cuda-convnet

③ Https://code.google.com/p/cuda-convnet2


Ubuntu installed cuda connector on the desktop

Today, I restored my computer due to computer poisoning, but after I restored it, I only self-checked the video card after I started it. The memory and hard disk are not checked. After the system is selected, the screen is black, and only one cursor flashes there. I tried the following:
1. Use a light disk to install the system. Both are Ghost systems. One cannot be installed, and the other cannot enter the system due to a lack of files.
2. For the lack of files, I mounted the hard disk to another system and copied the file. I tried to start the file on another computer, but I still indicated that the file was missing when I got it back.
3. Restore the previous image with one click, or even use another person's Ghost image. The same is true!
4. In terms of hardware memory, the video card has been crashed.
5. When a problem occurs, the fan is found to be broken ~~

Thank you for your help!
As the question is, in addition to the CD does not respond, the optical drive Normal conversion, that is, the cursor has been flashing. You cannot enter the system or reinstall the system. The cursor is always flashing in the upper left corner of the black screen...
Like you, I installed these two systems. In Windows 7, I divided 60 GB of space for Ubuntu. I used ultraISO to burn the Ubuntu installation file to a USB flash drive, then start the USB flash drive in BIOS settings and use the USB flash drive to install Ubuntu on the computer. I used this method to install Ubuntu. To access the installed Ubuntu, I also installed EasyBCD in Windows 7. For me, if you want to install the latest Ubuntu system, you can format the space where Ubuntu is located in Windows 7 and clear the startup items of Ubuntu with EasyBCD, in this way, the old Ubuntu is completely removed. To install a new one, you have to burn the Ubuntu ISO file to the USB flash disk, enable the USB flash disk in BIOS, and then install the system from the USB flash disk.
 
Ubuntu 1404 cannot apply the previously saved display Configuration

This problem is caused by an error in the configuration file of your driver or driver xorg .. Fix it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.