Sunday, April 27, 2008

Interview with Donald Knuth

I've seen [this interview with Donald Knuth](http://www.informit.com/articles/article.aspx?p=1193856) linked a few times, and I also found it very interesting. In particular, I found it interesting that he:

- uses EMACS/TeX -- after writing everything by hand.
- does not particularly care for unit tests
- is a big fan of (i.e., invented) [Literate programming](http://www.literateprogramming.com/)
- is not a big fan of multicore processing (he does note, however, that physics and biology as exceptions where multicore programming makes sense..)

I have to admit, that I am on his side in terms of the unit testing and literate programming issues. I find that my biggest chalange in programming is not getting the code right (i.e., unit tests), but rather designing the way the function/class will behave for the user. Writing down what you expect the program to do in different cases (i.e., the API documentation) seems to be the best way to write a good, solid program.

Monday, April 14, 2008

NetCDF build notes for Mac OS 10.5 with ifort and gfortran

I have recently written down the steps I needed to build netcdf3, hdf5, and netcdf4 on my Mac using both ifort and [gfortran](http://r.research.att.com/tools/). Details follow

Python build script for roms

I wrote a build script for ROMS in python based on some of the other build scripts (in bash and Cshell) I have seen. The usage is as follows:

Create a directory with a header file called case_name.h in it. This should have the CPP defs for your particular case. Then run the build script like this:

build-roms.py case_name

Options, as seen from the help are:

-h, --help Print this message

--fort=[ifort] Specify fortran compiler
--netcdf=[4, 3] Version of NetCDF to use [default is NetCDF4]
-j=n Parallel make [n = number of procs, default is 4]

--mpi Compile using mpi
--clean Delete Build scratch directory before build
--debug Compile in debug mode
--root Specify ROMS_ROOT_DIR

This script creates a Build directory in the local directory, where the actual compilation happens. Analytical things can be defined in an optional Functionals directory, just like with the other build scripts. To see the script, continue...