[gambit-list] optimizing computer simulations of the Ising model

Bradley Lucier lucier at math.purdue.edu
Wed Feb 25 14:02:20 EST 2009


The purpose of the code may be obvious to you, but I can't tell what you
want to do (even knowing roughly what the Ising model is, and after
looking at the wikipedia page you pointed to).

Some advice:

1.  If you're going to use something again and again, don't recompute
it, compute it once and save it.  It appears that helical-neighbors is
computed over and over again.  In accept-flip you compute (energy-jump/J
grid site) twice if it turns out to be positive.  You can use (time ...)
to get information about how much stuff is consed, etc.

2.  If you can avoid arithmetic between exact (integer, rational)
numbers and inexact (floating-point) numbers, do so.  And if you know
that computations or comparisons are between fixnums, use the fixnum
operations fx+, fx<, ...; if you know that certain operations apply only
to flonums use fl+, ...

3.  If you've done the things above, then declaring
(standard-bindings)(extended-bindings)(block)(not safe) will help (but
not before doing those things).

4.  If you've done all *those* things, then don't use -O2 (the options
that Gambit chooses at configuration time are almost always faster,
especially for gcc) and if "-march=native" helps, then use it at
configuration time.

Brad




More information about the Gambit-list mailing list