2010年8月17日 星期二

How to suspend process

今天有人問我在Linux 下要如何將行程暫停, 這個問題我從來沒想過. 用Google 查了一下發現用kill 就行了.

kill -stop PID  #suspend process
kill -cont PID  #restart process

2010年8月11日 星期三

How to query dependencies from RPM file or packages


rpm -qpR {.rpm-file}
rpm -qR {package-name}

How to list packages in Ubuntu

dpkg --get-selections > packages

References:
http://www.cyberciti.biz/faq/how-do-i-find-what-dependencies-a-rpm-file-has/
http://askubuntu.com/questions/17823/how-to-list-all-installed-packages

2010年7月28日 星期三

swap two variable

For Interger
x ^= y;
y ^= x;
x ^= y;

For Float numberx=x+y;
y=x-y;
x=x-y;





2010年5月26日 星期三

安裝 GLU lib 於CentOS 5.3

    於CentOS 上使用 CUDA 時常會遇到缺少 cannot find -lGLU or cannot find -lXi  和 cannot find -lXmu 的編譯錯誤.

這時只要安裝以下的函式庫就可以解決

yum install freeglut freeglut-devel libXi-devel libXmu-devel

2010年4月27日 星期二

CUDA programming under Compute-Exclusive Mode

How can I tell my programs to choose the available device automatically

It is very simple to make your program automatically choose the right device: DO NOT use cudaSetDevice().
When you don't explicitly specify to use which device, your CUDA program will first try to set up context on device0. If device0 is not available, it will try device1.

What will happen if I choose a device which is being used by another program.

Since all GPU devices have been configured as compute-exclusive mode, the second thread which tries to contact with GPU device will be denied. If you insist using this device by using cudaSetDevice() in your code, you will receive an error when running a CUDA API function.