Thursday, August 31, 2006
Distance
At last I met Jian, the director this afternoon. Before entering his office I felt a little nervous. He's nice and conversational so most of the time I was just listening. The goal of the data-driven system is gorgeous and attractive, as he described, a chance with cost and challenges, where Google's already a pacemaker. Benyu and Weizhu also encouraged me a lot. I really appreciate it. Well, it's fascinating that six-month coding is worth nothing but a report of two-hour debugging works effectively.
Then I hurried back to campus for a talk given by David Axmark, co-founder of MySQL. At first I even ran into a wrong room until the words such as "exon" and "gene" drove me out. There were not many audience, and very few questions were proposed as in classes of Tsinghua, which always made the speaker disappointed. David sighed that might be why there were few open source projects in China. Passion and curiosity may be the best drive powers, but neither could live easily. Besides, there would be a story about a Triton among the minnows.
Tuesday, August 29, 2006
Life as a Debugger
A DFS (distributed file system) suffered from a network problem and my mentor asked me to solve it, which took most of my afternoon. In fact the problem was rather old: when sending or receiving large blocks of data (10M – 70M on different machines), calls to send/recv probably fail with error code WSAENOBUFS (10055). I believe that the problem is due to running out of kernel memory for sending or receiving data. More powerful a machine is, the bigger the threshold buffer size could be.
As KB201213 suggests, following workarounds could be applied:
- Use the socket in non-blocking or asynchronous mode.
- Break large-size data blocks into small ones and specify a relatively small buffer in send for blocking sockets, preferably no larger than 64K.
- Set the SO_SNDBUF socket option to 0 (zero) to allow the stack to send from your application buffer directly.
In my opinion, overlapped I/O locks the memory that would be sent or received to avoid page switching. When the size of locked memory goes too large, the kernel would think that there’s no sufficient memory and WSAENOBUFS is returned.
The basic idea is to break large blocks into smaller ones. Using for-loops for send/recv on smaller buffers may be the simplest solution. An alternative is to use scatter/gather I/O by WSASend/WSARecv. First, a large buffer can also be allocated at once as usual, however, pass in an array of WSABUF that contains pointers to different sections of the buffer, where each section has a smaller size (16K - 1M, for example). This approach might be faster though more bug-prone.
I had reproduced the problem on a desktop and solved it using the proposed approach. Further test would be taken on the original source code to verify it. By the way, note that a recent API TransmitPackets is likely to fail without any error code reported.
Later I turned to a memory exception problem when using IT++ to do SVD on a 30,000*30,000 matrix on a server with an AMD Opteron 254 (daul-core) and 16G physical memory. Such a matrix takes slightly less than 8G memory and a SVD would consume about 24G memory for 3 matrices. However, someone set the maximum virtual memory size to only 2G which would definitely trigger the memory exception. Adjust it and everything is OK.
After supper, I got a message from the physics guy on GTalk asking me to help with compile another two libraries...
Monday, August 28, 2006
Life as a Compiler
The physics guy said that they had spent over a year on compiling this on ChinaGrid, gosh! Currently he's testing the program and checking the results. I agree with my boss that they do need something similar to nanoHUB to simplify scientific computing, or too much time would be wasted on getting over these meaningless obstacles.
While compiling the library I was talking to Sunny and tension on GTalk. They just went to Redondo Beach near Los Angeles with mingkong, waicha, etc., enjoying the sea, playing football and taking a lot of beautiful photos. Wow, I'm thinking about hanging around to take some photos of the rail on the east of the campus. That might be cool.
Saturday, August 26, 2006
Flowers around Houhai
Houhai
After night fell, bars and coffee houses lit and became so crowded as usual. With water, willow trees, lights, music, etc., it's really a perfect place for friends and lovers, maybe also appropriate for losers to be alone.
We left for the Forbidden City, which was only a few blocks away. However, there was no lights that we failed to take some photos. Leave it to next time.
Some historical stuff. Hai, meaning "sea" in Chinese , sometimes refers to "big lake". There're several famous "hais" or lakes in the city of Beijing next to the Forbidden city, as shown in the map provided by Google Earth. The 2nd Ring Road is very clear, as well as the Tian'anmen square marked. From north to south, the six hais are Xihai (Jishuitan), Houhai, Qianhai, Beihai, Zhonghai and Nanhai, which literally mean west lake, back lake, front lake, north lake, middle lake and south lake, respectively.
Wikipedia gives a detailed description of the history of Beijing, and that's also a history of these hais. Over a thousand years ago Beijing was wet and abundant of rivers and lakes. In 938 the Liao Dynasty set up a secondary capital around these natural hais and named it Nanjing ("southern captial", and "Beijing" means "northern capital", funny) for the captial then was far north. In 1125 the Jurchen Jing Dynasty took over Beijing and named it Zhongdu ("central capital"). In 1215 Mongol got Beijing as its captial and later named it Dadu ("grand capital") or Cambuluc in Marco Polo's account, when Xihai (Jishuitan) then was a very important commercial port.
In 1368 the Ming dynasty founded in Nanjing (this time it's not Beijing) and in 1403 the 3rd emperor moved the capital to Beijing. The Forbidden City started to be built soon after that, also these hais were well designed as imperial gardens. The Qing Dynasty replaced the Ming Dynasty in 1644 and lasted to 1911, when Beihai, Zhonghai and Nanhai continued to be refined. The last emperor was expelled from the Forbidden City later and this palace became national museum. Even since then Nanhai and Zhonghai have been resevered as where the central govenment resides; Beihai has been open as a public park; Xihai (Jishuitan), Houhai and Qianhai, also known as Shichahai, have been good places for citizens to walk and enjoy, famous for bars and coffee houses around the lakes recent years.
Thursday, August 24, 2006
To Be or Not to Be
Without question, Grigory Perelman has made his choice to turn down the 2006 Fields Medal, and is believed to live in St. Petersburg reclusively. He's made such great contributions to the Poincaré conjecture that maybe even another label pales. The New Yorker has published an interesting article on the topic of the Poincaré conjecture though it's more like a political novel messing with intrigues.
Meanwhile, Pluto has no opportunity to made its own choice: to be or not to be a planet. It is now out of our solar system as a planet in a recent vote by the International Astronomical Union and considered as a "dwarf planet". People always prefer labeling, and usually show little respect to inherency.
Tuesday, August 22, 2006
Sixth Teaching Building
In fact I don't like the building for its sharp shape and vivid red, though most of my courses in Tsinghua were taken in this latest teaching building.
Here's a photo of the building of another aspect by Haijun Guo.
I took the photo just before sunset, when the sky was pretty lovely and many newbies passed by. See more photos of the sky from TuotuoXP.
Sunday, August 20, 2006
Afterglow
As soon as leaving the lab, a beautiful view of afterglow came up in the west. Then I quickly got back to my dorm, picked up my DC and headed for the north of the campus. On the seventh floor of Building Zijing 2# I took several photos.
It seemd a little late that the sun went down for quite a while and the clouds turned too dark. Besides, I should have brought a tripod, that reminded me of my tripod-carrier days with TuotuoXP. Here are some more photos from Jack and xinhuanet.com.
Truly, Madly, Deeply
I wanna stand with you on a mountainMaybe I were on Mars and even did I miss the news that Darren Hayes, the former lead singer, got married in London this June. Congrats!
I wanna bathe with you in the sea
I wanna lay like this forever
Until the sky falls down on me