SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

DIY Deep Learning with Caffe Workshop
DIY Deep Learning with Caffe WorkshopDIY Deep Learning with Caffe Workshop
DIY Deep Learning with Caffe Workshop
odsc
 
2014 valat-phd-defense-slides
2014 valat-phd-defense-slides2014 valat-phd-defense-slides
2014 valat-phd-defense-slides
SĂŠbastien Valat
 
A peek on numerical programming in perl and python e christopher dyken 2005
A peek on numerical programming in perl and python  e christopher dyken  2005A peek on numerical programming in perl and python  e christopher dyken  2005
A peek on numerical programming in perl and python e christopher dyken 2005
Jules Krdenas
 

Was ist angesagt? (20)

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

Ähnlich wie Pysense: wireless sensor computing in Python?

Natural Language Processing with CNTK and Apache Spark with Ali Zaidi
Natural Language Processing with CNTK and Apache Spark with Ali ZaidiNatural Language Processing with CNTK and Apache Spark with Ali Zaidi
Natural Language Processing with CNTK and Apache Spark with Ali Zaidi
Databricks
 
Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/Invoke
Dmitri Nesteruk
 

Ähnlich wie Pysense: wireless sensor computing in Python? (20)

Scaling Python to CPUs and GPUs
Scaling Python to CPUs and GPUsScaling Python to CPUs and GPUs
Scaling Python to CPUs and GPUs
 
EEDC Programming Models
EEDC Programming ModelsEEDC Programming Models
EEDC Programming Models
 
Natural Language Processing with CNTK and Apache Spark with Ali Zaidi
Natural Language Processing with CNTK and Apache Spark with Ali ZaidiNatural Language Processing with CNTK and Apache Spark with Ali Zaidi
Natural Language Processing with CNTK and Apache Spark with Ali Zaidi
 
MXNet Workshop
MXNet WorkshopMXNet Workshop
MXNet Workshop
 
Eclipse Con Europe 2014 How to use DAWN Science Project
Eclipse Con Europe 2014 How to use DAWN Science ProjectEclipse Con Europe 2014 How to use DAWN Science Project
Eclipse Con Europe 2014 How to use DAWN Science Project
 
An Introduction to OMNeT++ 6.0
An Introduction to OMNeT++ 6.0An Introduction to OMNeT++ 6.0
An Introduction to OMNeT++ 6.0
 
IS-ENES COMP Superscalar tutorial
IS-ENES COMP Superscalar tutorialIS-ENES COMP Superscalar tutorial
IS-ENES COMP Superscalar tutorial
 
25-MPI-OpenMP.pptx
25-MPI-OpenMP.pptx25-MPI-OpenMP.pptx
25-MPI-OpenMP.pptx
 
[html5jロボット部 第7回勉強会] Microsoft Cognitive Toolkit (CNTK) Overview
[html5jロボット部 第7回勉強会] Microsoft Cognitive Toolkit (CNTK) Overview[html5jロボット部 第7回勉強会] Microsoft Cognitive Toolkit (CNTK) Overview
[html5jロボット部 第7回勉強会] Microsoft Cognitive Toolkit (CNTK) Overview
 
Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/Invoke
 
mpi4py.pdf
mpi4py.pdfmpi4py.pdf
mpi4py.pdf
 
On the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of PythonOn the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of Python
 
On the necessity and inapplicability of python
On the necessity and inapplicability of pythonOn the necessity and inapplicability of python
On the necessity and inapplicability of python
 
Performance Optimization of SPH Algorithms for Multi/Many-Core Architectures
Performance Optimization of SPH Algorithms for Multi/Many-Core ArchitecturesPerformance Optimization of SPH Algorithms for Multi/Many-Core Architectures
Performance Optimization of SPH Algorithms for Multi/Many-Core Architectures
 
D. Fast, Simple User-Space Network Functions with Snabb (RIPE 77)
D. Fast, Simple User-Space Network Functions with Snabb (RIPE 77)D. Fast, Simple User-Space Network Functions with Snabb (RIPE 77)
D. Fast, Simple User-Space Network Functions with Snabb (RIPE 77)
 
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
 
CSE5656 Complex Networks - Location Correlation in Human Mobility, Implementa...
CSE5656 Complex Networks - Location Correlation in Human Mobility, Implementa...CSE5656 Complex Networks - Location Correlation in Human Mobility, Implementa...
CSE5656 Complex Networks - Location Correlation in Human Mobility, Implementa...
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"
 
Tms320 f2812
Tms320 f2812Tms320 f2812
Tms320 f2812
 
Scalable Deep Learning on AWS Using Apache MXNet - AWS Summit Tel Aviv 2017
Scalable Deep Learning on AWS Using Apache MXNet - AWS Summit Tel Aviv 2017Scalable Deep Learning on AWS Using Apache MXNet - AWS Summit Tel Aviv 2017
Scalable Deep Learning on AWS Using Apache MXNet - AWS Summit Tel Aviv 2017
 

Mehr von Davide Carboni

Internet of Things al Festivalscienza 2010
Internet of Things al Festivalscienza 2010Internet of Things al Festivalscienza 2010
Internet of Things al Festivalscienza 2010
Davide Carboni
 
Introduzione ai Design Patterns nella Programmazione a Oggetti
Introduzione ai Design Patterns nella Programmazione a OggettiIntroduzione ai Design Patterns nella Programmazione a Oggetti
Introduzione ai Design Patterns nella Programmazione a Oggetti
Davide Carboni
 
Browsing Large Collections of Geo-Tagged Pictures
Browsing Large Collections of Geo-Tagged PicturesBrowsing Large Collections of Geo-Tagged Pictures
Browsing Large Collections of Geo-Tagged Pictures
Davide Carboni
 
Kickoff del Progetto Cluster Mashup e Geoweb
Kickoff del Progetto Cluster Mashup e GeowebKickoff del Progetto Cluster Mashup e Geoweb
Kickoff del Progetto Cluster Mashup e Geoweb
Davide Carboni
 
Open al bivio fra software e webware (al javaday 2006)
Open al bivio fra software e webware (al javaday 2006)Open al bivio fra software e webware (al javaday 2006)
Open al bivio fra software e webware (al javaday 2006)
Davide Carboni
 
Open al bivio fra software e webware
Open al bivio fra software e webwareOpen al bivio fra software e webware
Open al bivio fra software e webware
Davide Carboni
 

Mehr von Davide Carboni (20)

PPT-CyberJourney-June-2023-Carboni.pptx
PPT-CyberJourney-June-2023-Carboni.pptxPPT-CyberJourney-June-2023-Carboni.pptx
PPT-CyberJourney-June-2023-Carboni.pptx
 
From Smart Contracts to NFT
 From Smart Contracts to NFT From Smart Contracts to NFT
From Smart Contracts to NFT
 
Blockchain School 2019 - Security of Smart Contracts.pdf
Blockchain School 2019 - Security of Smart Contracts.pdfBlockchain School 2019 - Security of Smart Contracts.pdf
Blockchain School 2019 - Security of Smart Contracts.pdf
 
The Bitcoin blockchain (en)
The Bitcoin blockchain (en)The Bitcoin blockchain (en)
The Bitcoin blockchain (en)
 
Internet-of-things, sicurezza, privacy, trust
Internet-of-things, sicurezza, privacy, trustInternet-of-things, sicurezza, privacy, trust
Internet-of-things, sicurezza, privacy, trust
 
Blockchain - crittomonete, Bitcoin e altre applicazioni
Blockchain - crittomonete, Bitcoin e altre applicazioniBlockchain - crittomonete, Bitcoin e altre applicazioni
Blockchain - crittomonete, Bitcoin e altre applicazioni
 
08 mapreduce
08   mapreduce08   mapreduce
08 mapreduce
 
04 bloom
04 bloom04 bloom
04 bloom
 
2 phase-commit
 2 phase-commit 2 phase-commit
2 phase-commit
 
Internet of Things al Festivalscienza 2010
Internet of Things al Festivalscienza 2010Internet of Things al Festivalscienza 2010
Internet of Things al Festivalscienza 2010
 
Introduzione ai Design Patterns nella Programmazione a Oggetti
Introduzione ai Design Patterns nella Programmazione a OggettiIntroduzione ai Design Patterns nella Programmazione a Oggetti
Introduzione ai Design Patterns nella Programmazione a Oggetti
 
Browsing Large Collections of Geo-Tagged Pictures
Browsing Large Collections of Geo-Tagged PicturesBrowsing Large Collections of Geo-Tagged Pictures
Browsing Large Collections of Geo-Tagged Pictures
 
Programmazione concorrente in Java (vecchio modello)
Programmazione concorrente in Java (vecchio modello)Programmazione concorrente in Java (vecchio modello)
Programmazione concorrente in Java (vecchio modello)
 
NAT Traversal
NAT TraversalNAT Traversal
NAT Traversal
 
Introduction P2p
Introduction P2pIntroduction P2p
Introduction P2p
 
Spoleto07
Spoleto07Spoleto07
Spoleto07
 
Kickoff del Progetto Cluster Mashup e Geoweb
Kickoff del Progetto Cluster Mashup e GeowebKickoff del Progetto Cluster Mashup e Geoweb
Kickoff del Progetto Cluster Mashup e Geoweb
 
Open al bivio fra software e webware (al javaday 2006)
Open al bivio fra software e webware (al javaday 2006)Open al bivio fra software e webware (al javaday 2006)
Open al bivio fra software e webware (al javaday 2006)
 
Web 2.0, mashup e GeoWeb
Web 2.0, mashup e GeoWebWeb 2.0, mashup e GeoWeb
Web 2.0, mashup e GeoWeb
 
Open al bivio fra software e webware
Open al bivio fra software e webwareOpen al bivio fra software e webware
Open al bivio fra software e webware
 

KĂźrzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

KĂźrzlich hochgeladen (20)

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

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