object Main extends App
Scala-Par-AM is a modified version of Scala-AM with the goal to study the parallelization of abstract interpretation, focused on analysis of Scheme programs. Some unused parts of Scala-AM have been removed. The essential parts are in the machine/ sub-directory.
This main program executes some abstract machines on some Scheme programs depending of some parameters and print results in TSV format (data separated by tabulation).
Run with --help
command line parameter to show all options:
$ java -jar scala-par-am.jar --help
Or directly with the shell script that also set some JVM configurations:
$ ./scala-par-am.sh --help
This example:
$ ./scala-par-am.sh --files "Scheme-examples/OPi/factorial*.scm" --machines SeqAAMLS,ParAAMLSAPart,ParAAMCPart --processes 1,4,2runs on files that match the "Scheme-examples/OPi/factorial*.scm" path with machine SeqAAMLS on 1 process, with machine ParAAMLSAPart on 4 and 2 processes, and with machine ParAAMCPart with 1, 4 and 2 processes.
scala-par-am.jar can be downloaded directly https://bitbucket.org/OPiMedia/scala-par-am/downloads/
scala-am.jar must be accessible in the classpath to use oldAAM machine. Download it if necessary: https://bitbucket.org/OPiMedia/scala-am/downloads/
Depending of command line parameters, for each lattice specified, for each bound, for each address, for each file Scheme program, for default step and/or step with filter, for each machine and for each number of processes this program do the following:
1. The input Scheme program is parsed. It is done by:
- Parsing the file as a list of s-expressions (exp/SExp.scala, exp/SExpParser.scala)
- Compiling these s-expressions into Scheme expressions (exp/scheme/Scheme.scala)
2. To run the program, we need an abstract machine and some semantics. Semantics definitions have to implement the Semantics interface (semantics/Semantics.scala).
3. Once the abstract machine is created and we have a semantics for the program we want to analyze, the abstract machine can perform its evaluation, relying on methods of the semantics class to know how to evaluate expressions. The abstract machine only deals with which states to evaluate in which order, where to store values, where to store continuations, how to push and pop continuations, etc. The semantics encode what to do when encountering a program construct. For example, the semantics can tell what to evaluate next, that a continuation needs to be pushed, or that a variable needs to be updated. The abstract machine will then respectively evaluate the expression needed, push the continuation, or update the variable.
Multiple abstract machine implementations are available, defined in the machine/ directory. Every abstract machine implementation has to implement the AbstractMachine interface (machine/AbstractMachine.scala).
List of all available machines:
- oldAAM: to call AAMNS (AAM No Subsumption) of Scala-AM https://bitbucket.org/OPiMedia/scala-am
- SeqAAM: sequential machine where the worklist implemented with a list of states
- SeqAAMS: sequential machine where the worklist implemented with a set of states
- SeqAAMLS: sequential machine where the worklist implemented with a list of sets of states
- SeqAAMLSH: SeqAAMLS that includes to the worklist only the not halted states
- ParAAMLSAState: ParAAM-L-SA-state for Parallel AAM - Loop - SenderAggregator - state
- ParAAMLSASet: ParAAM-L-SA-set for Parallel AAM - Loop - SenderAggregator - set
- ParAAMLSAPart: ParAAM-L-SA-part for Parallel AAM - Loop - SenderAggregator - part
- ParAAMCSState: ParAAM-C-S-state for Parallel AAM - Concurrent - Sender - state
- ParAAMCSSet: ParAAM-C-S-set for Parallel AAM - Concurrent - Sender - set
- ParAAMCSPart: ParAAM-C-S-part for Parallel AAM - Concurrent - Sender - part
- ParAAMCState: ParAAM-C-state for Parallel AAM - Concurrent - state
- ParAAMCSet: ParAAM-C-set for Parallel AAM - Concurrent - set
- ParAAMCPart: ParAAM-C-part for Parallel AAM - Concurrent - part
- ParAAMCHybrid: ParAAM-C-hybrid
- ParAAMCSetH: ParAAM-C-set-halt
- ParAAMCPartH: ParAAM-C-part-halt
- ParAAMCHybridH: ParAAM-C-hybrid-halt
The abstract machine also uses a lattice to represent values. Lattices should implement the JoinLattice trait that can be found in lattice/JoinLattice.scala, which provides the basic features of a lattice.
- The repository of Scala-Par-AM: https://bitbucket.org/OPiMedia/scala-par-am
- ScalaDoc of this code: http://www.opimedia.be/DS/online-documentations/Scala-Par-AM/html/be/opimedia/scala_par_am/Main$.html
- The repository of the starting fork of Scala-AM: https://bitbucket.org/OPiMedia/scala-am
- The original repository of Scala-AM: https://github.com/acieroid/scala-am
- Master thesis about this project: https://bitbucket.org/OPiMedia/efficient-parallel-abstract-interpreter-in-scala/
Source https://bitbucket.org/OPiMedia/scala-par-am/src/master/scala-par-am/src/main/scala/Main.scala
Authors:
Olivier Pirson
Quentin Stiévenart (for the original Scala-AM that composes the biggest part of this project)
- Version
June 18, 2020
- Alphabetic
- By Inheritance
- Main
- App
- DelayedInit
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- case class ParamsConfig(root: String = "", exceptsFilename: String = "", lattices: Seq[Configuration.Lattice.Value] = List(Configuration.Lattice.TypeSet), bounds: Seq[Int] = List(100), addresses: Seq[Configuration.Address.Value] = ..., filenamesPattern: String = "regex:.+\\.scm", stepFilters: Seq[Boolean] = List(false), machines: Seq[Configuration.Machine.Value] = ..., processes: Seq[Int] = List(1), filenamePrepare: String = "", nbRepetition: Int = 1, timeout: FiniteDuration = FiniteDuration(1, "day"), betweenTime: FiniteDuration = FiniteDuration(1, "second"), headerEnabled: Boolean = true, infoHeaderEnabled: Boolean = false, statsEnabled: Boolean = false, statsEscaped: Boolean = false, kamonEnabled: Boolean = false, outputGraphEnabled: Boolean = false, statsOutputGraphEnabled: Boolean = false, dotGraphEnabled: Boolean = false, isListMachines: Boolean = false, justListEnabled: Boolean = false, estimationTime: FiniteDuration = FiniteDuration(1, "second")) extends Product with Serializable
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
args: Array[String]
- Attributes
- protected
- Definition Classes
- App
- Annotations
- @deprecatedOverriding( "args should not be overridden" , "2.11.0" )
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate() @throws( ... )
- val default: ParamsConfig
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
val
executionStart: Long
- Definition Classes
- App
- Annotations
- @deprecatedOverriding( ... , "2.11.0" )
-
def
foreachRun[U](config: ParamsConfig): Int
For each file described in config, for each machine, lattice, process from config.machines, config.lattices and config.processes, apply run(lattice, bound, address, file, stepFilterEnabled, machine, process, config.timeout, config.nbRepetition, config.betweenTime, config.outputGraphEnabled, config.statsOutputGraphEnabled, config.dotGraphEnabled, config.statsEnabled, config.statsEscaped, config.justListEnabled).
For each file described in config, for each machine, lattice, process from config.machines, config.lattices and config.processes, apply run(lattice, bound, address, file, stepFilterEnabled, machine, process, config.timeout, config.nbRepetition, config.betweenTime, config.outputGraphEnabled, config.statsOutputGraphEnabled, config.dotGraphEnabled, config.statsEnabled, config.statsEscaped, config.justListEnabled).
If machine is oldAAM then apply runOld(lattice, bound, address, file, config.timeout, config.nbRepetition) instead run.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
loadRunOldMainMethod: Method
Load and return the MainAsScalaParAM.main method from scala-am.jar.
-
def
main(args: Array[String]): Unit
- Definition Classes
- App
- Annotations
- @deprecatedOverriding( "main should not be overridden" , "2.11.0" )
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
val
parser: OptionParser[ParamsConfig] { ... /* 9 definitions in type refinement */ }
Parses command line parameters and runs
-
def
printAverage(data: Seq[Double]): Unit
Print average, etc.
Print average, etc. of data
-
def
printEstimation(nbPrepared: Int, nbExecuted: Int, timeout: FiniteDuration, estimationTime: FiniteDuration, betweenTime: FiniteDuration): Unit
Print number of estimation of time
-
def
printHeader(nbRepetition: Int, statsEnabled: Boolean, statsEscaped: Boolean): Unit
Print the header corresponding to TSV data
-
def
printListMachines(): Unit
Print the list of available machines with parallel information
-
def
readExcepts(filename: String): Set[String]
Reads the file filename and returns set of files.
Reads the file filename and returns set of files.
The format of read filename is, for each line: [#] FILENAME [# COMMENT] Each line beginning by # is ignored.
If filename doesn't exist then return an empty set.
-
def
run(latticeValue: Configuration.Lattice.Value, bound: Int, addressValue: Configuration.Address.Value, file: Path, stepFilterEnabled: Boolean, machineValue: Configuration.Machine.Value, process: Int, timeout: FiniteDuration, nbRepetition: Int, betweenTime: FiniteDuration, outputGraphEnabled: Boolean, statsOutputGraphEnabled: Boolean, dotGraphEnabled: Boolean, statsEnabled: Boolean, statsEscaped: Boolean, justListEnabled: Boolean): Int
Dispatch to runOld (for oldAAM machine from Scala-AM) or to runNew (Scala-Par-AM machines).
-
def
runNew(latticeValue: Configuration.Lattice.Value, bound: Int, addressValue: Configuration.Address.Value, file: Path, stepFilterEnabled: Boolean, machineValue: Configuration.Machine.Value, process: Int, timeout: FiniteDuration, nbRepetition: Int, betweenTime: FiniteDuration, outputGraphEnabled: Boolean, statsOutputGraphEnabled: Boolean, dotGraphEnabled: Boolean, statsEnabled: Boolean, statsEscaped: Boolean, justListEnabled: Boolean): Int
Run the machine (!= oldAAM) on file with corresponding parameters.
-
def
runOld(latticeValue: Configuration.Lattice.Value, bound: Int, address: Configuration.Address.Value, file: Path, timeout: FiniteDuration, nbRepetition: Int): Int
Run oldAAM machine of Scala-AM on file with MainAsScalaParAM.main of scala-am.jar and corresponding parameters.
Run oldAAM machine of Scala-AM on file with MainAsScalaParAM.main of scala-am.jar and corresponding parameters.
The oldAAM machine of Scala-AM corresponds to the AAMNS machine of Scala-AM It is a version of the AAM machine of Scala-AM (written by Quentin Stiévenart) without the subsumption part (AAMNS - AAM No Subsumption). It can be considered as the original version of AAM of this Scala-Par-AM.
-
lazy val
runOldMainMethod: Method
To run oldAAM machine (AAMNS - AAM No Subsumption) of Scala-AM on file with MainAsScalaParAM.main of scala-am.jar
- val scalaParAMVersion: String
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
def
delayedInit(body: ⇒ Unit): Unit
- Definition Classes
- App → DelayedInit
- Annotations
- @deprecated
- Deprecated
(Since version 2.11.0) the delayedInit mechanism will disappear
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
- Deprecated
(Since version ) see corresponding Javadoc for more information.