README.lp-io.txt 2.08 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
LP-IO
-----

LP-IO is a simple API for writing data collectively from a ROSS simulation.
It is best suited for relatively compact final statistics from each LP 
rather than for ongoing event logging.  

API
---

lp_io_prepare(): call before tw_run as a collective operation.  This 
prepares a directory to hold the simulation results.  If the
LP_IO_UNIQ_SUFFIX flag is specified, the lp-io will append a unique
identifier to the specified directory name based on the rank 0 pid and
the current unix time.

lp_io_write(): call at any time during the simulation itself (i.e. in an
event handler or in the lp finalize() function).  This is not a collective
call.  The caller must specify a string identifier (which will become a file
within the output directory) as well as the buffer and size to write.

NOTES on identifiers:
- Each LP can use as many identifiers as it wants to.
- Identifiers do not have to be coordinated across LPs.  For example, some
  LP types may use "lpdata1" and others may use "lpdata2", while others
  don't write data at all.
- Each identifier can be written to as many times as needed.  It just
  appends additional data on each write call.

lp_io_flush(): call after tw_run as a collective operation.  This will
aggregate all data written by the simulation with lp_io_write() calls and
store data in the output directory using collective write operations.

Example:
--------
See lp-io-test.  

To run sequentially: "./lp-io-test --sync=1"

To run in parallel: "mpiexec -n 8 ./lp-io-test --sync=2"

This example will generate two output files.  The output files are in text
format so that you can view them with "cat" or a text editor.

Limitations:
---------
- The code allocates a copy of all memory buffers.
- The aggregation could be optimized further.  Right now it includes a O(N)
  step to construct a global list of identifiers used by the model.
- There is a fixed (but arbitrary) limit on identifier string length and on 
  the total number of identifiers used by the simulation.  This was done to
  simplify the implementation rather than to address any particular resource
  limitation.