!======================================================================= ! RCS Header: ! Revision [$Revision: 1.7.1.1 $] Named [$Name: release#2_9_b5 $] ! Last checkin [$Date: 2001/12/06 10:13:56 $] ! Author [$Author: frpb $] !======================================================================= ! *****************************COPYRIGHT******************************* ! (c) CROWN COPYRIGHT 2001, Met Office, All Rights Reserved. ! Please refer to Copyright file in top level GCOM directory ! for further details ! *****************************COPYRIGHT******************************* #include "gc_prolog.h" SUBROUTINE GC_RBCAST (MSG, LEN, SEND, NPROC, ISTAT, SARR) ! ****************************************************************** ! * Purpose: ! * ! * Broadcast a real array to every processor. ! * ! * Input: ! * MSG - message tag ! * LEN - number of elements in message ! * SEND - sender of the message ! * NPROC - Number of processors ! * SARR - array to be sent ! * ! * Output: ! * SARR - array to be received (on nodes != SEND) ! * ISTAT - status of bcast. 0 is OK (MPI_SRC only), ! * refer to the header files for nonzero status codes ! * ! * NOTES: ! * ! ****************************************************************** IMPLICIT NONE INTEGER MSG, LEN, SEND, NPROC, ISTAT REAL SARR(LEN) #if defined(SHM_SRC) INCLUDE 'mpp/shmem.fh' #include "gc__shm_common.h" #include "gc__opts_common.h" #include "gc__nam_common.h" INTEGER I, OFFSET, TOT_LEN, PART_LEN #endif #if defined(MPI_SRC) INCLUDE 'mpif.h' #endif #if defined(SHM_SRC) OFFSET = 0 TOT_LEN = LEN 1000 CONTINUE PART_LEN = MIN(TOT_LEN, MAX_COLL) IF (OFFSET .GT. 0) CALL BARRIER() DO I = 1, PART_LEN NAM_RWORK(I) = SARR(I+OFFSET) ENDDO CALL BARRIER() #if defined(FLP_64B) CALL SHMEM_BROADCAST(NAM_RWORK,NAM_RWORK,PART_LEN,SEND,0,0,NPROC, & BCAST_SYNC_WRK) #else CALL SHMEM_BROADCAST4(NAM_RWORK,NAM_RWORK,PART_LEN,SEND,0,0,NPROC, & BCAST_SYNC_WRK) #endif DO I = 1, PART_LEN SARR(I+OFFSET) = NAM_RWORK(I) ENDDO OFFSET = OFFSET + PART_LEN TOT_LEN = TOT_LEN - PART_LEN IF (TOT_LEN .GT. 0) GOTO 1000 CALL BARRIER() #endif #if defined (MPI_SRC) CALL MPI_BCAST(SARR, GC__RSIZE*LEN, MPI_BYTE, SEND, $ MPI_COMM_WORLD, ISTAT) #endif #if defined(SHM_SRC) || defined(SERIAL_SRC) ISTAT = GC__OK #endif RETURN END