Fedora 17.. ready for relishing !

Fedora 17 is up, and ready to be downloaded and used.. Cheers to the Fedora team for a wonderful release… !!!

Advertisements

Install Nvidia Driver and CUDA Toolkit on CentOS 6

( Update: have posted a MUCH simpler method of driver install. Steps for CUDA toolkit install have to be followed as given in this post, i.e. , bulleted step # 10 – 19 )

Although the topic has been addressed succinctly in a CentOS forum post, there are certain things like plymouth configuration post Nvidia driver install, etc. which I felt needed to be jotted down for reference. So, here we go describing the Nvidia CUDA toolkit installation on a CentOS system:

  • Download the appropriate toolkit, driver and SDK from Nvidia’s website.
  • RHEL, and its derivatives come with the open source Nvidia driver called nouveau. Before installing Nvidia drivers, we need to ensure nouveau drivers dont get loaded. For this, append the following in the line starting with ‘kernel’ in the file /etc/boot/grub.conf:

rdblacklist=nouveau nouveau.modeset=0

  • Install the Development Tools and Development Libraries group packages, and a few extra packages listed below:

sudo yum groupinstall ‘Development Tools’ ‘Development Libraries’

sudo yum install kernel-devel gcc-c++ freeglut freeglut-devel libX11-devel mesa-libGLU-devel libXmu-devel libXi-devel gcc* compat-gcc* compat-glibc* compat-lib*

  • Restart the system. Upon restart, you’ll see that the resolution of the display would have gone for a toss. Thats due to blacklisting the nouveau driver, and is a sign that we are on track! Open terminal and type the following to goto non-GUI mode (called, runlevel 3):

sudo init 3

  • Above command takes us to text mode. Change directory to /usr/src/kernels/ and note down the complete path of the kernel folder present. In our scenario, it shows up as:

/usr/src/kernels/2.6.32-220.13.1.el6.x86_64/

  • Change directory to the folder containing the downloaded files from Nvidia’s website (say ~/Downloads). Mark the 3 downloaded files as executables:

cd ~/Downloads

chmod a+x NV*; chmod a+x cuda*; chmod a+x gpu*

  • Now finally, we are ready to run the installer. First is the Nvidia Driver install :

sudo sh NVIDIA-Linux-x86_64-295.20.run –kernel-source-path=/usr/src/kernels/2.6.32-220.13.1.el6.x86_64/

  • NOTE : there’s a double minus sign before the word kernel above. During the above install, accept the licence agreement shown. Reboot upon completion:

sudo reboot

  • You’ll notice that the GUI resolution is back to normal, indicating successful Nvidia driver install. Now, cudatoolkit has to be installed.
  • Open terminal and change directory to ~/Downloads. Run the cudatoolkit*.run file:

sudo sh cudatoolkit_4.0.17_linux_64_rhel6.0.run

  • During the install, you’ll be asked to supply installation path. Enter the default path itself (/usr/local/cuda).
  • Once completed, few more steps are needed, like adding /usr/local/cuda to default path environment variable, etc. :

sudo nano /etc/ld.so.conf.d/cuda.conf

  • Add the following lines to the above created file :

/usr/local/cuda/lib64
/usr/local/cuda/lib

  • Save the above file by pressing Ctrl+x, followed by ‘y’ and pressing Enter. Now run:

sudo ldconfig

  • For adding cuda install path to enviroment path variable, edit ~/.bash_profile file using a text editor (say, nano ~/.bash_profile) :

export CUDA_INSTALL_PATH=/usr/local/cuda
export PATH=($PATH: /usr/local/cuda/bin)
export LD_LIBRARY_PATH=/usr/local/cuda/lib64
export PATH=($PATH: /usr/local/cuda/lib)

  • Finally, gpucomputingsdk needs to be installed. For that :

sh gpucomputingsdk_4.0.17_linux.run

  • During the install , you’ll be asked for install path. Keep in mind that the sdk can take around 400-500MB. Say, we install it to ~/Documents/NVIDIA_GPU_Computing_SDK.
  • Once done, we need to compile the files in the SDK:

cd ~/Documents/NVIDIA_GPU_Computing_SDK/C/

make

  • To check whether everything is working fine, we’ll run the deviceQuery file, provided by the SDK just installed:

cd ~/Documents/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/

./deviceQuery

  • You should see something similar to what is shown at this link .

Congrats for successfully installing the Nvidia driver and the cudatoolkit on your CentOS system. I know, things should be much simpler. I wish someday Nvidia open-sources their drivers and CUDA toolkit to make things simpler for Linux enthusiasts. All that is left now, is to fix the ugly white-blue scrolling bar that shows up instead of the beautiful Plymouth at boot.

  • Reboot system. At the grub prompt, press ‘e’ against the first item on the grub menu to edit its kernel arguments (this mode is called kernel edit mode).
  • Out the the three lines being shown (starting with : root; kernel; initrd ), scroll to kernel line and press ‘e’ again. Type in the following at the end of that line:

vga=ask

  • Press Enter after typing the above and press ‘b’. You’ll see a tabulated list of keywords against several screen-resolutions. Note down the number being shown against the  most appropriate screen resolution. Say, the number is 361. Now, reboot system. Again, enter the kernel edit mode described in the previous two list items. The only difference being that instead of vga=ask, enter vga=0x361. Now press ‘b’ and you’ll see the beautiful Plymouth back in its glory!
  • To make this change permanent, open terminal and open /boot/grub/grub.conf as sudo (sudo nano /boot/grub/grub.conf).
  • Find the line saying ‘kernel’ against your most recent kernel version and add vga=0x361. Save the file (Ctrl+x, y, Enter)

Plymouth theme will now show up everytime that you’ll reboot. Enjoy!

MATLAB: Running codes in mixed OS environment

Ever faced the problem of running executables in a MATLAB installation on Linux. I frequently use an executable file (.exe) provided by an eminent research lab, but the linux enthusiast that I am, shifting to Windows just for running this file is out of the question! So, how to solve this issue!

Well, you need access to either a system running Windows at your workplace, or have a virtual Windows installation in VirtualBox. Set up ssh via cygwin (refer SSH via CYGWIN) on such a system and also make sure to have a password-less SSH login enabled (refer ssh autologin) between the Linux and Windows systems.

Once this is done and given the fact that such a Windows environment is up and running, all you have to do through the MATLAB command prompt is:

system(‘ssh username@IP_of_windows command1;command2’);

where : command1 and command2 are the things you want to execute on that system. For e.g: in my scenario, i have already put the .exe (say: test.exe) in the cygwin home folder (C:/cygwin/home/<username>/) on the Windows system. Now, i just run:

system(‘ssh username@IP_of_windows ./test.exe’);

You can use few more ssh/scp via system command calls in MATLAB to copy back & forth the data. Thats it!

Configure CodeBlocks to compile OpenCV codes

CodeBlocks is one of the IDE(s) that i prefer using due to its simplicity and fast interface. Plus the benefit of having MATLAB like command suggestions. The steps are outlined below:

  • Search the path where opencv is installed in your system.. you can do a :

locate cv.h

  • in my system, this returns : /usr/local/include/opencv/cv.h. Copy the path till the opencv directory, i.e : /usr/local/include/opencv/
  • Now, open CodeBlocks > New Project > (any project type of your choice.. for starters, Console Project is a good beginning) . Now goto,

Project > Build Options > Linker Settings tab

  • Under “Other Linker options” add the following, one below the other:

-lopencv_core
-lopencv_highgui
-lopencv_contrib
-lopencv_ml
-lopencv_legacy
-lopencv_imgproc
-lopencv_video
-lopencv_features2d
-lopencv_calib3d
-lopencv_objdetect
-lopencv_flann

  • Now, in the same window, under “Search directories tab”, add the opencv directory you copied above, i.e. for my system, it’ll be :

/usr/local/include/opencv/

  • Now, Project > Properties > C/C++ Parser options, again add the same directory path.

And you are done !! Enjoy compiling OpenCV codes in CodeBlocks 🙂

Fedora 15 Lovelock Released :)

The awesomeness of Fedora 15 is now out in the wild for everyone to experience :) If you are amongst the not-so-crazy ones, who have been playing around with the OS since its Alpha days, well.. its time you experience it !

Head to :

http://fedoraproject.org/get-fedora

And yes, the release banner prepared by the Fedora Design team rocks !! just couldn’t help but posting it here too..

Fedora 15 Lovelock

Fedora 15 Release Banner

yum rocks !!!! :)

With F15 (Fedora 15) in its final stages before release, have been playing around with my F15 system alot more in the past few days.. Recently observed a REAL nice feature in yum, which has made me a BIG BIG fan of it’s..

Had forgotten that i didnt have deltaiso rpm package installed in my system. So, i typed :

applydeltaiso old.iso delta.diso new.iso

and this is the output :

yum installing the package providing the command

Well, as can be seen.. yum found the command in a package, and after permission from the user, installed the required package and the dependencies on its own !!! In my view, its a FANTASTIC feature.. the user doesnt have to worry which package provides the command..

Am not sure if this was there in earlier releases of yum, but its a great great feature 🙂 Glad to have discovered it finally, in case the feature existed since before.. and yes, kudos to the yum team !!

Broken Eject keyboard shortcut in Gnome 2.30

There  is a configurable and pre-defined keyboard shortcut in GNOME for CD drive eject, suited especially for keyboard junkies who hate to take their hands off the keyboard for any operation.. However, since previous 2-3 releases of GNOME, i have observed that the keyboard shortcut binding is broken.. in the sense, that it doesn’t work.

So, i defined my own custom shortcut from the “Keyboard Shortcuts” window in Preference menu of Gnome based Distro, by the following method :

  1. Click on ADD button in “Keyboard Shortcut” window
  2. Specify a name for the keyboard shortcut you are defining (in my case: EJECT CD DRIVE)
  3. in the command text box, specify : eject
  4. Click OK to get a new entry in the shortcuts window (at the bottom)
  5. Click on the entry at extreme right hand side
  6. Press the key combinations you desire for the binding.

And you are done ! try pressing the keyboard combination, and you’ll see it working absolutely fine.