Thursday, June 21, 2012

Stop worrying about the "923-bit encryption" press release

The popular press usually gets crypto stuff wrong, but this time I can't find anybody within even a mile of the truth. Fujitsu et al released a press release a few days ago with the breathless title "Fujitsu Laboratories, NICT and Kyushu University Achieve World Record Cryptanalysis of Next-Generation Cryptography"

It's unfortunate that they chose to take this approach, because all their misleading yet juicy quotes are leading to a lot of popular press articles that mangle the truth even further, leading to the popular and mistaken impression that nobody actually knows how to keep anything safe using crypto, whereas the truth is that there are quite a few well-established and secure practices that work great and that most people just can't be bothered to follow.

Here's what's actually going on:

Pairing-based crypto is a tiny little branch of security that's interesting to researchers (it was needed for my dissertation), which is probably why it's so hard to get the story straight, and it's not in common use in any commercial product I'm aware of.

The most common thing the press gets wrong in these kinds of articles is making claims about security in terms of key lengths.  There are two main branches of modern crypto: private (symmetric) key and public (asymmetric) key.  They're usually used together, and while they both use keys, symmetric crypto uses much shorter keys than public-key crypto does.  For a secure symmetric cipher like AES, a 128-bit key is plenty long, and for a secure public key algorithm like RSA, 2048-bits is plenty long.

In this case, pairing-based crypto is a third kind of animal, and its security and key lengths don't have any bearing on either public or private key algorithms.

So the bottom line is that it's a very interesting research result, with absolutely no impact on the crypto people actually use (which is almost always what we can safely assume when the press gets breathless about some new research result).

Thursday, May 17, 2012

Understanding CPU, I/O and memory bandwidth choices (as of May 2012)


Every year or two I have to go catch up on the latest PC hardware so I can make reasonable decisions about what gear to buy.  Here's the result of my latest inquiry into high end Intel hardware.  Thanks to William over at Puget Systems for patiently explaining it.

CPUs:
  • Sandybridge is the latest intel CPU architecture.  Available in i3/i5/i7/xeon and more.  All of those CPU types were around before sandybridge, so for example, i7 does not necessarily imply sandybridge.
  • Sockets: Currently Intel mostly uses the LGA1155 and LGA 2011.  i5 and i7 use LGA1155, i7 and xeon use LGA2011.  i7 and xeon motherboards have different chipsets, so generally aren't interchangeable even though they share the LGA2011 socket.
  • There are only a few LGA2011 socket i7 chips, vs. many Xeon options.
  • "Server motherboard" typically means Xeon, and dual-socket boards are more common than single-socket (6 single vs. 27 dual mobos currently on newegg right now)
Memory:
  • i5 supports dual-channel memory (modules installed in pairs).  Sandybridge i7 and xeon support quad channel, which can double the memory bandwidth.
  • i5 and LGA1155 are limited to 32GB RAM.  i7 typically limited to 64GB RAM (although I see some 128GB MSI i7 mobos).  Dual-socket Xeon boards can do up to 768GB
  • ECC memory requires Xeon
PCI:
  • PCIe has 3 standards: 1.0, 2.0, and 3.0.  3.0 is brand new and mostly only used for video cards right now.  1.0 does 250MB/sec per lane, 2.0 does 500MB/sec per lane, 3.0 does 1GB/sec per lane.
  • Xeon has a built-in PCI controller

Saturday, May 12, 2012

Gnome Network Manager (lucid) "apply" button greyed out

My 2wire DSL modem has a DNS server in it that I can't shut off, and when we start heavily using the network, DNS lookups get really slow or fail completely.  Lame!  Sometimes I've resorted to editing my /etc/resolv.conf by hand and then doing chattr +i to keep it from changing, but that's pretty inelegant, and sucks when I want to use wireless at work.

Turns out there's a solution in the gnome network manager gui.  Right click on the icon, then edit connections... wireless... edit the appropriate network... IPv4 settings... then change to "Automatic (DHCP) addresses only".  Then you can put 8.8.8.8, google's public DNS server, in the "DNS servers" field.

Now, when I tried that just now, it worked fine except that the "apply" button was greyed out.  I tried a bunch of things, like killing nm-applet and restarting it as root, but what finally seemed to do the trick was right clicking on the icon and unchecking "Enable networking" before doing my edits.

Thursday, April 05, 2012

Can we find out if our universe is real?

Tonight I sat down with a friend and explored a question that’s been rolling around in my head for a long time now, which may have an answer or may not be in any way decidable by mankind.

I’ve written a few pages of introduction at the beginning to get people into the general ballpark, but the rest is pretty much our shorthand notes of interesting features in the space.  So don’t expect it to be a finished, comprehensible document; it’s just a bunch of vaguely clustered concepts.  We were exploring a space, and our only goal was to see if the question is worth thinking about more.  We think it is.



Can we find out if our universe is real?

Section 0: Introduction (are we completely nuts?)
The core idea here is that maybe we’re living in a simulated universe, and maybe we can detect that.  If we could, it would be the single most important scientific discovery in the history of mankind.

It’s also possible that we’re in a simulated universe but we can’t possibly detect it.  It’s a real possibility, and it’s the one people usually bring up as a reason why there’s no point in discussing it.  But unless undetectably simulated universes are the only kind of simulated universe we can imagine, then we shouldn’t stop asking questions yet.

If there’s any possibility we’re both in a simulated universe and that we could detect that, it’s certainly worth spending some time on.  How would we find out?  What would the consequences be?  Could there be bad consequences?

The positive possibilities include potentially being able to break the known laws of physics to help solve our problems, being able to negotiate with or steal parts of the “parent” universe and gaining knowledge for its own sake of the way things really are in a grand sense.  The negative possibilities include crashing our universe (if it’s a badly written computer program and we experiment with edge cases of its behavior) or getting our universe shut down (if we do something that gets negative attention from whoever’s in charge.)

Are there plausible circumstances in which we might succeed?  Well, here’s one example of how it might all play out:

Let’s hypothesize that our universe is a big brute force particle simulation running on a giant computer in our “parent” universe -- that is, there are a bunch of “gluons” represented as some sort of “bits” in the computer, and something resembling our mathematics is performed on them so that they interact according to what we perceive to be the laws of physics.  That simulation then is the true underlying nature of everything in our universe.

And let’s further hypothesize that the math they use has some of the kinds of subtle errors that our own computations do -- that digits get chopped off past some number of decimal points, like getting past the edge of a calculator screen.  These errors don’t interfere with the operation of our universe, but if you carefully measure, you can detect them as highly suspicious inconsistencies.

We run some tests in a particle accelerator, trying to create situations that magnify the subtle errors into something we can measure.  And on the 574th setup, we discover that the usual laws of physics are a little off in this really specific case.  That’s enough for a Nobel prize on its own, but in this case, if it turns out to strongly confirm our hypothesis, then we’ve just acquired the first hard evidence that there’s a whole universe behind what we can see.

It would open up a new branch of physics, one with absolutely limitless potential compared to the laws we’re used to dealing with, because this branch pulls back the curtain and gives us a peek at an underlying reality that we have never before glimpsed.


Section 0.5: Where we’re going with this

Section 1: The Problem Space, talks about the kinds of categories we can imagine simulated universes falling into.
Section 2: Goals covers the end goals we’re trying to reach.
Section 3: Crazy Side Ideas covers things that came up while we were thinking about this topic, that weren’t directly related.  (But they’re a great side-effect of thinking about this topic!)
Section 4: Implementation Sketches talks about a few simulations we tried to imagine building, to give us hints into the kinds of inconsistencies that might accompany them.
Section 5: Suspicious Things lists things we see in our own universe that might be the result of being in a simulation -- phenomena that seem unlikely results of an undirected natural process.
Section 6: Testable Hypotheses is our first pass at imagining experiments whose results might conclusively prove that we’re in a simulation.


Section 1: The problem space

What are the ways that some intelligent agent might go about simulating our reality?  We can imagine a lot of ways to do it, plus a whole class of things that we can’t possibly imagine.  But it gives us some starting places to begin our search.

It seems like most scenarios would have some common elements:
  • A “parent” universe with some sort of intelligent life that knows how to create reality simulations
  • A “creator” -- an intelligent actor with some reason for creating a simulation
  • A “simulation implementation” -- how did they do it?  A big computer with a bunch of simulated particles?  Something more efficient than that?  A bunch of simulated brains?  

Parent Universe

Here are some ideas for what the parent universe might look like:

- Just like our own in almost all respects
- Just like our own but with a lot more matter or energy
- Itself a simulation
- Similar laws in a higher dimensional space
- No similarity (we’re like a game-of-life experiment, and have no hope of understanding the parent universe)

Parent Universe timescale

How does time in the parent universe relate to our notions of time?

- In lock step with our own (a “realtime” simulation)
- Time goes massively faster in our universe (they’re watching galaxies grow)
- Time goes massively slower in our universe (we look like statues because they think so fast)
- No correlation at all
- Time is a function of resources, so it sometimes runs slower or faster.  (Does building supercomputers make our simulation run slower?)

Simulation Reasons

What kind of being would create our reality, and why?

Incomprehensible - we couldn’t possibly understand
Programmer - something like a person with a big computer
Dumb AI with lots of time - simple algorithm trying to optimize for something and building our universe as a very inefficient way of accomplishing its goal
Major Superintelligence - we can’t comprehend their brain
Accident - We’re an eddy in a cloud in some atmosphere; there’s a “parent” universe that created our big bang, but nobody did it on purpose.
End user - Somebody else wrote the simulation, and lots of other agents use it to create their own universes for their own purposes.

Simulation Reasons

Why might they have created our reality?

- Business (someone is selling the art/code/music we make, or the chemical compounds and plants and animals that evolved on our world)

- Military (threat simulation)
- Attempt to create superintelligence (Are we smarter than our creators and in situations analogous to what they face?) -- maybe it’s easy for them to create big brute-force particle simulations and they’ve never bothered to figure out how to code up an AI directly, or they’re waiting for us to do it.
- Simple computations being mapped out as an attempt to do Solomonov induction on one’s own universe (though the line between being a sim and being the basement gets blurry if our universe is a simple computation, especially given Tegmark 4 type realities.)
- The experiences of the actors in our universe are somehow terminal-utility-ful to the simulators.  (We’re living out their fantasies)
- Some other aspect of our universe is somehow terminal-utility-ful to the simulators. (Our universe is an abstract artwork of some sort hanging on a wall somewhere.)
- Psychological simulations of game-theoretically relevant situations
- Academic study of anthropology, sociology, psychology
- Historical curiosity -- see the primitive aliens!
- Education (class project)
- Blackmail Fodder (basement super villain is holding us hostage)
- Casual unintentional (it’s a screensaver)
- Causal intentional (it’s a game, or a child’s toy)

If we’re made of actual particles in a larger universe (eg., a bunch of hydrogen in a giant petri dish)

- Food (tasty nebulas)
- Chemical process (making helium)
- Accidental byproduct (the hydrogen was fuel and we’re just exhaust)
- Biological process

Simulation Implementations

What are the broad ways we can imagine trying to simulate a universe?

Basic building blocks

- Brute-force gluon (particle) simulation
- Optimized particle simulation (fancy math that saves cycles or storage)
- High level brain simulation (just a brain living in a video game, like the Truman Show)
- Experience simulation (we might be “real” people in the parent universe whose realities are being totally subverted, like the Matrix)
- Actual particles (hydrogen in a petri dish)

- Their space has more dimension(s) than ours and our universe is just a bunch of particles held in a plane by some magnets or something.
- Technology not conceivable by us (catchall category)
- Very (large) intelligent mind on drugs/dreaming/day dreaming
- Unintentional butterfly effect in another universe.

It’s also possible that our universe is a simple computation that has some platonic reality of its own and is also being simulated by many other universes (which again is not something we could detect, except in cases where one of them has a lossy/buggy implementation or meddles.)

Simulation Scopes -- what’s being actually simulated, and what’s just a facade?

- Our entire universe is a simulation
- Our Galaxy (and the rest of the universe is just fake “wallpaper”)
- Our Solar System (and the rest of the universe is just fake “wallpaper”)
- The planet Earth (and the rest of the universe is just fake “wallpaper”)
- Some group of people (you and your friends)
- Individual person (solipsism -- you’re the only one who goes on thinking when you’re alone)
- Individual experience (it’s only you, and you’ve only been around for a week)

Lazily evaluated mix of the above -- things don’t exist until we look at them.

Simulation Resource Limitations

Rather than choosing explicitly what to simulate, maybe simulation parameters are a function of available resources -- perhaps we’ll terminate when:
- we run out of CPU cycles or RAM
- after time has elapsed in the parent universe
- after some goal is met (once intelligent life forms and reaches a certain level, the simulation freezes for evaluation)



Section 2: Our Goals
- Create experiments to determine whether we’re in a simulation, and then
   . Try to contact the creator(s) and
       . make friends
       . do recon and figure out friend/foe
   . Try to root the machine and explore the parent universe without permission
   . Try to break the rules

Section 3: Crazy Side Ideas
Can any of these strategies work for us? (eg., could building a big particle simulator be easier than building an AI?)
Cosmic Background Radiation = Federation radio jammer to keep immature races from hearing signals from advanced races.


Section 4: Implementation Sketches
If we were going to simulate a universe, how would we do it?

Scenario 1: Brute-force universe-wide particle simulation on a digital computer
- Create the basic gluons classes and rules for interaction
- Store the gluons in some sort of data structure
- Run in time-slice epochs, with each gluon interacting with each other one, one at a time.  Then repeat.

Scenario 2: Efficient particle simulation
- Like scenario 1, but a clever algorithm lets big clouds of gluons act as a single unit without having to worry about each individual one.

Scenario 3: Brain particle simulation -- scan some “real” brain, then simulate all the particles making up that brain and feed it fake stimulus.

Scenario 4: AI simulation of all humans -- a superintelligent being “pretends” to be all of us and our surroundings.



Section 5: Suspicious Things
Does our reality seem like the kind of thing that might be easy to simulate, or annoyingly difficult?

- Our universe appears to be discretized

- Humanity hasn’t stone-aged itself yet

- Drake’s equation: why do we appear to be alone?

- Small number of elementary particles -- there are only a few simple kinds of subatomic particles.  That’s much easier to code than if, say, elements were indivisible (no such thing as atom smashing) with unique properties and there were thousands or millions of different ones.

- Aggregates of people/things behaving in ways more predictable than butterfly effects might imply.  (eg. is someone always winning at the stock market?)

- Quantum entanglement: does that seem suspiciously easy to code up, or suspiciously hard?  Are there parent universes that might make it really easy?

- Speed of light ensures that we have very limited interactions with distant objects.

- Relativity.  More suspicion because of locality.  Less suspicion because time is less linear and thus harder to keep track of than if it were universal.

- Time: we only go forward through time. State gets thrown away as time progresses (we do this all the time when we code, not bothering to save intermediate states)

- Dark Matter: Maybe someone just tweaked a parameter for how heavy our galaxy was so things wouldn’t fly away!

- Religion?  (If we’re in an Anthropology department’s simulation or a video game, then were Gods real, and actually just bored grad students from the parent universe?)

- Emptiness: why bother simulating so much useless empty space?

- Cosmology -- universe seems consistently to have come from a small single big bang -- no really weird shit in the hubble deep field image.  This hints that we’re not a tiny accidental chemical reaction on some weather pattern or plant in the parent universe.



Section 6: Testable Hypotheses


Detecting the wallpaper -- stars placed in a mathematically predictable pattern (eg., a simple pseudorandom number generator) would be a smoking gun.

Numerical errors -- if interactions between quanta were rounded down to the nearest integer, violating conservation in some extreme case
The Grand Unified Theory turns out to have its root in discrete math.

Pixels -- are positions discretized to a stationary grid in some reference frame?  Are there jaggies?  (Is true diagonal motion impossible?)

High energy experiments -- do things start behaving in suspicious ways at high energies (gluon position = NaN)

Rounding errors: eg. do a quantum experiment that is supposed to turn out a certain way 1/billion times and the rare way never happens.

Quantum entanglement stops working with sufficiently large clusters of particles.

Super computers or particle accelerators above a certain size always break.

Satellites sent out of the solar system start sending signals from slightly wrong origins.
- Satellites smash into “the sky” :)
Weird things happen if you actually try to compress too much matter into the same space on earth.

Bayes: Can we use human history as a training/verification set on hypotheses?  That is, how would this document have looked in the 1800’s, and what would that have led us to believe when we successfully went to the moon, discovered gluons and left the solar system?

- Victorian hypothesis: We’re sitting around in 1880, and guess that the earth is simulated, and the cosmos is all wallpaper.  Test: go to the moon, planets, stars.  Result: yep, real moon, real planets. (Crazy time -- moon landing really was fake... because there wasn’t a moon!)
- Victorian hypothesis: We guess we’re in a big particle simulation.  Test: build big microscope, look at atoms.  Result: very suspicious -- everything’s discretized!

Sunday, March 25, 2012

Aluminum air batteries for extended trips in electric cars

I like the idea of owning an electric car, except that we frequently make trips to see family members 100 and 350 miles away.  So I've been scratching my head about ways to let an electric car do that.  (The obvious approach is to buy a Chevy Volt or a plug-in Prius).

Today I read up on aluminum-air batteries, which have some neat properties.  They have very simple chemistry from very plentiful sources: aluminum, water and carbon.  They let the aluminum oxidize using oxygen from the atmosphere, and as the aluminum anode dissolves, you get aluminum hydroxide, which can be reprocessed into pure aluminum.

The other great thing about them is their theoretical energy density of 8 kwh / kg, far higher than we see with lithium-ion batteries.

The downside is that they're single-use -- no recharging.  But for a road trip, that may not be so bad -- instead of gassing up, you trade in the depleted battery modules for fresh ones and head back on your way.  I'm imagining a standardized battery module rack in the trunk that you only fill with modules when you're planning a long trip.

The economics kinda sorta work.  This paper claims they can get about 1.3 kwh / kg of the 8kw theoretical maximum, and that they could recycle the batteries for about $1.10 / kg.  So you'd basically be paying $1 / kwh.  The Nissan Leaf takes about 34 kwh / 100 miles, so your road trip miles would cost about $0.34 / mile.  That's 2x or 3x the price of gas for a traditional car on the highway, but you're only paying it on long trips, and it saves you from having to install a gas motor + generator in your all-electric car.

The other interesting possibility is using solar thermal plants to reprocess the spent aluminum hydroxide.  It melts at 572F, which is a downright easy temperature for a field of mirrors to produce.  The great thing about that process is that the solar thermal plant doesn't have to actually generate any electricity directly -- it's just generating heat to strip off the oxygen atoms, which turns into electricity later when it's in your car.  So the plant is much simpler than a solar thermal electric plant would be.

Here's a paper that proposed that very arrangement back in 2010.

In my studies, it was sad to see a lot of the startups from the 1990's and 2000's working on aluminum-air batteries closed down.  I only found one or two companies selling metal-air batteries at all, and those are zinc-air batteries, which have a lower theoretical energy density limit.

So maybe it's time to start looking into this technology again, especially now that electric cars are hitting the market.

Monday, March 19, 2012

Disable "browser back" and "browser forward" keys in gnome

My lenovo thinkpad has keys above the left and right arrow keys, that by default are wired to my browser's "forward" and "back" buttons.  This is a horrible idea, because it means that frequently I'll accidently hit them while entering text in a textbox, and lose all my edits when the browser leaves the page.

This fixed it for Ubuntu Lucid (running gnome):

System ... Keyboard Shortcuts ... Add ... Name: Do nothing ... Command: /bin/true ... Apply ... click in the "Shortcut" column for the newly created shortcut ... press the browser back button.

It should display as "XF86Back".  Now repeat, creating another shortcut for XF86Forward.  Problem solved!

Monday, March 05, 2012

mbw MCBLOCK test results (used to be) bogus

Update: Andras updated mbw to fix this.

I was testing a machine's memory performance, and ran across the "mbw" package in Ubuntu lucid.

$ mbw -a -n 1 1024
...
0 Method: MEMCPY Elapsed: 0.23493 MiB: 1024.00000 Copy: 4358.801 MiB/s
0 Method: DUMB Elapsed: 0.16298 MiB: 1024.00000 Copy: 6282.864 MiB/s
0 Method: MCBLOCK Elapsed: 0.08543 MiB: 1024.00000 Copy: 11986.562 MiB/s

I was curious why the MCBLOCK numbers were so much higher than the others, and this led me to the relevant piece of code:


                for(t=0; t < array_bytes; t+=block_size) {
                        c=mempcpy(b,a,block_size);    
                }
                if(t > array_bytes){
                        c=mempcpy(b,a,t-array_bytes);
                }

Which appears to be completely broken.  The mempcpy(b, a, block_size) call does exactly same thing every time.  All I can figure is that the author either was trying to demonstrate cache performance, or fumbled an attempt to do the memcpy() calls on blocks of block_size each.

Anyway, it's a good reminder of Caveat Emptor when using random benchmarks.