coding environment infrastructure for efficient parallel computing
DESCRIPTION
Industrial Project - 234313. Coding environment infrastructure for efficient parallel computing. Team. Developers: Vlad Krasnov Ady Abraham Supervisor: Dr. Roee Engelberg , LSI. Goals. Make programming with asynchronous non-blocking APIs intuitive. Preserve maximal efficiency. - PowerPoint PPT PresentationTRANSCRIPT
Coding environment infrastructure for efficientparallel computing
Industrial Project - 234313
Team
Developers:
Vlad Krasnov
Ady Abraham
Supervisor:
Dr. Roee Engelberg, LSI
Goals
Make programming with asynchronous non-blocking APIs intuitive.
Preserve maximal efficiency.
A()
B() C()
F T
A(){ //some code here... some_async_IO(decision1);}decision1(){ if(...) C(); else B();}B(){ //some code here... some_async_IO(A);}C(){ //some code here... some_async_IO(exit_func);}exit_func(){ return;}
Legacy model: The Project’s Goal:
START(EXAMPLE); ASYNC(A); WHILE(...) ASYNC(B); ASYNC(A); ENDWHILE; ASYNC(C); END;
// execution pointEXEC(EXAMPLE);
Methodology
Define abstract computation modelSyntax definition.Framework implementation in order to
run the required flow.Debug and validation.
Achievements
Framework with MACRO based syntax that provides Turing-complete semantics.Second tier API with debugging capabilities.
Natural easy-to-use easy-to-read syntax.No training required.
Achievements
Supports:Synchronous functions.Asynchronous functions. IfWhileBreakGoto / LabelsExit
Example (legacy code)
void GetAddressForWrite(void* ctx){ read_map(ctx, Continue1, ctx); // top snapshot}
void Continue1(void* ctx){ if(error_occured(ctx)){ give_up_chunk(ctx); return; } if(map_exists(ctx)){ // in top snapshot update_address(ctx); return; } Loop(ctx);}
void Loop(void* ctx){ if(!map_does_not_exist(ctx)){ ContinueFromLoop(ctx); return; } get_next_snapshot(ctx); read_map(ctx, Continue2, ctx); // of next snapshot}
void Continue2(void* ctx){ if(error_occured(ctx)){ give_up_chunk(ctx); return; } Loop(ctx);}
void ContinueFromLoop(void* ctx){ get_new_chunk(ctx); init_new_chunk(ctx, Continue3, ctx);}
Example (legacy code) cont.
void Continue3(void* ctx){ if(error_occured(ctx)){ give_up_chunk(ctx); return; } update_map(ctx, Continue4, ctx); // of top
snapshot}
void Continue4(void* ctx){ if(error_occured(ctx)){ give_up_chunk(ctx); return; } update_address(ctx); Done(ctx);}
Example
START(GET_ADDRESS_FOR_WRITE); ASYNC(read_map); // top snapshot IF(error_occured); GOTO(bail); ENDIF; IF(map_exists); // in top snapshot SYNC(update_address); EXIT; ENDIF; WHILE(map_does_not_exist); SYNC(get_next_snapshot); ASYNC(read_map); // of next snapshot IF(error_occured); GOTO(bail); ENDIF; ENDWHILE;
SYNC(get_new_chunk); ASYNC(init_new_chunk); IF(error_occured); GOTO(bail); ENDIF;
ASYNC(update_map); // of top snapshot IF(error_occured); GOTO(bail); ENDIF;
SYNC(update_address); EXIT;
LABEL(bail); SYNC(give_up_chunk); // only if was allocated SYNC(set_error); EXIT; END;
EXEC(GET_ADDRESS_FOR_WRITE, ctx, Done);
Example Output
ASYNC: read_mapDone with async...map_exists(): FALSEmap_does_not_exist(): TRUESYNC: get_next_snapshotASYNC: read_mapDone with async...map_does_not_exist(): TRUESYNC: get_next_snapshotASYNC: read_mapDone with async...map_does_not_exist(): TRUESYNC: get_next_snapshotASYNC: read_mapDone with async...map_does_not_exist(): FALSESYNC: get_new_chunkASYNC: init_new_chunkDone with async...ASYNC: update_mapDone with async...SYNC: update_addressFlow terminated
Conclusions
The project is more user friendly and useful than was expected at first.
Writing code with async function has now became easy!
No reason to be afraid of programming with async functions anymore.