The parameters of the application are these:
Usage: <main class> [options]
Options:
--help
-debug
Debug mode
Default: false
-guiEnabled
GUI or command line app
Default: false
-nBodies
Number of bodies
Default: 0
-nSteps
Steps of the simulation
Default: 0
-nWorkers
Number of threads to use
Default: 0
An example, after running the shadow jar task of Gradle, is the following:
java -jar build/libs/BodiesSimulation-1.0-all.jar -nSteps 20000 -nBodies 1000 -nWorkers 4 -guiEnabled
If using java 8 jpf-core is already included with its jar in this repo. To run JPF on the simulation just execute:
java -jar jpf-core/build/RunJPF.jar +classpath=build/classes/java/main/ TestBodiesSimulation.jpf
Otherwise with docker on a Unix-like system:
-
docker pull gianlucaaguzzi/pcd-jpf:latest
-
docker run -v $(pwd):/home -it gianlucaaguzzi/pcd-jpf:latest /bin/bash
-
Then in the interactive shell:
java -jar $JPF ./your/path/to/file.jpf
The dockerfile is hosted here.
My result, with 2 steps, 2 bodies and 2 workers
JavaPathfinder core system v8.0 (rev 121f36476db0a420769058fa7ce56554cb6869c7) - (C) 2005-2014 United States Government. All rights reserved. ====================================================== system under test jpf.SimLauncher.main() ====================================================== search started: 4/10/22 1:13 PM ====================================================== results no errors detected ====================================================== statistics elapsed time: 00:03:05 states: new=1360601,visited=2859696,backtracked=4220297,end=1496 search: maxDepth=752,constraints=0 choice generators: thread=1360601 (signal=77039,lock=315586,sharedRef=839138,threadApi=2858,reschedule=76600), data=0 heap: new=313984,released=431170,maxLive=563,gcCycles=3577726 instructions: 44901131 max memory: 673MB loaded code: classes=107,methods=2202 ====================================================== search finished: 4/10/22 1:16 PM
-
To get a csv under
build/libs
with the execution time of the simulation in milliseconds:./perf_eval.sh build/libs/BodiesSimulation-1.0-all.jar <nSteps> <nBodies> <nTries>
-
To generate the graphs of speedup in a python venv using matplotlib:
python3 -m venv .venv
,source .venv/bin/activate
,pip install -r requirements.txt
,python3 plot_speedup.py <input_csv_filename>
.