PySense
    Python Decorators for Wireless Sensor Macroprogramming




Davide Carboni,
ICSOFT 2010, Athens 22-24 April

                                                             1
Who, where...




                        geoweb.crs4.it
                        twitter.com/__dadaista__

locative sensor web ubicomp web of things mobile
                                               2 2
wireless sensor
           networking today


                communication
communication
                                computation




                                              3
wireless sensor
                computing

                                       computation--

                   communication--
 communication--


computation++



                                     computation++
                                                       4
Decentralization

• In today cloud computing
  “computation costs less then
  storage” → “move the
  computation to data”
• In today wireless networks
  “computation costs less then
  communication” → move the
  computation to data (sensors)

                                  5
Decentralization

• Wireless Sensor Computing
  – not only simple sensors connected to
    a central computer, but rather
    elements capable of computation
    in a distributed system
• Computation Vs Communication
  – One byte sent demands 100 times
    the energy of an integer instruction


                                           6
Programming models

• Node-level programming
  – program for each node type (error
    prone, difficult, only for experts)
• Network as DB
  – Good but limited to queries (TinyDB)
• Macroprogramming
  – Program the net as a whole, the
    middleware partition the code on the
    nodes automatically
                                           7
Use case

• given an energy consumption
  model E and an application code C,
  there exists a partitioning of code
  C={c1,c2,...,cn} and a set Tx of
  transmissions Tx={tx1,tx2,...,txk}
  which is optimal for E



                                        8
PySense

• What is PySense
  – A programming model for Python
  – A middleware based on Python
    decorators and API
  – It runs on:
    • Base Runtime Environment (based on
      Python 2.6)
    • Remote Runtime Environment (based on
      Python-on-a-chip)

                                             9
What is not PySense

• Not ready to use solution
• Not bound to a specific network
  topology (mesh, clustering, ...) or
  network protocol stack
  (zigbee,tcp,...)
• Not efficient in terms of memory
  used by nodes


                                        10
Motivation

• Python:
  – easy to use,
  – easy to learn,
  – rapid prototyping
                        And because we
                        like to go beyond
                             the limits



                                            11
What is a python
          decorator

Syntactic sugar
@foo
def f(x):<implementation>

Equivalent to call
foo(f)
where foo returns a function

                               12
What is a python
           decorator
def foo(func):
    def my_f(*args):
         do_something_pre()
         func(*args)
         do_something_post()
    return my_f

@foo
def f(x):
     return x*x

                               13
Elements of PySense

•   Region
•   Group
•   @mote
•   @onboard
•   @onbase
•   @auto


                                 14
PySense Regions

Region(“/(0,0,100,100)”) | Region(“/foo/3/312”)




                                                  15
@mote

@mote
class M:
  def getX(self):pass
  def setY(self,y):pass

           Finds a mote m with X,Y
m=M()
m.getX()        Read X from m, translated
                 in a network message
                  from the invoker to m
                                            16
@mote                         Translated into
class M:                   a network message:
   def getX(self):pass    TO <addr> CALL f x,y,...

   @onboard
   def f(self,args):<code to move on node>

   @onbase
   def g(self,args):<code to run on base>

   @auto
   def h(self,args):<some code>

                                                     17
Simple program

r=Region(“/somewhere”) #somewhere
@mote
class CO2Sense:
  def getConc(self): A lot of long range messages
    pass               exchanged between base
                               and remotes

values=
[c.getConc() for c in r.items(CO2Sense)]
avg = sum(values)/len(values)

                                                    18
A little better

@mote
class CO2Sense:
  def getConc(self):pass     The avg () will be run
                             In one remote elected
class CO2Group(Group):           head of group
  @onboard
  def avg(self):
    return sum([m.getConc() for m in self.motes])
/ len(self.motes)
                                        Short range
                                         messages
avg=CO2Group(r.items(CO2Sense)).avg()

                                                      19
Where we are

• API and decorators implemented
  and tested on PC processes
  running python-on-a-chip
  interpreter and pipes for I/O
• Todo:
 – @auto
 – Deployment on real boards … we
   want a real test bed not simulation

                                         20
A lot to do

• Approach #1       Hey … this is a position paper

 – running a VM and interpreter on the
   mote
 – Memory demanding
• Approach #2
 – Compiling @onboard python on native
   code
 – Need OTA reconf

                                                     21
VM on board

           MBED board
           64KB RAM
          Clock 100MHz
          USB, ETH, ...




               Running python
                  and HTTP
              is too demanding


                                 22
Questions & Answers




                      23

More Related Content

PDF
The world is the computer and the programmer is you
ODP
High-Performance Computing and OpenSolaris
PDF
"Semantic Segmentation for Scene Understanding: Algorithms and Implementation...
PDF
Distributed Multi-device Execution of TensorFlow – an Outlook
PPTX
Afanasov14flynet slides
PDF
NUMA-aware thread-parallel breadth-first search for Graph500 and Green Graph5...
PDF
Parallel Computing Example with Raspberry Pi Cluster
PDF
PFN Summer Internship 2019 / Kenshin Abe: Extension of Chainer-Chemistry for ...
The world is the computer and the programmer is you
High-Performance Computing and OpenSolaris
"Semantic Segmentation for Scene Understanding: Algorithms and Implementation...
Distributed Multi-device Execution of TensorFlow – an Outlook
Afanasov14flynet slides
NUMA-aware thread-parallel breadth-first search for Graph500 and Green Graph5...
Parallel Computing Example with Raspberry Pi Cluster
PFN Summer Internship 2019 / Kenshin Abe: Extension of Chainer-Chemistry for ...

What's hot (20)

PPT
MPEG-4 BIFS Overview
PPTX
DIY Deep Learning with Caffe Workshop
PPTX
Lzw compression ppt
PDF
2014 valat-phd-defense-slides
PDF
Standardizing on a single N-dimensional array API for Python
PDF
NUMA-aware Scalable Graph Traversal on SGI UV Systems
PDF
PyData NYC whatsnew NumPy-SciPy 2019
PPTX
Paralell
PDF
Reversible Digital Watermarking of Audio Wav Signal Using Additive Interpolat...
PDF
Python at Ordnance Survey
PPTX
ODP
Linux and Open Source in Math, Science and Engineering
PDF
HTCC poster for CERN Openlab opendays 2015
PDF
Fast and Scalable NUMA-based Thread Parallel Breadth-first Search
PDF
A peek on numerical programming in perl and python e christopher dyken 2005
PDF
Graph500 and Green Graph500 benchmarks on SGI UV2000 @ SGI UG SC14
PDF
The Joy of SciPy
PPT
Lzw coding technique for image compression
PPTX
LEGaTO: Software Stack Runtimes
PPTX
TensorFlow Object Detection API
MPEG-4 BIFS Overview
DIY Deep Learning with Caffe Workshop
Lzw compression ppt
2014 valat-phd-defense-slides
Standardizing on a single N-dimensional array API for Python
NUMA-aware Scalable Graph Traversal on SGI UV Systems
PyData NYC whatsnew NumPy-SciPy 2019
Paralell
Reversible Digital Watermarking of Audio Wav Signal Using Additive Interpolat...
Python at Ordnance Survey
Linux and Open Source in Math, Science and Engineering
HTCC poster for CERN Openlab opendays 2015
Fast and Scalable NUMA-based Thread Parallel Breadth-first Search
A peek on numerical programming in perl and python e christopher dyken 2005
Graph500 and Green Graph500 benchmarks on SGI UV2000 @ SGI UG SC14
The Joy of SciPy
Lzw coding technique for image compression
LEGaTO: Software Stack Runtimes
TensorFlow Object Detection API
Ad

Similar to Pysense: wireless sensor computing in Python? (20)

PDF
обзор Python
PPTX
5-Tut3_Networking_with_Python.pptx good intro
PDF
Micropython for the iot
PDF
mpi4py Manual!
PPTX
Python for IoT CoE.pptx KDOJWIHJNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
PDF
Your interactive computing
PDF
SunPy: Python for solar physics
PDF
Harmonic Stack for Speed
PPTX
embedded system with raspberry piVarun[1].pptx
PDF
Quest for a low powered home hub 120522
PPTX
Summer 2017 undergraduate research powerpoint
PDF
IoT Programming on the Raspberry Pi
PDF
PPTX
[University] Capstone Design Project 2 (SAIOT)
PDF
Engineer Engineering Software
PDF
Python in the real world : from everyday applications to advanced robotics
PDF
Introduction to Python Syntax and Semantics
PDF
python-csp: bringing OCCAM to Python
PPT
Master Python Basics Easily – From Zero to Real-World Applications for UG Stu...
PDF
Smart objectapi tutorial 092013
обзор Python
5-Tut3_Networking_with_Python.pptx good intro
Micropython for the iot
mpi4py Manual!
Python for IoT CoE.pptx KDOJWIHJNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
Your interactive computing
SunPy: Python for solar physics
Harmonic Stack for Speed
embedded system with raspberry piVarun[1].pptx
Quest for a low powered home hub 120522
Summer 2017 undergraduate research powerpoint
IoT Programming on the Raspberry Pi
[University] Capstone Design Project 2 (SAIOT)
Engineer Engineering Software
Python in the real world : from everyday applications to advanced robotics
Introduction to Python Syntax and Semantics
python-csp: bringing OCCAM to Python
Master Python Basics Easily – From Zero to Real-World Applications for UG Stu...
Smart objectapi tutorial 092013
Ad

More from Davide Carboni (20)

PDF
Facts & Figures about Web3 Security in 2024
PPTX
PPT-CyberJourney-June-2023-Carboni.pptx
PDF
From Smart Contracts to NFT
PDF
Blockchain School 2019 - Security of Smart Contracts.pdf
PDF
The Bitcoin blockchain (en)
PDF
Internet-of-things, sicurezza, privacy, trust
PDF
Blockchain - crittomonete, Bitcoin e altre applicazioni
ODP
08 mapreduce
PDF
04 bloom
PDF
2 phase-commit
PDF
Internet of Things al Festivalscienza 2010
PDF
Introduzione ai Design Patterns nella Programmazione a Oggetti
PDF
Browsing Large Collections of Geo-Tagged Pictures
PDF
Programmazione concorrente in Java (vecchio modello)
PPT
NAT Traversal
PPT
Introduction P2p
PDF
Spoleto07
ODP
Kickoff del Progetto Cluster Mashup e Geoweb
ODP
Open al bivio fra software e webware (al javaday 2006)
ODP
Web 2.0, mashup e GeoWeb
Facts & Figures about Web3 Security in 2024
PPT-CyberJourney-June-2023-Carboni.pptx
From Smart Contracts to NFT
Blockchain School 2019 - Security of Smart Contracts.pdf
The Bitcoin blockchain (en)
Internet-of-things, sicurezza, privacy, trust
Blockchain - crittomonete, Bitcoin e altre applicazioni
08 mapreduce
04 bloom
2 phase-commit
Internet of Things al Festivalscienza 2010
Introduzione ai Design Patterns nella Programmazione a Oggetti
Browsing Large Collections of Geo-Tagged Pictures
Programmazione concorrente in Java (vecchio modello)
NAT Traversal
Introduction P2p
Spoleto07
Kickoff del Progetto Cluster Mashup e Geoweb
Open al bivio fra software e webware (al javaday 2006)
Web 2.0, mashup e GeoWeb

Recently uploaded (20)

PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
Five Habits of High-Impact Board Members
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
Tartificialntelligence_presentation.pptx
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
Architecture types and enterprise applications.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
DOCX
search engine optimization ppt fir known well about this
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
Modernising the Digital Integration Hub
PDF
Unlock new opportunities with location data.pdf
PDF
August Patch Tuesday
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PPTX
The various Industrial Revolutions .pptx
Getting started with AI Agents and Multi-Agent Systems
WOOl fibre morphology and structure.pdf for textiles
Five Habits of High-Impact Board Members
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Tartificialntelligence_presentation.pptx
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
A contest of sentiment analysis: k-nearest neighbor versus neural network
Architecture types and enterprise applications.pdf
Zenith AI: Advanced Artificial Intelligence
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
search engine optimization ppt fir known well about this
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Modernising the Digital Integration Hub
Unlock new opportunities with location data.pdf
August Patch Tuesday
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
Final SEM Unit 1 for mit wpu at pune .pptx
The various Industrial Revolutions .pptx

Pysense: wireless sensor computing in Python?

  • 1. PySense Python Decorators for Wireless Sensor Macroprogramming Davide Carboni, ICSOFT 2010, Athens 22-24 April 1
  • 2. Who, where... geoweb.crs4.it twitter.com/__dadaista__ locative sensor web ubicomp web of things mobile 2 2
  • 3. wireless sensor networking today communication communication computation 3
  • 4. wireless sensor computing computation-- communication-- communication-- computation++ computation++ 4
  • 5. Decentralization • In today cloud computing “computation costs less then storage” → “move the computation to data” • In today wireless networks “computation costs less then communication” → move the computation to data (sensors) 5
  • 6. Decentralization • Wireless Sensor Computing – not only simple sensors connected to a central computer, but rather elements capable of computation in a distributed system • Computation Vs Communication – One byte sent demands 100 times the energy of an integer instruction 6
  • 7. Programming models • Node-level programming – program for each node type (error prone, difficult, only for experts) • Network as DB – Good but limited to queries (TinyDB) • Macroprogramming – Program the net as a whole, the middleware partition the code on the nodes automatically 7
  • 8. Use case • given an energy consumption model E and an application code C, there exists a partitioning of code C={c1,c2,...,cn} and a set Tx of transmissions Tx={tx1,tx2,...,txk} which is optimal for E 8
  • 9. PySense • What is PySense – A programming model for Python – A middleware based on Python decorators and API – It runs on: • Base Runtime Environment (based on Python 2.6) • Remote Runtime Environment (based on Python-on-a-chip) 9
  • 10. What is not PySense • Not ready to use solution • Not bound to a specific network topology (mesh, clustering, ...) or network protocol stack (zigbee,tcp,...) • Not efficient in terms of memory used by nodes 10
  • 11. Motivation • Python: – easy to use, – easy to learn, – rapid prototyping And because we like to go beyond the limits 11
  • 12. What is a python decorator Syntactic sugar @foo def f(x):<implementation> Equivalent to call foo(f) where foo returns a function 12
  • 13. What is a python decorator def foo(func): def my_f(*args): do_something_pre() func(*args) do_something_post() return my_f @foo def f(x): return x*x 13
  • 14. Elements of PySense • Region • Group • @mote • @onboard • @onbase • @auto 14
  • 16. @mote @mote class M: def getX(self):pass def setY(self,y):pass Finds a mote m with X,Y m=M() m.getX() Read X from m, translated in a network message from the invoker to m 16
  • 17. @mote Translated into class M: a network message: def getX(self):pass TO <addr> CALL f x,y,... @onboard def f(self,args):<code to move on node> @onbase def g(self,args):<code to run on base> @auto def h(self,args):<some code> 17
  • 18. Simple program r=Region(“/somewhere”) #somewhere @mote class CO2Sense: def getConc(self): A lot of long range messages pass exchanged between base and remotes values= [c.getConc() for c in r.items(CO2Sense)] avg = sum(values)/len(values) 18
  • 19. A little better @mote class CO2Sense: def getConc(self):pass The avg () will be run In one remote elected class CO2Group(Group): head of group @onboard def avg(self): return sum([m.getConc() for m in self.motes]) / len(self.motes) Short range messages avg=CO2Group(r.items(CO2Sense)).avg() 19
  • 20. Where we are • API and decorators implemented and tested on PC processes running python-on-a-chip interpreter and pipes for I/O • Todo: – @auto – Deployment on real boards … we want a real test bed not simulation 20
  • 21. A lot to do • Approach #1 Hey … this is a position paper – running a VM and interpreter on the mote – Memory demanding • Approach #2 – Compiling @onboard python on native code – Need OTA reconf 21
  • 22. VM on board MBED board 64KB RAM Clock 100MHz USB, ETH, ... Running python and HTTP is too demanding 22