If You Build It They Will Come The
If You Build It, They Will Come: The SNBENCH Architecture Adam Bradley Azer Bestavros & Michael Long Computer Science Department Boston University http: //www. cs. bu. edu/groups/wing/ May 13, 2005
Before we begin… Welcome To Summer! May 13, 2005 The sn. Bench Architecture 2
Sensorium Infrastructure @ BU Sensorium: A common space equipped with video sensors (VS) for ubiquitous recognition and tracking of activities therein Infrastructure: o o o Range of VS Elements Programmable VS Network Backend compute engines Backend TByte storage Mobile/wireless query units Research Engineer May 13, 2005 The sn. Bench Architecture 3
sn. Bench The Sensorium is the computer… Design/implement the programming and run-time infrastructure necessary for developers to specify and deploy truly distributed applications over a heterogeneous network of Sensing Elements (SEs) and Computing Elements (CEs) What sensors could I use and what functionality do I get from them? May 13, 2005 The sn. Bench Architecture 4
sn. Bench: Goals o o “Write Once, Run… Wherever” Don’t program nodes… Program the network! n Start with building blocks o o o n Glue together with high-level language o n Conditionals, loops, functions… Pretend the network isn’t there o May 13, 2005 Sensors Stock algorithms (edge detect, face count, FFT) Dynamic modules (novel algorithms) “Single System Image” Programming Paradigm The sn. Bench Architecture 5
sn. Bench: Programming Cycle o Program n o Compile n o SNAFU program is compiled to produce a plan of execution expressed in STEP Map and Link n o Program specified by gluing together building blocks using SNAFU language Service Dispatcher decomposes STEP plans into smaller linked dispatch-able STEPs Load and Execute n May 13, 2005 STEP plans are dispatched (i. e. , loaded) into SXE execution environments The sn. Bench Architecture 6
SNAFU: SNet Apps as FUnctions! o Functional specification language n e. g. , identify the face seen through camera 1 identify(facefind(snapshot(cam 1))) May 13, 2005 The sn. Bench Architecture 7
SNAFU: SNet Apps as FUnctions! o Use “annotative” functions for constraints n e. g. , minimum acceptable resolution facecount(resn(800 x 600 x 24 b, snapshot(cam 1))) n e. g. , what streams can be “exposed” public(facecount(snapshot(private(cam 1))))) May 13, 2005 The sn. Bench Architecture 8
SNAFU: SNet Apps as FUnctions! o Events in time captured by “triggers” n e. g. , motion detected at night triggers email(“security@bu. edu”, trigger( (motion(snapshot(cam 2)) && (2 am<NOW<4 am)), snapshot(cam 2))) May 13, 2005 The sn. Bench Architecture 9
SNAFU: SNet Apps as FUnctions! o Three trigger types: n trigger(p, a): “Wait until p” o n level_trigger(p, a): “Whenever p” o n n while (true) { if (p) { a; while (p) {} } }; Value of trigger is value of a’s evaluation Level and edge triggers produce streams o May 13, 2005 while (true) { if (p) a; }; edge_trigger: “Whenever p becomes true” o n do { /* no-op */ } until (p); a; a. k. a. “persistent queries” living in network The sn. Bench Architecture 10
SNAFU: SNet Apps as FUnctions! o Trigger Qo. S (Scheduling annotations) period(100 ms, level_trigger(f(cam 1), g(cam 1))) May 13, 2005 The sn. Bench Architecture 11
SNAFU: SNet Apps as FUnctions! o Retrieving values from triggers: n n n o Non-blocking read - Last result Blocking read - Wait for next result Fresh read - Wait for a “from scratch” result Recursion: n LAST_TRIGGER_EVALUATION term o o May 13, 2005 Last value produced by innermost(? ) trigger term Not sure what to call it… “head recursion” ? The sn. Bench Architecture 12
STEP: Sensorium Typed Exec Plan “Instruction Set Architecture” is a DAG email “security@bu. edu” email(“security@bu. edu”, edge_trigger( (motion(snapshot(cam 2)) && (2 am<NOW<4 am)), snapshot(cam 2))) edge_trigger && < 2 am < clock motion 4 am snapshot cam 2 May 13, 2005 The sn. Bench Architecture 13
STEP: Sensorium Typed Exec Plan Notes: email q Evaluation percolates “security@bu. edu” up from leaf nodes toward roots. q Sensor nodes provide && fresh data at all times. q Function nodes < < evaluate once then disable themselves. 2 am clock 4 am q Trigger nodes can re-enable children for re-evaluation. May 13, 2005 The sn. Bench Architecture edge_trigger motion snapshot cam 2 14
sn. Bench: Runtime Setting n n n SNAFU-to-STEP compiler SXE: Sensorium e. Xecution Environment SD: Service Dispatcher SXE SXE SD, SXE SXE Compiler, Web Browser, SXE(? ) May 13, 2005 The sn. Bench Architecture 15
Map, Link, and Dispatch email “security@bu. edu” SXE edge_trigger && < 2 AM < clock SXE motion 4 AM snapshot SXE cam 2 May 13, 2005 The sn. Bench Architecture 16
Map, Link, and Dispatch email “security@bu. edu” trigger SXE edge_trigger && logical_and < < SXE motion 2 AM clock 4 AM snapshot cam 2 SXE cam 2 May 13, 2005 The sn. Bench Architecture 17
Why sn. Bench? o A Sensorium Research Catalyst n Extrinsic research o n Intrinsic research o n Languages, type systems, compilers, graph algorithms, schedulers, Qo. S engines, naming, etc. to make the framework efficient/useful/flexible Supporting research o May 13, 2005 Accessible framework for developing distributed sensing applications in heterogeneous networks System context, supporting middleware/services The sn. Bench Architecture 18
Extrinsic Research o Flexible substrate for experimenting with distributed sensor applications n n o Extensible w/ new algorithms (“opcodes”) Trade some speed for versatility and easy re-programmability/re-tasking Abstracts away “the network” n May 13, 2005 Vision researchers don’t need to understand communication protocols, RT schedulers, network resource reservation, etc. The sn. Bench Architecture 19
Extrinsic Research: Sensorium Target Applications Assistive Environments n e. g. for home/hospice/elder care/… Safety Monitoring n e. g. in factories/daycare/garages/subways… Intelligent Spaces n e. g. for classrooms/meeting rooms/theaters/farms… Secure Facilities and Homeland Security Uses n e. g. at airports/embassies/prisons/CS labs/… People Flow/Activity Studies n May 13, 2005 e. g. at malls/interstates/… The sn. Bench Architecture 20
Intrinsic/Extrinsic Research Why limit ourselves to passive sensing? Control actuators with sn. Bench programs! n n n Multi-DOF Cameras Mobile Sensors Robots Control theory issues… May 13, 2005 The sn. Bench Architecture 21
Intrinsic Research o Scheduling/Linking/Binding n n How did we arrive at this partitioning? How did we arrive at these assignments? email “security@bu. edu” SXE edge_trigger && < 2 AM < clock SXE motion 4 AM snapshot cam 2 May 13, 2005 The sn. Bench Architecture SXE 22
Scheduling: Processing Capacity Load averages? Busy rate? STEP nodes/s? Realtime scheduler? SXE email ? “security@bu. edu” edge_trigger SXE && < < 2 AM clock 4 AM motion snapshot SXE cam 2 May 13, 2005 The sn. Bench Architecture 23
Scheduling: Network Capacity 8 Mb/s 95% SXE ? email “security@bu. edu” edge_trigger 100 Mb/s 10% 100 Mb/s 40% SXE 100 Mb/s 20% && < < 2 AM clock 4 AM motion snapshot SXE cam 2 May 13, 2005 The sn. Bench Architecture 512 kb/s 75% SXE 24
Scheduling: Code Presence motion email delta [empty] facefind [empty] SXE bodytrack email motion “security@bu. edu” edge_trigger oflow delta [empty] && < < 2 AM clock 4 AM snapshot delta motion snapshot SXE cam 2 May 13, 2005 ? SXE The sn. Bench Architecture 25
Intrinsic Research Scheduling = Constrained Graph embedding and optimization! motion email delta [empty] SXE ? email “security@bu. edu” edge_trigger && < < 2 AM clock 4 AM May 13, 2005 8 Mb/s 60% motion oflow 100 Mb/s delta 10% [empty] facefind bodytrack email 100 Mb/s 40% SXE snapshot 100 Mb/s 20% delta motion snapshot SXE The sn. Bench Architecture 512 kb/s 75% SXE 26
More Scheduling Multiple simultaneous programs may share STEP sub-graphs: email(“security@bu. edu”, block( edge_trigger(motion(snapshot(cam 2)) && (2 am<NOW<4 am), snapshot(cam 2))) trigger( facerecognizer( block( edge_trigger(motion(snapshot(cam 2)) && (2 am<NOW<4 am), snapshot(cam 2))), facelibrary(“Adam Bradley”)), email(“adams. wife@gmail. com”, “He’s working late again. ”)) May 13, 2005 The sn. Bench Architecture 27
More Scheduling: CSE Common Subexpression/Subgraph Elimination email(“security@bu. edu”, “security@bu. edu”edge_trigger block( edge_trigger(motion(snapshot(cam 2)) && (2 am<NOW<4 am), && snapshot(cam 2))) trigger < < motion facerecognizer 2 AM clock 4 AM email snapshot cam 2 edge_trigger facelibrary “adams. wife@gmail. com” “He’s working late again” trigger( && “Adam Bradley” facerecognizer( block( edge_trigger( < < motion(snapshot(cam 2)) && (2 am<NOW<4 am), 2 am clock 4 am snapshot(cam 2))), facelibrary(“Adam Bradley”)), cam 2 email(“adams. wife@gmail. com”, “He’s working late again. ”)) May 13, 2005 The sn. Bench Architecture 28
More Scheduling: CSE Common Subexpression/Subgraph Elimination email motion 2 AM clock 4 AM snapshot cam 2 facerecognizer m < Co < m on Su bg ra ph email(“security@bu. edu”, “security@bu. edu”edge_trigger block( edge_trigger(motion(snapshot(cam 2)) && (2 am<NOW<4 am), && snapshot(cam 2))) trigger edge_trigger facelibrary email “azer. wife@cs. bu. edu” “He’s working late again” trigger( && “Azer Bestavros” facerecognizer( block( edge_trigger( < < motion(snapshot(cam 2)) && (2 am<NOW<4 am), 2 am clock 4 am snapshot(cam 2))), facelibrary(“Adam Bradley”)), cam 2 email(“adams. wife@gmail. com”, “He’s working late again. ”)) May 13, 2005 The sn. Bench Architecture 29
More Scheduling: CSE Common Subexpression/Subgraph Elimination email “security@bu. edu”edge_trigger email(“security@bu. edu”, block( edge_trigger(motion(snapshot(cam 2)) && (2 am<NOW<4 am), logical_and snapshot(cam 2))) trigger < < lights_are_on 2 AM clock 4 AM facerecognizer snapshot cam 2 edge_trigger facelibrary email “azers. wife@cs. bu. edu” “He’s working late again” trigger( logical_and “Azer Bestavros” facerecognizer( block( edge_trigger( < < lights_are_on motion(snapshot(cam 2)) && (2 am<NOW<4 am), 2 AM clock 4 AM snapshot(cam 2))), facelibrary(“Adam Bradley”)), cam 2 email(“adams. wife@gmail. com”, “He’s working late again. ”)) May 13, 2005 The sn. Bench Architecture 30
More Scheduling: CSE Common Subexpression/Subgraph Elimination email(“security@bu. edu”, block( SXE edge_trigger(motion(snapshot(cam 2)) && (2 am<NOW<4 am), snapshot(cam 2))) trigger SXE email facerecognizer “security@bu. edu”edge_trigger SXE May 13, 2005 facelibrary email “azers. wife@cs. bu. edu” “He’s working late again” trigger( logical_and “Azer Bestavros” facerecognizer( block( edge_trigger( < < lights_are_on motion(snapshot(cam 2)) && (2 am<NOW<4 am), 2 AM clock 4 AM snapshot(cam 2))), facelibrary(“Adam Bradley”)), cam 2 email(“adams. wife@gmail. com”, “He’s working late again. ”)) The sn. Bench Architecture 31
Intrinsic Research o Program Optimization let x = snapshot(cam 2) in email(“security@bu. edu”, block( edge_trigger(motion(x) && (2 am<NOW<4 am), x))) let x = snapshot(cam 2) in trigger( edge_trigger(motion(x) && (2 am<NOW<4 am), true), email(“security@bu. edu”, x)) o What to optimize? n n May 13, 2005 STEP Node count? Trigger count? (More or less? ) The sn. Bench Architecture 32
More Scheduling: Architecture o o What if we can’t run SXE on a node? STEP: a compile-able virtual ISA n n o Embedded C dialects? Java ME? Support alternate “linking” protocols n n May 13, 2005 Serial (base station) SN wireless protocols (e. g. 802. 15. 4) The sn. Bench Architecture 33
Intrinsic Research o o Better Programming Languages Alternate Execution Environments SNAFU Sn. QL Sn. LOG Sn. C STEP Native C May 13, 2005 J 2 ME JXTA The sn. Bench Architecture SXE 34
Intrinsic Research o Scheduling/Real-Time Type Systems period(100 ms, let x = period(75 ms, edge_trigger(y, z)) in edge_trigger(f(x), g(x)) o Resource Management Type Inference level_trigger( state(4 MB, entropymeasure( bw(2 MBps, deltastream(cam 1)))), period_gt(250 ms, signal(actuator 1, true)) o Actualizers (SD is a “mini-ITM”) n May 13, 2005 Static and dynamic “type checks” The sn. Bench Architecture 35
Intrinsic Research o Intentional Naming n n n Naming sensors by identity: “The webcam in Azer’s Office” Naming sensors by property: “Any two cams which see point X from perspectives >90 degrees apart” Naming sensors by dynamic attribute: “Any cam which sees Adam” o o May 13, 2005 May depend upon existence of persistent queries. What p. q. ’s should we instantiate to produce the highest odds of success at the lowest cost? Wearables as part of the Sensorium? The sn. Bench Architecture 36
Intrinsic Research o How do you offer Real. Time, Qo. S, etc. if you don’t know about the timing of atomic operations? n n n May 13, 2005 Live profiling of new opcodes Speculative/probabilistic scheduling Run-time scheduler parameter changes The sn. Bench Architecture 37
Supporting Research o SXE Implementations and Internals n SXE itself as high-performance service o o o n Programmer can upload their own functions o o o May 13, 2005 Real-time scheduling Self-profiling Fast I/O delivery (Lives in kernel sandbox? ) C++, Java, C#, Perl, Matlab, whatever… Automatically generate glue to link with SXE Sandboxing issues The sn. Bench Architecture 38
Current Status o Whitepaper n n o SNAFU and STEP syntax (tentative) SNAFU type principles (tentative) 1 G Implementation (work in progress) n Java o o n May 13, 2005 SNAFU-to-STEP compiler Service Dispatcher SXE (with HTTP-based interface) JAR-based extensibility Expect first live demo mid-summer The sn. Bench Architecture 39
If You Build It, They Will Come: The SNBENCH Architecture Adam Bradley Azer Bestavros & Michael Long Computer Science Department Boston University http: //www. cs. bu. edu/groups/wing/ May 13, 2005
- Slides: 40