Mehwish Nagda, Christo Frank Devaraj, Indranil Gupta, Gul Agha University of Illinois...
-
Upload
howard-daniels -
Category
Documents
-
view
214 -
download
0
Transcript of Mehwish Nagda, Christo Frank Devaraj, Indranil Gupta, Gul Agha University of Illinois...
Mehwish Nagda, Christo Frank Devaraj, Indranil Gupta, Gul Agha
University of Illinois (Urbana-Champaign)
MotivationMany scientific disciplines express ideas, results and phenomena through differential equations
From competition in ecosystems to Schroedinger’s Wave Equation
Can we translate the scalability and reliability inherent in non-Computer distributed systems into protocols for distributed systems?
Can we generate code for such distributed protocols?
Can we do this rigorously, rather than hand-wavily?
ApproachDiffGen: Toolkit to systematically translate a subset of differential equation systems into equivalent distributed protocol code in C so that the protocols are guaranteed to
show equivalent stochastic behavior as original equation systembe probabilistically scalablebe probabilistically reliablehave low and scalable bandwidth at each processhave low convergence times
DiffGen internals are backed by rigorous translation methodologies, that guarantee provable properties of generated code.
Internals: Input Semantics
The above is a sample input into the toolkit for a system of 3 equations.Each equation has to be in the form D[x i] =f(x1, x2, ..., xi, ..., xn) where xi is the variable that is differentiated.0.3*x^2*z^2 is a term in the first equation for variable x.Each term in the equation starts with a positive or negative constant value. Variables in the term are separated by ` * ‘.Exponents for each variable follow the ` ^ ' character. A variable with no exponent defined has an exponent of 1.
D[x] = 0.3*x^2*z^2 - 0.3*x^2*y^2D[y] = 0.3*y^2*z^2 - 0.3*x^2*y^2D[z] = -0.3*x^2*z^2 -0.3*y^2*z^2 + 0.3*x^2*y^2 + 0.3*x^2*y^2
sample input (diffsys) file
222222
2222
2222
6.03.03.0
3.03.0
3.03.0
yxzyzxdt
dx
yxzydt
dx
yxzxdt
dx
Intermediate Representation, diffIR
Input system is converted to diffIR, the intermediate representation of the differential equation systemThe differential system contains a list of differential equations in the system. The differential equation contains a list of positive and negative terms as well as the differential equation variable.The equation term contains the constant in the term, the set of variables involved in the term and their exponents, and a reference to the matching negative or positive term in the differential equation system.
equationvariable
negative terms
positive terms
positive terms
negative terms
differential system
differential equation
constant
variable
variable
exp
exp
equation term
differential equation
match term
Science of Protocol Design
The toolkit then maps the equation system to a state machine which contains
One state per basic variable in the original equation system
Actions mapped onto these states by mapping terms to one of three actions:
xc. flippingTerm T =
Periodically toss coin with probability p.cIf heads, switch state to state y with +c.x term
.c.x-x-Xy
,,Tfx,ix,
Tfxiyy one time samplingTerm –T =
Periodically toss coin with probability p.cIf heads, sample other processes uniformly at random from across the groupIf first target choices are in state x and for all j, the jth process sampled is in the same state as the j th variable in (when ordered lexicographically), then switch state to state y with the +T term
)Tfi1-Tf(ix-Xy
x,y,x,x,
with 1,, Tfi xx
1-Tfi x,x,
.c.x-x-Xy
,,Tfx,ix,
Tfxiyytokenizing
Term –T =
A variable w in X’ is chosen such that Flipping or one time sampling actions are created for processes in state w with actions modified so that instead of switching state a token is sent to a random process known to be in state x that transitions into the state of the variable with the corresponding +T term on receiving the token
0 Tfi x,w,
with 0,, Tfi xx
x - X y x,y, Tfi1 j
x - X y
x,y, Tfi
Template filesThe diffIR is mapped to the above actions and the code is generated into template files. Template files implement:
Alarm System: Timer events are used to wake nodes up to carry out protocol actions every protocol period. A node in a particular state will set a timer for each negative term in the corresponding differential equation.Core Probabilistic Functions: Code for flipping, one time sampling and tokenizing are written in the form of four parameterized C functions (flipping, ots, tok_flipping and tok_ots). Communication: The messaging subsystem is built out of an interface that has two methods send_msg and receive_msg. We provide both a simulator implementation and a UDP sockets implementation.Server: The server is used to register each client and to stop the protocol.
Generated Code
Code generated is for the Lotka Volterra model. The output protocol is for majority selection in a distributed systemCode generated consists of the header snippet (in fixedclient.h and common.h) and the initialize_states and schedule_timer_event functions (in fixedclient.c)
The header snippet defines the number of states (equations) in the input system and constants for each stateThe initialize_states function initializes the number of negative terms in each equation
D[x] = 0.3*x*z - 0.3*x*yD[y] = 0.3*y*z - 0.3*x*yD[z] = -0.3*x*z -0.3*y*z + 0.3*x*y + 0.3*x*y sample input
Initialize_states snippetfixedclient.c
header snippetfixedclient.h &common.h
void initialize_states(){ state_terms[ST_x] = 1; state_terms[ST_y] = 1; state_terms[ST_z] = 2;}
…
#define STATES 3int state_terms[STATES];#define ST_x 0#define ST_y 1#define ST_z 2
Generated Code
The schedule_timer_event function chooses which of the four core probabilistic functions should be called depending on the process’ current state and the term associated with the current alarm. The function is written using the three mapping techniques for flipping, one time sampling and tokenizing.
schedule_timer_event snippetfixedclient.c
void schedule_timer_event (int nodeid, struct pp_payload* payload)
{ int curr_term, to_state, prev_state; int* curr_state; float p; curr_state = get_state(); prev_state = *curr_state; if (*curr_state != payload->state) return; curr_term = payload->term; if (*curr_state == ST_x && curr_term == 0) { int num_states; int *states, *exponents; num_states = 2; states = (int*)malloc(num_states*sizeof(int)); exponents = (int*)malloc(num_states
*sizeof(int)); states[0] = ST_y;states[1] = ST_x; exponents[0] = 1;exponents[1] = 0; ots (ST_z, 0.5, num_states,
states, exponents); } if (*curr_state == ST_y && curr_term == 0) …}
Additional DiffGen Capabilities
Simple lightweight Internal Simulator for testing and performance evaluation that is
synchronous
based on a discrete event simulation model
assumes a FIFO message queue
This is Continuing Work
InternalNew rewriting techniques Develop graphical simulatorAutomated Debugging : helped by emergent knowledge of common bug classes among differential equation-based protocolsIncorporating other Diff. Eqn based methodologies as they emergeGraphical Simulator
ExternalCombine with auxiliary methodologies for augmenting protocol properties, e.g., topology awarenessCombine with IDEs?
Alpha version Demo
We have a (working!) version of the DiffGen toolkit
Please ask for a demo!