Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

using rsync to copy files and folders

Monday, May 2, 2011

Quest for a tool to do a copy excluding hidden files lead me to find the rsync command. Here is how I copy a folder from source to destination excluding all hidden files/folders (all that with a "." prefix in the name).

rsync -a --exclude='.*' source/ destination/

This might be especially useful when copying folders checked out from SVN, that needs to be checked-in to a different location. Having the .svn folder under sub-folders can cause them not to be checked in.

Read more...

svn - 1

Friday, December 17, 2010

To get the list of all modified files, after a specific REVNO to the latest HEAD
svn diff -r REVNO:HEAD --summarize

Read more...

Downloading an MMS stream with mencoder

Wednesday, November 24, 2010

All you need is one command:


mencoder mms://url/filename.wmv -ovc copy -oac copy -o output.wmv

Read more...

getting ~/.bashrc to be executed

Monday, November 8, 2010

If your ~/.bashrc is not getting executed every time you login, add these lines to your ~/.bash_profile file:

 # include .bashrc if it exists 
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

Read more...

CUDA 3.0 and gcc 4.4.x

Thursday, October 21, 2010

Deadly combination! Compilation breaks when you try to do make on NVidia SDK example projects even. Problem is with nvcc incompatibility. A gcc version of 4.3.x works fine (as of this date).


Here is the compilation error listing:
/usr/include/string.h:43: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/include/string.h:64: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/include/bits/string3.h:49: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/include/bits/string3.h:78: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/local/cuda/bin/../include/common_functions.h:59: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/local/cuda/bin/../include/common_functions.h:62: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/local/cuda/bin/../include/math_functions.h:422: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/local/cuda/bin/../include/math_functions.h:427: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/local/cuda/bin/../include/math_functions.h:440: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/include/bits/mathinline.h:38: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/include/bits/mathinline.h:50: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/include/bits/mathinline.h:62: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/include/c++/4.4/i486-linux-gnu/bits/c++locale.h: In function ‘int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)’:
/usr/include/c++/4.4/i486-linux-gnu/bits/c++locale.h:86: error: ‘__builtin_stdarg_start’ was not declared in this scope
dxtc.cu: In function ‘int main(int, char**)’:
dxtc.cu:789: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
make[1]: *** [obj/i386/release/dxtc.cu.o] Error 1

Fixing the error basically means commenting out the specific lines in math_functions.h and common_functions.h on which the compiler shows the error (shown in dark blue).

Solution: comment them out. This will fix compilation errors. I have not tested the side-effect of this hack. But as for fixing compilation break, it works!

Note:
I needed a few more steps:
1. Uninstall gcc-4.4.x, g++-4.4.x (and all 4.4.x libraries)
2. Install gcc and g++ 4.3.x versions.
3. ln -s /usr/bin/gcc-4.3. /usr/bin/gcc
4. ln -s /usr/bin/g++-4.3. /usr/bin/g++
5. Install libXi-dev (since -lXi failed)
6. Install libxmu-dev (since -lxmu failed)

Steps 5,6 were required when I tried to build GL applications like fluidGL, simpleGL etc.

Related links:


Read more...

Installing CUDA on Ubuntu

Wednesday, October 13, 2010

Its simple as counting 1, 2, 3.. (as long as everything is supported and works fine).

PART I:
NVidia (developer) driver that is required by CUDA (as mentioned in the GPU computing page). This might be different from the latest driver you might find in other pages.

Step 1: Download the driver for your nvidia graphics card. These will come as .run files.

Step 2: If you have traces of your (now obsolete) driver from nVidia, get rid of them with the following 2 commands:
sudo apt-get remove --purge nvidia
sudo nvidia-installer --uninstall

Step 3: Stop your display manager
sudo /etc/init.d/gdm stop

Step 3.5: Now you do not have your X running, so switch to console:
ctrl + alt + F1

Step 4:
sudo sh devdriver_3.2_linux_32_260.24.run

This should bring up a console based miniature GUI, enter details as required. And complete the installation.

Step 5: Bring back the X
sudo /etc/init.d/gdm start


PART II: Installing CUDA toolkit
Step 1: Download the CUDA toolkit (cudatoolkit_3.2.9_linux_32_ubuntu10.04.run) from GPU Computing page at NVidia site.

Step 2: Run the file:
sh cudatoolkit_3.2.9_linux_32_ubuntu10.04.run

Make sure you do not do it as root (or with sudo prefix).
Step 3: I prefer leaving the default locations for installation.

Step 4: Assuming default locations of installation, set environment variables

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib


PART III: Installing sample projects, SDK etc.

Step 1: Download gpucomputingsdk_3.2_linux.run

Step 2: Run (do not run this in root mode)
sh gpucomputingsdk_3.2_linux.run

Step 3: Give default locations to CUDA installation (or the modified locations, if you have modified them)

Step 4: Test if its fine
cd ~/NVIDIA_GPU_Computing_SDK/C
make

This should build all example projects included in the SDK without any error. If that goes fine, it means you have a working CUDA environment to work with.

Now try running one of the programs (one I like is to query the GPU)
cd bin/linux/release/
./deviceQuery

It gives me an output like this:
./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

There is 1 device supporting CUDA

Device 0: "GeForce GT 240M"
CUDA Driver Version: 3.20
CUDA Runtime Version: 3.20
. . . . .
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 3.20, CUDA Runtime Version = 3.20, NumDevs = 1, Device = GeForce GT 240M



Components that I have/chose:

  1. Ubtuntu 10.04 (32bit)
  2. NVidia GT240M graphics card
  3. devdriver_3.2_linux_32_260.24.run driver
  4. cudatoolkit_3.2.9_linux_32_ubuntu10.04.run
  5. gpucomputingsdk_3.2_linux.run

Read more...

less and vim

Friday, April 2, 2010

When you are "lessing" a file, just type :gv to open the file in vim for editing. Upon quitting vim, it will return back to the less-view.

Read more...

opengl capturing using GLC

Tuesday, March 9, 2010

GLC is a tool that allows recording of opengl renderings done by applications.

Capture
glc-capture -s -o ~/output1.glc ./assignment

Play
glc-play ~/output.glc -y 1 -o - | mplayer -demuxer y4m -

Read more...