Modules and Utilities for HLSIM

Util1d.scm (by dder)

Library of support routines. Useful procedures such as color-me and make-sim/1, alternative make-sim routines to test gunk code with different processor distributions. Load the file after loading hlsim (might want to compile first for speed).
 

Interface.scm (by radhi)

More extensive utilities file. Interface functions for making a simulation object. Modified sim object to store the communication radius (simulation.get sim 'radius). Different types of layouts (random, smoothed, hex, rectangular). Functions for saving and reusing the same layout (for experiments, debugging). Functions for Display management, color-me routines, and drawing list of processors Utilities such as nbrhood size to comm radius conversions, find-nearest-processor, compute-nbrhood-stats, pi, etc. Several functions copied from dder's utils. Load the file after loading hlsim (might want to compile first for speed).
 

Comms.scm and Queue.scm (by newts)

Turns off collisions. The files override the hlsim communications model and prevent messages from being lost. Messages are stored in a queue - no message is ever lost and no collisions are generated. This is all invisible to the user and the message interface is the same as before . Copy the files and compile for speed ( (cf "queue") (cf "comms4.scm"), make sure to run scheme with the -compiler option). Again load after hlsim is loaded.
 

Gradients.scm (by radhi)

This is a module for implementing gradients at a low level within hlsim. Gradients are easy to implement well even at a high level but because they are message intensive, they use up alot of memory and slow things down considerably to the point where it is difficult to implement any higher level ideas on top of gradients. This file implements gradients that travel the whole sheet, count up away from the source, and the event is delivered to all porcessors at the same time. None of these characteristics are difficult to change. See comments in the scheme file. Also look at this file if you are interested in writing your own modules. Use gradients-multiple.scm if you need to create gradients with multiple sources (such as a line of processor creating a gradient in GPL), but read the comments in the file first.

To Use: Compile the file and load after loading hlsim. You need to create your own init file to define the processor interface. This file must be loaded as is, i.e. it is already cps converted by hand and it MUST end with the lambda statement (see documentation on creating cheat procedures).

my-init.scm:
(define (create-gradient cont fuel store name)
        (%create-gradient cont fuel store name))
;;--file must end in---
(lambda (cont fuel store) (cont unspecific fuel store))
Within the processor's program you must include:
(define gradient-event (make-event))
To create a gradient named g1 call (create-gradient 'g1)
Processors receive an event called gradient-event, with the value
('g1 integer-gradient-value smoothed-fp-gradient-value).
To load your program
(simulation.load 'init "my-init.scm" "your-gunk-program")
 


Other tips and hlsim idiosync:

Make sure you have a big enough heap (memory) size.
In emacs,
C-u M-x run-scheme
scheme -compiler -heap 8000

For large simulations reset the *STORE-SIZE* for hlsim. In fact if the store size is too small hlsim gives you a warning and recommends a higher size. Default is 20, largest I've used is 100.

Hlsim may not work with Scmutils. Scmutils allows case sensitive variables, as a result define-structure no longer works correctly is any of the elemnts use capital letters. This bug hits hlsim. May be fixed in the future.