CUDA Is Like Owning A Supercomputer

The word supercomputer gets thrown around quite a bit. The original Cray-1, for example, operated at about 150 MIPS and had about eight megabytes of memory. A modern Intel i7 CPU can hit almost 250,000 MIPS and is unlikely to have less than eight gigabytes of memory, and probably has quite a bit more. Sure, MIPS isn’t a great performance number, but clearly, a top-end PC is way more powerful than the old Cray. The problem is, it’s never enough.

Today’s computers have to processes huge numbers of pixels, video data, audio data, neural networks, and long key encryption. Because of this, video cards have become what in the old days would have been called vector processors. That is, they are optimized to do operations on multiple data items in parallel. There are a few standards for using the video card processing for computation and today I’m going to show you how simple it is to use CUDA — the NVIDIA proprietary library for this task. You can also use OpenCL which works with many different kinds of hardware, but I’ll show you that it is a bit more verbose.
Continue reading “CUDA Is Like Owning A Supercomputer” →

Inventing The Digital Watch Again And Again And…

In the 1950s, artwork of what the future would look like included flying cars and streamlined buildings reaching for the sky. In the 60s we were heading for the Moon. When digital watches came along in the 70s, it seemed like a natural step away from rotating mechanical hands to space age, electrically written digits in futuristic script.

But little did we know that digital watches had existed before and that our interest in digital watches would fade only to be reborn in the age of smartphones.

Mechanical Digital Watches

Cortébert jump-hour wristwatch by Wallstonekraft CC-BY-SA 3.0
Cortébert jump-hour wristwatch.
Image by Wallstonekraft CC-BY-SA 3.0

In 1883, Austrian inventor Josef Pallweber patented his idea for a jumping hour mechanism. At precisely the change of the hour, a dial containing the digits from 1 to 12 rapidly rotates to display the next hour. It does so suddenly and without any bounce, hence the term “jump hour”. He licensed the mechanism to a number of watchmakers who used it in their pocket watches. In the 1920s it appeared in wristwatches as well. The minute was indicated either by a regular minute hand or a dial with digits on it visible through a window as shown here in a wristwatch by Swiss watchmaker, Cortébert.

The jump hour became popular worldwide but was manufactured only for a short period of time due to the complexity of its production. It’s still manufactured today but for very expensive watches, sometimes with a limited edition run.

The modern digital watch, however, started from an unlikely source, the classic movie 2001: A Space Odyssey.

Continue reading “Inventing The Digital Watch Again And Again And…” →

Mechanisms: Gears

Even before the Industrial Revolution, gears of one kind or another have been put to work both for and against us. From ancient water wheels and windmills that ground grain and pounded flax, to the drive trains that power machines of war from siege engines to main battle tanks, gears have been essential parts of almost every mechanical device ever built. The next installment of our series on Mechanisms will take a brief look at gears and their applications.

Continue reading “Mechanisms: Gears” →

Linux Fu: File Aliases, Links, And Mappings

Have you heard it said that everything in Linux is a file? That is largely true, and that’s why the ability to manipulate files is crucial to mastering Linux Fu.

One thing that makes a Linux filesystem so versatile is the ability for a file to be many places at once. It boils down to keeping the file in one place but using it in another. This is handy to keep disk access snappy, to modify a running system, or merely to keep things organized in a way that suits your needs.

There are several key features that lend to this versatility: links, bind mounts, and user space file systems immediately come to mind. Let’s take a look at how these work and how you’ll often see them used.

Continue reading “Linux Fu: File Aliases, Links, And Mappings” →

A Tale Of Two Phases And Tech Inertia

What kind of power service is in the United States? You probably answered 120-volt service. If you thought a little harder, you might remember that you have some 240-volt outlets and that some industrial service is three phase. There used to be DC service, but that was a long time ago. That’s about it, right? Turns out, no. There are a very few parts of the United States that have two-phase power. In addition, DC didn’t die as quickly as you might think. Why? It all boils down to history and technological inertia.

Split Phase Power by Charles Esson CC-BY-SA 3.0

You probably have quite a few 120-volt power jacks in sight. It is pretty hard to find a residence or commercial building these days that doesn’t have these outlets. If you have a heavy duty electric appliance, you may have a 240-volt plug, too. For home service, the power company supplies 240 V from a center tapped transformer. Your 120V outlets go from one side to the center, while your 240V outlets go to both sides. This is split phase service.

Industrial customers, on the other hand, are likely to get three-phase service. With three-phase, there are three wires, each carrying the line voltage but out of phase with each other. This allows smaller conductors to carry more power and simplifies motor designs. So why are there still a few pockets of two-phase?

Continue reading “A Tale Of Two Phases And Tech Inertia” →

Stephen Hawking’s Legacy Includes Making His Work Widely Approachable

We are saddened by the passing of physicist Stephen Hawking. One of the great minds of our time, Hawking’s work to apply quantum theory to black holes launched his career and led to his best known theoretical discovery that black holes emit radiation, aptly known as Hawking radiation.

Thinking back on Stephen Hawking’s contributions to humanity, it strikes us that one of his most important is his embrace of pop culture. While his scientific discoveries and writings are what will stand the test of time, in our own age it is remarkable that Stephen Hawking is a household name around the world.

Hawking’s first book, A Brief History of Time, has sold more than 10 million copies and for many readers was their introduction into the way physicists view space and time. It was written for general consumption and not reserved for those who were already bathed in the jargon of theoretical physics. It sent the message that contemplating science is something that is fun to do in your spare time. This work continued with his more recent mini-series Into the Universe with Stephen Hawking created for the Discovery Channel.

A fan of the series, Hawking appeared in an episode of Star Trek: The Next Generation in 1993 and made subsequent, often repeat, appearances on The Simpsons, Futurama, and The Big Bang Theory. This was great fun for all science geeks who knew of his work, but it has a far more profound effect of normalizing interaction with a world-class scientist. Appearing on these shows told the story that the pursuit of knowledge is cool.

Having scientists in the public light is crucial to research and advancement. It lets the general public know what kind of frontiers are being pursued, and why that matters. This trickles both up and down, inspiring the next generation of scientists by introducing deep topics at an early age, and ensuring funding and opportunities for this upcoming wave of researchers has widespread support.

Stephen Hawking showed us some incredibly complicated secrets of the cosmos both through his discovery, and through his ambassadorship of scientific knowledge. He will be greatly missed but leaves behind an admirable legacy which we can all strive to live up to.

[Main image by Martin Pope via The Telegraph]

Archimedes Would Have Known Better If He Could Count To A Million

Today is March 14th, or Pi Day because 3.14 is March 14th rendered in month.day date format. A very slightly better way to celebrate the ratio of a circle’s circumference to its diameter is July 22nd, or 22/7 written in day/month order, a fractional approximation of pi that’s been used for thousands of years and is a better fit than 3.14. Celebrating Pi Day on July 22nd also has the advantage of eschewing middle-endian date formatting.

But Pi Day is completely wrong. We should be celebrating Tau Day, to celebrate the ratio of the circumference to the radius instead of the diameter. That’s June 28th, or 6.283185…. Nonetheless, today is Pi Day and in the absence of something truly new and insightful — we’re still waiting for someone to implement a spigot algorithm in 6502 assembly, by the way — this is a fantastic opportunity to discuss something tangentially related to pi, the history of mathematics, and the idea that human knowledge builds upon itself in an immense genealogy stretching back to the beginning of history.

This is our Pi Day article, but instead of complaining about date formats, or Tau, we’re going to do something different. This is how you approximate pi with the Monte Carlo method, and how anyone who can count to a million can get a better approximation of one the fundamental constants of the Universe than Archimedes.

Continue reading “Archimedes Would Have Known Better If He Could Count To A Million” →