Trip to Yellowstone National Park

| categories: traveling | View Comments

先挖个坑,慢慢补全 7月份去了 Yellowstone,算是来美国以后真正意义上第一次去国家公园吧。(虽然春假去了 Great Smoky Mountain,但是那一趟实在太水了,都没有 Hiking..以后有机会要重新再去一次)。 自己很坑的用胶片机照了所有的照片,但是现在也没有选上 B&W Photography 的课,于是拍的两卷也不知道什么时候才能洗出来了。目测只有下次回国的时候拿回去洗了。

Read and Post Comments

Read and Post Comments

Some tips on Cachelab

| categories: programming | View Comments

Ok.. This lab is actually not that difficult. I just made some supid error in the c code which wasted me like 4 hours to find it out.

There are two parts in this lab. Part A asks you to finish a cache simulator, and part B requires you to write a program to transpose matrix with limited cache miss.

For part A, it should be quite easy since only hit count, miss count and eviction count are required. So just malloc some memory and then process each trace and update cache status after each trace. The results are there then.

For part B, it is a little tricky for the case 64 * 64 matrix. What I did is that use a 4 * 8 subset in matrix B as a buffer so it could always be hit when reading or writing these memories.

Assume blow is a submatrix S with size of 8 * 8. And we also vertically seperate the 4 * 8 buffer into to parts, B1 and B2.

|---+---|
| 1 | 2 |
|---+---|
| 3 | 4 |
|---+---|

So if we want to transpose SAn into SBm, the SBm would be like:

|----+----|
| 1' | 2' |
|----|----|
| 3' | 4' |
|----|----|

Then the buffer would be of great help for us.

Opperations are like:

  • 1 T-> buffer 1
  • 2 T-> buffer 2
  • 4 T-> 4'
  • buffer 2 -> 3'
  • 3 T-> buffer 2
  • buffer 1 -> 1'
  • buffer 2 -> 2'

Here T stands for transpose and '->' stands for move, all operations are based on a 4*4 submatrix base.

These operations designed in 4 * 4 should only causes 16 misses for the transpose of a 8 * 8 submatrix. There would be some submatrixs left, but they are easy to handle.

Read and Post Comments

Next Page »