WaveScope Ryan Newton MIT/CSAIL Work with: Lewis Girod, Kyle - - PowerPoint PPT Presentation

wavescope
SMART_READER_LITE
LIVE PREVIEW

WaveScope Ryan Newton MIT/CSAIL Work with: Lewis Girod, Kyle - - PowerPoint PPT Presentation

WaveScope Ryan Newton MIT/CSAIL Work with: Lewis Girod, Kyle Jamieson, Yuan Mei, Stan Rost, Arvind Thiagarajan, Hari Balakrishnan, Sam Madden http://wavescope.csail.mit.edu/ Motivation: Stream + Signal Processing


slide-1
SLIDE 1

WaveScope

Ryan Newton MIT/CSAIL Work with: Lewis Girod, Kyle Jamieson, Yuan Mei, Stan Rost, Arvind Thiagarajan, Hari Balakrishnan, Sam Madden http://wavescope.csail.mit.edu/

slide-2
SLIDE 2

Motivation: Stream + Signal Processing

http://wavescope.csail.mit.edu/

slide-3
SLIDE 3

Motivation: Stream + Signal Processing

  • Pipeline leak detection and localization

http://wavescope.csail.mit.edu/

Are there anomalies in the frequency response to an introduced pulse?

slide-4
SLIDE 4

Motivation: Stream + Signal Processing

  • Pipeline leak detection and localization
  • Seizure onset detection using EEG

http://wavescope.csail.mit.edu/

Are there anomalies in the frequency response to an introduced pulse? Is a seizure imminent given signals from various brain regions?

slide-5
SLIDE 5

Motivation: Stream + Signal Processing

  • Pipeline leak detection and localization
  • In situ animal behavior studies
  • Seizure onset detection using EEG

http://wavescope.csail.mit.edu/

Are there anomalies in the frequency response to an introduced pulse? What time ranges contained marmot calls? Is a seizure imminent given signals from various brain regions?

slide-6
SLIDE 6

Are there anomalies in the frequency response to an introduced pulse? What time ranges contained marmot calls? Is a seizure imminent given signals from various brain regions?

http://wavescope.csail.mit.edu/

Motivation: Stream + Signal Processing

  • Pipeline leak detection and localization
  • In situ animal behavior studies
  • Seizure onset detection using EEG
slide-7
SLIDE 7

Are there anomalies in the frequency response to an introduced pulse? What time ranges contained marmot calls? Is a seizure imminent given signals from various brain regions?

http://wavescope.csail.mit.edu/

Motivation: Stream + Signal Processing

  • Pipeline leak detection and localization
  • In situ animal behavior studies
  • Seizure onset detection using EEG

Limitations of Streaming DBMS

  • Difficult to extend operator set
  • Outcalls to Matlab, etc
  • Embedded support
  • High per-sample/operator overhead
slide-8
SLIDE 8

WaveScope Features

slide-9
SLIDE 9

WaveScope Features

High data-rate

4 channels x 48 khz = 400,000 bytes/sec (per node) x 20 nodes

slide-10
SLIDE 10

WaveScope Features

High data-rate Embedded, low- power devices

4 channels x 48 khz = 400,000 bytes/sec (per node) x 20 nodes

slide-11
SLIDE 11

WaveScope Features

Signal-oriented data-model

High data-rate Embedded, low- power devices

4 channels x 48 khz = 400,000 bytes/sec (per node) x 20 nodes

slide-12
SLIDE 12

WaveScope Features

Signal-oriented data-model

High data-rate

  • Flexible windowing
  • Efficient time-stamping

Embedded, low- power devices

4 channels x 48 khz = 400,000 bytes/sec (per node) x 20 nodes

slide-13
SLIDE 13

WaveScope Features

Signal-oriented data-model

High data-rate

  • Flexible windowing
  • Efficient time-stamping

Ch0 = AudioSource(0, 48000, 1024); S = stream_map(fft, Ch0);

WaveScript Language

Ch0 = AudioSource(0, 48000, 1024); S = stream_map( FFT, Ch0 );

Embedded, low- power devices

4 channels x 48 khz = 400,000 bytes/sec (per node) x 20 nodes

slide-14
SLIDE 14

WaveScope Features

Signal-oriented data-model

High data-rate

  • Flexible windowing
  • Efficient time-stamping

Ch0 = AudioSource(0, 48000, 1024); S = stream_map(fft, Ch0);

WaveScript Language

Ch0 = AudioSource(0, 48000, 1024); S = stream_map( FFT, Ch0 );

Embedded, low- power devices

4 channels x 48 khz = 400,000 bytes/sec (per node) x 20 nodes

  • Not StreamSQL
  • Write script to generate query network
  • Query network is optimized, compiled

to native code, executed by engine

slide-15
SLIDE 15

Drilling down: Marmot-call application

Node

Some Marmots

http://wavescope.csail.mit.edu/

slide-16
SLIDE 16

Drilling down: Marmot-call application

Node

Some Marmots

  • Goal: study calling behavior.

http://wavescope.csail.mit.edu/

slide-17
SLIDE 17

Drilling down: Marmot-call application

Node

Some Marmots

  • Goal: study calling behavior.

http://wavescope.csail.mit.edu/

slide-18
SLIDE 18

Drilling down: Marmot-call application

Node

Some Marmots

  • Goal: study calling behavior.

http://wavescope.csail.mit.edu/

slide-19
SLIDE 19

Drilling down: Marmot-call application

Node

Some Marmots

  • Goal: study calling behavior.
  • Detect, record, localize, classify.

http://wavescope.csail.mit.edu/

slide-20
SLIDE 20

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

Schematic of Marmot-detector

(Phase1)

http://wavescope.csail.mit.edu/

slide-21
SLIDE 21

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

Schematic of Marmot-detector

(Phase1)

Fast-path DSP to determine temporal ranges for marmot calls

http://wavescope.csail.mit.edu/

slide-22
SLIDE 22

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

Schematic of Marmot-detector

(Phase1)

Stream’s Tuple Schema

http://wavescope.csail.mit.edu/

slide-23
SLIDE 23

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

Schematic of Marmot-detector

(Phase1)

Stream’s Tuple Schema

Data Model:

  • Streams are first-class values.
  • Streams contain Tuples
  • One or more unnamed fields: Stream<int,float>
  • Fields may also be arrays, Tuples, SigSegs, or

tagged-union datatypes, but not Streams.

  • SigSegs: efficiently managed windows of samples
  • pass-by-reference
  • cheap to append, copy,

forward, rewindow

  • fewer timestamps

http://wavescope.csail.mit.edu/

slide-24
SLIDE 24

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

Schematic of Marmot-detector

(Phase1)

Stream’s Tuple Schema

Data Model:

  • Streams are first-class values.
  • Streams contain Tuples
  • One or more unnamed fields: Stream<int,float>
  • Fields may also be arrays, Tuples, SigSegs, or

tagged-union datatypes, but not Streams.

  • SigSegs: efficiently managed windows of samples
  • pass-by-reference
  • cheap to append, copy,

forward, rewindow

  • fewer timestamps

Ch0 = AudioSource(...);

http://wavescope.csail.mit.edu/

slide-25
SLIDE 25

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

Schematic of Marmot-detector

(Phase1)

Stream’s Tuple Schema

Data Model:

  • Streams are first-class values.
  • Streams contain Tuples
  • One or more unnamed fields: Stream<int,float>
  • Fields may also be arrays, Tuples, SigSegs, or

tagged-union datatypes, but not Streams.

  • SigSegs: efficiently managed windows of samples
  • pass-by-reference
  • cheap to append, copy,

forward, rewindow

  • fewer timestamps
0 1 2 3 4 5 6 7 8 9 10 …..

S

A B

[4,8) [0,4) Ch0 = AudioSource(...);

http://wavescope.csail.mit.edu/

slide-26
SLIDE 26

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

Schematic of Marmot-detector

(Phase1)

Stream’s Tuple Schema

http://wavescope.csail.mit.edu/

slide-27
SLIDE 27

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

WaveScript Code for Detector

http://wavescope.csail.mit.edu/

slide-28
SLIDE 28

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

WaveScript Code for Detector

http://wavescope.csail.mit.edu/

// Main query, phase 1 Ch0 = AudioSource(0, 48000, 1024); Ch1 = AudioSource(1, 48000, 1024); Ch2 = AudioSource(2, 48000, 1024); Ch3 = AudioSource(3, 48000, 1024); control = profileDetect(Ch0, marmotScore, <64,192>); datawindows = sync4(control, Ch0, Ch1, Ch2, Ch4);

slide-29
SLIDE 29

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

WaveScript Code for Detector

http://wavescope.csail.mit.edu/

// Main query, phase 1 Ch0 = AudioSource(0, 48000, 1024); Ch1 = AudioSource(1, 48000, 1024); Ch2 = AudioSource(2, 48000, 1024); Ch3 = AudioSource(3, 48000, 1024); control = profileDetect(Ch0, marmotScore, <64,192>); datawindows = sync4(control, Ch0, Ch1, Ch2, Ch4);

slide-30
SLIDE 30

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

WaveScript Code for Detector

http://wavescope.csail.mit.edu/

// Main query, phase 1 Ch0 = AudioSource(0, 48000, 1024); Ch1 = AudioSource(1, 48000, 1024); Ch2 = AudioSource(2, 48000, 1024); Ch3 = AudioSource(3, 48000, 1024); control = profileDetect(Ch0, marmotScore, <64,192>); datawindows = sync4(control, Ch0, Ch1, Ch2, Ch4); fun profileDetect(S : Stream<SigSeg<int16>>, scorefun, <winsize,step>) {

wins = rewindow(S, winsize, step); scores : Stream< float > scores = iterate(w in wins) { emit scorefun( FFT(w) ); }; withscores : Stream<float, SigSeg<int16>> withscores = zip2(scores, wins); return threshFilter(withscores);

}

slide-31
SLIDE 31

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

// Main query, phase 1 Ch0 = AudioSource(0, 48000, 1024); Ch1 = AudioSource(1, 48000, 1024); Ch2 = AudioSource(2, 48000, 1024); Ch3 = AudioSource(3, 48000, 1024); control = profileDetect(Ch0, marmotScore, <64,192>); datawindows = sync4(control, Ch0, Ch1, Ch2, Ch4); fun profileDetect(S : Stream<SigSeg<int16>>, scorefun, <winsize,step>) {

wins = rewindow(S, winsize, step); scores : Stream< float > scores = iterate(w in wins) { emit scorefun( FFT(w) ); }; withscores : Stream<float, SigSeg<int16>> withscores = zip2(scores, wins); return threshFilter(withscores);

}

WaveScript Code for Detector

http://wavescope.csail.mit.edu/

profileDetect( Ch0, ...)

ProfileDetector

slide-32
SLIDE 32

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

// Main query, phase 1 Ch0 = AudioSource(0, 48000, 1024); Ch1 = AudioSource(1, 48000, 1024); Ch2 = AudioSource(2, 48000, 1024); Ch3 = AudioSource(3, 48000, 1024); control = profileDetect(Ch0, marmotScore, <64,192>); datawindows = sync4(control, Ch0, Ch1, Ch2, Ch4); fun profileDetect(S : Stream<SigSeg<int16>>, scorefun, <winsize,step>) {

wins = rewindow(S, winsize, step); scores : Stream< float > scores = iterate(w in wins) { emit scorefun( FFT(w) ); }; withscores : Stream<float, SigSeg<int16>> withscores = zip2(scores, wins); return threshFilter(withscores);

}

WaveScript Code for Detector

http://wavescope.csail.mit.edu/

ProfileDetector

zip2(...)

<iterate> rewindow(...) threshFilter(...)

slide-33
SLIDE 33

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

// Main query, phase 1 Ch0 = AudioSource(0, 48000, 1024); Ch1 = AudioSource(1, 48000, 1024); Ch2 = AudioSource(2, 48000, 1024); Ch3 = AudioSource(3, 48000, 1024); control = profileDetect(Ch0, marmotScore, <64,192>); datawindows = sync4(control, Ch0, Ch1, Ch2, Ch4); fun profileDetect(S : Stream<SigSeg<int16>>, scorefun, <winsize,step>) {

wins = rewindow(S, winsize, step); scores : Stream< float > scores = iterate(w in wins) { emit scorefun( FFT(w) ); }; withscores : Stream<float, SigSeg<int16>> withscores = zip2(scores, wins); return threshFilter(withscores);

}

WaveScript Code for Detector

http://wavescope.csail.mit.edu/

ProfileDetector

<iterate> <iterate>

<iterate>

<iterate> <iterate> <iterate>

slide-34
SLIDE 34

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

// Main query, phase 1 Ch0 = AudioSource(0, 48000, 1024); Ch1 = AudioSource(1, 48000, 1024); Ch2 = AudioSource(2, 48000, 1024); Ch3 = AudioSource(3, 48000, 1024); control = profileDetect(Ch0, marmotScore, <64,192>); datawindows = sync4(control, Ch0, Ch1, Ch2, Ch4); fun profileDetect(S : Stream<SigSeg<int16>>, scorefun, <winsize,step>) {

wins = rewindow(S, winsize, step); scores : Stream< float > scores = iterate(w in wins) { emit scorefun( FFT(w) ); }; withscores : Stream<float, SigSeg<int16>> withscores = zip2(scores, wins); return threshFilter(withscores);

}

wavescope@nms.csail.mit.edu

ProfileDetector

<iterate> <iterate>

<iterate>

<iterate> <iterate> <iterate>

http://wavescope.csail.mit.edu/

WaveScript Code for Detector

slide-35
SLIDE 35

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

// Main query, phase 1 Ch0 = AudioSource(0, 48000, 1024); Ch1 = AudioSource(1, 48000, 1024); Ch2 = AudioSource(2, 48000, 1024); Ch3 = AudioSource(3, 48000, 1024); control = profileDetect(Ch0, marmotScore, <64,192>); datawindows = sync4(control, Ch0, Ch1, Ch2, Ch4); fun profileDetect(S : Stream<SigSeg<int16>>, scorefun, <winsize,step>) {

wins = rewindow(S, winsize, step); scores : Stream< float > scores = iterate(w in wins) { emit scorefun( FFT(w) ); }; withscores : Stream<float, SigSeg<int16>> withscores = zip2(scores, wins); return threshFilter(withscores);

}

wavescope@nms.csail.mit.edu

ProfileDetector

<iterate> <iterate>

<iterate>

<iterate> <iterate> <iterate>

Integrated Language

http://wavescope.csail.mit.edu/

WaveScript Code for Detector

slide-36
SLIDE 36

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

// Main query, phase 1 Ch0 = AudioSource(0, 48000, 1024); Ch1 = AudioSource(1, 48000, 1024); Ch2 = AudioSource(2, 48000, 1024); Ch3 = AudioSource(3, 48000, 1024); control = profileDetect(Ch0, marmotScore, <64,192>); datawindows = sync4(control, Ch0, Ch1, Ch2, Ch4); fun profileDetect(S : Stream<SigSeg<int16>>, scorefun, <winsize,step>) {

wins = rewindow(S, winsize, step); scores : Stream< float > scores = iterate(w in wins) { emit scorefun( FFT(w) ); }; withscores : Stream<float, SigSeg<int16>> withscores = zip2(scores, wins); return threshFilter(withscores);

}

wavescope@nms.csail.mit.edu

ProfileDetector

<iterate> <iterate>

<iterate>

<iterate> <iterate> <iterate>

Integrated Language

  • High-level, query-like declarative programs
  • map, project, filter streams
  • apply library signal-processing ops

http://wavescope.csail.mit.edu/

WaveScript Code for Detector

slide-37
SLIDE 37

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

// Main query, phase 1 Ch0 = AudioSource(0, 48000, 1024); Ch1 = AudioSource(1, 48000, 1024); Ch2 = AudioSource(2, 48000, 1024); Ch3 = AudioSource(3, 48000, 1024); control = profileDetect(Ch0, marmotScore, <64,192>); datawindows = sync4(control, Ch0, Ch1, Ch2, Ch4); fun profileDetect(S : Stream<SigSeg<int16>>, scorefun, <winsize,step>) {

wins = rewindow(S, winsize, step); scores : Stream< float > scores = iterate(w in wins) { emit scorefun( FFT(w) ); }; withscores : Stream<float, SigSeg<int16>> withscores = zip2(scores, wins); return threshFilter(withscores);

}

wavescope@nms.csail.mit.edu

ProfileDetector

<iterate> <iterate>

<iterate>

<iterate> <iterate> <iterate>

Integrated Language

  • High-level, query-like declarative programs
  • map, project, filter streams
  • apply library signal-processing ops
  • Low-level, imperative code within

custom-operators

  • use iterate to introduce

http://wavescope.csail.mit.edu/

WaveScript Code for Detector

slide-38
SLIDE 38

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

// Main query, phase 1 Ch0 = AudioSource(0, 48000, 1024); Ch1 = AudioSource(1, 48000, 1024); Ch2 = AudioSource(2, 48000, 1024); Ch3 = AudioSource(3, 48000, 1024); control = profileDetect(Ch0, marmotScore, <64,192>); datawindows = sync4(control, Ch0, Ch1, Ch2, Ch4); fun profileDetect(S : Stream<SigSeg<int16>>, scorefun, <winsize,step>) {

wins = rewindow(S, winsize, step); scores : Stream< float > scores = iterate(w in wins) { emit scorefun( FFT(w) ); }; withscores : Stream<float, SigSeg<int16>> withscores = zip2(scores, wins); return threshFilter(withscores);

}

wavescope@nms.csail.mit.edu

ProfileDetector

<iterate> <iterate>

<iterate>

<iterate> <iterate> <iterate>

http://wavescope.csail.mit.edu/

WaveScript Code for Detector

slide-39
SLIDE 39

<w1,w2,w3,w4> sync ProfileDetector Audio0

<audio window>

<t1,t2,bool> Audio1 Audio2 Audio3

<audio window> <audio window> <audio window>

// Main query, phase 1 Ch0 = AudioSource(0, 48000, 1024); Ch1 = AudioSource(1, 48000, 1024); Ch2 = AudioSource(2, 48000, 1024); Ch3 = AudioSource(3, 48000, 1024); control = profileDetect(Ch0, marmotScore, <64,192>); datawindows = sync4(control, Ch0, Ch1, Ch2, Ch4); fun profileDetect(S : Stream<SigSeg<int16>>, scorefun, <winsize,step>) {

wins = rewindow(S, winsize, step); scores : Stream< float > scores = iterate(w in wins) { emit scorefun( FFT(w) ); }; withscores : Stream<float, SigSeg<int16>> withscores = zip2(scores, wins); return threshFilter(withscores);

}

wavescope@nms.csail.mit.edu

ProfileDetector

<iterate> <iterate>

<iterate>

<iterate> <iterate> <iterate>

Abstraction, Abstraction, Abstraction

  • Functions that build query network
  • Generic library routines
  • int16, int32, float, etc...
  • take a list of input streams
  • capture common patterns; e.g. split-join
  • ... but with no runtime overhead

http://wavescope.csail.mit.edu/

WaveScript Code for Detector

slide-40
SLIDE 40

Conclusions

  • High-rate event stream + signal processing important in a

number of emerging apps

  • WaveScope:

Language, compiler, distributed + embedded runtime

  • Key ideas:
  • Sigseg data model: efficient windowing construct
  • Integrated language, custom operators,

abstraction through query generation

  • Status: Prototype nearly complete; preliminary

measurements show 1-7 million samples/s on real apps

http://wavescope.csail.mit.edu/

slide-41
SLIDE 41

Optimization

  • Algebraic
  • General: operator merging, predicate reordering, etc
  • Domain specific: FFT(IFFT(...))
  • Compiler
  • Whole program optimization (a la HPC)
  • The usual
  • (But the C compiler can handle some of these.)
slide-42
SLIDE 42