


bsp_sync(3)             BSPlib FUNCTIONS              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  super-
     steps.  During a superstep each process can perform a number
     of computations on data held locally at the start of  super-
     step  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 ini-
     tiated during a superstep is _n_o_t _g_u_a_r_a_n_t_e_e_d to  occur  until
     bsp_sync  is  executed; this is even the case for the unbuf-
     fered variants of communication (i.e., bsp_hpput(3))

EXAMPLE
     1)   bsp_begin(3) and bsp_init(3)),  the  following  program
          _a_t_t_e_m_p_t_s (it is not guaranteed) to serialise the print-
          ing 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 %d0,
                         i,bsp_nprocs());
                fflush(stdout);
                bsp_sync();
              }
            bsp_end();
          }


     2)   Consider a  Fortran  77  program  that  prints  ``Hello
          World'' in parallel.



Oxford BSP Toolset  Last change: 1.4 25/9/98                    1






bsp_sync(3)             BSPlib FUNCTIONS              bsp_sync(3)



                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)

     ``_B_S_P_l_i_b: _T_h_e _B_S_P _P_r_o_g_r_a_m_m_i_n_g _L_i_b_r_a_r_y'' 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
     _h_t_t_p://_w_w_w._b_s_p-_w_o_r_l_d_w_i_d_e._o_r_g for more details.


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


BUGS
     Problems  and  bug  reports  should  be  mailed  to  _b_s_p_l_i_b-
     _b_u_g_s@_c_o_m_l_a_b._o_x._a_c._u_k


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

















Oxford BSP Toolset  Last change: 1.4 25/9/98                    2



