Swarm command-line interface

Swarm executable is a command line user interface to Swarm-NG package.

Swarm executable can be used to accomplish different tasks:

Command-line interface

Usage:
 	swarm [options] COMMAND [PARAMETER VALUE VALUE ...]

Possible commands are: 
	integrate :  Integrate a [loaded|generated] ensemble
	benchmark :  Compare outputs for different methods of integrations
	verify    :  Verify an integrator against a reference integrator
	query     :  Query data from a log file
	test      :  Test a configuration against input/output files
	generate  :  Generate a new ensemble and save it to output file
	convert   :  Read input file and write it to output file (converts to/from text)

Options:

General Options:
  -c [ --cfg ] arg      Integrator configuration file
  --defaults            Use default values for required configuration options
  -h [ --help ]         produce help message
  -p [ --plugins ]      list all of the plugins
  -v [ --verbose ] arg  Verbosity level (debug output) 
  -q [ --quiet ]        Suppress all the notifications (for CSV generation)

Integation Options:
  -d [ --destination_time ] arg Destination time to achieve
  -l [ --logarithmic ] arg      Produce times in logarithmic scale
  -n [ --interval ] arg         Energy test intervals
  -i [ --input ] arg            Input file
  -o [ --output ] arg           Output file
  -I [ --text_input ] arg       Text Input file
  -O [ --text_output ] arg      Text Output file

Benchmark Options:
  --range arg           Parameter value range param=v1,v2,v3

Query Options:
  -t [ --time ] arg     range of times to query
  -s [ --system ] arg   range of systems to query
  -b [ --body ] arg     range of bodies to query
  -k [ --keplerian ]    output in Keplerian coordinates
  --astrocentric        output coordinates in astrocentric frame
  --barycentric         output coordinates in barycentric frame
  --origin              output coordinates in origin frame [default w/ 
                        Cartesian]
  --jacobi              output coordinates in Jacobi frame [default w/ 
                        Keplerian]
  -f [ --logfile ] arg  the log file to query

Typical use of swarm requires a command followed by several options and parameters specific to the command. There are some options that are general to all commands, but most options are only valid with specific commands.

General Options

Following options are interpreted by swarm regardless of the command used.

integrate: General purpose integration

Reads an ensemble from a file (Generates one if no input file specified) and integrates it. Statistical information about time progress and energy conservation will be written to output in specified intervals. The resulting ensemble is saved to a file if an output file is specified.

Examples:

swarm integrate -c test.cfg

swarm integrate -c conf1.cfg -d 100 -i INPUT.bin -o OUTPUT.bin

swarm integrate -c conf2.cfg -d 100 -n 10 -I INPUT.txt -O OUTPUT.txt

benchmark: Stress test and Stability test for integrators

Put integrators under stress test and compare the timing and stability of different integration scenarios.

Benchmark requires a parameter name to iterate over and values for the parameter. Values can be listed in the command line or can be specified using from, to, inc switches for looping over numerical values.

Parameter name should be a valid configuration parameter. In the current version, any parameter can be iterated over, however some parameters should not be iterated over this behavior might change in future versions.

Paramaters that are usually used for benchmark are:

Options

You have to define a range for benchmarking using --range switch. The parameter to range can be in one of these three forms

Examples:

Performs a stress test for a specific integration scenario using generated systems
swarm benchmark -c conf.cfg --range nsys=4000,8000,16000,32000

Integrate an ensemble stored in text format in testcase.txt using three different integrators and compare the time and stability.

swarm benchmark -c base.cfg -I testcase.txt --range integrator=hermite,rkck_fixed

Compare 3 completely different integration scenarios stored in 3 different files using the same test data.

swarm benchmark -I testcase.txt config=case1.cfg,case2.cfg,case3.cfg

Strees test for different number of bodies ranging from 3 to 9.

swarm benchmark -c conf.cfg nbod=3..9

Strees test for different number of systems ranging from 3000 to 9000 by the increment of 1000.

swarm benchmark -c conf.cfg nsys=3000..1000..9000
It will run for number of systems equal to 3000, 4000, 5000, 6000, 7000, 8000, 9000.

verify: Verifying correctness

Integrate ensembles in different scenarios and compare the results to a reference implementation.

First, the ensemble is integrated using the base configuration. The resulting ensemble is then used as reference ensemble. Then the different scenarios are executed and after each integration scenario the result is compared to reference ensemble. Positions and velocitios of each body is compared to corresponding body in the reference ensemble. Time of the corresponding systems should be close enough. The difference between values can be tolerated up to certain user-controlled threshold.

To use different scenarios, you can use the same syntax as benchmark command. While you can iterate over any parameter, it is recommended to iterate only over integrators and configurations.

Configuration Options

These options should be specified in the base configuration:

Examples:

Provided that basecpu.cfg contains all the configurations for hermite, euler and verlet integrators and integrator is set to a CPU integrator, the following line verifies the correctness of hermite, euler and verlet integrators versus a CPU implementation using data from testcase.txt
swarm benchmark -c basecpu.cfg -I testcase.txt integrator=hermite,rkck_fixed

query: Examine log files

Tests and Benchmarks

Used for inetgrity testing of swarm. Similar to verify but compares the results to a pre-calculated ensemble.

Overview

Options and execution is similar to integrate command. After the integration, the output file is loaded and is compared to the result of integration. The test is passed if the difference in time, positions and velocities is less than the user-controllable thresholds. cf. Configuration Options

Examples:

First Step: On machine A, generate the output file using a specific integration scenario:
MachineA$ swarm integrate -c integ.cfg -I testinput.txt -O testoutput.txt
Second Step: Copy all files to machine B, build swarm and test the same integration scenario using:
MachineB$ swarm test -c integ.cfg -I testinput.txt -O testoutput.txt && echo "Test Passed!"

generate: Generate stable ensemble for tests

Generate a stable ensemble for stability tests.

Options

Configuration Options:

Examples:

Generate an ensemble with 12000 systems consisting of 4 bodies each. Put two lines in generate.cfg:
nsys=12000
nbod=4
Generate the ensamble using swarm generate
swarm generate -c generate.cfg -o ensemble.bin

convert: Convert I/O formats

Convert text files to binary files and vice versa.

Options

Convert text to binary

Convert binary to text

Examples

Convert text file to binary
swarm convert -I my.txt -o my.bin

Convert binary file to text

swarm convert -i my.bin -O my.txt

doxygen