diff --git a/base/modules/penv/psi_c_collective_mod.F90 b/base/modules/penv/psi_c_collective_mod.F90 index 3f95038d..a69f4774 100644 --- a/base/modules/penv/psi_c_collective_mod.F90 +++ b/base/modules/penv/psi_c_collective_mod.F90 @@ -55,11 +55,11 @@ module psi_c_collective_mod end interface psb_bcast interface psb_scan_sum - module procedure psb_cscan_sums + module procedure psb_cscan_sums, psb_cscan_sumv end interface psb_scan_sum interface psb_exscan_sum - module procedure psb_cexscan_sums + module procedure psb_cexscan_sums, psb_cexscan_sumv end interface psb_exscan_sum @@ -796,13 +796,65 @@ contains #if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) - call mpi_scan(dat,dat_,1,psb_mpi_c_spk_,mpi_sum,ictxt,info) + call mpi_exscan(dat,dat_,1,psb_mpi_c_spk_,mpi_sum,ictxt,info) dat = dat_ #else - dat = 0 + dat = czero #endif end subroutine psb_cexscan_sums + subroutine psb_cscan_sumv(ictxt,dat,root) + use psb_realloc_mod +#ifdef MPI_MOD + use mpi +#endif + implicit none +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_mpk_), intent(in) :: ictxt + complex(psb_spk_), intent(inout) :: dat(:) + integer(psb_mpk_), intent(in), optional :: root + integer(psb_mpk_) :: root_ + complex(psb_spk_), allocatable :: dat_(:) + integer(psb_mpk_) :: iam, np, info + integer(psb_ipk_) :: iinfo + +#if !defined(SERIAL_MPI) + call psb_info(ictxt,iam,np) + call psb_realloc(size(dat),dat_,iinfo) + dat_ = dat + if (iinfo == psb_success_) & + & call mpi_scan(dat,dat_,size(dat),psb_mpi_c_spk_,mpi_sum,ictxt,info) +#endif + end subroutine psb_cscan_sumv + + subroutine psb_cexscan_sumv(ictxt,dat,root) + use psb_realloc_mod +#ifdef MPI_MOD + use mpi +#endif + implicit none +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_mpk_), intent(in) :: ictxt + complex(psb_spk_), intent(inout) :: dat(:) + integer(psb_mpk_), intent(in), optional :: root + integer(psb_mpk_) :: root_ + complex(psb_spk_), allocatable :: dat_(:) + integer(psb_mpk_) :: iam, np, info + integer(psb_ipk_) :: iinfo +#if !defined(SERIAL_MPI) + call psb_info(ictxt,iam,np) + call psb_realloc(size(dat),dat_,iinfo) + dat_ = dat + if (iinfo == psb_success_) & + & call mpi_exscan(dat,dat_,size(dat),psb_mpi_c_spk_,mpi_sum,ictxt,info) +#else + dat = czero +#endif + end subroutine psb_cexscan_sumv end module psi_c_collective_mod diff --git a/base/modules/penv/psi_d_collective_mod.F90 b/base/modules/penv/psi_d_collective_mod.F90 index 58f919eb..fa022233 100644 --- a/base/modules/penv/psi_d_collective_mod.F90 +++ b/base/modules/penv/psi_d_collective_mod.F90 @@ -69,11 +69,11 @@ module psi_d_collective_mod end interface psb_bcast interface psb_scan_sum - module procedure psb_dscan_sums + module procedure psb_dscan_sums, psb_dscan_sumv end interface psb_scan_sum interface psb_exscan_sum - module procedure psb_dexscan_sums + module procedure psb_dexscan_sums, psb_dexscan_sumv end interface psb_exscan_sum @@ -1287,13 +1287,65 @@ contains #if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) - call mpi_scan(dat,dat_,1,psb_mpi_r_dpk_,mpi_sum,ictxt,info) + call mpi_exscan(dat,dat_,1,psb_mpi_r_dpk_,mpi_sum,ictxt,info) dat = dat_ #else - dat = 0 + dat = dzero #endif end subroutine psb_dexscan_sums + subroutine psb_dscan_sumv(ictxt,dat,root) + use psb_realloc_mod +#ifdef MPI_MOD + use mpi +#endif + implicit none +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_mpk_), intent(in) :: ictxt + real(psb_dpk_), intent(inout) :: dat(:) + integer(psb_mpk_), intent(in), optional :: root + integer(psb_mpk_) :: root_ + real(psb_dpk_), allocatable :: dat_(:) + integer(psb_mpk_) :: iam, np, info + integer(psb_ipk_) :: iinfo + +#if !defined(SERIAL_MPI) + call psb_info(ictxt,iam,np) + call psb_realloc(size(dat),dat_,iinfo) + dat_ = dat + if (iinfo == psb_success_) & + & call mpi_scan(dat,dat_,size(dat),psb_mpi_r_dpk_,mpi_sum,ictxt,info) +#endif + end subroutine psb_dscan_sumv + + subroutine psb_dexscan_sumv(ictxt,dat,root) + use psb_realloc_mod +#ifdef MPI_MOD + use mpi +#endif + implicit none +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_mpk_), intent(in) :: ictxt + real(psb_dpk_), intent(inout) :: dat(:) + integer(psb_mpk_), intent(in), optional :: root + integer(psb_mpk_) :: root_ + real(psb_dpk_), allocatable :: dat_(:) + integer(psb_mpk_) :: iam, np, info + integer(psb_ipk_) :: iinfo +#if !defined(SERIAL_MPI) + call psb_info(ictxt,iam,np) + call psb_realloc(size(dat),dat_,iinfo) + dat_ = dat + if (iinfo == psb_success_) & + & call mpi_exscan(dat,dat_,size(dat),psb_mpi_r_dpk_,mpi_sum,ictxt,info) +#else + dat = dzero +#endif + end subroutine psb_dexscan_sumv end module psi_d_collective_mod diff --git a/base/modules/penv/psi_e_collective_mod.F90 b/base/modules/penv/psi_e_collective_mod.F90 index 7d2ff4b0..59e74280 100644 --- a/base/modules/penv/psi_e_collective_mod.F90 +++ b/base/modules/penv/psi_e_collective_mod.F90 @@ -65,11 +65,11 @@ module psi_e_collective_mod end interface psb_bcast interface psb_scan_sum - module procedure psb_escan_sums + module procedure psb_escan_sums, psb_escan_sumv end interface psb_scan_sum interface psb_exscan_sum - module procedure psb_eexscan_sums + module procedure psb_eexscan_sums, psb_eexscan_sumv end interface psb_exscan_sum @@ -1164,13 +1164,65 @@ contains #if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) - call mpi_scan(dat,dat_,1,psb_mpi_epk_,mpi_sum,ictxt,info) + call mpi_exscan(dat,dat_,1,psb_mpi_epk_,mpi_sum,ictxt,info) dat = dat_ #else - dat = 0 + dat = ezero #endif end subroutine psb_eexscan_sums + subroutine psb_escan_sumv(ictxt,dat,root) + use psb_realloc_mod +#ifdef MPI_MOD + use mpi +#endif + implicit none +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_mpk_), intent(in) :: ictxt + integer(psb_epk_), intent(inout) :: dat(:) + integer(psb_mpk_), intent(in), optional :: root + integer(psb_mpk_) :: root_ + integer(psb_epk_), allocatable :: dat_(:) + integer(psb_mpk_) :: iam, np, info + integer(psb_ipk_) :: iinfo + +#if !defined(SERIAL_MPI) + call psb_info(ictxt,iam,np) + call psb_realloc(size(dat),dat_,iinfo) + dat_ = dat + if (iinfo == psb_success_) & + & call mpi_scan(dat,dat_,size(dat),psb_mpi_epk_,mpi_sum,ictxt,info) +#endif + end subroutine psb_escan_sumv + + subroutine psb_eexscan_sumv(ictxt,dat,root) + use psb_realloc_mod +#ifdef MPI_MOD + use mpi +#endif + implicit none +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_mpk_), intent(in) :: ictxt + integer(psb_epk_), intent(inout) :: dat(:) + integer(psb_mpk_), intent(in), optional :: root + integer(psb_mpk_) :: root_ + integer(psb_epk_), allocatable :: dat_(:) + integer(psb_mpk_) :: iam, np, info + integer(psb_ipk_) :: iinfo +#if !defined(SERIAL_MPI) + call psb_info(ictxt,iam,np) + call psb_realloc(size(dat),dat_,iinfo) + dat_ = dat + if (iinfo == psb_success_) & + & call mpi_exscan(dat,dat_,size(dat),psb_mpi_epk_,mpi_sum,ictxt,info) +#else + dat = ezero +#endif + end subroutine psb_eexscan_sumv end module psi_e_collective_mod diff --git a/base/modules/penv/psi_m_collective_mod.F90 b/base/modules/penv/psi_m_collective_mod.F90 index bd1eefd4..5959e468 100644 --- a/base/modules/penv/psi_m_collective_mod.F90 +++ b/base/modules/penv/psi_m_collective_mod.F90 @@ -65,11 +65,11 @@ module psi_m_collective_mod end interface psb_bcast interface psb_scan_sum - module procedure psb_mscan_sums + module procedure psb_mscan_sums, psb_mscan_sumv end interface psb_scan_sum interface psb_exscan_sum - module procedure psb_mexscan_sums + module procedure psb_mexscan_sums, psb_mexscan_sumv end interface psb_exscan_sum @@ -1164,13 +1164,65 @@ contains #if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) - call mpi_scan(dat,dat_,1,psb_mpi_mpk_,mpi_sum,ictxt,info) + call mpi_exscan(dat,dat_,1,psb_mpi_mpk_,mpi_sum,ictxt,info) dat = dat_ #else - dat = 0 + dat = mzero #endif end subroutine psb_mexscan_sums + subroutine psb_mscan_sumv(ictxt,dat,root) + use psb_realloc_mod +#ifdef MPI_MOD + use mpi +#endif + implicit none +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_mpk_), intent(in) :: ictxt + integer(psb_mpk_), intent(inout) :: dat(:) + integer(psb_mpk_), intent(in), optional :: root + integer(psb_mpk_) :: root_ + integer(psb_mpk_), allocatable :: dat_(:) + integer(psb_mpk_) :: iam, np, info + integer(psb_ipk_) :: iinfo + +#if !defined(SERIAL_MPI) + call psb_info(ictxt,iam,np) + call psb_realloc(size(dat),dat_,iinfo) + dat_ = dat + if (iinfo == psb_success_) & + & call mpi_scan(dat,dat_,size(dat),psb_mpi_mpk_,mpi_sum,ictxt,info) +#endif + end subroutine psb_mscan_sumv + + subroutine psb_mexscan_sumv(ictxt,dat,root) + use psb_realloc_mod +#ifdef MPI_MOD + use mpi +#endif + implicit none +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_mpk_), intent(in) :: ictxt + integer(psb_mpk_), intent(inout) :: dat(:) + integer(psb_mpk_), intent(in), optional :: root + integer(psb_mpk_) :: root_ + integer(psb_mpk_), allocatable :: dat_(:) + integer(psb_mpk_) :: iam, np, info + integer(psb_ipk_) :: iinfo +#if !defined(SERIAL_MPI) + call psb_info(ictxt,iam,np) + call psb_realloc(size(dat),dat_,iinfo) + dat_ = dat + if (iinfo == psb_success_) & + & call mpi_exscan(dat,dat_,size(dat),psb_mpi_mpk_,mpi_sum,ictxt,info) +#else + dat = mzero +#endif + end subroutine psb_mexscan_sumv end module psi_m_collective_mod diff --git a/base/modules/penv/psi_s_collective_mod.F90 b/base/modules/penv/psi_s_collective_mod.F90 index 5d86d581..5de46599 100644 --- a/base/modules/penv/psi_s_collective_mod.F90 +++ b/base/modules/penv/psi_s_collective_mod.F90 @@ -69,11 +69,11 @@ module psi_s_collective_mod end interface psb_bcast interface psb_scan_sum - module procedure psb_sscan_sums + module procedure psb_sscan_sums, psb_sscan_sumv end interface psb_scan_sum interface psb_exscan_sum - module procedure psb_sexscan_sums + module procedure psb_sexscan_sums, psb_sexscan_sumv end interface psb_exscan_sum @@ -1287,13 +1287,65 @@ contains #if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) - call mpi_scan(dat,dat_,1,psb_mpi_r_spk_,mpi_sum,ictxt,info) + call mpi_exscan(dat,dat_,1,psb_mpi_r_spk_,mpi_sum,ictxt,info) dat = dat_ #else - dat = 0 + dat = szero #endif end subroutine psb_sexscan_sums + subroutine psb_sscan_sumv(ictxt,dat,root) + use psb_realloc_mod +#ifdef MPI_MOD + use mpi +#endif + implicit none +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_mpk_), intent(in) :: ictxt + real(psb_spk_), intent(inout) :: dat(:) + integer(psb_mpk_), intent(in), optional :: root + integer(psb_mpk_) :: root_ + real(psb_spk_), allocatable :: dat_(:) + integer(psb_mpk_) :: iam, np, info + integer(psb_ipk_) :: iinfo + +#if !defined(SERIAL_MPI) + call psb_info(ictxt,iam,np) + call psb_realloc(size(dat),dat_,iinfo) + dat_ = dat + if (iinfo == psb_success_) & + & call mpi_scan(dat,dat_,size(dat),psb_mpi_r_spk_,mpi_sum,ictxt,info) +#endif + end subroutine psb_sscan_sumv + + subroutine psb_sexscan_sumv(ictxt,dat,root) + use psb_realloc_mod +#ifdef MPI_MOD + use mpi +#endif + implicit none +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_mpk_), intent(in) :: ictxt + real(psb_spk_), intent(inout) :: dat(:) + integer(psb_mpk_), intent(in), optional :: root + integer(psb_mpk_) :: root_ + real(psb_spk_), allocatable :: dat_(:) + integer(psb_mpk_) :: iam, np, info + integer(psb_ipk_) :: iinfo +#if !defined(SERIAL_MPI) + call psb_info(ictxt,iam,np) + call psb_realloc(size(dat),dat_,iinfo) + dat_ = dat + if (iinfo == psb_success_) & + & call mpi_exscan(dat,dat_,size(dat),psb_mpi_r_spk_,mpi_sum,ictxt,info) +#else + dat = szero +#endif + end subroutine psb_sexscan_sumv end module psi_s_collective_mod diff --git a/base/modules/penv/psi_z_collective_mod.F90 b/base/modules/penv/psi_z_collective_mod.F90 index 7176e02a..33fe7764 100644 --- a/base/modules/penv/psi_z_collective_mod.F90 +++ b/base/modules/penv/psi_z_collective_mod.F90 @@ -55,11 +55,11 @@ module psi_z_collective_mod end interface psb_bcast interface psb_scan_sum - module procedure psb_zscan_sums + module procedure psb_zscan_sums, psb_zscan_sumv end interface psb_scan_sum interface psb_exscan_sum - module procedure psb_zexscan_sums + module procedure psb_zexscan_sums, psb_zexscan_sumv end interface psb_exscan_sum @@ -796,13 +796,65 @@ contains #if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) - call mpi_scan(dat,dat_,1,psb_mpi_c_dpk_,mpi_sum,ictxt,info) + call mpi_exscan(dat,dat_,1,psb_mpi_c_dpk_,mpi_sum,ictxt,info) dat = dat_ #else - dat = 0 + dat = zzero #endif end subroutine psb_zexscan_sums + subroutine psb_zscan_sumv(ictxt,dat,root) + use psb_realloc_mod +#ifdef MPI_MOD + use mpi +#endif + implicit none +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_mpk_), intent(in) :: ictxt + complex(psb_dpk_), intent(inout) :: dat(:) + integer(psb_mpk_), intent(in), optional :: root + integer(psb_mpk_) :: root_ + complex(psb_dpk_), allocatable :: dat_(:) + integer(psb_mpk_) :: iam, np, info + integer(psb_ipk_) :: iinfo + +#if !defined(SERIAL_MPI) + call psb_info(ictxt,iam,np) + call psb_realloc(size(dat),dat_,iinfo) + dat_ = dat + if (iinfo == psb_success_) & + & call mpi_scan(dat,dat_,size(dat),psb_mpi_c_dpk_,mpi_sum,ictxt,info) +#endif + end subroutine psb_zscan_sumv + + subroutine psb_zexscan_sumv(ictxt,dat,root) + use psb_realloc_mod +#ifdef MPI_MOD + use mpi +#endif + implicit none +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_mpk_), intent(in) :: ictxt + complex(psb_dpk_), intent(inout) :: dat(:) + integer(psb_mpk_), intent(in), optional :: root + integer(psb_mpk_) :: root_ + complex(psb_dpk_), allocatable :: dat_(:) + integer(psb_mpk_) :: iam, np, info + integer(psb_ipk_) :: iinfo +#if !defined(SERIAL_MPI) + call psb_info(ictxt,iam,np) + call psb_realloc(size(dat),dat_,iinfo) + dat_ = dat + if (iinfo == psb_success_) & + & call mpi_exscan(dat,dat_,size(dat),psb_mpi_c_dpk_,mpi_sum,ictxt,info) +#else + dat = zzero +#endif + end subroutine psb_zexscan_sumv end module psi_z_collective_mod