SlideShare a Scribd company logo
Practical Aggregate Programming in Scala
Roberto Casadei
PhD Student in CS&Eng
roby.casadei@unibo.it
Department of Computer Science and Engineering
University of Bologna
Student talk at Scala Symposium, Amsterdam 2016
Slides available at http://www.slideshare.net/RobertoCasadei/presentations
Sample code at https://bitbucket.org/metaphori/scafi-tutorial
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 1 / 30
Outline
1 Aggregate Computing: The Basics
2 SCAFI: Practical Aggregate Programming in Scala
3 Conclusion
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 2 / 30
Aggregate Computing: The Basics
Outline
1 Aggregate Computing: The Basics
2 SCAFI: Practical Aggregate Programming in Scala
3 Conclusion
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 3 / 30
Aggregate Computing: The Basics
Problem: design/programming CASs
Collective/Complex Adaptive Systems (CASs)
Structure: Environment + (Mobile, Large-scale) Networks of { people + devices }
Global interpretation: embedded devices collectively form a “diffused” computational system
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 4 / 30
Aggregate Computing: The Basics
An approach to CAS development
Issues ⇒ approach
• Large-scale ⇒ decentralised coordination
• Situatedness + distributed autonomy ⇒ substantial unpredictability ⇒ self-*
• Complex collective behavior ⇒ good abstractions, layered approach, compositionality
Shifting the mindset: from local to global
• Declarativeness and the global viewpoint
• Crowd-aware services
• Failure recovery of enterprise services
• Distributed monitoring and reacting (e.g., temperature, fire)
• Expected global behavior vs. traditional device-centric interface
⇒ Aggregate Programming [BPV15]: a paradigm for programming whole aggregates of devices.
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 5 / 30
Aggregate Computing: The Basics
Aggregate programming [BPV15]
From the local/device-centric viewpoint to the global/aggregate viewpoint
Aggregate programming: what
Goal: programming the collective behaviour of aggregates (of devices) ⇒ global-to-local
Aggregate programming: how
Prominent approach (generalizing over several prior approaches and strategies [BDU+
12])
founded on field calculus and self-org patterns
• Computational fields as unifying abstraction of local/global viewpoints
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 6 / 30
Aggregate Computing: The Basics
Aggregate Programming Stack
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 7 / 30
Aggregate Computing: The Basics
Aggregate (computing) systems & Execution model
Structure ⇒ (network/graph)
• A set of devices (aka nodes/points/things).
• Each device is able to communicate with a subset of devices known as its neighbourhood.
Dynamics
Each device is given the same aggregate program and works at async / partially-sync rounds:
(1) Retrieve context
⇐ Messages from neighbours
⇐ Sensor values
(2) Aggregate program execution
⇒ export (a tree-like repr of computation) + output (result of last expr in body)
(3) Broadcast export to neighbourhood
(4) Execute actuators
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 8 / 30
SCAFI: Practical Aggregate Programming in Scala
Outline
1 Aggregate Computing: The Basics
2 SCAFI: Practical Aggregate Programming in Scala
3 Conclusion
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 9 / 30
SCAFI: Practical Aggregate Programming in Scala
SCAFI: Scala with Computational Fields
Goal: bring Aggregate Computing to the field of mainstream software development
What
SCAFI [CV16] is an integrated framework for building systems with aggregate programming.
• Scala-internal DSL for expressing aggregate computations.
• Linguistic support + execution support (interpreter/VM)
• Correct, complete, efficient impl. of the Higher-Order Field Calculus
semantics [DVPB15]
• Distributed platform for execution of aggregate systems.
• Support for multiple architectural styles and system configurations.
• Actor-based implementation (based on Akka).
Where
• https://bitbucket.org/scafiteam/scafi
libraryDependencies += "it.unibo.apice.scafiteam" % "scafi-core_2.11" % "0.1.0" // on Maven Central
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 10 / 30
SCAFI: Practical Aggregate Programming in Scala
Computational fields [DVB16]
• (Abstract interpretation) Mapping space-time to computational objects
• (Concrete interpretation) Mapping devices to values: φ : δ →
• “Distributed” data structure working as the global abstraction
• The bridge abstraction between local behavior and global behavior
Discrete systems as an approximation of
spacetime
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 11 / 30
SCAFI: Practical Aggregate Programming in Scala
Field/aggregate computations
Global viewpoint
• Aggregate interpretation
• Natural/denotational semantics
• Program: computation over whole fields
• Output (at a given time): system-wide
snapshot of a computational field
• Geometric view: properties of collections
of points
Local viewpoint
• Device-centric interpretation
• Operational semantics
• Program: steps of a single device
• Output (at a given time): latest value
yielded by the device
• Geometric view: properties of a single
point
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 12 / 30
SCAFI: Practical Aggregate Programming in Scala
So, what is an aggregate program?
• The global program
– "Local programs" obtained via global-to-local mapping
• May take the form of field calculus programs (in the representation given by some PL)
– Actually, the field calculus is like FJ for Java, or the lambda calculus for Haskell
• An aggregate program consists of
1) A set of function definitions
2) A body of expressions.
• Example: an aggregate program in SCAFI
class MyProgram extends AggregateProgram with MyAPI {
def isSource = sense[Boolean]("source")
// Entry point for execution
override def main() = gradient(isSource)
}
– Each device of the aggregate system is given an instance of MyProgram.
– Each device repeatedly runs the main method at async rounds of execution.
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 13 / 30
SCAFI: Practical Aggregate Programming in Scala
Computing with fields
Expressing aggregate/field computations in SCAFI
trait Constructs {
def rep[A](init: A)(fun: (A) => A): A
def nbr[A](expr: => A): A
def foldhood[A](init: => A)(acc: (A,A)=>A)(expr: => A): A
def aggregate[A](f: => A): A
// Not primitive, but foundational
def sense[A](name: LSNS): A
def nbrvar[A](name: NSNS): A
def branch[A](cond: => Boolean)(th: => A)(el: => A): A
}
• Mechanisms for context-sensitiveness: nbr, nbrvar, sense
• Mechanisms for field evolution: rep
• Mechanisms for interaction: nbr
• Mechanisms for field domain restriction and partitioning: aggregate, branch
• Reference formal system: field calculus [DVB16, DVPB15]
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 14 / 30
SCAFI: Practical Aggregate Programming in Scala
Simple fields
0
(x)=>x+1
true t<0,1>
Constant, uniform field: 5
– Local view: evaluates to 5 in the context of a single device
– Global view: yields a uniform constant field that holds 5 at any point (i.e., at any device)
Constant, non-uniform field: mid()
– mid() is a built-in function that returns the ID of the running device
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 15 / 30
SCAFI: Practical Aggregate Programming in Scala
rep: dynamically evolving fields
rep
0
(x)=>x+1
t
v0
t
v1
..
rep(0){(x)=>x+1}
// Signature: def rep[A](init: A)(fun: (A) => A): A
// Initially 0; state is incremented at each round
rep(0){ _+1 }
– Notice: the frequency of computation can vary over time and from device to device
– In general, the resulting field will be heterogeneous in time and space
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 16 / 30
SCAFI: Practical Aggregate Programming in Scala
nbr: interaction, communication, observation
nbr de
nbr{e}
φd=[d1→v1,..,dn→vn]
– Local view: nbr returns a field from neighbors to their corresponding value of the given expr e
– Global view: a field of fields
– Needs to be reduced using a *hood operation
– foldhood works by retrieving the value of expr for each neighbour and then folding over the
resulting structure as you’d expect from FP.
// Signature: def nbr[A](expr: => A): A
// Signature: def foldhood[A](init: => A)(acc: (A,A)=>A)(expr: => A): A
foldhood(0)(_+_){ nbr{1} }
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 17 / 30
SCAFI: Practical Aggregate Programming in Scala
Context-sensitiveness and sensors
Local context:
1) The export of the previous computation
2) Messages received from neighbours
3) Values perceived from the physical/software environment
Sensing
// Query a local sensor
sense[Double]("temperature")
// Compute the maximum distance from neighbours
foldhood(Double.MinValue)(max(_,_)){ // Also: maxHood {...}
nbrvar[Double](NBR_RANGE_NAME)
}
– nbr queries a local sensor
– nbrvar queries a "neighbouring sensor" (a sort of "environmental probe")
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 18 / 30
SCAFI: Practical Aggregate Programming in Scala
Field domain restriction
Alignment
• Aggregate computations can be represented as a trees
• Device exports are "paths" along these trees
• When two devices execute the same tree node, they are said to be aligned
• Interaction is possible only between aligned devices
Use cases for branch
• Partitioning the space into subspaces performing subcomputations
• Regulating admissible interactions (i.e., further restricting the neighbourhood)
branch(sense[Boolean]("flag")){
compute(...) // sub-computation
}{
Double.MaxValue // stable value (i.e., not computing)
}
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 19 / 30
SCAFI: Practical Aggregate Programming in Scala
Functions
Two kinds of functions in SCAFI:
1) "Normal" Scala functions: serve as units for encapsulating behavior/logic
def foldhoodMinus[A](init: => A)(acc: (A,A) => A)(ex: => A): A =
foldhood(init)(acc){ mux(mid()==nbr(mid())){ init }{ ex } }
def isSource = sense[Boolean]("source")
2) First-class "aggregate" functions [DVPB15] – which also work as units for alignment
def branch[A](cond: => Boolean)(th: => A)(el: => A): A =
mux(cond, ()=>aggregate{ th }, ()=>aggregate{ el })()
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 20 / 30
SCAFI: Practical Aggregate Programming in Scala
Example: the gradient [BBVT08]
def nbrRange = nbrvar[Double](NBR_RANGE_NAME)
def gradient(source: Boolean): Double =
rep(Double.PositiveInfinity){ distance =>
mux(source) {
0.0
}{
minHood { nbr{distance} + nbrRange }
}
}
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 21 / 30
SCAFI: Practical Aggregate Programming in Scala
Example: the channel I
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 22 / 30
SCAFI: Practical Aggregate Programming in Scala
Example: the channel II
Each device is given the same aggregate program:
class ChannelProgram extends AggregateProgram with ChannelAPI {
def main = channel(isSource, isDestination, width)
}
def channel(src: Boolean, dest: Boolean, width: Double) =
distanceTo(src) + distanceTo(dest) <= distBetween(src, dest) + width
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 23 / 30
SCAFI: Practical Aggregate Programming in Scala
Example: the channel III
trait ChannelAPI extends Language with Builtins {
def channel(src: Boolean, dest: Boolean, width: Double) =
distanceTo(src) + distanceTo(dest) <= distBetween(src, dest) + width
def G[V:OB](src: Boolean, field: V, acc: V=>V, metric: =>Double): V =
rep( (Double.MaxValue, field) ){ dv =>
mux(src) { (0.0, field) } {
minHoodMinus {
val (d, v) = nbr { (dv._1, dv._2) }
(d + metric, acc(v))
}
}
}._2
def broadcast[V:OB](source: Boolean, field: V): V =
G[V](source, field, x=>x, nbrRange())
def distanceTo(source: Boolean): Double =
G[Double](source, 0, _ + nbrRange(), nbrRange())
def distBetween(source: Boolean, target: Boolean): Double =
broadcast(source, distanceTo(target))
def nbrRange(): Double = nbrvar[Double](NBR_RANGE_NAME)
def isSource = sense[Boolean]("source"); def isDestination = sense[Boolean]("destination")
}
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 24 / 30
SCAFI: Practical Aggregate Programming in Scala
Scaling with complexity
General coordination operators [VBDP15]
• Gradient-cast: accumulates values “outward” along a gradient starting from source nodes.
def G[V:OB](src: Boolean, init: V,
acc: V=>V, metric: =>Double): V
• Converge-cast: collects data distributed across space “inward” by accumulating values from
edge nodes to sink nodes down a “potential” field.
def C[V:OB](potential: V, acc: (V,V)=>V, local: V, Null: V): V
• Time-decay: supports information summarisation across time.
def T[V:Numeric](initial: V, floor: V, decay: V=>V): V
• Sparse-choice: supports creation of partitions and selection of sparse subsets of devices in
space
def S(grain: Double, metric: => Double): Boolean
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 25 / 30
SCAFI: Practical Aggregate Programming in Scala
A case study: crowd engineering [CPV16]
val (high,low,none) = (2,1,0) // crowd level
def crowdWarning(p: Double, r: Double, warn: Double, t: Double):
Boolean =
distanceTo(crowdTracking(p,r,t) == high) < warn
def crowdTracking(p: Double, r: Double, t: Double) = {
val crowdRgn = recentTrue(densityEst(p, r)>1.08, t)
branch(crowdRgn){ dangerousDensity(p, r) }{ none }
}
def dangerousDensity(p: Double, r: Double) = {
val mr = managementRegions(r*2, () => { nbrRange })
val danger = average(mr, densityEst(p, r)) > 2.17 &&
summarize(mr, (_:Double)+(_:Double), 1 / p, 0) > 300
mux(danger){ high }{ low }
}
// Auxiliary functions
def recentTrue(state: Boolean, memTime: Double): Boolean
def managementRegions(grain: Double,
metric: => Double): Boolean = S(gran,metric)
def densityEst(p: Double, range: Double): Double
def summarize(sink: Boolean, acc: (Double,Double)=>Double,
local: Double, Null: Double): Double
def average(sink: Boolean, value: Double): Double
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 26 / 30
SCAFI: Practical Aggregate Programming in Scala
Quick platform setup
// STEP 1: CHOOSE INCARNATION
import it.unibo.scafi.incarnations.{ BasicActorP2P => Platform }
// STEP 2: DEFINE AGGREGATE PROGRAM SCHEMA
class Demo_AggregateProgram extends Platform.AggregateProgram {
override def main(): Any = foldhood(0){_ + _}(1)
}
// STEP 3: DEFINE MAIN PROGRAM
object Demo_MainProgram extends Platform.CmdLineMain
1) Demo_MainProgram -h 127.0.0.1 -p 9000
-e 1:2,4,5;2;3 --subsystems 127.0.0.1:9500:4:5
--program "demos.Demo_AggregateProgram"
2) Demo_MainProgram -h 127.0.0.1 -p 9500
-e 4;5:4
--program "demos.Demo_AggregateProgram"
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 27 / 30
SCAFI: Practical Aggregate Programming in Scala
Manual node setup
// STEP 1: CHOOSE INCARNATION
import scafi.incarnations.{ BasicActorP2P => Platform }
import Platform.{AggregateProgram,Settings,PlatformConfig}
// STEP 2: DEFINE AGGREGATE PROGRAM SCHEMA
class Program extends AggregateProgram with CrowdAPI {
// Specify a "dangerous density" aggregate computation
override def main(): Any = crowdWarning(...)
}
// STEP 3: PLATFORM SETUP
val settings = Settings()
val platform = PlatformConfig.setupPlatform(settings)
// STEP 4: NODE SETUP
val sys = platform.newAggregateApplication()
val dm = sys.newDevice(id = Utils.newId(),
program = Program,
neighbours = Utils.discoverNbrs())
val devActor = dm.actorRef // get underlying actor
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 28 / 30
Conclusion
Outline
1 Aggregate Computing: The Basics
2 SCAFI: Practical Aggregate Programming in Scala
3 Conclusion
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 29 / 30
Conclusion
Summary: key ideas
Aggregate programming
• A "macro" (programmingengineering) approach to CASs, formally grounded in the Field
Calculus.
• Allows to compose “emergent” phenomena & defines layers of (self-stabilizing) building blocks.
SCAFI: a Scala framework for Aggregate Programming
• Provides an internal DSL for field-based computations
• Provides an actor-based platform for building aggregate systems
Future work
• Evolve SCAFI to support scalable computations in cluster- and cloud-based systems.
• What does it take to set up a framework for adaptive execution strategies?
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 30 / 30
Conclusion
Question time
Questions?
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 31 / 30
Appendix References
References I
[BBVT08] Jacob Beal, Jonathan Bachrach, Dan Vickery, and Mark Tobenkin.
Fast self-healing gradients.
In Proceedings of the 2008 ACM symposium on Applied computing, pages 1969–1975.
ACM, 2008.
[BDU+
12] Jacob Beal, Stefan Dulman, Kyle Usbeck, Mirko Viroli, and Nikolaus Correll.
Organizing the aggregate: Languages for spatial computing.
CoRR, abs/1202.5509, 2012.
[BPV15] Jacob Beal, Danilo Pianini, and Mirko Viroli.
Aggregate Programming for the Internet of Things.
IEEE Computer, 2015.
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 32 / 30
Appendix References
References II
[CPV16] Roberto Casadei, Danilo Pianini, and Mirko Viroli.
Simulating large-scale aggregate mass with alchemist and scala.
In Maria Ganzha, Leszek Maciaszek, and Marcin Paprzycki, editors, Proceedings of the
Federated Conference on Computer Science and Information Systems (FedCSIS
2016), Gdansk, Poland, 11-14 September 2016. IEEE Computer Society Press.
To appear.
[CV16] Roberto Casadei and Mirko Viroli.
Towards aggregate programming in Scala.
In First Workshop on Programming Models and Languages for Distributed Computing,
PMLDC ’16, pages 5:1–5:7, New York, NY, USA, 2016. ACM.
[DVB16] Ferruccio Damiani, Mirko Viroli, and Jacob Beal.
A type-sound calculus of computational fields.
Science of Computer Programming, 117:17 – 44, 2016.
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 33 / 30
Appendix References
References III
[DVPB15] Ferruccio Damiani, Mirko Viroli, Danilo Pianini, and Jacob Beal.
Code mobility meets self-organisation: A higher-order calculus of computational fields.
volume 9039 of Lecture Notes in Computer Science, pages 113–128. Springer
International Publishing, 2015.
[VBDP15] Mirko Viroli, Jacob Beal, Ferruccio Damiani, and Danilo Pianini.
Efficient engineering of complex self-organising systems by self-stabilising fields.
2015.
R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 34 / 30

More Related Content

What's hot (18)

scilab
scilabscilab
scilab
jay shankar
 
S1 DML Syntax and Invocation
S1 DML Syntax and InvocationS1 DML Syntax and Invocation
S1 DML Syntax and Invocation
Arvind Surve
 
Why scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with thisWhy scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with this
Ruslan Shevchenko
 
Yacc
YaccYacc
Yacc
BBDITM LUCKNOW
 
Why Scala for Web 2.0?
Why Scala for Web 2.0?Why Scala for Web 2.0?
Why Scala for Web 2.0?
Alex Payne
 
Lex tool manual
Lex tool manualLex tool manual
Lex tool manual
Sami Said
 
Java 8
Java 8Java 8
Java 8
vilniusjug
 
Haskell vs. F# vs. Scala
Haskell vs. F# vs. ScalaHaskell vs. F# vs. Scala
Haskell vs. F# vs. Scala
pt114
 
A Source-To-Source Approach to HPC Challenges
A Source-To-Source Approach to HPC ChallengesA Source-To-Source Approach to HPC Challenges
A Source-To-Source Approach to HPC Challenges
Chunhua Liao
 
Introduction to D programming language at Weka.IO
Introduction to D programming language at Weka.IOIntroduction to D programming language at Weka.IO
Introduction to D programming language at Weka.IO
Liran Zvibel
 
Lex & yacc
Lex & yaccLex & yacc
Lex & yacc
Taha Malampatti
 
JDK8 Functional API
JDK8 Functional APIJDK8 Functional API
JDK8 Functional API
Justin Lin
 
OCL 2.5 plans
OCL 2.5 plansOCL 2.5 plans
OCL 2.5 plans
Edward Willink
 
Lexyacc
LexyaccLexyacc
Lexyacc
unifesptk
 
Ehsan parallel accelerator-dec2015
Ehsan parallel accelerator-dec2015Ehsan parallel accelerator-dec2015
Ehsan parallel accelerator-dec2015
Christian Peel
 
D programming language
D programming languageD programming language
D programming language
Jordan Open Source Association
 
HPAT presentation at JuliaCon 2016
HPAT presentation at JuliaCon 2016HPAT presentation at JuliaCon 2016
HPAT presentation at JuliaCon 2016
Ehsan Totoni
 
The D Programming Language - Why I love it!
The D Programming Language - Why I love it!The D Programming Language - Why I love it!
The D Programming Language - Why I love it!
ryutenchi
 
S1 DML Syntax and Invocation
S1 DML Syntax and InvocationS1 DML Syntax and Invocation
S1 DML Syntax and Invocation
Arvind Surve
 
Why scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with thisWhy scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with this
Ruslan Shevchenko
 
Why Scala for Web 2.0?
Why Scala for Web 2.0?Why Scala for Web 2.0?
Why Scala for Web 2.0?
Alex Payne
 
Lex tool manual
Lex tool manualLex tool manual
Lex tool manual
Sami Said
 
Haskell vs. F# vs. Scala
Haskell vs. F# vs. ScalaHaskell vs. F# vs. Scala
Haskell vs. F# vs. Scala
pt114
 
A Source-To-Source Approach to HPC Challenges
A Source-To-Source Approach to HPC ChallengesA Source-To-Source Approach to HPC Challenges
A Source-To-Source Approach to HPC Challenges
Chunhua Liao
 
Introduction to D programming language at Weka.IO
Introduction to D programming language at Weka.IOIntroduction to D programming language at Weka.IO
Introduction to D programming language at Weka.IO
Liran Zvibel
 
JDK8 Functional API
JDK8 Functional APIJDK8 Functional API
JDK8 Functional API
Justin Lin
 
Ehsan parallel accelerator-dec2015
Ehsan parallel accelerator-dec2015Ehsan parallel accelerator-dec2015
Ehsan parallel accelerator-dec2015
Christian Peel
 
HPAT presentation at JuliaCon 2016
HPAT presentation at JuliaCon 2016HPAT presentation at JuliaCon 2016
HPAT presentation at JuliaCon 2016
Ehsan Totoni
 
The D Programming Language - Why I love it!
The D Programming Language - Why I love it!The D Programming Language - Why I love it!
The D Programming Language - Why I love it!
ryutenchi
 

Viewers also liked (10)

Java 8 and beyond, a scala story
Java 8 and beyond, a scala storyJava 8 and beyond, a scala story
Java 8 and beyond, a scala story
ittaiz
 
Six years of Scala and counting
Six years of Scala and countingSix years of Scala and counting
Six years of Scala and counting
Manuel Bernhardt
 
Scala in Practice
Scala in PracticeScala in Practice
Scala in Practice
Francesco Usai
 
Scala Past, Present & Future
Scala Past, Present & FutureScala Past, Present & Future
Scala Past, Present & Future
mircodotta
 
Brendan O'Bra Scala By the Schuykill
Brendan O'Bra Scala By the SchuykillBrendan O'Bra Scala By the Schuykill
Brendan O'Bra Scala By the Schuykill
Brendan O'Bra
 
Microservices in Java and Scala (sfscala)
Microservices in Java and Scala (sfscala)Microservices in Java and Scala (sfscala)
Microservices in Java and Scala (sfscala)
Chris Richardson
 
Fun[ctional] spark with scala
Fun[ctional] spark with scalaFun[ctional] spark with scala
Fun[ctional] spark with scala
David Vallejo Navarro
 
BDX 2016 - Tzach zohar @ kenshoo
BDX 2016 - Tzach zohar  @ kenshooBDX 2016 - Tzach zohar  @ kenshoo
BDX 2016 - Tzach zohar @ kenshoo
Ido Shilon
 
Macro in Scala
Macro in ScalaMacro in Scala
Macro in Scala
takezoe
 
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
Eugene Yokota
 
Java 8 and beyond, a scala story
Java 8 and beyond, a scala storyJava 8 and beyond, a scala story
Java 8 and beyond, a scala story
ittaiz
 
Six years of Scala and counting
Six years of Scala and countingSix years of Scala and counting
Six years of Scala and counting
Manuel Bernhardt
 
Scala Past, Present & Future
Scala Past, Present & FutureScala Past, Present & Future
Scala Past, Present & Future
mircodotta
 
Brendan O'Bra Scala By the Schuykill
Brendan O'Bra Scala By the SchuykillBrendan O'Bra Scala By the Schuykill
Brendan O'Bra Scala By the Schuykill
Brendan O'Bra
 
Microservices in Java and Scala (sfscala)
Microservices in Java and Scala (sfscala)Microservices in Java and Scala (sfscala)
Microservices in Java and Scala (sfscala)
Chris Richardson
 
BDX 2016 - Tzach zohar @ kenshoo
BDX 2016 - Tzach zohar  @ kenshooBDX 2016 - Tzach zohar  @ kenshoo
BDX 2016 - Tzach zohar @ kenshoo
Ido Shilon
 
Macro in Scala
Macro in ScalaMacro in Scala
Macro in Scala
takezoe
 
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
Eugene Yokota
 
Ad

Similar to Practical Aggregate Programming in Scala (20)

Scafi: Scala with Computational Fields
Scafi: Scala with Computational FieldsScafi: Scala with Computational Fields
Scafi: Scala with Computational Fields
Roberto Casadei
 
Aggregate Programming in Scala
Aggregate Programming in ScalaAggregate Programming in Scala
Aggregate Programming in Scala
Roberto Casadei
 
A Programming Framework for Collective Adaptive Ecosystems
A Programming Framework for Collective Adaptive EcosystemsA Programming Framework for Collective Adaptive Ecosystems
A Programming Framework for Collective Adaptive Ecosystems
Roberto Casadei
 
Programming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive SystemsProgramming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive Systems
Roberto Casadei
 
On Execution Platforms for Large-Scale Aggregate Computing
On Execution Platforms for Large-Scale Aggregate ComputingOn Execution Platforms for Large-Scale Aggregate Computing
On Execution Platforms for Large-Scale Aggregate Computing
Roberto Casadei
 
ScaFi-Web, A Web-Based application for Field-based Coordination
ScaFi-Web, A Web-Based application for Field-based CoordinationScaFi-Web, A Web-Based application for Field-based Coordination
ScaFi-Web, A Web-Based application for Field-based Coordination
Gianluca Aguzzi
 
Towards Aggregate Programming in Scala
Towards Aggregate Programming in ScalaTowards Aggregate Programming in Scala
Towards Aggregate Programming in Scala
Roberto Casadei
 
Simulating Large-scale Aggregate MASs with Alchemist and Scala
Simulating Large-scale Aggregate MASs with Alchemist and ScalaSimulating Large-scale Aggregate MASs with Alchemist and Scala
Simulating Large-scale Aggregate MASs with Alchemist and Scala
Danilo Pianini
 
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems ProgrammingFScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
Roberto Casadei
 
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
Roberto Casadei
 
Engineering the Aggregate - Talk at Software Engineering for Intelligent and ...
Engineering the Aggregate - Talk at Software Engineering for Intelligent and ...Engineering the Aggregate - Talk at Software Engineering for Intelligent and ...
Engineering the Aggregate - Talk at Software Engineering for Intelligent and ...
Danilo Pianini
 
Declarative Macro-Programming of Collective Systems with Aggregate Computing:...
Declarative Macro-Programming of Collective Systems with Aggregate Computing:...Declarative Macro-Programming of Collective Systems with Aggregate Computing:...
Declarative Macro-Programming of Collective Systems with Aggregate Computing:...
Roberto Casadei
 
From Field-based Coordination to Aggregate Computing
From Field-based Coordination to Aggregate ComputingFrom Field-based Coordination to Aggregate Computing
From Field-based Coordination to Aggregate Computing
Roberto Casadei
 
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Roberto Casadei
 
Practical Aggregate Programming with Protelis @ SASO2017
Practical Aggregate Programming with Protelis @ SASO2017Practical Aggregate Programming with Protelis @ SASO2017
Practical Aggregate Programming with Protelis @ SASO2017
Danilo Pianini
 
Building blocks for aggregate programming of self-organising applications
Building blocks for aggregate programming of self-organising applicationsBuilding blocks for aggregate programming of self-organising applications
Building blocks for aggregate programming of self-organising applications
FoCAS Initiative
 
Aggregate Computing Platforms: Bridging the Gaps
Aggregate Computing Platforms: Bridging the GapsAggregate Computing Platforms: Bridging the Gaps
Aggregate Computing Platforms: Bridging the Gaps
Roberto Casadei
 
Arvindsujeeth scaladays12
Arvindsujeeth scaladays12Arvindsujeeth scaladays12
Arvindsujeeth scaladays12
Skills Matter Talks
 
Aggregate Computing Research: an Overview
Aggregate Computing Research: an OverviewAggregate Computing Research: an Overview
Aggregate Computing Research: an Overview
Roberto Casadei
 
A Presentation of My Research Activity
A Presentation of My Research ActivityA Presentation of My Research Activity
A Presentation of My Research Activity
Roberto Casadei
 
Scafi: Scala with Computational Fields
Scafi: Scala with Computational FieldsScafi: Scala with Computational Fields
Scafi: Scala with Computational Fields
Roberto Casadei
 
Aggregate Programming in Scala
Aggregate Programming in ScalaAggregate Programming in Scala
Aggregate Programming in Scala
Roberto Casadei
 
A Programming Framework for Collective Adaptive Ecosystems
A Programming Framework for Collective Adaptive EcosystemsA Programming Framework for Collective Adaptive Ecosystems
A Programming Framework for Collective Adaptive Ecosystems
Roberto Casadei
 
Programming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive SystemsProgramming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive Systems
Roberto Casadei
 
On Execution Platforms for Large-Scale Aggregate Computing
On Execution Platforms for Large-Scale Aggregate ComputingOn Execution Platforms for Large-Scale Aggregate Computing
On Execution Platforms for Large-Scale Aggregate Computing
Roberto Casadei
 
ScaFi-Web, A Web-Based application for Field-based Coordination
ScaFi-Web, A Web-Based application for Field-based CoordinationScaFi-Web, A Web-Based application for Field-based Coordination
ScaFi-Web, A Web-Based application for Field-based Coordination
Gianluca Aguzzi
 
Towards Aggregate Programming in Scala
Towards Aggregate Programming in ScalaTowards Aggregate Programming in Scala
Towards Aggregate Programming in Scala
Roberto Casadei
 
Simulating Large-scale Aggregate MASs with Alchemist and Scala
Simulating Large-scale Aggregate MASs with Alchemist and ScalaSimulating Large-scale Aggregate MASs with Alchemist and Scala
Simulating Large-scale Aggregate MASs with Alchemist and Scala
Danilo Pianini
 
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems ProgrammingFScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
Roberto Casadei
 
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
Roberto Casadei
 
Engineering the Aggregate - Talk at Software Engineering for Intelligent and ...
Engineering the Aggregate - Talk at Software Engineering for Intelligent and ...Engineering the Aggregate - Talk at Software Engineering for Intelligent and ...
Engineering the Aggregate - Talk at Software Engineering for Intelligent and ...
Danilo Pianini
 
Declarative Macro-Programming of Collective Systems with Aggregate Computing:...
Declarative Macro-Programming of Collective Systems with Aggregate Computing:...Declarative Macro-Programming of Collective Systems with Aggregate Computing:...
Declarative Macro-Programming of Collective Systems with Aggregate Computing:...
Roberto Casadei
 
From Field-based Coordination to Aggregate Computing
From Field-based Coordination to Aggregate ComputingFrom Field-based Coordination to Aggregate Computing
From Field-based Coordination to Aggregate Computing
Roberto Casadei
 
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Roberto Casadei
 
Practical Aggregate Programming with Protelis @ SASO2017
Practical Aggregate Programming with Protelis @ SASO2017Practical Aggregate Programming with Protelis @ SASO2017
Practical Aggregate Programming with Protelis @ SASO2017
Danilo Pianini
 
Building blocks for aggregate programming of self-organising applications
Building blocks for aggregate programming of self-organising applicationsBuilding blocks for aggregate programming of self-organising applications
Building blocks for aggregate programming of self-organising applications
FoCAS Initiative
 
Aggregate Computing Platforms: Bridging the Gaps
Aggregate Computing Platforms: Bridging the GapsAggregate Computing Platforms: Bridging the Gaps
Aggregate Computing Platforms: Bridging the Gaps
Roberto Casadei
 
Aggregate Computing Research: an Overview
Aggregate Computing Research: an OverviewAggregate Computing Research: an Overview
Aggregate Computing Research: an Overview
Roberto Casadei
 
A Presentation of My Research Activity
A Presentation of My Research ActivityA Presentation of My Research Activity
A Presentation of My Research Activity
Roberto Casadei
 
Ad

More from Roberto Casadei (20)

Software Engineering Methods for Artificial Collective Intelligence
Software Engineering Methods for Artificial Collective IntelligenceSoftware Engineering Methods for Artificial Collective Intelligence
Software Engineering Methods for Artificial Collective Intelligence
Roberto Casadei
 
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Roberto Casadei
 
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
Roberto Casadei
 
Introduction to the 1st DISCOLI workshop on distributed collective intelligence
Introduction to the 1st DISCOLI workshop on distributed collective intelligenceIntroduction to the 1st DISCOLI workshop on distributed collective intelligence
Introduction to the 1st DISCOLI workshop on distributed collective intelligence
Roberto Casadei
 
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Roberto Casadei
 
6th eCAS workshop on Engineering Collective Adaptive Systems
6th eCAS workshop on Engineering Collective Adaptive Systems6th eCAS workshop on Engineering Collective Adaptive Systems
6th eCAS workshop on Engineering Collective Adaptive Systems
Roberto Casadei
 
Augmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Augmented Collective Digital Twins for Self-Organising Cyber-Physical SystemsAugmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Augmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Roberto Casadei
 
Tuple-Based Coordination in Large-Scale Situated Systems
Tuple-Based Coordination in Large-Scale Situated SystemsTuple-Based Coordination in Large-Scale Situated Systems
Tuple-Based Coordination in Large-Scale Situated Systems
Roberto Casadei
 
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
Roberto Casadei
 
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Roberto Casadei
 
Testing: an Introduction and Panorama
Testing: an Introduction and PanoramaTesting: an Introduction and Panorama
Testing: an Introduction and Panorama
Roberto Casadei
 
On Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate ProgrammingOn Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate Programming
Roberto Casadei
 
Engineering Resilient Collaborative Edge-enabled IoT
Engineering Resilient Collaborative Edge-enabled IoTEngineering Resilient Collaborative Edge-enabled IoT
Engineering Resilient Collaborative Edge-enabled IoT
Roberto Casadei
 
Aggregate Processes in Field Calculus
Aggregate Processes in Field CalculusAggregate Processes in Field Calculus
Aggregate Processes in Field Calculus
Roberto Casadei
 
AWS and Serverless Computing
AWS and Serverless ComputingAWS and Serverless Computing
AWS and Serverless Computing
Roberto Casadei
 
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
Roberto Casadei
 
The Rust Programming Language: an Overview
The Rust Programming Language: an OverviewThe Rust Programming Language: an Overview
The Rust Programming Language: an Overview
Roberto Casadei
 
Akka Remoting and Clustering: an Introduction
Akka Remoting and Clustering: an IntroductionAkka Remoting and Clustering: an Introduction
Akka Remoting and Clustering: an Introduction
Roberto Casadei
 
Akka Actors: an Introduction
Akka Actors: an IntroductionAkka Actors: an Introduction
Akka Actors: an Introduction
Roberto Casadei
 
Bridging the Pervasive Computing Gap: An Aggregate Perspective
Bridging the Pervasive Computing Gap: An Aggregate PerspectiveBridging the Pervasive Computing Gap: An Aggregate Perspective
Bridging the Pervasive Computing Gap: An Aggregate Perspective
Roberto Casadei
 
Software Engineering Methods for Artificial Collective Intelligence
Software Engineering Methods for Artificial Collective IntelligenceSoftware Engineering Methods for Artificial Collective Intelligence
Software Engineering Methods for Artificial Collective Intelligence
Roberto Casadei
 
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Roberto Casadei
 
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
Roberto Casadei
 
Introduction to the 1st DISCOLI workshop on distributed collective intelligence
Introduction to the 1st DISCOLI workshop on distributed collective intelligenceIntroduction to the 1st DISCOLI workshop on distributed collective intelligence
Introduction to the 1st DISCOLI workshop on distributed collective intelligence
Roberto Casadei
 
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Roberto Casadei
 
6th eCAS workshop on Engineering Collective Adaptive Systems
6th eCAS workshop on Engineering Collective Adaptive Systems6th eCAS workshop on Engineering Collective Adaptive Systems
6th eCAS workshop on Engineering Collective Adaptive Systems
Roberto Casadei
 
Augmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Augmented Collective Digital Twins for Self-Organising Cyber-Physical SystemsAugmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Augmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Roberto Casadei
 
Tuple-Based Coordination in Large-Scale Situated Systems
Tuple-Based Coordination in Large-Scale Situated SystemsTuple-Based Coordination in Large-Scale Situated Systems
Tuple-Based Coordination in Large-Scale Situated Systems
Roberto Casadei
 
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
Roberto Casadei
 
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Roberto Casadei
 
Testing: an Introduction and Panorama
Testing: an Introduction and PanoramaTesting: an Introduction and Panorama
Testing: an Introduction and Panorama
Roberto Casadei
 
On Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate ProgrammingOn Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate Programming
Roberto Casadei
 
Engineering Resilient Collaborative Edge-enabled IoT
Engineering Resilient Collaborative Edge-enabled IoTEngineering Resilient Collaborative Edge-enabled IoT
Engineering Resilient Collaborative Edge-enabled IoT
Roberto Casadei
 
Aggregate Processes in Field Calculus
Aggregate Processes in Field CalculusAggregate Processes in Field Calculus
Aggregate Processes in Field Calculus
Roberto Casadei
 
AWS and Serverless Computing
AWS and Serverless ComputingAWS and Serverless Computing
AWS and Serverless Computing
Roberto Casadei
 
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
Roberto Casadei
 
The Rust Programming Language: an Overview
The Rust Programming Language: an OverviewThe Rust Programming Language: an Overview
The Rust Programming Language: an Overview
Roberto Casadei
 
Akka Remoting and Clustering: an Introduction
Akka Remoting and Clustering: an IntroductionAkka Remoting and Clustering: an Introduction
Akka Remoting and Clustering: an Introduction
Roberto Casadei
 
Akka Actors: an Introduction
Akka Actors: an IntroductionAkka Actors: an Introduction
Akka Actors: an Introduction
Roberto Casadei
 
Bridging the Pervasive Computing Gap: An Aggregate Perspective
Bridging the Pervasive Computing Gap: An Aggregate PerspectiveBridging the Pervasive Computing Gap: An Aggregate Perspective
Bridging the Pervasive Computing Gap: An Aggregate Perspective
Roberto Casadei
 

Recently uploaded (20)

Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Improving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevExImproving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevEx
Justin Reock
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
Domino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use CasesDomino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use Cases
panagenda
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training RoadblocksDown the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | BluebashMCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
Bluebash
 
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to KnowWhat is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
SMACT Works
 
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
Jasper Oosterveld
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Improving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevExImproving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevEx
Justin Reock
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
Domino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use CasesDomino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use Cases
panagenda
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training RoadblocksDown the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | BluebashMCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
Bluebash
 
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to KnowWhat is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
SMACT Works
 
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
Jasper Oosterveld
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 

Practical Aggregate Programming in Scala

  • 1. Practical Aggregate Programming in Scala Roberto Casadei PhD Student in CS&Eng [email protected] Department of Computer Science and Engineering University of Bologna Student talk at Scala Symposium, Amsterdam 2016 Slides available at http://www.slideshare.net/RobertoCasadei/presentations Sample code at https://bitbucket.org/metaphori/scafi-tutorial R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 1 / 30
  • 2. Outline 1 Aggregate Computing: The Basics 2 SCAFI: Practical Aggregate Programming in Scala 3 Conclusion R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 2 / 30
  • 3. Aggregate Computing: The Basics Outline 1 Aggregate Computing: The Basics 2 SCAFI: Practical Aggregate Programming in Scala 3 Conclusion R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 3 / 30
  • 4. Aggregate Computing: The Basics Problem: design/programming CASs Collective/Complex Adaptive Systems (CASs) Structure: Environment + (Mobile, Large-scale) Networks of { people + devices } Global interpretation: embedded devices collectively form a “diffused” computational system R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 4 / 30
  • 5. Aggregate Computing: The Basics An approach to CAS development Issues ⇒ approach • Large-scale ⇒ decentralised coordination • Situatedness + distributed autonomy ⇒ substantial unpredictability ⇒ self-* • Complex collective behavior ⇒ good abstractions, layered approach, compositionality Shifting the mindset: from local to global • Declarativeness and the global viewpoint • Crowd-aware services • Failure recovery of enterprise services • Distributed monitoring and reacting (e.g., temperature, fire) • Expected global behavior vs. traditional device-centric interface ⇒ Aggregate Programming [BPV15]: a paradigm for programming whole aggregates of devices. R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 5 / 30
  • 6. Aggregate Computing: The Basics Aggregate programming [BPV15] From the local/device-centric viewpoint to the global/aggregate viewpoint Aggregate programming: what Goal: programming the collective behaviour of aggregates (of devices) ⇒ global-to-local Aggregate programming: how Prominent approach (generalizing over several prior approaches and strategies [BDU+ 12]) founded on field calculus and self-org patterns • Computational fields as unifying abstraction of local/global viewpoints R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 6 / 30
  • 7. Aggregate Computing: The Basics Aggregate Programming Stack R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 7 / 30
  • 8. Aggregate Computing: The Basics Aggregate (computing) systems & Execution model Structure ⇒ (network/graph) • A set of devices (aka nodes/points/things). • Each device is able to communicate with a subset of devices known as its neighbourhood. Dynamics Each device is given the same aggregate program and works at async / partially-sync rounds: (1) Retrieve context ⇐ Messages from neighbours ⇐ Sensor values (2) Aggregate program execution ⇒ export (a tree-like repr of computation) + output (result of last expr in body) (3) Broadcast export to neighbourhood (4) Execute actuators R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 8 / 30
  • 9. SCAFI: Practical Aggregate Programming in Scala Outline 1 Aggregate Computing: The Basics 2 SCAFI: Practical Aggregate Programming in Scala 3 Conclusion R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 9 / 30
  • 10. SCAFI: Practical Aggregate Programming in Scala SCAFI: Scala with Computational Fields Goal: bring Aggregate Computing to the field of mainstream software development What SCAFI [CV16] is an integrated framework for building systems with aggregate programming. • Scala-internal DSL for expressing aggregate computations. • Linguistic support + execution support (interpreter/VM) • Correct, complete, efficient impl. of the Higher-Order Field Calculus semantics [DVPB15] • Distributed platform for execution of aggregate systems. • Support for multiple architectural styles and system configurations. • Actor-based implementation (based on Akka). Where • https://bitbucket.org/scafiteam/scafi libraryDependencies += "it.unibo.apice.scafiteam" % "scafi-core_2.11" % "0.1.0" // on Maven Central R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 10 / 30
  • 11. SCAFI: Practical Aggregate Programming in Scala Computational fields [DVB16] • (Abstract interpretation) Mapping space-time to computational objects • (Concrete interpretation) Mapping devices to values: φ : δ → • “Distributed” data structure working as the global abstraction • The bridge abstraction between local behavior and global behavior Discrete systems as an approximation of spacetime R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 11 / 30
  • 12. SCAFI: Practical Aggregate Programming in Scala Field/aggregate computations Global viewpoint • Aggregate interpretation • Natural/denotational semantics • Program: computation over whole fields • Output (at a given time): system-wide snapshot of a computational field • Geometric view: properties of collections of points Local viewpoint • Device-centric interpretation • Operational semantics • Program: steps of a single device • Output (at a given time): latest value yielded by the device • Geometric view: properties of a single point R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 12 / 30
  • 13. SCAFI: Practical Aggregate Programming in Scala So, what is an aggregate program? • The global program – "Local programs" obtained via global-to-local mapping • May take the form of field calculus programs (in the representation given by some PL) – Actually, the field calculus is like FJ for Java, or the lambda calculus for Haskell • An aggregate program consists of 1) A set of function definitions 2) A body of expressions. • Example: an aggregate program in SCAFI class MyProgram extends AggregateProgram with MyAPI { def isSource = sense[Boolean]("source") // Entry point for execution override def main() = gradient(isSource) } – Each device of the aggregate system is given an instance of MyProgram. – Each device repeatedly runs the main method at async rounds of execution. R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 13 / 30
  • 14. SCAFI: Practical Aggregate Programming in Scala Computing with fields Expressing aggregate/field computations in SCAFI trait Constructs { def rep[A](init: A)(fun: (A) => A): A def nbr[A](expr: => A): A def foldhood[A](init: => A)(acc: (A,A)=>A)(expr: => A): A def aggregate[A](f: => A): A // Not primitive, but foundational def sense[A](name: LSNS): A def nbrvar[A](name: NSNS): A def branch[A](cond: => Boolean)(th: => A)(el: => A): A } • Mechanisms for context-sensitiveness: nbr, nbrvar, sense • Mechanisms for field evolution: rep • Mechanisms for interaction: nbr • Mechanisms for field domain restriction and partitioning: aggregate, branch • Reference formal system: field calculus [DVB16, DVPB15] R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 14 / 30
  • 15. SCAFI: Practical Aggregate Programming in Scala Simple fields 0 (x)=>x+1 true t<0,1> Constant, uniform field: 5 – Local view: evaluates to 5 in the context of a single device – Global view: yields a uniform constant field that holds 5 at any point (i.e., at any device) Constant, non-uniform field: mid() – mid() is a built-in function that returns the ID of the running device R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 15 / 30
  • 16. SCAFI: Practical Aggregate Programming in Scala rep: dynamically evolving fields rep 0 (x)=>x+1 t v0 t v1 .. rep(0){(x)=>x+1} // Signature: def rep[A](init: A)(fun: (A) => A): A // Initially 0; state is incremented at each round rep(0){ _+1 } – Notice: the frequency of computation can vary over time and from device to device – In general, the resulting field will be heterogeneous in time and space R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 16 / 30
  • 17. SCAFI: Practical Aggregate Programming in Scala nbr: interaction, communication, observation nbr de nbr{e} φd=[d1→v1,..,dn→vn] – Local view: nbr returns a field from neighbors to their corresponding value of the given expr e – Global view: a field of fields – Needs to be reduced using a *hood operation – foldhood works by retrieving the value of expr for each neighbour and then folding over the resulting structure as you’d expect from FP. // Signature: def nbr[A](expr: => A): A // Signature: def foldhood[A](init: => A)(acc: (A,A)=>A)(expr: => A): A foldhood(0)(_+_){ nbr{1} } R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 17 / 30
  • 18. SCAFI: Practical Aggregate Programming in Scala Context-sensitiveness and sensors Local context: 1) The export of the previous computation 2) Messages received from neighbours 3) Values perceived from the physical/software environment Sensing // Query a local sensor sense[Double]("temperature") // Compute the maximum distance from neighbours foldhood(Double.MinValue)(max(_,_)){ // Also: maxHood {...} nbrvar[Double](NBR_RANGE_NAME) } – nbr queries a local sensor – nbrvar queries a "neighbouring sensor" (a sort of "environmental probe") R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 18 / 30
  • 19. SCAFI: Practical Aggregate Programming in Scala Field domain restriction Alignment • Aggregate computations can be represented as a trees • Device exports are "paths" along these trees • When two devices execute the same tree node, they are said to be aligned • Interaction is possible only between aligned devices Use cases for branch • Partitioning the space into subspaces performing subcomputations • Regulating admissible interactions (i.e., further restricting the neighbourhood) branch(sense[Boolean]("flag")){ compute(...) // sub-computation }{ Double.MaxValue // stable value (i.e., not computing) } R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 19 / 30
  • 20. SCAFI: Practical Aggregate Programming in Scala Functions Two kinds of functions in SCAFI: 1) "Normal" Scala functions: serve as units for encapsulating behavior/logic def foldhoodMinus[A](init: => A)(acc: (A,A) => A)(ex: => A): A = foldhood(init)(acc){ mux(mid()==nbr(mid())){ init }{ ex } } def isSource = sense[Boolean]("source") 2) First-class "aggregate" functions [DVPB15] – which also work as units for alignment def branch[A](cond: => Boolean)(th: => A)(el: => A): A = mux(cond, ()=>aggregate{ th }, ()=>aggregate{ el })() R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 20 / 30
  • 21. SCAFI: Practical Aggregate Programming in Scala Example: the gradient [BBVT08] def nbrRange = nbrvar[Double](NBR_RANGE_NAME) def gradient(source: Boolean): Double = rep(Double.PositiveInfinity){ distance => mux(source) { 0.0 }{ minHood { nbr{distance} + nbrRange } } } R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 21 / 30
  • 22. SCAFI: Practical Aggregate Programming in Scala Example: the channel I R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 22 / 30
  • 23. SCAFI: Practical Aggregate Programming in Scala Example: the channel II Each device is given the same aggregate program: class ChannelProgram extends AggregateProgram with ChannelAPI { def main = channel(isSource, isDestination, width) } def channel(src: Boolean, dest: Boolean, width: Double) = distanceTo(src) + distanceTo(dest) <= distBetween(src, dest) + width R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 23 / 30
  • 24. SCAFI: Practical Aggregate Programming in Scala Example: the channel III trait ChannelAPI extends Language with Builtins { def channel(src: Boolean, dest: Boolean, width: Double) = distanceTo(src) + distanceTo(dest) <= distBetween(src, dest) + width def G[V:OB](src: Boolean, field: V, acc: V=>V, metric: =>Double): V = rep( (Double.MaxValue, field) ){ dv => mux(src) { (0.0, field) } { minHoodMinus { val (d, v) = nbr { (dv._1, dv._2) } (d + metric, acc(v)) } } }._2 def broadcast[V:OB](source: Boolean, field: V): V = G[V](source, field, x=>x, nbrRange()) def distanceTo(source: Boolean): Double = G[Double](source, 0, _ + nbrRange(), nbrRange()) def distBetween(source: Boolean, target: Boolean): Double = broadcast(source, distanceTo(target)) def nbrRange(): Double = nbrvar[Double](NBR_RANGE_NAME) def isSource = sense[Boolean]("source"); def isDestination = sense[Boolean]("destination") } R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 24 / 30
  • 25. SCAFI: Practical Aggregate Programming in Scala Scaling with complexity General coordination operators [VBDP15] • Gradient-cast: accumulates values “outward” along a gradient starting from source nodes. def G[V:OB](src: Boolean, init: V, acc: V=>V, metric: =>Double): V • Converge-cast: collects data distributed across space “inward” by accumulating values from edge nodes to sink nodes down a “potential” field. def C[V:OB](potential: V, acc: (V,V)=>V, local: V, Null: V): V • Time-decay: supports information summarisation across time. def T[V:Numeric](initial: V, floor: V, decay: V=>V): V • Sparse-choice: supports creation of partitions and selection of sparse subsets of devices in space def S(grain: Double, metric: => Double): Boolean R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 25 / 30
  • 26. SCAFI: Practical Aggregate Programming in Scala A case study: crowd engineering [CPV16] val (high,low,none) = (2,1,0) // crowd level def crowdWarning(p: Double, r: Double, warn: Double, t: Double): Boolean = distanceTo(crowdTracking(p,r,t) == high) < warn def crowdTracking(p: Double, r: Double, t: Double) = { val crowdRgn = recentTrue(densityEst(p, r)>1.08, t) branch(crowdRgn){ dangerousDensity(p, r) }{ none } } def dangerousDensity(p: Double, r: Double) = { val mr = managementRegions(r*2, () => { nbrRange }) val danger = average(mr, densityEst(p, r)) > 2.17 && summarize(mr, (_:Double)+(_:Double), 1 / p, 0) > 300 mux(danger){ high }{ low } } // Auxiliary functions def recentTrue(state: Boolean, memTime: Double): Boolean def managementRegions(grain: Double, metric: => Double): Boolean = S(gran,metric) def densityEst(p: Double, range: Double): Double def summarize(sink: Boolean, acc: (Double,Double)=>Double, local: Double, Null: Double): Double def average(sink: Boolean, value: Double): Double R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 26 / 30
  • 27. SCAFI: Practical Aggregate Programming in Scala Quick platform setup // STEP 1: CHOOSE INCARNATION import it.unibo.scafi.incarnations.{ BasicActorP2P => Platform } // STEP 2: DEFINE AGGREGATE PROGRAM SCHEMA class Demo_AggregateProgram extends Platform.AggregateProgram { override def main(): Any = foldhood(0){_ + _}(1) } // STEP 3: DEFINE MAIN PROGRAM object Demo_MainProgram extends Platform.CmdLineMain 1) Demo_MainProgram -h 127.0.0.1 -p 9000 -e 1:2,4,5;2;3 --subsystems 127.0.0.1:9500:4:5 --program "demos.Demo_AggregateProgram" 2) Demo_MainProgram -h 127.0.0.1 -p 9500 -e 4;5:4 --program "demos.Demo_AggregateProgram" R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 27 / 30
  • 28. SCAFI: Practical Aggregate Programming in Scala Manual node setup // STEP 1: CHOOSE INCARNATION import scafi.incarnations.{ BasicActorP2P => Platform } import Platform.{AggregateProgram,Settings,PlatformConfig} // STEP 2: DEFINE AGGREGATE PROGRAM SCHEMA class Program extends AggregateProgram with CrowdAPI { // Specify a "dangerous density" aggregate computation override def main(): Any = crowdWarning(...) } // STEP 3: PLATFORM SETUP val settings = Settings() val platform = PlatformConfig.setupPlatform(settings) // STEP 4: NODE SETUP val sys = platform.newAggregateApplication() val dm = sys.newDevice(id = Utils.newId(), program = Program, neighbours = Utils.discoverNbrs()) val devActor = dm.actorRef // get underlying actor R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 28 / 30
  • 29. Conclusion Outline 1 Aggregate Computing: The Basics 2 SCAFI: Practical Aggregate Programming in Scala 3 Conclusion R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 29 / 30
  • 30. Conclusion Summary: key ideas Aggregate programming • A "macro" (programmingengineering) approach to CASs, formally grounded in the Field Calculus. • Allows to compose “emergent” phenomena & defines layers of (self-stabilizing) building blocks. SCAFI: a Scala framework for Aggregate Programming • Provides an internal DSL for field-based computations • Provides an actor-based platform for building aggregate systems Future work • Evolve SCAFI to support scalable computations in cluster- and cloud-based systems. • What does it take to set up a framework for adaptive execution strategies? R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 30 / 30
  • 31. Conclusion Question time Questions? R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 31 / 30
  • 32. Appendix References References I [BBVT08] Jacob Beal, Jonathan Bachrach, Dan Vickery, and Mark Tobenkin. Fast self-healing gradients. In Proceedings of the 2008 ACM symposium on Applied computing, pages 1969–1975. ACM, 2008. [BDU+ 12] Jacob Beal, Stefan Dulman, Kyle Usbeck, Mirko Viroli, and Nikolaus Correll. Organizing the aggregate: Languages for spatial computing. CoRR, abs/1202.5509, 2012. [BPV15] Jacob Beal, Danilo Pianini, and Mirko Viroli. Aggregate Programming for the Internet of Things. IEEE Computer, 2015. R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 32 / 30
  • 33. Appendix References References II [CPV16] Roberto Casadei, Danilo Pianini, and Mirko Viroli. Simulating large-scale aggregate mass with alchemist and scala. In Maria Ganzha, Leszek Maciaszek, and Marcin Paprzycki, editors, Proceedings of the Federated Conference on Computer Science and Information Systems (FedCSIS 2016), Gdansk, Poland, 11-14 September 2016. IEEE Computer Society Press. To appear. [CV16] Roberto Casadei and Mirko Viroli. Towards aggregate programming in Scala. In First Workshop on Programming Models and Languages for Distributed Computing, PMLDC ’16, pages 5:1–5:7, New York, NY, USA, 2016. ACM. [DVB16] Ferruccio Damiani, Mirko Viroli, and Jacob Beal. A type-sound calculus of computational fields. Science of Computer Programming, 117:17 – 44, 2016. R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 33 / 30
  • 34. Appendix References References III [DVPB15] Ferruccio Damiani, Mirko Viroli, Danilo Pianini, and Jacob Beal. Code mobility meets self-organisation: A higher-order calculus of computational fields. volume 9039 of Lecture Notes in Computer Science, pages 113–128. Springer International Publishing, 2015. [VBDP15] Mirko Viroli, Jacob Beal, Ferruccio Damiani, and Danilo Pianini. Efficient engineering of complex self-organising systems by self-stabilising fields. 2015. R. Casadei (Università di Bologna) Practical Aggregate Programming in Scala Scala Symposium ’16 34 / 30