From d99c45ae3d5a56ef87d316123b3962f607beef53 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Thu, 19 Nov 2015 15:25:27 +0000 Subject: [PATCH] psblas base/serial/impl/psb_c_coo_impl.f90 base/serial/impl/psb_c_csc_impl.f90 base/serial/impl/psb_c_csr_impl.f90 base/serial/impl/psb_d_coo_impl.f90 base/serial/impl/psb_d_csc_impl.f90 base/serial/impl/psb_d_csr_impl.f90 base/serial/impl/psb_s_coo_impl.f90 base/serial/impl/psb_s_csc_impl.f90 base/serial/impl/psb_s_csr_impl.f90 base/serial/impl/psb_z_coo_impl.f90 base/serial/impl/psb_z_csc_impl.f90 base/serial/impl/psb_z_csr_impl.f90 Fixes to print routines and computation of sizes for spspmm --- base/serial/impl/psb_c_coo_impl.f90 | 11 +++++------ base/serial/impl/psb_c_csc_impl.f90 | 14 +++++++------- base/serial/impl/psb_c_csr_impl.f90 | 14 +++++++------- base/serial/impl/psb_d_coo_impl.f90 | 11 +++++------ base/serial/impl/psb_d_csc_impl.f90 | 14 +++++++------- base/serial/impl/psb_d_csr_impl.f90 | 14 +++++++------- base/serial/impl/psb_s_coo_impl.f90 | 11 +++++------ base/serial/impl/psb_s_csc_impl.f90 | 14 +++++++------- base/serial/impl/psb_s_csr_impl.f90 | 14 +++++++------- base/serial/impl/psb_z_coo_impl.f90 | 11 +++++------ base/serial/impl/psb_z_csc_impl.f90 | 14 +++++++------- base/serial/impl/psb_z_csr_impl.f90 | 14 +++++++------- 12 files changed, 76 insertions(+), 80 deletions(-) diff --git a/base/serial/impl/psb_c_coo_impl.f90 b/base/serial/impl/psb_c_coo_impl.f90 index 2325f96b..6e976b14 100644 --- a/base/serial/impl/psb_c_coo_impl.f90 +++ b/base/serial/impl/psb_c_coo_impl.f90 @@ -415,12 +415,11 @@ subroutine psb_c_coo_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmtv integer(psb_ipk_) :: i,j, nmx, ni, nr, nc, nz - if (present(head)) then - write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' - write(iout,'(a,a)') '% ',head - write(iout,'(a)') '%' - write(iout,'(a,a)') '% COO' - endif + write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' + if (present(head)) write(iout,'(a,a)') '% ',head + write(iout,'(a)') '%' + write(iout,'(a,a)') '% COO' + if (a%is_dev()) call a%sync() nr = a%get_nrows() diff --git a/base/serial/impl/psb_c_csc_impl.f90 b/base/serial/impl/psb_c_csc_impl.f90 index dcf9f29b..1f8b732b 100644 --- a/base/serial/impl/psb_c_csc_impl.f90 +++ b/base/serial/impl/psb_c_csc_impl.f90 @@ -2770,12 +2770,12 @@ subroutine psb_c_csc_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmtv integer(psb_ipk_) :: i,j, nmx, ni, nr, nc, nz - if (present(head)) then - write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' - write(iout,'(a,a)') '% ',head - write(iout,'(a)') '%' - write(iout,'(a,a)') '% COO' - endif + + write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' + if (present(head)) write(iout,'(a,a)') '% ',head + write(iout,'(a)') '%' + write(iout,'(a,a)') '% COO' + if (a%is_dev()) call a%sync() nr = a%get_nrows() @@ -2860,7 +2860,7 @@ subroutine psb_ccscspspmm(a,b,c,info) nzeb = (((nza+na-1)/na)*((nzb+nb-1)/nb))*nb ! Estimate number of nonzeros on output. ! Turns out this is often a large overestimate. - call c%allocate(ma,nb,min(nzc,nze,nzeb)) + call c%allocate(ma,nb,nzc) call csc_spspmm(a,b,c,info) diff --git a/base/serial/impl/psb_c_csr_impl.f90 b/base/serial/impl/psb_c_csr_impl.f90 index 0e08e9ca..38c67839 100644 --- a/base/serial/impl/psb_c_csr_impl.f90 +++ b/base/serial/impl/psb_c_csr_impl.f90 @@ -2597,12 +2597,12 @@ subroutine psb_c_csr_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmtv integer(psb_ipk_) :: irs,ics,i,j, nmx, ni, nr, nc, nz - if (present(head)) then - write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' - write(iout,'(a,a)') '% ',head - write(iout,'(a)') '%' - write(iout,'(a,a)') '% COO' - endif + + write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' + if (present(head)) write(iout,'(a,a)') '% ',head + write(iout,'(a)') '%' + write(iout,'(a,a)') '% COO' + if (a%is_dev()) call a%sync() nr = a%get_nrows() @@ -3087,7 +3087,7 @@ subroutine psb_ccsrspspmm(a,b,c,info) nzeb = (((nza+na-1)/na)*((nzb+nb-1)/nb))*nb ! Estimate number of nonzeros on output. ! Turns out this is often a large overestimate. - call c%allocate(ma,nb,min(nzc,nze,nzeb)) + call c%allocate(ma,nb,nzc) call csr_spspmm(a,b,c,info) diff --git a/base/serial/impl/psb_d_coo_impl.f90 b/base/serial/impl/psb_d_coo_impl.f90 index 4b123836..a2ca6e7f 100644 --- a/base/serial/impl/psb_d_coo_impl.f90 +++ b/base/serial/impl/psb_d_coo_impl.f90 @@ -415,12 +415,11 @@ subroutine psb_d_coo_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmtv integer(psb_ipk_) :: i,j, nmx, ni, nr, nc, nz - if (present(head)) then - write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' - write(iout,'(a,a)') '% ',head - write(iout,'(a)') '%' - write(iout,'(a,a)') '% COO' - endif + write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' + if (present(head)) write(iout,'(a,a)') '% ',head + write(iout,'(a)') '%' + write(iout,'(a,a)') '% COO' + if (a%is_dev()) call a%sync() nr = a%get_nrows() diff --git a/base/serial/impl/psb_d_csc_impl.f90 b/base/serial/impl/psb_d_csc_impl.f90 index 78dd44da..04572bf7 100644 --- a/base/serial/impl/psb_d_csc_impl.f90 +++ b/base/serial/impl/psb_d_csc_impl.f90 @@ -2770,12 +2770,12 @@ subroutine psb_d_csc_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmtv integer(psb_ipk_) :: i,j, nmx, ni, nr, nc, nz - if (present(head)) then - write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' - write(iout,'(a,a)') '% ',head - write(iout,'(a)') '%' - write(iout,'(a,a)') '% COO' - endif + + write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' + if (present(head)) write(iout,'(a,a)') '% ',head + write(iout,'(a)') '%' + write(iout,'(a,a)') '% COO' + if (a%is_dev()) call a%sync() nr = a%get_nrows() @@ -2860,7 +2860,7 @@ subroutine psb_dcscspspmm(a,b,c,info) nzeb = (((nza+na-1)/na)*((nzb+nb-1)/nb))*nb ! Estimate number of nonzeros on output. ! Turns out this is often a large overestimate. - call c%allocate(ma,nb,min(nzc,nze,nzeb)) + call c%allocate(ma,nb,nzc) call csc_spspmm(a,b,c,info) diff --git a/base/serial/impl/psb_d_csr_impl.f90 b/base/serial/impl/psb_d_csr_impl.f90 index bd2b5994..72890e44 100644 --- a/base/serial/impl/psb_d_csr_impl.f90 +++ b/base/serial/impl/psb_d_csr_impl.f90 @@ -2597,12 +2597,12 @@ subroutine psb_d_csr_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmtv integer(psb_ipk_) :: irs,ics,i,j, nmx, ni, nr, nc, nz - if (present(head)) then - write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' - write(iout,'(a,a)') '% ',head - write(iout,'(a)') '%' - write(iout,'(a,a)') '% COO' - endif + + write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' + if (present(head)) write(iout,'(a,a)') '% ',head + write(iout,'(a)') '%' + write(iout,'(a,a)') '% COO' + if (a%is_dev()) call a%sync() nr = a%get_nrows() @@ -3087,7 +3087,7 @@ subroutine psb_dcsrspspmm(a,b,c,info) nzeb = (((nza+na-1)/na)*((nzb+nb-1)/nb))*nb ! Estimate number of nonzeros on output. ! Turns out this is often a large overestimate. - call c%allocate(ma,nb,min(nzc,nze,nzeb)) + call c%allocate(ma,nb,nzc) call csr_spspmm(a,b,c,info) diff --git a/base/serial/impl/psb_s_coo_impl.f90 b/base/serial/impl/psb_s_coo_impl.f90 index bd58d44a..e700e48b 100644 --- a/base/serial/impl/psb_s_coo_impl.f90 +++ b/base/serial/impl/psb_s_coo_impl.f90 @@ -415,12 +415,11 @@ subroutine psb_s_coo_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmtv integer(psb_ipk_) :: i,j, nmx, ni, nr, nc, nz - if (present(head)) then - write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' - write(iout,'(a,a)') '% ',head - write(iout,'(a)') '%' - write(iout,'(a,a)') '% COO' - endif + write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' + if (present(head)) write(iout,'(a,a)') '% ',head + write(iout,'(a)') '%' + write(iout,'(a,a)') '% COO' + if (a%is_dev()) call a%sync() nr = a%get_nrows() diff --git a/base/serial/impl/psb_s_csc_impl.f90 b/base/serial/impl/psb_s_csc_impl.f90 index da8350cc..aed2ada9 100644 --- a/base/serial/impl/psb_s_csc_impl.f90 +++ b/base/serial/impl/psb_s_csc_impl.f90 @@ -2770,12 +2770,12 @@ subroutine psb_s_csc_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmtv integer(psb_ipk_) :: i,j, nmx, ni, nr, nc, nz - if (present(head)) then - write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' - write(iout,'(a,a)') '% ',head - write(iout,'(a)') '%' - write(iout,'(a,a)') '% COO' - endif + + write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' + if (present(head)) write(iout,'(a,a)') '% ',head + write(iout,'(a)') '%' + write(iout,'(a,a)') '% COO' + if (a%is_dev()) call a%sync() nr = a%get_nrows() @@ -2860,7 +2860,7 @@ subroutine psb_scscspspmm(a,b,c,info) nzeb = (((nza+na-1)/na)*((nzb+nb-1)/nb))*nb ! Estimate number of nonzeros on output. ! Turns out this is often a large overestimate. - call c%allocate(ma,nb,min(nzc,nze,nzeb)) + call c%allocate(ma,nb,nzc) call csc_spspmm(a,b,c,info) diff --git a/base/serial/impl/psb_s_csr_impl.f90 b/base/serial/impl/psb_s_csr_impl.f90 index fd1d0a22..182da555 100644 --- a/base/serial/impl/psb_s_csr_impl.f90 +++ b/base/serial/impl/psb_s_csr_impl.f90 @@ -2597,12 +2597,12 @@ subroutine psb_s_csr_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmtv integer(psb_ipk_) :: irs,ics,i,j, nmx, ni, nr, nc, nz - if (present(head)) then - write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' - write(iout,'(a,a)') '% ',head - write(iout,'(a)') '%' - write(iout,'(a,a)') '% COO' - endif + + write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' + if (present(head)) write(iout,'(a,a)') '% ',head + write(iout,'(a)') '%' + write(iout,'(a,a)') '% COO' + if (a%is_dev()) call a%sync() nr = a%get_nrows() @@ -3087,7 +3087,7 @@ subroutine psb_scsrspspmm(a,b,c,info) nzeb = (((nza+na-1)/na)*((nzb+nb-1)/nb))*nb ! Estimate number of nonzeros on output. ! Turns out this is often a large overestimate. - call c%allocate(ma,nb,min(nzc,nze,nzeb)) + call c%allocate(ma,nb,nzc) call csr_spspmm(a,b,c,info) diff --git a/base/serial/impl/psb_z_coo_impl.f90 b/base/serial/impl/psb_z_coo_impl.f90 index 6796fe80..8eac15bc 100644 --- a/base/serial/impl/psb_z_coo_impl.f90 +++ b/base/serial/impl/psb_z_coo_impl.f90 @@ -415,12 +415,11 @@ subroutine psb_z_coo_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmtv integer(psb_ipk_) :: i,j, nmx, ni, nr, nc, nz - if (present(head)) then - write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' - write(iout,'(a,a)') '% ',head - write(iout,'(a)') '%' - write(iout,'(a,a)') '% COO' - endif + write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' + if (present(head)) write(iout,'(a,a)') '% ',head + write(iout,'(a)') '%' + write(iout,'(a,a)') '% COO' + if (a%is_dev()) call a%sync() nr = a%get_nrows() diff --git a/base/serial/impl/psb_z_csc_impl.f90 b/base/serial/impl/psb_z_csc_impl.f90 index 935a0b42..0354bef8 100644 --- a/base/serial/impl/psb_z_csc_impl.f90 +++ b/base/serial/impl/psb_z_csc_impl.f90 @@ -2770,12 +2770,12 @@ subroutine psb_z_csc_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmtv integer(psb_ipk_) :: i,j, nmx, ni, nr, nc, nz - if (present(head)) then - write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' - write(iout,'(a,a)') '% ',head - write(iout,'(a)') '%' - write(iout,'(a,a)') '% COO' - endif + + write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' + if (present(head)) write(iout,'(a,a)') '% ',head + write(iout,'(a)') '%' + write(iout,'(a,a)') '% COO' + if (a%is_dev()) call a%sync() nr = a%get_nrows() @@ -2860,7 +2860,7 @@ subroutine psb_zcscspspmm(a,b,c,info) nzeb = (((nza+na-1)/na)*((nzb+nb-1)/nb))*nb ! Estimate number of nonzeros on output. ! Turns out this is often a large overestimate. - call c%allocate(ma,nb,min(nzc,nze,nzeb)) + call c%allocate(ma,nb,nzc) call csc_spspmm(a,b,c,info) diff --git a/base/serial/impl/psb_z_csr_impl.f90 b/base/serial/impl/psb_z_csr_impl.f90 index 4abd54f2..ab4878ff 100644 --- a/base/serial/impl/psb_z_csr_impl.f90 +++ b/base/serial/impl/psb_z_csr_impl.f90 @@ -2597,12 +2597,12 @@ subroutine psb_z_csr_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmtv integer(psb_ipk_) :: irs,ics,i,j, nmx, ni, nr, nc, nz - if (present(head)) then - write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' - write(iout,'(a,a)') '% ',head - write(iout,'(a)') '%' - write(iout,'(a,a)') '% COO' - endif + + write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' + if (present(head)) write(iout,'(a,a)') '% ',head + write(iout,'(a)') '%' + write(iout,'(a,a)') '% COO' + if (a%is_dev()) call a%sync() nr = a%get_nrows() @@ -3087,7 +3087,7 @@ subroutine psb_zcsrspspmm(a,b,c,info) nzeb = (((nza+na-1)/na)*((nzb+nb-1)/nb))*nb ! Estimate number of nonzeros on output. ! Turns out this is often a large overestimate. - call c%allocate(ma,nb,min(nzc,nze,nzeb)) + call c%allocate(ma,nb,nzc) call csr_spspmm(a,b,c,info)