Fortress is a new language in development from Sun Research. It was
one of the three participants in the DOD’s HPCS project (Cray’s Chapel and
IBM’s X10 were the other two.) They’ve recently open-sourced their
interpreter. Quoting an article I just read,
Fortress is designed to be a modern replacement for Fortran, a
programming language born 50 years ago at IBM but still very popular
for high-performance computing tasks such as forecasting the weather.
Out of curiosity, I checked out some of the presentations given by
people involved in the project. Though Fortress is meant to be a
general purpose language, I’m mostly interested in the use of this
language for numerical computing. I’ll try to describe the three big
features that caught my eye:
- Notation is closer to math
- Use of units in data types
- Mapping data types to regions
Math notation
They’ve tried to keep the code syntax as close as possible to math
notation. If you’ve ever read something like Numerical Recipes,
you’d realize that it takes a lot of effort to “translate” the
mathematical description of the algorithm to the prescribed source
code. Try the conjugate gradient section sometime — it’ll make you
throw up.
For example, the union between two sets
is
written in code as A UNION {1,2,3,4}. The factorial function
is written in code as
f(n) = PRODUCT[i <- 1:n] i.
Units in data types
It’s quite common in numerical code to scale units so that operations
are done on numbers of the same magnitude. This helps prevent
operations where you have to divide a really small number by a really
large number. For example, in molecular dynamics, the units used for
acceleration are typically angstrom-per-femtosecond-squared. After a
while, keeping account of the units becomes a nightmare.
Fortress lets you attach units to the data types. Types are statically
checked for correctness. This should make physicists very happy as
dimensional analysis is done automatically.
Regions and distributions

Every object in Fortress has an associated region. Regions describe
the hierarchical structure of memory and CPU resources (see the above
picture.) Distributions are used to describe the parallel structure of
data. For example, the same array can be mapped either to multiple
cores of a single CPU, or over multiple nodes using
distributions. Thus, the distributions assign data to a region.
This is really cool because this separates data distribution from
program correctness. Right now, a physicist must also know a fair bit
of computer architecture and performance tuning in order to write
decent programs. At Supercomputing 05, the guys who had won the
Gordon Bell prize spent a significant amount of time trying out
different ways to distribute data. Each time a new scheme was to be
tried, large chunks of their code had to be re-written.
In conclusion, these guys have come up with some impressive
technology. Let’s see how this changes the way we program numerical
code. Until then, check out the presentations, papers and talks at
their website.