Sandia Home

APPSPACK Configuration and Examples for Serial Mode

APPSPACK Configuration and Examples for Serial Mode

APPSPACK has a serial executable and library. This is not the preferred method of running APPSPACK, but it is useful for debugging purposes. The library may be used as part of a custom communication interface, see Using the Serial APPSPACK Library with a Custom Communication Interface.

Configuring and Compiling APPSPACK in Serial Mode

Go to the directory where you have installed APPSPACK, run the configuration tool, and compile the code.
cd appspack
./configure
make

This will create the following:

  • src/appspack - the default executable
  • src/libappspack.a - the default library that can be linked with larger codes
  • examples/example1 - a simple example executable

Using the Serial Version of APPSPACK

Try a simple example as follows.
cd appspack/examples
../src/appspack example1.apps

Serial.gif

APPSPACK in Serial Mode

In serial mode, APPSPACK executes only one simulation at a time.

Format of the APPSPACK Input File

The APPSPACK input file, example1.apps, may be adapted to your own application. It is formatted as follows.

executable = example1
n_parameters = 2
initial_point = 0.2 0.3
lower_bounds = -1 -1
upper_bounds = 1 1
scale = 1 1
params_prefix = /tmp/example1_input
result_prefix = /tmp/example1_output

The order of the parameters is important. The are described as follows.

  • executable - name of the executable file (use the full path if there are any problems)
  • n_parameters - number of parameters to be varied
  • lower_bounds - lower bounds on each parameter
  • upper_bounds - upper bounds on each parameter
  • scale - scale of each parameter; ideally each parameter is O(1)
  • params_prefix - prefix to the input file that will be fed to the executable
  • result_prefix - prefix of the output file that will be created by the executable

Communicating with a Simulation Via File I/O

Simulations are executed via a C stdlib system() call. In this example, the simulation is executed by the program example1 (specified by executable in the APPSPACK input file). APPSPACK communicates with the simulation via input and ouput files.

Specifically, before writing each simulation, APPSPACK writes a file named something like /tmp/example1_input.000_032. In this case the globally unique id, or GUID, is the 000_032. This changes for each execution of the simulation code. The prefix, /tmp/example1_input, is specified by params_prefix in the APPSPACK input file.

An example parameter file is formatted as follows.

2
4.88281e-05
0.000195312

The first line indicated the number of parameters, and the paramters are then listed, one per line.

The simulator will then execute the simulation via the following command

example1 /tmp/example1_input.000_032 /tmp/example1_output.000_032

The simulation itself is expected to read in the file /tmp/example1_input.000_032 and output the file /tmp/example1_output.000_032.

Finally, APPSPACK will read the resulting output file, which should contain a single value. For example,

6.375000e-02

Using the Serial APPSPACK Library with a Custom Communication Interface

Coming soon.
Generated on Mon Oct 27 15:14:48 2003 for APPSPACK by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2002


© Sandia Corporation | Site Contact | Privacy and Security