Monthly Archives: October 2010

Jeff Mather, Paste-up Monkey

I love, the little service that extracts links from a Twitter feed and makes a newspaper-like collection of articles from them. It’s amazingly high quality for “alpha” software — it’s actually what we used to call “beta” software back in the day. (I guess the real question is whether they’ll make it to beta before Google nabs the idea for Google News.)

Unless you follow a very narrow group of people or like to see a hodge-podge of randomness, it’s most useful when applied to a list in Twitter. Here are a couple examples from my lists:

Go ahead, make your own paper. Discover some awesome articles.

Posted in General, Worthy Feeds | Leave a comment

Performance Programming Links

Faithful readers: This dispatch falls into the bucket of “stuff that’s about work and not diabetes.” (Not that diabetes isn’t its own kind of work.) This is what I do for my 9-5. It’s the stuff I do between thinking about diabetes, my next bike outing, where I want to travel someday, and all those other things. Don’t worry, we’ll get back to all that “good stuff” soon enough; but this post is for the lurking coworkers and people searching on the Google.

Here are a few performance-related articles and presentations that I stumbled upon recently:

Igor Ostrovsky at Microsoft wrote a very useful description of various processor cache effects. Here are the notes I took while reading it:

  • Array access is slower than math
  • Data alignment can determine how many cache lines are touched
  • Keep modifications/accesses within the same cache level
  • Be aware of instruction level dependencies and parallelism opportunities
  • Avoid touching too many memory locations from the same cache line, causes contention
  • There’s a trade-off between the size of what you’re putting in the cache and the number of elements you touch in it. — What does that mean, Jeff? Not exactly sure, but cache assoc. is usually not a huge deal compared to other issues.
  • Because cores have their own caches and because memory needs to remain consistent, avoid letting two threads modify data on the same cache line.
  • Even when you think you know what you’re doing, there’s other crazy stuff going on.

Isn’t that last one the sad truth about performance optimization?

Igor also has an excellent article about branch prediction. Basically, if you structure your code so that if branches are predictably true (or predictably false) the CPU can start walking down that code path until it’s proved wrong. But if it’s close to random, you’ll see performance hits.

Joe Duffy, also at Microsoft, debunks the “premature optimization is evil” myth. Joe summarizes the article himself quite well, so I’ll just quote him.

In this short article, we’ll look at some important principles that are counter to what many people erroneously believe this [“avoid premature optimization”] statement to be saying. To save you time and suspense, I will summarize the main conclusions: I do not advocate contorting oneself in order to achieve a perceived minor performance gain. Even the best performance architects, when following their intuition, are wrong 9 times out of 10 about what matters. (Or maybe 97 times out of 100, based on Knuth’s numbers.) What I do advocate is thoughtful and intentional performance tradeoffs being made as every line of code is written. Always understand the order of magnitude that matters, why it matters, and where it matters. And measure regularly! I am a big believer in statistics, so if a programmer sitting in his or her office writing code thinks just a little bit more about the performance implications of every line of code that is written, he or she will save an entire team that time and then some down the road. Given the choice between two ways of writing a line of code, both with similar readability, writability, and maintainability properties, and yet interestingly different performance profiles, don’t be a bozo: choose the performant approach. Eschew redundant work, and poorly written code. And lastly, avoid gratuitously abstract, generalized, and allocation-heavy code, when slimmer, more precise code will do the trick.

Follow these suggestions and your code will just about always win in both maintainability and performance.

If you do anything that falls under the labels of “multicore,” “multithreaded,” or “multi-processor,” then you should definitely add Multicore Info and Intel’s software blogs to your RSS feed aggregator.

One recent Intel offering is a recording of “Introducing Intel Parallel Building Blocks”. The Intel folks discusses Intel Cilk Plus, Threading Building Blocks (TBB), and Array Building Blocks. Here are some notes from the 45 minute presentation:

  • Intel Cilk Plus is a lower-level way to expose parallelism and the potential for vectorization to C++ code. It currently only works with the Intel compiler.
  • TBB is awesome. That’s me saying that. I use it to easily exploit data parallelism in our existing codebase. (Because I use it already, I didn’t take many notes on it. Sorry.)
  • Array Building Block (ArBB) provide the highest level of abstraction presenting the ability to specify array data containers (1-D to N-D, including nested containers and [soon] sparse data) and then do vector operations on the data in the containers. Sounds familiar.
  • Cilk Plus includes reducers to prevent data races, has #pragma simd to empower the compiler to make vector assumptions, and has a mechanism for specifying a range of vector data.
  • Parallel Inspector and Parallel Amplifier are alleged to help squeeze performance out of code that uses TBB.
  • ArBB uses a two-part compilation process, one of which is a runtime JIT.
  • There are collisions between the schedulers in Intel MKL and Cilk (and TBB, etc.). Beware.

And finally, there’s a recording of a webinar about Intel Parallel Advisor that may be of interest. It’s next in my queue of things to watch.

Posted in Computing, Fodder for Techno-weenies, Software Engineering, Worthy Feeds | Leave a comment

An Invitation to Diabetes Researchers

I just finished reading Michael Bliss’s excellent The Discovery of Insulin about the amazing work at the University of Toronto in 1921-1923 by Banting, Best, Collip, and Macloed. For most readers, it’s surely a story about discovery and rivalry and collaboration in medicine, culminating in the first effective treatment of diabetes and (very quickly thereafter) the Nobel Prize for Medicine.

For me it was also a history of what I avoided by being diagnosed with type 1 diabetes after 1922. Bliss includes a small sample of the lives of some of the people afflicted with diabetes before the discovery of insulin. I was truly inspired by those who were fortunate enough to receive this “miracle drug,” but I was heartbroken by all of the people of that age who didn’t make it because the only treatment was to survive on a meager 500-or-so calories for intolerable months until slipping into the coma of ketoacidosis and then (eventually) death.

It’s been almost 89 years since the first successful clinical use of insulin, but we still don’t have a cure. At best, insulin is the key part of a hormone replacement therapy where people with diabetes try to mimic a pancreas. At worst, insulin is a fickle treatment that is difficult to use, expensive, and out of reach of millions of people worldwide.

While I’m so grateful for what I have — a treatment that gives life — what we need now is a cure . . . even if it’s only useful for people who are not yet sick or are newly diagnosed.

If you’re working on a cure or a new therapy for diabetes, the rest of this post is for you.

I will help you with any technical software aspects of your research that you need. If you have questions about MATLAB or C++, I will do my very best to answer them. If you need help with software design or object-oriented analysis/design, I can help you structure your solution. If you require some help with the non-development aspects of software development — such as project management or using tools — I will help you there, too.

My particular areas of expertise are MATLAB, C++, medical imaging formats (such as DICOM), some familiarity with image processing, and multithreaded programming using Intel’s TBB. I also know my fair share about life with diabetes. I can’t promise that I’ll have all of the answers to your particular question, but I’ll work with you as much as I can. And I’ll connect you with my coworkers as much as I can, if it comes down to that. Finding a cure that’s safe, effective, and universally accessible isn’t my day job, but moving into the third era of diabetes where no one dies from it and no one has to impersonate a pancreas is something I’d love to be a small (even anonymous) part of.

You can e-mail me at work or home, and you can hit me up on Twitter, too.

Posted in 101 in 1001, Book Notes, Diabetes, MATLAB, Software Engineering | Leave a comment

The Flip Turn

I’m not a very coordinated person, and I’m even less graceful in the water; but I’ve told myself that at some point I’m going to do this:

So why not at lap swim tomorrow?

OMG, I’m going to drown.

Posted in 101 in 1001, General, Life Lessons, Swimming, Video | 2 Comments

Diabetes T-Shirt Challenge!

We people with diabetes have an invisible disease, but that doesn’t mean we can’t wear our pancreases on our sleeve! Announcing the Diabetes T-Shirt Design Challenge.

A T-shirt that says 'A Velociraptor Ate My Pancreas'
Click for larger…

Create a diabetes-themed tee and share it with the world. It can be funny, serious, snarky, simple, crafty, hip — whatever you want. Tell the world what you think about diabetes, your pancreas, the food police, your support team, your insulin pump, . . . The possibilities are endless. All you need is a plain T-shirt, an idea, and a little craftiness. For example, here’s one Lisa made last year:

I love my pancreas/paperweight T-shirt
Click for larger…

After you make your T-shirt, be sure to upload a picture and write about it on Friday, November 5th, the first ever “DiabeTees Day.” That gives you three full weeks from Friday to make your shirt and at least NINE whole days to give it that vintage, well-worn look before World Diabetes Day. If you make a shirt, please leave a comment below, and I’ll do my best to link to everyone who’s joining in.

How do you make a T-shirt? There are several ways, and most involve an iron. You can do what we our parents did in the 70s: you buy puffy letters and glittery iron-ons at the craft store, lay them out on your shirt, fire up the iron, and let the world know your pancreas just won’t keep on truckin’. (Sorry, got distracted there.) Or you can use some software to design your own iron-ons, which you then print out and apply to your shirt. There are also more web-sites than you can shake a stick at that will make T-shirts with your own design; but I don’t know anything about them.

Whatever you decide, just remember these three things:

  • Friday, November 5, 2010, is DiabeTees Day.
  • Post a picture of your shirt on your site, Flickr, etc.
  • Leave a comment below with the link.

And have fun!

BTW, the pancreas in the picture above is from I Heart Guts, a great website with lots of fun plush toys, pins, and stickers of your insides. Check ‘em out!

. . . And, there’s already a website in the UK called DiabeTees. I hope they don’t mind that I’m borrowing “DiabeTees.” Maybe if we all go check out their store, they’ll feel less chagrin.

Posted in Diabetes, General, This is who we are | 2 Comments

Diabetes BAMF… Or Not

Until a man is twenty-five, he still thinks, every so often, that under the right circumstances he could be the baddest motherfucker in the world. If I moved to a martial-arts monastery in China and studied real hard for ten years. If my family was wiped out by Colombian drug dealers and I swore myself to revenge. If I got a fatal disease, had one year to live, and devoted it to wiping out street crime. If I just dropped out and devoted my life to being bad. — Neal Stephenson, Snow Crash

It’s tempting to think that I could become a badass diabetes mofo. (I would say “ninja,” but that title is already taken.) If I could go back into the hospital as an inpatient, start over again, and get the right basal rates while in the hospital. If I had the world’s most dedicated support team. If I had a CGM and all the time in the world to learn from its chirping and charting. If I spent five years and read every journal article and textbook about diabetes self-management.

But I can’t just put my life on hold, drop out, and hope that I could be the baddest PWD around. None of us with diabetes can really expect that. There’s just too much life to be lived to give it all over to avenging the wrongs our pancreases visited upon us. However, I can get better results than I have now, even if I can’t be the zen/kung fu master who parries away every blow from the Big Bad.

I certainly can’t do it all by myself — although I am stubborn enough to feel that with the skills and knowledge I already have I should be able to do a lot. The last week hasn’t been anywhere near perfect, but the little bit of info from the CGM trial has been good and helped me make some much needed changes. I’ve banished the NPH demon and started to get more confidence with larger bolus amounts. Now I feel like I have learned enough to ask dumb questions (i.e., questions I don’t know the answers to). Because it’s diabetes, when I get these questions answered, I’ll have a new set of questions to ask; but that’s progress, and I can live with it.

Here are my questions. If you have any pointers, tips, generalizable experience, or just plain-old speculation or advice, I would be happy to read it.

  1. How do you know when active insulin (a.k.a., “bolus on board” or “insulin on board”) matters for preventing lows or highs? If I ate three hours ago and have five units of active insulin, will my BG likely go up, go down, or stay the same?
  2. When should I add an extra bolus for protein or fat?
  3. What is the correct way to do a combination/dual-wave bolus? I’ve mostly been winging it, but I don’t know if it actually does any good.
  4. When should I bolus for meals? I’m way past bolusing afterward, but should it be right when I eat? (That seems unlikely.) 5 minutes before? 15? 30? Does “it depend” on the meal?

Any other sage advice for becoming a BAMF would be greatly appreciated and accepted with the greatest of humility and with full knowledge that my diabetes may behave differently than yours. And I promise to share more of what I learn along the way.

Posted in Diabetes, Life Lessons | 2 Comments


Speaking of rabbits and insulin . . .

Rabbit-shaped syringe cover

I’m not sure that this device — which is from an actual U.S. patent filing — would actually make children any more comfortable about getting injections. Or rabbits for that matter. Just saying.

Posted in Diabetes, General, Health Care | 2 Comments

Catching Up with Mr. Mather

Hey y’all. It’s Columbus day; and, yes, I am at work again.

I know it’s been a little quiet around here recently. There are a few reasons for that. (1) I’ve been really busy with swimming, bicycling, running, yard work, birthday celebrations, and visiting friends. (2) I’m doing something fun (to me) at the office, that’s taking a lot of my attention. (3) The camera club that I sometimes attend has restarted. It’s the same as it ever was. Evidently I am, too. (4) We went to Montréal this past weekend. (5) I’m trying to keep up more with my Twitter peeps. (6) I’m reading a lot, although I’m very slow at it. Most recently I’ve finished Ahmed Rashid’s Taliban, and I picked up The Discovery of Insulin by Michael Bliss just where I left it this spring, about a third of the way through. (More about each of those books later.) And (7) I have a boatload of things that I want to do.

Runners and dude roller-skiing in Mont-Royal park, Montreal

I’ve been having some interesting diabetes things going on. I finally finished annotating my CGMS data, matching the graph’s spikes and troughs with my food/exercise/insulin logbook. The data was all over the place — literally — but mostly high. I tried a few of the suggestions that my endocrinologist gave, with mixed results; but I have decided to focus on what I can observe myself and fix on my own: namely my basal rates. After making a couple small corrections and overnight tests, I’ve managed to wake up with almost exactly the same blood glucose readings as when I went to bed. And the last couple times that I’ve exercised in the afternoon have worked out very, very well. I’m steadily getting where I want to be.

Photo of a week's worth of CGM data

Of course, eating a multi-course meal at Le Keg on Saturday presented a new challenge: How exactly do you bolus for something that involves about 12oz of incredibly tasty New York strip sirloin — not to mention bread, a Caesar salad, pain au fromage, a (small) baked potato, veggies, and a chocolate brownie sundae? I did quite well for the first three hours after dinner — I had multiple readings in the 120s, which is almost perfect — but then I steadily climbed quite high over the next five hours. Somehow I need to figure out when I need to give extra insulin and then figure out how to give those additional 7.5 units* over the next four hours. It seems to me that I need extra practice!

Crêpe de framboises avec chocolat
Breakfast on the day after the feast

Until next time.

* — I learned while reading The Discovery of Insulin that a “unit” was the amount of insulin that would cause a healthy rabbit to go into hypoglycemic shock. Lisa and I have started talking about insulin in terms of “rabbits.”

Posted in Data-betes, Diabetes, General, Photography, Travel | 3 Comments

Bon Mots – Part 2

Since we’re going to Montréal this weekend, here’s another installment of some French words that were recently new to me. (You might be interested in the first part, too.) As always, if I have missed something subtle in their meaning, let me know.

  • tortpas correct
  • retraite — pension
  • parmi — among (“parmi ceux-ci . . .” = “among these . . .”)
  • la Toile — The Web/Internetz/etc.
  • mention — statement (masc. n.)
  • pouce — thumb
  • renverser — to overthrow
  • pari — gamble (masc. n.)
  • pas forcement — not necessarily
  • nulle part — nowhere
  • ailleurs — elsewhere
  • hors piste — backcountry
  • bourrée — stuffed
  • enregistrer — to save
  • majordome — butler
  • à la une — feature (as in “a featured story”)
  • tyrolienne — yodel (fem. n.)
  • se faire chier — to piss off, to annoy, to have a fucking nightmare, to be pissed off
  • la chiasse — the shits
  • chiant — boring
  • piéger — to trap, ensnare (“la France piégée par les vélos”)
  • les hirondelles — the swallows (birds)
  • locataire — tenant (fem.)
  • ado — teenager, adolescent
  • tache — stain (fem. n.)
  • honte — shame
  • crainte — fear
  • les orteils — toes
  • marée noire — oil slick
  • tricheur — cheater (masc.)
  • haubanlinceul, shroud
  • paroisse — parish
  • tiroir — drawer (as in “a desk drawer”)
Posted in Bon mots, From the Yellow Notepad, General | 1 Comment


So it’s my birthday. . . .

Posted in General | 3 Comments