Each year at this time my family and I head to the Jersey shore. I have to admit, I have been here for four days and have not yet been to the beach. That is not entirely true. Last night I watched the sun set over the water with requisite dog and cigar.
Wait a minute. Those who are not geographically challenged, will recall that New Jersey is on the east coast and the sun sets on the west coast. True enough, but in certain parts of southern New Jersey you can see the sun set over the Delaware Bay. Looks like an ocean sunset and works for the tourists.
If you are wondering where I am, I can tell you in a single sentence. Go to the State of New Jersey and head south as far as you can go without going into the water. A nice short and concise algorithm. And, due to the geography that simple sentence will put you within 300 yards of where I am sitting right now.
While we are talking about algorithms, notice that I told you what to do, not how to do it. Such is the nice thing about declarative programming. You the traveler can choose to take a car, bicycle, personal helicopter, or whatever to get here. And your mode of transportation determines how you travel. I doubt you would take a bicycle on major highways nor would you limit you flight path to roads were you in a helicopter.
Interestingly, this algorithm is executed in parallel all throughout the summer. That is a large group of automobiles each head to the same destination executing their version of the “head south” algorithm. There is also communication between the travelers and excluding the friendly hand jesters we all experience in traffic, subtle local communication between drivers creates few collisions. There is also quite a bit of congestion, but this can be avoided by adding some intelligence to your algorithm. First, you can utilize traffic data now broadcast on radio, cell phone, and GPS unit. Second, by timing your travel you can avoid major congestion.
Obviously, the bulk of drivers use a basic algorithm even though there is quite a lot of congestion. Others use more intelligent algorithms and thus minimize their travel time. There big difference is the static vs dynamic algorithm. Those that travel the same way at the same time each year would seem to have a static algorithm. The drivers that adapt to conditions would seem to have a more dynamic algorithm.
Most people, I suppose, probably do not think about traffic jams in this way. I find it instructive in a sense. The overall declarative algorithm “head south the the beach” is executed by a large population of “processors” (drivers). The static algorithms, while successful, do not take into account changing conditions. The dynamic algorithms try to adapt to the available information.
When I think about programming clusters, multi-core, and GP-GPUs, I long for a declarative solutions (i.e. multiply these two matrices). The declarative system would “understand” how to use the hardware at hand to give me a solution in the shortest time. Like my traffic analogy, I think that a dynamic approach would lead to the best results. For instance, I would have one binary and that would adapt to what ever hardware on which it was run (assuming it had knowledge of the hardware). Thus, how it gets to the answer depends on the external conditions — that cannot be predicted at compile time. Or, like my traffic analogy, the flat tire that causes a backup, that causes me to take the back way through the pine barrens and stop at that ice cream place. Ah the joys of optimization.
In closing, as I sit finishing up this column, my teenage daughter and her BFFL listened to me read it out load. Their feedback was quite helpful. My daughter, Taylor, is questioning why anyone would pay me to write such a thing, while her friend, Carla, cannot stop ROFL. At least the dog is taking me seriously.
My twitter count is up to 97! However, I noticed some of my “followers” don’t seem so interested in HPC as some of their posts are how should I say “biological in nature.” In any case, join my quest to have 100 followers and read my pithy posts at thedeadline on Twitter.
Douglas Eadline is the Senior HPC Editor for Linux Magazine.