Tuesday, April 29, 2008

How GPUs are better than CPUs

Intel has a great CPU core right now, AMD does not, and in combination with Intel having higher-performance silicon, Intel is currently beating AMD handily. Meanwhile, Intel and AMD are both integrating graphics into the CPU and NVidia probably feels sidelined. So NVidia says that the CPU is dead. I agree, a little.

Many things people want to do these days are memory bandwidth limited. Editing/recoding video, or even tweaking still pictures and playing games are all memory bandwidth limited. GPUs have far better memory bandwidth than CPUs, because they are sold differently.

The extra bandwidth comes from five advantages that GPUs enjoy:
  • GPU and memory come together on one board (faster, more pins)
  • point-to-point memory interface (faster, lower power)
  • cheap GPU silicon real estate means more pins
  • occasional bit errors in GPU memory are considered acceptable
  • GPUs typically have less memory than CPUs
When people buy CPUs, they buy the memory seperately from the CPU. There are 2 chip carriers, one socket, a PC board, and one DIMM connector between the two. In comparison, when people buy GPUs, they buy the memory and the GPU chip together. There are 2 chip carriers and a PC board between the two.

CPU memory interfaces are expected to be expandible. Expandibility has dropped somewhat, so that currently you get two slots, one of which starts out populated and the other of which is sometimes populated and sometimes not. The consequence is that the CPU to DRAM connection has multiple drops on each pin.

GPUs always have one DRAM pin to each GPU pin. If they use more DRAM chips, those chips have more narrow interfaces. Because they are guaranteed point-to-point interfaces, the interfaces can run at higher speed, generally about twice the rate of CPU interfaces.

CPU silicon is optimized for single-thread performance -- both Intel and AMD have very high performance silicon. As a result, the silicon costs more per unit area than the commodity silicon the GPUs are built with. The "programs" that run on GPUs are much more amenable to parallelization, which is why GPUs can be competitive with lower-performance silicon.

It turns out that I/O pins require drivers and ESD protection structures that have not scaled down with logic transistors over time. As a result, pins on CPUs cost more than pins on GPUs, and so GPUs have more pins. That means they can talk to more DRAM pins and get more bandwidth.

All of the above advantages would apply to a CPU if you sold it the same way a GPU is sold. The final two advantages that GPUs enjoy would not apply, but are easy to work around.

The first is the acceptability of bit errors. GPUs do not have ECC. It would be easy to make a CPU/GPU that had a big wide interface with ECC.

The second is the memory size. GPUs typically connect to 8 or 16 DRAM chips with 32b interfaces each. It would be straightforward to connect with 64 DRAM chips with 8b interfaces each. If fanout to the control pins of the DRAMs becomes a problem, off-chip dedicated drivers would be cheap to implement.

So, I think integrated CPU/GPU combinations will be interesting for the market, but I think they will be more interesting once they are sold the way GPUs are sold today. Essentially, you will buy a motherboard from Iwill with an AMD CPU/GPU and 2 to 8 GB of memory, and the memory and processor will not be upgradable.

For servers, I think AMD is going in the right direction: very low power (very cheap) mux chips which connect perhaps 4 or even 8 DRAM pins to each GPU/CPU pin. This solution can maintain point-to-point electrical connections to DIMM-mounted DRAMs, and get connectivity to 512 DRAM chips for 64 GB per GPU/CPU chip.

Sunday, April 20, 2008

Fountain Prototype

Martha and I are building a pool in the back yard. In that pool will be hot tub, and pouring into that hot tub will be a fountain. I want lots of water flow, and curves, especially since the overall pool will be rectangular (due to the automatic cover). To give you an idea, here's the pool:

The hot tub is circular, and has a 1 foot thick wall that seperates it from the pool. Out of the center of that wall, water will leap up, arch over, and fall into the tub. This will pour nicely over your shoulders if you are an adult, and it will make a fancy tube to explore if you are a child.

The trouble is that nobody sells a curved fountain like this. No problem, I'll just assemble it from a number of straight sections. Also, I do not want to use high-pressure pool pumps for this thing. Instead, I want to use low-power, low-pressure pond pumps. The manufacturer of the fountain has specs for the amount of water flow you need, but not the pressure. I smell project risk. Time for a prototype. Here's the overall arrangement: two fountain units, 1 foot wide each, one Sequence 4200seq12 pump, and some pipes to move the water.

I've got a flow gauge, two pressure gauges, and a ball valve so I can figure out how many gallons per minute throws the water how far.

I've also got a peanut gallery. They're interested because they're going to get to dance around in the water in a bit.

The fountains throw water about as far as the manufacturer claims. Note that my flow rates are for two 1 foot units.

Flow rateThrowNotes
48 GPM26.0 inches7 inch rise
45 GPM23.5 inches
41 GPM18.7 inches
37 GPM14.7 inches
35 GPM11.5 inches3+ psi pressure drop

I learned a bunch of things from this prototype:
  • The flow through the two units was not identical. One moved about 8% more water than the other, and threw the water a little further.
  • The flow through each units was not uniform. The unit throwing farther was throwing farther on one end.
  • With no fine filtration, and just a skimmer before the pump, the fountain units quickly accumulated debris that interfered with the flow.
  • The water sheet from each unit contracts from surface tension as it gets farther from the fountain. A 14 degree included angle between the two units turned out to roughly match the contraction, but this still left a constant gap from one to the next. I may try to fix that by mitering the two fountains together.
  • Martha and I agreed that 15 or 20 GPM per linear foot is not enough. We really like 25 GPM/foot better.
  • The fountain water entering the water surface was the cause of all the noise. The pump was really quiet, and you could only hear it when you walked right over to it.
  • The pump really doesn't prime itself. I had to stuff a hose up the intake and fill it full of water before the pump would move anything.
  • This pump can just move 48 GPM with this setup (which implies it is seeing about 5 feet of head). With more angles and losses in the system, I am going to need more pressure at that flow.
I also noted that the water sheet was rough. Water entry was noisy. I took a high-speed shot of the water, and sure enough, it's breaking up in flight. Note also how much shorter the rear fountain is than the front.

I noticed that the flow gauge was bouncing around a fair bit, so I presume I'm getting a bunch of turbulence, which probably does not help the fountains at all. These units are the "short lip" version of these fountains, which means they have just 1" of flow straightener before they launch the water. The standard version has a 6 inch lip, which I think might damp the turbulence more and lead to a cleaner sheet of water.

Inside the unit there are apparently 3 supports of some sort. These have visible wakes, but I wasn't able to see that the wakes caused more breaking up when they hit the edges.

So, my plan is not yet validated.
  • I need bigger pumps. 3 of the 5100SEQ22 will produce 200 gpm total at 10' head. That should give me enough extra force to push through the extra twists and turns.
  • Each fountain unit is going to need it's own throttle. The best way to implement this is probably a bank of eight $20 ball valves, and a seperate run to each fountain unit.
  • As long as I'm doing a seperate run to each fountain unit, I might arrange for the final connection to be long and straight to reduce turbulence. There will be a lot of turbulence in the fountain unit itself, so maybe this is hopeless.
  • I should order a fountain unit with a 6" lip, and see if I like that flow better.

Tuesday, April 08, 2008

Conservation versus outsourcing

Read "The Wonderful Curse of Natural Gas Price Volatility". It's short, just 12 pages long.

Check out the graph at the top of page 9: "U.S. Industrial Gas Demand Destruction". That's a 22% drop in industrial natural gas utilization between 1997 and 2006. That's not efficiency, that's offshoring! What's going on here?
  • Natural gas is a feedstock for the fertilizer, chemical, and plastics industries, and a fuel for the electric generation industry.
  • Electric power generators are less sensitive to the price of their fuel than fertilizer, ethanol, and plastics, since the latter three can all be shipped to us oversea, and electricity cannot.
  • The electric generation industry is sensitive to the capital necessary to build capacity, because the rent on the capital to build their plants has to be priced into the electricity sold, and different plants do compete to produce and sell electricity. Thus, more capital-intensive plants are more likely to have lower return on investment if electricity prices dip.
  • Gas turbine power plants have exceptionally low capital costs, making them very desirable to the power producers, and gas prices were low during the 1980s and 90s.
  • So, electric generators built 200 gigawatts of gas turbine powerplants during the 1990s and early 00s, so that gas turbine plants now constitude 41% of our nameplate capacity (EIA figures). These gas turbine plants are now running at a capacity factor of 21%, and produce 20% of our domestic power (once again, EIA).
  • Figure 7 of page 8 of the Ventyx report shows that between 1997 and 2006, gas consumption by the power generators rose from 11 to 17 billion cubic feet a day. That's all those gas turbines coming on line.
  • It turns out there is a limited supply of domestic natural gas. Demand rose, supply stayed constant, and thus prices rose.
  • Over the same time, industrial consumption dropped from 23 to 18 billion cubic feet a day. That's domestic fertilizer, chemical, and plastics production being moved overseas in response to higher feedstock costs.
  • U.S. consumption of fertilizer, chemicals, and plastics has not dropped, and conversion from the feedstock to the final product increases value, so offshoring has driven the jobs overseas and also increased our trade deficit by much more than the cost of the natural gas consumed by the electric generation industry.
What we have here is another example of a strong negative correlation between the performance of the U.S. power generation industry and the U.S. economy as a whole. This is a tragedy, partially responsible for our $708 billion dollar/year trade deficit. That's an unpaid $2360 bill, per man, woman, and child, per year, for everyone in the United States.

This post and the last one may lead some of you to think I'm all for a command economy. No. I'm pretty sure that if we nationalized the electric power generation industry, we'd end up running it less efficiently, which would also lead to higher domestic power costs. I do think we need to bring the measure of performance of the electric power generation industry into better alignment with the domestic economy.

The domestic economy does well with cheap energy. In this context, gas turbines are a disaster, since they redirect a feedstock away from high-value-added uses (plastics) into low-value-added uses (electric generation). We have readily available substitutes for electric generation (coal and nuclear), but not natural gas. In some sense, all a gas turbine does is convert one kind of energy into another without increasing the domestic supply.

I don't know how to make domestic power producers profit more when the US economy has cheaper energy. The benefit of marginally cheaper power is probably nonlinear, and possibly unmeasureable in any way that would allow accountants to calculate a credit to power producers. I do not want to see more coal powerplants, because of the currently externalized cost of CO2 production, even though they are a cheap source of power. Perhaps the simplest way forward is what we have now: tax credits or subsidies for the obvious answers, like wind and nuclear, and just feel our way through, year by year, guessing which subsidies will distort the electricity market to best serve the interests of our citizens.

I'm sorry to keep harping on this energy and trade stuff, but to be honest, I'm scared. I don't understand how to predict what this trade deficit will do, nor do I understand how big is too big, but $700 billion feels too big. Our trade deficit, national budget deficit, credit crisis, housing market meltdown, and war in Iraq give me the feeling that this nation has derailed and is about to make a very expensive and possibly bloody mess.

The last time we got into a World War, we had just splurged on national infrastructure. Think about this: 90% of the Allied aluminum flying over Germany was made with power from the Grand Coulee Dam, built from 1933 to 1942, i.e. just in time. I'm not saying I expect another World War, but I am saying that when times get tough it's good to have serious infrastructure in your back pocket.