Thursday, March 18, 2010

无语

以前看到CPF,以为是CFP;现在看到CFP,以为是CPF。。。

Monday, January 11, 2010

9 Days in Egypt

及艳照新鲜出炉。怀着无比兴奋的心情去,又怀着无比激动的心情回。走马观花的鉴赏了无数的壁画,神庙,浩瀚的沙漠和尼罗河绰绰风姿。但直到今天,耳边却还萦绕着小贩“One dollar”的叫卖声,沙漠露营篝火晚会的鼓声,镜头进沙的吱吱声,还有Hany的那句“你们会想念我的”。历历在目的,却是路边无数的流浪猫和烂尾楼,无处不在的AK47旅游警察,阿拉伯的数字(正宗),和四个蒙面女侠飒爽的英姿。9天的回忆很丰富,心里面默念:我还要出去玩!


Cairo也可以称为雾都了,细沙+薄雾,能见度也只有2、30米;

传说中的萨拉丁城堡没进去很遗憾,留给下次吧;

开罗的司机开车真的很猛,这才叫见缝插针;虽然车很破,但司机叔叔很负责;

开罗旅社的“海鸥面包”大家都很爱;楼下5块钱一个的Kebab汉堡超美味;

地铁女车厢进了2次,第一次抱头第二站冲出,第二次自投罗网用毛巾蒙头做了坏人,感觉比进女厕紧张;

“How old are you?”“Yes~~Yes”;

沙漠Safari处处都是Surprise,头顶探照灯,吃到了最美味的炭烧鸡;虽然语言不通,但心里面很感激开吉普的阿拉伯F4大哥们;

中国人应该更加友好一些,对外国人也好,对本地人也好,Letting our guards down a little bit;

发烧睡在Luxor超不爽的旅店床上度过了2010年的新年;不过很感谢大家的关照,特别是Alva悉心的照顾,让偶第二天就退出了“小废废”的行列;

Luxor Bob Marley hostel is dirty; its owner was always trying to pass the buck to the travelers when something goes wrong, even yelled to us; we felt unsafe staying there;

法语的声光Show和阿斯旺High Dam花了点冤枉钱;

最后大家都放弃了砍价(狂砍);

Aswan的国际机场只有我们5个人check-in;

“One dollar, one dollar”,“1 for 5 dollar,no?5 for 1 dollar”,“哈比比”,“呀啦呀啦”;

废片超级多;

埃及人很友好,虽然难免会瞄着你的钱袋 :-)

据说,I'm a lucky man;

想念Hany同学;舍命带我们去萨拉丁城堡的司机;沙漠中的阿拉伯F4和韩国志愿者Jin;Luxor的导游老爹,happy new year;开到Aswan的司机可爱的默罕默德同学(police man, rubbish, money money money);

Susu很可爱,而且这次有了个新名字——“天线宝宝”;
偶像很能干,又能计划,又能砍价,又能辩论,套Alva的话“我们都叫她偶像”;
美丽的公帐引力极大,引无数埃人尽骆驼(可惜没能打折啊),而且是最后一个“挂掉”;
Alva同学尽显“小废废”本色,不过一直在照顾我,真的很感动;

最后,一定不辜负大家的希望,早日跪拜大神。

另友情TK链接同去两位女侠的picasa:
http://picasaweb.google.com/chensu0714
http://picasaweb.google.com/vickiwang810

Wednesday, November 11, 2009

无题

看到同住的Kwoon lim正在为病怏怏Joshua煮晚餐,我称赞他说,不愧是哥们儿啊。他回答道:没什么嘛,顺手牵羊而已嘛。

Tuesday, October 20, 2009

总统府一日游

键词:高尔夫球场,植物园,稀世珍宝,没看到丹哥,热

Thursday, September 17, 2009

图解CUDA中用多线调度执行来隐藏内存访问延迟的机制

近在捣鼓CUDA,实现的几个小算法速度能提高到40~50x单线CPU的程度。可惜现在这边弄这个的人不多,基本没有“真人交流”。希望今后能用来做一些实际的项目,发挥一下潜能。嘿嘿。

最近应该会写一些心得,记录一下学习过程。我其实是一直有心做这样的事情,只是懒…… 从今天开始,哈哈。

图解CUDA中用多线调度执行来隐藏内存访问延迟的机制

GPU
和device RAM之间带宽虽宽(如GTX285的150GB/s),不过内存访问延迟依旧很大(400~600 cycles)。CPU用cache可以很好的解决内存延迟;不过GPU由于要处理的通常是大规模的数据集,源数据的locality或许并不高,即便加上很大的data cache效果也不一定好,所以索性放弃了data cache,换而采用用户可控的shared memory来开发data locality。最重要的,虽然GPU的一个处理器(SM - Streaming Multiprocessor)同时只能执行一个warp的线程(32个),但却可以容纳大量的活动线程(active threads <= 1024)。当一个warp由于访问内存而被阻塞时,SM可以马上转为执行其他ready的warp,直到其被内存访问阻塞。只要这样转一圈的时间(执行完一圈其他的warps再转回来到第一个被阻塞的warp的时间)大于600 cycle的延迟,这个延迟就被隐藏了。

下图示意了内存访问延迟不能被完全隐藏的情况。假设SM上只有4个warp,他们需要从内存里面读取数据,在上面计算一把,循环这个过程。当然,我们也可以看成每个warp计算一次就终止了,之后新的warp会产生出来,代替原来那个warp的位置。从图里面很容易看出来虚线部分的latency是怎么被隐藏的;也很容易看出来因为每个warp的计算不够长,所以没有能够隐藏掉所有的latency。


放到现有的G200的architecture上来,每个SM最多1024个active thread,也就是32个warp。每个warp执行一个基本指令需要4个cycle。也就是说,要隐藏600 cycles需要每个warp平均执行 600/4/32 = 4.69个基本指令。这就是为什么推荐compute to memory ratio至少大于5的原因。这还是建立在理想的1024个active thread的情况下的。如果SM上thread少,这个比例还要提高。

Wednesday, July 01, 2009

RIP

关上灯,耳机中响起《gone too soon》的旋律。歌声中夹杂的气息,呼吸声,点点的喉音,一切听起来都那么清晰,那么近,就像那个人还在耳边歌唱,还没有离去。

我们的这个时代,没有披头士,没有猫王,但是却很幸运的有MJ。他其实一直都是一个天真的孩子。只是,这个世界太复杂。May you rest in peace,默默的,祝福。

Monday, June 15, 2009

C code for Confidence level computation for BER testing

Article is "statistical confidence levels for estimating error probability".

The first function calculates the confidence level (CL) given the number bit errors measured (n), the total number of bits tested (N), and the expected BER (ph).


// CL = 1 - (\Sigma^{0}_{N}(n * ph)^k/(k!)) * e^{-n * ph}
double solve_CL_from_N_n_ph(unsigned N, double n, double ph)
{
double emnp = exp(-n * ph);
double sum = 1;
double product = 1;
for(unsigned k = 1; k <= N; k++)
{
product *= (n * ph / k);
sum += product;
}
sum *= emnp;
return(1 - sum);
}


The second function computes the minimum number of bits that need to be tested to confirm a certain confidence level (CL) of an expected BER (ph). If the number of bit errors measured upon receiving of such number of bits is less than N, the hypothesis is confirmed positively. The formula to compute n given N greater than 0 is mathematically hard to solve. This function solves by trying out different values of n in a binary search manner using the first function (which is reverse of the function in question) until n is converged to a certain extent.

double solve_n_from_ph_CL_N(double ph, double CL, unsigned N)
{
if(N==0)
return(-log(1-CL)/ph);
else
{
// solve n using binary search, based on "solve_CL_from_N_n_ph"
double upper_n = N/ph * max(100, N), // enlarge at least 100 times
lower_n = 100000, // at least 100000 data
cur_n = upper_n, next_n;
double min_interval = 100; // minimum internal to break the search
while(1)
{
double cur_CL = solve_CL_from_N_n_ph(N, cur_n, ph);
if(cur_CL >= CL) // if calculated value is more confident, try to reduce n
{
upper_n = cur_n;
next_n = lower_n + (upper_n - lower_n)/2;
} else
{
lower_n = cur_n;
next_n = upper_n - (upper_n - lower_n)/2;
}
if(fabs(next_n - cur_n) < min_interval)
break;
cur_n = next_n;
}
return(cur_n);
}
}

Tuesday, January 27, 2009

罗俊同学的口头禅:cheese我了。

What's best of being an Christian?

You can do anything you want. In the end, you just confess and get forgiveness from the GOD.

Wednesday, January 21, 2009

Ng

Ng不是not good,而是“黄”,新加坡人很多姓这个的。Ng是2个辅音字母,很多人读不出来,实际就读N。大街上老远看到一个熟人姓Ng的,大叫Mr N,喊破嗓子也听不见。哦,不对,不可能喊破嗓子。


还有姓Gn的,这个不会发了。

Sunday, January 18, 2009

X Fair Price

知道Jurong Point新开了家Fair Price,因为规模大,名字也不一样,叫X Fair Price。听起来觉得挺别扭,总觉得和ex-wife很像。遂感叹新加坡真是 昔非今比啊。

Friday, January 09, 2009

新加坡最繁华的路叫 乌贼路。

Monday, September 22, 2008

Chat Log

Magi:想想怎么回答学生问题……
Ryler:恩……就说一般的文件都有文件头,meta data之类的,这个没有,而且Google不到;其实主要是Google不到。所以应该是用户自定义的文件。内容嘛,只有鬼知道。
Magi:D这个回答好啊,developer就是诡异啊。
Magi:今年Yang kanyan和Yu renjun也要结婚了。
Ryler:啊!他们是gay? 没看出来……现在中国gay可以结婚了?
Magi:晕,我说错了。各自跟各自老婆结。钻牛角尖你的脑筋很快的嘛……

无题




知道,blog不是日记,日记是写给自己看的。不过,这些东西,一旦传到网上,就再也丢不了了。日记不行。答应为你写歌,可如今歌喉已不在,哪怕唱出来,也不会动人吧。


Monday, September 15, 2008

$songs[0]

It's My Life (lyrics)

Songwriters: Bon Jovi, Jon; Martin, Max; Sambora, Richard S;

This ain't a song for the broken-hearted
No silent prayer for the faith-departed
I ain't gonna be just a face in the crowd
You're gonna hear my voice
When I shout it out loud

It's my life
It's now or never
I ain't gonna live forever
I just want to live while I'm alive

(It's my life)
My heart is like an open highway
Like Frankie said
I did it my way
I just wanna live while I'm alive
It's my life

This is for the ones who stood their ground
For Tommy and Gina who never backed down
Tomorrow's getting harder make no mistake
Luck ain't even lucky
Got to make your own breaks

It's my life
And it's now or never
I ain't gonna live forever
I just want to live while I'm alive

(It's my life)
My heart is like an open highway
Like Frankie said
I did it my way
I just want to live while I'm alive
'Cause it's my life

Better stand tall when they're calling you out
Don't bend, don't break, baby, don't back down

It's my life
And it's now or never
'Cause I ain't gonna live forever
I just want to live while I'm alive

(It's my life)
My heart is like an open highway
Like Frankie said
I did it my way
I just want to live while I'm alive
'Cause it's my life!


Sunday, September 07, 2008

小方块和小蛋壳

人说,Wall-E是2008年最浪漫的影片。小方块好奇却又胆怯,但怀着只想要牵手的单纯,勇敢得差点粉身碎骨;小蛋壳一开始很白很暴力,后来却为旦夕中的小方块放弃自己的使命(directive)。其实,“他”是“她”或者“她”是“他”也说不定;他们之间到底是友情,还是爱情也说不定。浪漫不一定在爱人之间,为了彼此而超越自我的勇敢,就是最终极的浪漫了。无论在天荒地老的地球垃圾场,还是梦幻的星空中。


某人说,小蛋壳完全就是ipod啊。一说之下恍然大悟。乔布斯本来就是Pixar的老板(founder,其实是买过来的)啊。有眼光。

Monday, May 19, 2008

一个星期

再多的话也表达不出心中的悲痛,5月19日2点28分,在新加坡低头为受难的和幸存的人们祈祷。在生命面前,什么都变得不重要了。活着的人们,更没有理由不珍惜自己身边的亲人和朋友了,更没有理由自暴自弃了。愿天国的天空同样的蓝,鲜花同样的鲜艳。

Tuesday, April 22, 2008

Laptop build-in camera distortion problem

If you ever used laptop build-in camera for video conferencing, you will probably notice that your face is a bit distorted and not as pretty as the one inside a mirror. Actually, the same distortion happens for almost any cameras when the subject -- your face positions too close to them. For web cameras, wide-angle lens is used to jam in more environment, your face turns out to be even more funny.

Now that not everyone likes this distortion, and maybe it's an interesting application to flatten it. Assuming computation complexity is not a problem, it is possible to adjust each frame of image to de-distort it according to camera model and parameters before generating the video stream. An even more interesting approach is to build an accurate 3D model of your face, and dynamically manipulate it according to your facial expressions (while leaving less distorted, less important back ground as is). You can ask the software to pre-build your face model (not including hair of course) from several pictures of different angle. Or using a multi camera system, i.g., 3, from the left, center, and right side, to build it dynamically. This link shows a similar application using a single face picture. It's for fun, but surely shows the possibilities.

Wednesday, April 16, 2008

Thesis

Finally got the thesis writing done. The same old results, yet the procedure was full of struggling.

There's the saying that in order to do great things, you must aim high; another saying that the thousand miles journey starts with a single step forward. I guess I didn't really achieve a balance between these two, aiming too high, without a plan, only to discourage myself from stepping forward step by step. After all, I'm a normal person. But still, many great things are done by the normals.

"Welcome to the real-world, lad, where anything that is unthinkable is possible."

Tuesday, December 18, 2007

American Size of Stomach

I've been to America and got a rough idea about people's appetite there. For example, in McDonald's, a burger is about 1.5 times the size of a same one in Singapore. Yet I saw a guy swallowed two within 1 minute with one on each hand. A separate order of coke in another restaurant is 30cm tall. And I had to take away nearly the whole main course of a 20 dollar sea food order, just after finishing the soup and appetizer. This is no kidding. In doubt, try this one!

Cafe' Cartel, at Plaza Singapura. We went there for dinner on the way back from a Greek sculpture exhibition in the national museum. Five of us, two hadn't had lunch at all, another two had some light snack, in order to meet our meeting schedule. We walked in, already near half death out of starving and exhaustion.

HQ had been there before, he advocated the flagship "pork ribs", depicted in the picture below, without mentioning the doze. I ordered steak for a change of other 4 serves of pork ribs. The steak came first, normal sized 15x7 cm2 piece, plus some chips and vegetable, good for me. After another 10 minutes, the pork ribs finally showed up. Everyone's jaw dropped to the necks. They are not pork ribs, but piano boards (PB)! My steak was less than 1/5 of each PB, with the same price... To close, two of our usual big stomachs never felt full before, in a status without lunch, crashed upon this. One had to ask me to finish some leftovers, another one swept the whole, bearing the pain of standing up with a exploding belly for the rest of the day.