2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! Copyright (C) 2001 PWSCF group
|
|
|
|
! This file is distributed under the terms of the
|
|
|
|
! GNU General Public License. See the file `License'
|
|
|
|
! in the root directory of the present distribution,
|
|
|
|
! or http://www.gnu.org/copyleft/gpl.txt .
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
2003-02-08 00:04:36 +08:00
|
|
|
subroutine broadcast (ndata, data)
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! this routine broadcasts the real*8 vector 'data' from the first proces
|
|
|
|
! of each pool to all the other processors of the pool
|
|
|
|
!
|
2004-01-23 23:08:03 +08:00
|
|
|
USE kinds, only : DP
|
2003-02-21 22:57:00 +08:00
|
|
|
#ifdef __PARA
|
2003-01-20 05:58:50 +08:00
|
|
|
use para
|
|
|
|
#endif
|
2003-02-08 00:04:36 +08:00
|
|
|
implicit none
|
2003-01-20 05:58:50 +08:00
|
|
|
! on INPUT
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: ndata
|
2003-10-29 02:15:32 +08:00
|
|
|
real (kind=DP) :: data (ndata)
|
2003-02-21 22:57:00 +08:00
|
|
|
#ifdef __PARA
|
2003-10-29 02:15:32 +08:00
|
|
|
#include "machine.h"
|
2003-02-08 00:04:36 +08:00
|
|
|
include 'mpif.h'
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: root, ierr
|
2003-10-29 02:15:32 +08:00
|
|
|
if (nprocp <= 1) return
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! root is the "broadcasting" processors.
|
|
|
|
! N.B. in MPI the processors are labeled from 0 to nproc-1
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
root = 0
|
|
|
|
call mpi_barrier (MPI_COMM_POOL, ierr)
|
|
|
|
call mpi_bcast (data, ndata, MPI_REAL8, root, MPI_COMM_POOL, ierr)
|
2003-02-21 22:57:00 +08:00
|
|
|
call errore ('broadcast', 'info<>0', ierr)
|
2003-01-20 05:58:50 +08:00
|
|
|
#endif
|
2003-02-08 00:04:36 +08:00
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine broadcast
|
|
|
|
|