From 0b2e64ccaf731f7044704dcb5bfb4e1f003ad3d6 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Wed, 26 Mar 2008 15:50:32 +0000 Subject: [PATCH] psblas2-dev/: base/psblas/psb_dspmm.f90 base/psblas/psb_zspmm.f90 Changed handling of multiple columns. --- base/psblas/psb_dspmm.f90 | 52 ++++++++++++++++++++++----------------- base/psblas/psb_zspmm.f90 | 51 +++++++++++++++++++++----------------- 2 files changed, 58 insertions(+), 45 deletions(-) diff --git a/base/psblas/psb_dspmm.f90 b/base/psblas/psb_dspmm.f90 index f75e1c9f..fd7a519a 100644 --- a/base/psblas/psb_dspmm.f90 +++ b/base/psblas/psb_dspmm.f90 @@ -231,36 +231,42 @@ subroutine psb_dspmm(alpha,a,x,beta,y,desc_a,info,& end if - ib1=min(nb,ik) - xp => x(iix:lldx,jjx:jjx+ib1-1) - if (doswap_)& - & call psi_swapdata(ior(psb_swap_send_,psb_swap_recv_),& - & ib1,dzero,xp,desc_a,iwork,info) + if (doswap_.and.(np>1)) then + ib1=min(nb,ik) + xp => x(iix:lldx,jjx:jjx+ib1-1) + if (doswap_)& + & call psi_swapdata(ior(psb_swap_send_,psb_swap_recv_),& + & ib1,dzero,xp,desc_a,iwork,info) - blk: do i=1, ik, nb - ib=ib1 - ib1 = max(0,min(nb,(ik)-(i-1+ib))) - xp => x(iix:lldx,jjx+i+ib-1:jjx+i+ib+ib1-2) - if ((ib1 > 0).and.(doswap_)) & - & call psi_swapdata(psb_swap_send_,ib1,& - & dzero,xp,desc_a,iwork,info) + blk: do i=1, ik, nb + ib=ib1 + ib1 = max(0,min(nb,(ik)-(i-1+ib))) + xp => x(iix:lldx,jjx+i+ib-1:jjx+i+ib+ib1-2) + if ((ib1 > 0).and.(doswap_)) & + & call psi_swapdata(psb_swap_send_,ib1,& + & dzero,xp,desc_a,iwork,info) - if(info /= 0) exit blk + if(info /= 0) exit blk - ! local Matrix-vector product - call psb_csmm(alpha,a,x(:,jjx+i-1:jjx+i+ib-1),& - & beta,y(:,jjy+i-1:jjy+i+ib-1),info,trans=trans_) + ! local Matrix-vector product + call psb_csmm(alpha,a,x(:,jjx+i-1:jjx+i+ib-1),& + & beta,y(:,jjy+i-1:jjy+i+ib-1),info,trans=trans_) - if(info /= 0) exit blk + if(info /= 0) exit blk - if((ib1 > 0).and.(doswap_))& - & call psi_swapdata(psb_swap_send_,ib1,& - & dzero,xp,desc_a,iwork,info) - - if(info /= 0) exit blk - end do blk + if((ib1 > 0).and.(doswap_))& + & call psi_swapdata(psb_swap_send_,ib1,& + & dzero,xp,desc_a,iwork,info) + if(info /= 0) exit blk + end do blk + else + if (doswap_)& + & call psi_swapdata(ior(psb_swap_send_,psb_swap_recv_),& + & ib1,dzero,x(:,1:ik),desc_a,iwork,info) + if (info == 0) call psb_csmm(alpha,a,x(:,1:ik),beta,y(:,1:ik),info) + end if if(info /= 0) then info = 4011 call psb_errpush(info,name) diff --git a/base/psblas/psb_zspmm.f90 b/base/psblas/psb_zspmm.f90 index 936e3b99..92fd14b8 100644 --- a/base/psblas/psb_zspmm.f90 +++ b/base/psblas/psb_zspmm.f90 @@ -231,35 +231,42 @@ subroutine psb_zspmm(alpha,a,x,beta,y,desc_a,info,& end if - ib1=min(nb,ik) - xp => x(iix:lldx,jjx:jjx+ib1-1) - if (doswap_)& - & call psi_swapdata(ior(psb_swap_send_,psb_swap_recv_),& - & ib1,zzero,xp,desc_a,iwork,info) + if (doswap_.and.(np>1)) then + ib1=min(nb,ik) + xp => x(iix:lldx,jjx:jjx+ib1-1) + if (doswap_)& + & call psi_swapdata(ior(psb_swap_send_,psb_swap_recv_),& + & ib1,zzero,xp,desc_a,iwork,info) - blk: do i=1, ik, nb - ib=ib1 - ib1 = max(0,min(nb,(ik)-(i-1+ib))) - xp => x(iix:lldx,jjx+i+ib-1:jjx+i+ib+ib1-2) - if ((ib1 > 0).and.(doswap_)) & - & call psi_swapdata(psb_swap_send_,ib1,& - & zzero,xp,desc_a,iwork,info) + blk: do i=1, ik, nb + ib=ib1 + ib1 = max(0,min(nb,(ik)-(i-1+ib))) + xp => x(iix:lldx,jjx+i+ib-1:jjx+i+ib+ib1-2) + if ((ib1 > 0).and.(doswap_)) & + & call psi_swapdata(psb_swap_send_,ib1,& + & zzero,xp,desc_a,iwork,info) - if(info /= 0) exit blk + if(info /= 0) exit blk - ! local Matrix-vector product - call psb_csmm(alpha,a,x(:,jjx+i-1:jjx+i+ib-1),& - & beta,y(:,jjy+i-1:jjy+i+ib-1),info,trans=trans_) + ! local Matrix-vector product + call psb_csmm(alpha,a,x(:,jjx+i-1:jjx+i+ib-1),& + & beta,y(:,jjy+i-1:jjy+i+ib-1),info,trans=trans_) - if(info /= 0) exit blk + if(info /= 0) exit blk - if((ib1 > 0).and.(doswap_))& - & call psi_swapdata(psb_swap_send_,ib1,& - & zzero,xp,desc_a,iwork,info) + if((ib1 > 0).and.(doswap_))& + & call psi_swapdata(psb_swap_send_,ib1,& + & zzero,xp,desc_a,iwork,info) - if(info /= 0) exit blk - end do blk + if(info /= 0) exit blk + end do blk + else + if (doswap_)& + & call psi_swapdata(ior(psb_swap_send_,psb_swap_recv_),& + & ib1,zzero,x(:,1:ik),desc_a,iwork,info) + if (info == 0) call psb_csmm(alpha,a,x(:,1:ik),beta,y(:,1:ik),info) + end if if(info /= 0) then info = 4011