Tuesday, May 27, 2008

Python, the future of scientific computing?

I said on my last post I really like python too. Python is an incredibly easy language to program in named after Monty Python. :)

CERN is porting all (almost all) their software to python and several other scientific communities are doing the same thing. Why?
  1. Python was originally designed to work side by side with C and C++. (See below.)
  2. It's so simple, it requires only 1/6 the amount of code that C/C++ do.
  3. It is fast doing typical scientific computations. With the numPy libraries, numerical computations are comparable with C.
  4. Python is actively developed and getting faster. In fact a new compiler named PyPy is being developed with a goal of making python as fast as C.
  5. SciPy is feature rich, giving python as much built in scientific functionality as matlab.
  6. Python has great multi-threading capibilities.
  7. It has automatic garbage collection. (It handles memory issues for you.)
  8. Runs off a virtual machine. (Compiles on one machine, compiles on them all!)
  9. It's free, cross platform and all the rage in open source development. Ubuntu and Fedora consider being able to code in python as one of their top desired talents.
  10. Python unlike FORTRAN doesn't keep you locked in to only being able to do numerical stuff.
Well, I am not so naive as to think python will ever be as fast as C/C++. (It's a scripting language.)

However, I'll tell you why I think it could be the future. First, a good python programmer will always have fast code. Currently, what you do is write the computationally difficult routines in C/C++ and the rest in python. (Python was built for this.) Python is so easy to code in it really accelerates your coding without sacrificing computational speed.

However, as many aspects of python get faster, you can begin replacing more and more C/C++ code with python. Hence, your coding speed will continue to improve without sacrificing computational performance.

One school of thought is that it is fastest to first program everything in python. Then you can convert the computationally intense stuff to C/C++ faster than you could have done programming completely in C/C++ from the start. In the end your code is just as fast and you've save lots of time and headache coding.

Like everything, I could be wrong, but more and more I think python is going to work side by side with C/C++ replacing more and more of it as the years go on. As it does, it becomes the language of choice.

1 comment:

  1. Fortran was, is and will be the future of scientific computing/HPC


To add a link to text:
<a href="URL">Text</a>