Installation steps:
-
Make sure you have sbt (the default build tool for Scala) installed on your machine.
-
(Optional) To better read and modify the source code, a Scala IDE like Intellij IDEA is strongly recommended.
-
In the project root, open a terminal and type
sbt run
. After sbt have downloaded all project dependencies, it will print out all the detectedmain
functions and ask you whichmain
to run. To run the quickSort example described in the tutorial, choosesingularity.examples.QuickSort
. Results are saved intoresults-running
andresults
. See also Tutorial/Saving and Reading Patterns
(Note that to run other examples successfully, you might need to package everything into a Jar first, see step 4)
-
To run the set of Textbook algorithm examples described in the Singularity Paper, in the project root, type
sbt assembly
This will package everything into
target/scala-2.12/singularity-assembly-0.6.jar
, then typejava -cp target/scala-2.12/singularity-assembly-0.6.jar singularity.benchmarks.TextbookExamples
to start the 17 textbook algorithm examples described in section 7.1 of the Singularity paper. The additional packaging step is required in order to spawn multiple processes. By default, 8 subprocesses will run in parallel. You can change this number by setting
processNum
inTextbookExamples.main()
. As described in the tutorial, all results will be written intoresults-running
andresults
.In general, use
java -cp <path to the jar> <main class name>
to run other main classes that use a process pool. (only usingsbt run
will result in a classpath exception)