Monday, August 8, 2016
Wednesday, October 21, 2015
Caffe is a Deep learning framwork from BLVC.
Pycaffe is a Python interface of Caffe framework.
This posting deals with the troubles you might encounter while you are installing Pycaffe.
- Caffe install
The like below provides a very detailed installation process. Follow the instructions and install all the dependencies.
- pycaffe install
But you might have a problem with Ubuntu 14.04 repo.
2.1 make pycaffe
first, go to the directory that Caffe is installed. type this.
$ make pycaffe
2.2 edit ~/.bashrc
2.3 install google protobuff
2.4 Setup ~/.bashrc as follows
3. how to run pycaffe examples with ipython notebook (ipynb)
- ipython notebook error ?
upgrade it to bradnew version (4.0.0)
- Tornado Error ?
sudo apt-get remove python-tornado
sudo pip install tornado
- UsageError: Invalid GUI request u'inline' ?
pycaffe uses matplotlib “inline” feature.
You shoud use “ipython QTconsole”
qtconsole webpage :
libcuda error shooting :
Monday, August 3, 2015
Thursday, July 16, 2015
< CUDA & Theano installation >
TIPS that I’ve realized so far !
4/MAR/2017 Update: updated CUDA 7.5 to CUDA 8.0 and added trouble shooting section.
Before I forget the knowledge and tips from this massive hassle, I think I should write down something right now.
0. The BEST way to install CUDA&Theano in a nutshell.
- Install UBUNTU 14.04.
- Ubuntu is highly recommended for beginners since it has tons of troubleshooting articles on the web. You would find information or guides about Ubuntu easier than any other type of Linux systems.
- I’m not gonna cover the Installation process of Ubuntu 14.04 here. Instead, you will be able to easily find it by googling it and tons of blog postings are covering Ubuntu installation issues.
- I also recommend you to install “Anaconda” library. This is one of the easiest way to get all the dependencies that you need to run theano library.
- Download RUN version of CUDA 8.0 toolkit.
- Instead of that, refer to this page (CUDA toolkit download). There are two options. You can either select DEB installation or RUN file installation. I recommend RUN file installation because you can choose to opt out of installing the bundle driver and sample files.
- According to various sources, some people suffer from NVIDIA graphics driver issue so that they should install specific NVIDIA driver which is not included in CUDA toolkit package. However, in my case, that was not the case. Both of my desktop and laptop system didn’t work with seperate driver. Having said that, I metion this issue because some of readers might suffer from this issue. If your system is not working with driver included in CUDA toolkit, refer to this page.
- Disable Nouveau driver.
- I’ve struggled with this issue for ages. The thing is, most of the QNA pages on the web omit this process and I could not find out why does my linux system always show black screen after I reboot the system.
- This was because of the “Nouveau” driver that crashes with NVIDIA driver. To nip this in the bud before it ruins your mental health, I suggest you a fancy solution with this issue.
- We have to block Nouveau driver before it crashes with NVIDIA graphics driver. Type the following command.
$ sudo gedit /etc/modprobe.d/blacklist.conf
- Then, add the following commands to block Nouveau driver.
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
# for other linux distributions
- Stop X server.
- You should kill X server (Ubuntu GUI system) to install graphics related drivers. “ctrl + alt + F1” will lead you to text mode. Type the following command.
$ sudo service lightdm stop
- Install full version of CUDA 8.0 toolkit. (Driver, Toolkit, Samples)
- Go to the folder that you downloaded *.run file. Type the following command.
$ chmod a+x cuda_8.0.44_linux.run
$ sudo ./cuda_8.0.44_linux.run
- After browsing a long instruction article, you will encounter a few questions as followings. Please carefully read the questions and type your answers as the following.
Do you accept the previously read EULA? (accept/decline/quit): accept
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 346.46? ((y)es/(n)o/(q)uit): y
Do you want to install the OpenGL libraries? ((y)es/(n)o/(q)uit) [ default is yes ]: n
Do you want to run nvidia-xconfig? This will update the system X configuration file so that the NVIDIA X driver is used. The pre-existing X configuration file will be backed up. This option should not be used on systems that require a custom X configuration, such as systems with multiple GPU vendors. (y)es/(n)o/(q)uit [ default is no ]: n
Install the CUDA 8.0 Toolkit? ((y)es/(n)o/(q)uit): y
Enter Toolkit Location [ default is /usr/local/cuda-8.0 ]: [Enter]
Do you want to install a symbolic link at /usr/local/cuda? ((y)es/(n)o/(q)uit): y
Install the CUDA 8.0 Samples? ((y)es/(n)o/(q)uit): y
Enter CUDA Samples Location [ default is /root ]: [Enter]
- CAUTION !
DO NOT install OpenGL library. This might cause an error with your graphic driver.
- Reboot your system with the following command.
$ sudo reboot
- Edit .bashrc file to include PATH and LD_LIBRARY_PATH.
- If you don’t enroll the directory contains CUDA toolkit, you won’t be able to compile any code based on GPU programming. Add the following commands to ~/.bashrc file.
- CAUTION : In Ubuntu, there is no file such as ~/.bash_profile. You should edit ~/.bashrc file.
$ sudo gedit ~/.bashrc
- Once you see the gedit screen, type the following commands, and save it.
- Reboot your system with the following command.
$ sudo reboot
- Install and update G++/GCC compiler.
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential
$ gcc -v
$ make -v
- Compile CUDA sample and test deviceQuery.
- This process will check whether your CUDA library is correctly installed in your Ubuntu system.
~$ cd NVIDIA_CUDA-8.0_Samples
~/NVIDIA_CUDA-8.0_Samples$ cd bin/x86_64/linux/release
- Another easy way to check out whether your NVIDIA driver is in shipshape manner, you can use the following two commands.
$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2016 NVIDIA Corporation Built on Sun_Sep__4_22:14:01_CDT_2016 Cuda compilation tools, release 8.0, V8.0.44
Tue Jul 14 19:50:26 2015
| NVIDIA-SMI 346.46 Driver Version: 346.46 |
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| 0 GeForce 840M Off | 0000:0A:00.0 N/A | N/A |
| N/A 50C P0 N/A / N/A | 6MiB / 2047MiB | N/A Default |
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
| 0 C+G Not Supported |
- DO NOT TYPE “sudo apt-get install nvidia-cuda-toolkit”. This command is outdated one and this will lead you to CUDA 5.5 version. And it won’t work either. So, please follow the instruction I’ve written above.
- You have to be sure with the above two commands. If there is any command that doesn’t pop out the above messages, that indicates that you have a problem with your NVIDIA CUDA driver and compiler.
- Install Numpy,Scipy,Pip and Theano
- Now, we have to install python libraries that is necessary for Theano library. Type the following.
$ sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ git
- Once you install pip installer, you can easily install Theano library with the following command.
$ sudo pip install Theano
- Install OpenBlas.
$ sudo apt-get install libopenblas-dev
- Make .theanorc file.
- “.theanorc” file contains a few configuration for theano library. You should create theanorc file by typing the following command.
$ sudo gedit ~/.theanorc
- In the Gedit edit window, type the followings and save the file.
fastmath = True
ldflags = -lopenblas
- Test Theano library.
- Go to any directory type the following to make a python file.
$ sudo gedit testing_theano.py
- Copy and paste this code. Save “testing_theano.py” file.
$ python testing_theano.py
- If you can get the messages similar to the following messages, Theano library is successfully installed in your computer.
- Check out if you are getting the message “Using cpu device”. If you get “cpu” message, you should fix your configuration about CUDA and Theano library.
Using gpu device 0: GeForce 840M
Looping 1000 times took 1.03167891502 seconds
Result is [ 1.23178029 1.61879349 1.52278066 ..., 2.20771813 2.29967761
Used the gpu
CUDA test has been finished
< Trouble Shooting (Updated 4/Mar/2017) >
- If you are getting a message that says:
"The driver installation is unable to locate the kernel source. Please make sure that the kernel source packages are installed and set up correctly. If you know that the kernel source packages are installed
and set up correctly, you may pass the location of the kernel source."
$ sudo apt-get install dkms fakeroot build-essential linux-headers-generic
This was the only command that has solved the problem.
- IF you are getting a message like this:
This means you did not successfully shut down the X. Go back to the step 4 and make sure you surely shut down the X-server(GUI). If you are seeing the Ubuntu GUI, that means you are still having X-server on.
If you have any question, please mail me to the following address.