HTML automatically generated with rman
Table of Contents


treecode2 - fortran version of hackcode, with Cray optimizations and no recursion




treecode2 is the Hernquist version (Version 2, November 1988) of the Barnes and Hut treecode (see also hackcode1(1NEMO) . This version is written in fortran, has been optimized for supercomputers and is fully vectorized, no recursion used. See the file treecode.f for many more details.

Computational units can be anything, but the gravitational constant G=1.


Two files (both in ascii) determine the input parameters and input condition, and must be present at the start of the program.

The first one is the input parameter file with the name TREEPAR. It contains, line by line, the input parameters for this run. In the table below the values for the benchmark input parameter file are given in square brackets:

     headline      Identification string for the run (max 50 char) [standard NEMO
     nsteps        Number of timesteps [64]
     noutbod       Output system state (file TREEBOA) once every nsteps/noutbod
steps [100]
     noutlog       Output logfile data (file TREELOG) once every nsteps/noutlog
steps [1]
     dtime         Integration timestep [0.03125]
     tol             Error tolerance; 0.0=exact [1.0]
     eps          Potential softening parameter [0.05]
     usequad       Option to include quadrupole terms (.TRUE./.FALSE.) [.FALSE.]

The second file has to be named TREEBI, and contains the input bodies in a format described in stoa(1NEMO) .

Output files created are TREEBOA, which contains all the requested (see noutbod) output snapshots in ascii atos(1NEMO) format, TREELOG, which contains a log (see noutlog) of the run and TREEBO, which contains a binary (machine dependable) dump of the last snapshot. Note that these three output files must not be present when the program is to be run. (ANSI FORTRAN)

To avoid excessive overhead, noutlog should be larger than 1, typically ~ 10, depending on total number of steps though.


A shell script runtreecode2 is available to ease running this program slightly, and also prevents you from running two versions of treecode2 in the same directory. Script usage:

runtreecode2 input_snapshot output_snapshot pars_file

The input_snapshot and output_snapshot are now in snapshot(5NEMO) format, whereas the pars_file is in the format described in the previous PARAMETERS section.

A regular NEMO program treecode0 can also be used. Although very similar in operation to the abovementioned script, it makes running multiple versions of the programs a bit more transparant, and equal to running other programs in the NEMO environment.


The accompanying Makefile has targets to compile treecode2 on the Cray, Sun and Vax, by appropiately defining the OS= macro in the Makefile, as well as running benchmarks within NEMO’s environment. See Makefile for details.


Timings from the running the standard benchmark (see also hackcode1(1NEMO) from the makefile (cpu times are in seconds):
machine     cpu    compiler    OS
Cray YMP    1.625    cf77 -dp    Unicos ...
SGI         8.5    f77 -O3         IRIX Release 4.0.5F System V    
SGI         11.9    f77 -O         IRIX Release 4.0.5F System V    
Sparc 10/30    9.3    f77 -cg89 -dalign -fast -O    SUN OS 4.1.3 - SC1.0
Sparc 10/30    8.6    f77 -cg92 -dalign -fast -O    SUN OS 4.1.3 - SC2.0.1
Sparc 10/30    8.0    f77 -cg92 -dalign -fast -O4 -libmil    SUN OS 4.1.3 - SC2.0.1
Sparc 10/51    6.6    f77 -cg92 -dalign -fast -O4 -libmil    SUN OS 5.3 - SC2.0.1
Sparc 1 (4/60)    68.5    f77 -O          SUN OS 4.1.3 - SC1.0
Sparc 1 (4/60)    56.2    f77 -cg89 -dalign -fast -O    SUN OS 4.1.3 - SC1.0
Sun 3/60    1784.0    f77 -O         SUN OS 4.1.1 - SC1.0


Lars Hernquist


~/usr/lars/treecode2/            original LARS version
~/src/nbody/evolve/treecode2/    official NEMO version (ASCII atos/stoa I/O)

See Also

hackcode1(1NEMO) , treecode(1NEMO) , nbody0(1NEMO) , atos(1NEMO) , tabtos(1NEMO)


xx-xxx-xx    V2 allows quadrupole terms    Lars Hernquist (@UCB)
xx-xxx-xx    V2.1 optimized 2D and 3D versions of the code    LH
1-sep-86    V2.2 allow arbitrary large values of tol=    LH
18-nov-88    ’V2’ non-recursive vectorized version             LH (@IAS)
xx-apr-90    Directory made for NEMO’s export               PJT
5-jun-90    Document created                            PJT
23-oct-91    Cray tests - disabled SECOND in treeutil.f    PJT
15-apr-94    added benchmark docs                        PJT

Table of Contents