I was away on my travels last week, so I missed the first Code Coffee of the new term here in Oxford. Joe Zuntz was present to officiate, though, and led a discussion (allegedly) for the benefit of our new doctoral students, who’d just arrived at that point. The result was a collection of “one-line guides” on getting started with astrophysics-style computing and programming, which I’ve copied below. (Be warned: It’s a little Oxford-specific in parts.)
Getting help
Answering Questions
- StackOverflow website for asking questions
- IRC channels – freenode – for open source projects
Training
- Software Carpentry website
- OUCS training (wide range of IT courses)
- OERC training (mostly supercomputing and parallel computing)
Don’t code maths!
- Linear Algebra: (Scala-)Lapack/BLAS veclib on a Mac, or Intel Math Kernel Library (MKL). GNU Science Library (GSL), DOE Libraries, NAG libraries.
- Fourier Transforms: FFTW/MKL. Make your arrays length 2^n * 3^m * … (few small prime factors).
Numerical Methods
- Numerical Recipes: Read (for free online), but don’t use the code. The C version has messed up array indices.
- Netlib: Website with collection of old scientific/maths code. Mostly F77. e.g. slatec.
- slalib: Positional astronomy library, for dealing with astronomical coordinates and times.
General coding advice
Files
- Don’t invent your own file formats.
- FITS tables are not a great format. Consider using HDF instead.
Compilers
- GNU: gcc, g++, gfortran (freely-available, cross-platform)
- Intel: icc, ifort (tend to be faster for some applications)
- Avoid mixing Intel/GNU compilers, and different versions of the compilers, when using Fortran. The compiled Fortran modules that are produced may not be compatible between different versions.
Best Practices
- Software carpentry
- Best practices paper (for what it’s worth, I think following all of this advice would be a bit too ambitious for a good many astro projects…)
October 18th, 2012 at 8:59 am
“Avoid mixing Intel/GNU compilers, and different versions of the compilers, when using Fortran. The compiled Fortran modules that are produced may not be compatible between different versions.”
Surely this advice should be much more general, i.e. the expectation should be that everything should be compiled with the same compiler (except on VMS of course where, with the DEC compilers and linker, it is common to use several programming languages in one executable).
October 18th, 2012 at 5:13 pm
Yes, you’re right – unless you start compiling bits of code as libraries, in which case there should be compatibility between different compilers.