bsp_sync(3)

NAME
bsp_sync - end of a superstep.

C SYNOPSIS
#include "bsp.h"

void bsp_sync()

FORTRAN SYNOPSIS
SUBROUTINE  bspsync()

DESCRIPTION
A bsplib(3) calculation consists of a sequence of supersteps. During a superstep each process can perform a number of computations on data held locally at the start of superstep and may communicate data to other processes using either bsp_put(3), bsp_get(3), bsp_hpput(3), bsp_hpget(3), or bsp_send(3) . Any communications within a superstep are guaranteed to occur by the end of the superstep, where the bsp_nprocs(3) processes synchronise at a barrier. The end of one superstep and the start of the next is identified by a call to the library procedure bsp_sync . Communication initiated during a superstep is not guaranteed to occur until bsp_sync is executed; this is even the case for the unbuffered variants of communication (i.e., bsp_hpput(3) )

EXAMPLE

1)  bsp_begin(3) and bsp_init(3) ), the following program attempts (it is not guaranteed) to serialise the printing by ensuring each process prints its output in turn. This is done by performing p iterations, each separated by a barrier synchronisation, where process i prints ``Hello BSP Worldwide'' during iteration i .
    void main(void) {
      int i;
      bsp_begin(bsp_nprocs());
        for(i=0; i<bsp_nprocs(); i++) {
          if (bsp_pid()==i)
            printf("Hello BSP Worldwide from process %d of %d,
                   i,bsp_nprocs());
          fflush(stdout);
          bsp_sync();
        }
      bsp_end();
    }

2)  Consider a Fortran 77 program that prints ``Hello World'' in parallel.
          PROGRAM MAIN
            INCLUDE 'fbsp.h'
            INTEGER i
            CALL bspbegin(bspnprocs())
              DO i=0,bspnprocs()-1
                IF (bsppid() .eq. i) THEN
                  WRITE (*,*) 'Hello BSP Worldwide from process',
         +                    i,' of ',bspnprocs()
                END IF
                CALL bspsync()
              END DO
            CALL bspend()
          END

SEE ALSO
bsplib(3) ``BSPlib: The BSP Programming Library'' Jonathan M. D. Hill, Bill McColl, Dan C. Stefanescu, Mark W. Goudreau, Kevin Lang, Satish B. Rao, , Torsten Suel, Thanasis Tsantilas, and Rob Bisseling. Parallel Computing, to appear 1998. See http://www.bsp-worldwide.org for more details.

NOTES
bsplib(3) has no form of subset synchronisation.

BUGS
Problems and bug reports should be mailed to bsplib-bugs@comlab.ox.ac.uk

AUTHORS
The Oxford BSP Toolset implementation of BSPlib was written by Jonathan.Hill@comlab.ox.ac.uk
http://www.comlab.ox.ac.uk/oucl/people/jonathan.hill.html