Given an MPI program: {{{ #include ... #include int a, b, ...; ... function(){ ... } ... int main(){ .... } }}} It is translated to a CIVL-C program by ABC: {{{ #include // all included files are moved above to the new file scope. ... #include $input int argc;//optional, only necessary when the original main function has arguments. $input char** argv;//optional, only necessary when the original main function has arguments. $input int NPROCS; $input int NPROCS_UPPER; $input int NPROCS_LOWER; $assume NPROCS_LOWER < NPROCS && NPROCS <= NPROCS_UPPER; $gcomm GCOMM_WORLD = $gcomm_create($here, NPROCS); void MPI_Process(int _rank){ ... } void main(){ $proc procs[NPROCS]; for(int i = 0; i < NPROCS; i++){ procs[i] = $spawn MPI_Process(i); } for(int i = 0; i < NPROCS; i++){ $wait(procs[i]); } $gcomm_destroy(GCOMM_WORLD); } }}} Whereas `MPI_Process()` is a wrapper of the original MPI program with some additional : {{{ void MPI_Process(){ $comm MPI_COMM_WORLD = $comm_create(...); //SLIGHTLY-MODIFIED ORIGINAL PROGRAM; int a, b, ...; ... function(){...} ... ... __main(){...} // renamed main() to __main() .... //ORIGINAL PROGRAM ENDS HERE; __main(); $comm_destroy(MPI_COMM_WORLD); } }}}