Archive for June, 2007

Symbolic Math

Posted in Computing 1 year, 1 month ago

One of my colleagues in the lab finds the symbolic program Mathematica indispensable. I’ve heard similar stories about Mathematica from some of my other friends. Canadian universities tend to prefer Maple over Mathematica, so I’ve never had a chance to try it out (Maple is built by a Canadian company so maybe they also get a discount.)

The only other symbolic program I’m familiar with is Maxima. Infact, I wrote a whole introduction to Maxima many years ago, much of it now obsolete.

While reading some reviews about the newly released Mathematica 6.0, I came across a post on the wolfram blog showcasing many of the new features. One particular post that I found very useful is the visualization of various abstract features in Mathematica. I’ve taken two examples: Map and Expand. For others, read the whole post.

Map

Expand

This is really awesome. As a numerical practitioner, implementing numerical algorithms requires a context switch from a mathematician to a computer scientist. There are numerous ways to implement the same mathematical operation, not all of them equivalent (arising from the non-associative property of floating point numbers.) For example, for differentiation alone, there’s forward, backward and central differences amongst other schemes.

Another advantage of using symbolic languages is that it’s really easy to do Common Subexpression Elimination on analytical expressions. I had previously written about the special case of diffusion tensors. A particular framework for dealing with such objects is the Log-Euclidean framework. One method of computing the exponential of a matrix (one of the many described in this publication) takes about forty minutes on an image. It would be nice to eliminate places where Logs and Exps are done consecutively to save some time and improve accuracy.

I have another idea about mixing symbolic and numerical code, which I’ll write about soon.

IA-64, IA-32, x86_64

Posted in Computing 1 year, 1 month ago

One of the steps in my everyday workflow is pretty compute expensive. Clusters aren’t really meant for the kind of data intensive tasks that medical imaging deals with, so all of our machines are single image ones. I have my dual processor ia32 desktop, two ia64 SGI Altix machines, and a custom built x86_64 SMP machine with about 40 cores.

As I wrote in my previous post, the script that I ported to python is pretty smart (or so I thought.) It automatically detects the kind of architecture (using uname) and launches the appropriate binary. Though everything is backward compatible in theory, running ia32 code on the ia64 architecture is about 15 times slower.

Here’s a problem I have no solution to (this is on a ia64 machine):

> uname -p
ia64
> python
>>> import commands
>>> commands.getstatusoutput ("uname -p")
(0, 'i686')

Switching to Python

Posted in Computing 1 year, 1 month ago

Though BASH has served my scripting needs for many years, I’m finding the various limitations of the language quite frustrating. For example, just last week, I was trying to do some string processing. I know this should be trivial to someone who knows cut, sed and and other textutils, but that someone isn’t me. The various types of quotes, no spaces before equal signs for declaring variables and other subtle details kept slowing me down.

It was time for a real language.

I’ve tried countless times before to bring python into my set of everyday skills. Two major issues kept taking me back into the world of bash:

  • The use of indentation for logic. When I write C/C++/Java code, I hardly look at the screen. I just go on typing code (like writing poetry) and then press C-c C-q to auto-indent the current region. At the same time I press C-c C-c to start compilation within emacs so that I can look at compilation errors right in the edit window. It’s only after the above two steps that I actually look at what I’ve written. The use of curly braces is part of my thought process.

  • Poor support for python out-of-the-box in emacs. Pressing Tab doesn’t take you to the right level of indentation (maybe because there isn’t a “right” level of indentation?) This has drastically improved in recent versions.

On the other hand, it wasn’t very smart to ignore something with so many potential advantages. In my few days with python, I was amazed to see the breadth and quality of the available libraries. All the way from web frameworks, numerical libraries, scientific plotting, imaging, MPI and distributed libraries to even parsing C++ code. There are also wrappers for almost every imaginable C/C++ library out there (ITK, VTK, ODE, SDL, …)

I decided to go cold turkey and port one of my glue scripts at my day job from bash to python. Once I had gotten over my initial wall of skepticism, I found the ride easy and actually enjoyable. Ofcourse, every time I hit a road block, google has always come to the rescue. I haven’t learnt to use any of the advanced feature of python yet, but I’m sufficiently satisfied with my progress thus far.

I’ll be detailing my experiences with python in the next few weeks.

Fight with spam

Posted in Web 1 year, 1 month ago

In the few months that this blog has been running, akismet (”the collaborative effort to make spam a non-issue”) has caught about 4000 spam comments.

Retard Captcha

Most sites use CAPTCHA to determine legitimate users. A friend recently told me about a new method that spammers are using to circumvent CAPTCHA. A site with high demand content (like free music or porn) harvests CAPCTCHA on demand from another site and displays it to a user. The user is able to decode the text and types in the correct text, which in turn is used to spam the site where the CAPTCHA is taken from.

This is incredible.

A more useful version of this technique is reCAPTCHA. Instead of posting spam, the user is presented with words from a book that is currently being digitized, some of it correctly recognized by software and some incorrectly. This is compared with what others have typed in, and if correct, your comment is posted and the words added back to the database.

I’m trying to figure out if the evil way or the good way was thought of first. I’m guessing evil.

Nvidia Tesla

Posted in Computing 1 year, 2 months ago

Nvidia is coming out a massively multi-threaded GPU based architecture. Each GPU will have 128 processors per core providing upto 500 gigaflops of performance. Multiples of these can be connected to a host via PCI Express for more power. Their server solution at the high end gives you 2 teraflops peak performance.

Some selling points:

  • Industry’s first massively multi-threaded architecture with a 128-processor computing core
  • World’s only C-language development environment for the GPU
  • A suite of developer tools (C-compiler, debugger, performance profiler, optimized libraries)
  • Largest ISV development community for GPU Computing applications
  • Seamlessly able to fit into existing HPC environments

One of the white papers available on Nvidia’s website claims a 240X performance increase for the molecular dynamics program NAMD.

If you’re interested in this kind of stuff, gpgpu is a good place to check.