From e16b7906fa88d949f16fc06678018f29e21ebd4b Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Sun, 28 Oct 2018 11:20:00 +0000 Subject: [PATCH] Fixed test directory issues with Makefiles and interface updates. --- test/fileread/Makefile | 5 ++++- test/hello/Makefile | 11 +++++++---- test/kernel/Makefile | 4 +++- test/pargen/Makefile | 5 ++++- test/serial/Makefile | 5 ++++- test/serial/d_matgen.F90 | 2 +- test/serial/psb_d_xyz_impl.f90 | 28 +++++++++++++++++----------- test/serial/psb_d_xyz_mat_mod.f90 | 14 ++++++++++++-- test/torture/Makefile | 12 ++++++++---- test/util/Makefile | 6 +++--- 10 files changed, 63 insertions(+), 29 deletions(-) diff --git a/test/fileread/Makefile b/test/fileread/Makefile index d825eab4..132a2e15 100644 --- a/test/fileread/Makefile +++ b/test/fileread/Makefile @@ -18,7 +18,10 @@ ZFOBJS=getp.o psb_zf_sample.o EXEDIR=./runs -all: psb_sf_sample psb_df_sample psb_cf_sample psb_zf_sample +all: runsd psb_sf_sample psb_df_sample psb_cf_sample psb_zf_sample + +runsd: + (if test ! -d runs ; then mkdir runs; fi) psb_sf_sample.o psb_df_sample.o psb_cf_sample.o psb_zf_sample.o: getp.o diff --git a/test/hello/Makefile b/test/hello/Makefile index 1a73ff34..6516a868 100644 --- a/test/hello/Makefile +++ b/test/hello/Makefile @@ -1,10 +1,10 @@ -BASEDIR=../.. -INCDIR=$(BASEDIR)/include +INSTALLDIR=../.. +INCDIR=$(INSTALLDIR)/include MODDIR=$(INSTALLDIR)/modules/ include $(INCDIR)/Make.inc.psblas # # Libraries used -LIBDIR=$(BASEDIR)/lib +LIBDIR=$(INSTALLDIR)/lib PSBLAS_LIB= -L$(LIBDIR) -lpsb_util -lpsb_krylov -lpsb_prec -lpsb_base LDLIBS=$(PSBLDLIBS) # @@ -16,7 +16,10 @@ FINCLUDES=$(FMFLAG)$(MODDIR) $(FMFLAG). EXEDIR=./runs -all: hello pingpong +all: runsd hello pingpong + +runsd: + (if test ! -d runs ; then mkdir runs; fi) hello: hello.o $(FLINK) hello.o -o hello $(PSBLAS_LIB) $(LDLIBS) diff --git a/test/kernel/Makefile b/test/kernel/Makefile index 453bcd26..8eb076a4 100644 --- a/test/kernel/Makefile +++ b/test/kernel/Makefile @@ -17,8 +17,10 @@ STOBJS=s_file_spmv.o DPGOBJS=pdgenspmv.o EXEDIR=./runs -all: d_file_spmv s_file_spmv pdgenspmv +all: runsd d_file_spmv s_file_spmv pdgenspmv +runsd: + (if test ! -d runs ; then mkdir runs; fi) d_file_spmv: $(DTOBJS) $(FLINK) $(LOPT) $(DTOBJS) -o d_file_spmv $(PSBLAS_LIB) $(LDLIBS) diff --git a/test/pargen/Makefile b/test/pargen/Makefile index 72a2a512..20a95c0b 100644 --- a/test/pargen/Makefile +++ b/test/pargen/Makefile @@ -16,7 +16,10 @@ FINCLUDES=$(FMFLAG)$(MODDIR) $(FMFLAG). EXEDIR=./runs -all: psb_d_pde3d psb_s_pde3d psb_d_pde2d psb_s_pde2d +all: runsd psb_d_pde3d psb_s_pde3d psb_d_pde2d psb_s_pde2d + +runsd: + (if test ! -d runs ; then mkdir runs; fi) psb_d_pde3d: psb_d_pde3d.o $(FLINK) psb_d_pde3d.o -o psb_d_pde3d $(PSBLAS_LIB) $(LDLIBS) diff --git a/test/serial/Makefile b/test/serial/Makefile index 3469d375..0136949a 100644 --- a/test/serial/Makefile +++ b/test/serial/Makefile @@ -15,7 +15,10 @@ FINCLUDES=$(FMFLAG)$(MODDIR) $(FMFLAG). EXEDIR=./runs -all: d_matgen +all: runsd d_matgen + +runsd: + (if test ! -d runs ; then mkdir runs; fi) psb_d_xyz_impl.o d_matgen.o: psb_d_xyz_mat_mod.o diff --git a/test/serial/d_matgen.F90 b/test/serial/d_matgen.F90 index 31f7f882..68d4f70d 100644 --- a/test/serial/d_matgen.F90 +++ b/test/serial/d_matgen.F90 @@ -414,7 +414,7 @@ program d_matgen ! call psb_barrier(ictxt) t1 = psb_wtime() - if (.true.) then + if (.false.) then call psb_gen_pde3d(ictxt,idim,a,b,x,desc_a,afmt,& & a1,a2,a3,b1,b2,b3,c,g,info,amold=acsr) else if (.false.) then diff --git a/test/serial/psb_d_xyz_impl.f90 b/test/serial/psb_d_xyz_impl.f90 index 4f57c53d..cf32ec60 100644 --- a/test/serial/psb_d_xyz_impl.f90 +++ b/test/serial/psb_d_xyz_impl.f90 @@ -2008,7 +2008,7 @@ end subroutine psb_d_xyz_csgetptn subroutine psb_d_xyz_csgetrow(imin,imax,a,nz,ia,ja,val,info,& - & jmin,jmax,iren,append,nzin,rscale,cscale) + & jmin,jmax,iren,append,nzin,rscale,cscale,chksz) ! Output is always in COO format use psb_error_mod use psb_const_mod @@ -2026,9 +2026,9 @@ subroutine psb_d_xyz_csgetrow(imin,imax,a,nz,ia,ja,val,info,& logical, intent(in), optional :: append integer(psb_ipk_), intent(in), optional :: iren(:) integer(psb_ipk_), intent(in), optional :: jmin,jmax, nzin - logical, intent(in), optional :: rscale,cscale + logical, intent(in), optional :: rscale,cscale,chksz - logical :: append_, rscale_, cscale_ + logical :: append_, rscale_, cscale_, chksz_ integer(psb_ipk_) :: nzin_, jmin_, jmax_, err_act, i integer(psb_ipk_) :: ierr(5) character(len=20) :: name='csget' @@ -2073,13 +2073,18 @@ subroutine psb_d_xyz_csgetrow(imin,imax,a,nz,ia,ja,val,info,& else cscale_ = .false. endif + if (present(chksz)) then + chksz_ = chksz + else + chksz_ = .true. + endif if ((rscale_.or.cscale_).and.(present(iren))) then info = psb_err_many_optional_arg_ call psb_errpush(info,name,a_err='iren (rscale.or.cscale)') goto 9999 end if - call xyz_getrow(imin,imax,jmin_,jmax_,a,nz,ia,ja,val,nzin_,append_,info,& + call xyz_getrow(imin,imax,jmin_,jmax_,a,nz,ia,ja,val,nzin_,append_,chksz_,info,& & iren) if (rscale_) then @@ -2103,7 +2108,7 @@ subroutine psb_d_xyz_csgetrow(imin,imax,a,nz,ia,ja,val,info,& contains - subroutine xyz_getrow(imin,imax,jmin,jmax,a,nz,ia,ja,val,nzin,append,info,& + subroutine xyz_getrow(imin,imax,jmin,jmax,a,nz,ia,ja,val,nzin,append,chksz,info,& & iren) use psb_const_mod @@ -2118,7 +2123,7 @@ contains integer(psb_ipk_), allocatable, intent(inout) :: ia(:), ja(:) real(psb_dpk_), allocatable, intent(inout) :: val(:) integer(psb_ipk_), intent(in) :: nzin - logical, intent(in) :: append + logical, intent(in) :: append, chksz integer(psb_ipk_) :: info integer(psb_ipk_), optional :: iren(:) integer(psb_ipk_) :: nzin_, nza, idx,i,j,k, nzt, irw, lrw @@ -2146,11 +2151,12 @@ contains nz = 0 - call psb_ensure_size(nzin_+nzt,ia,info) - if (info == psb_success_) call psb_ensure_size(nzin_+nzt,ja,info) - if (info == psb_success_) call psb_ensure_size(nzin_+nzt,val,info) - - if (info /= psb_success_) return + if (chksz) then + call psb_ensure_size(nzin_+nzt,ia,info) + if (info == psb_success_) call psb_ensure_size(nzin_+nzt,ja,info) + if (info == psb_success_) call psb_ensure_size(nzin_+nzt,val,info) + if (info /= psb_success_) return + end if if (present(iren)) then do i=irw, lrw diff --git a/test/serial/psb_d_xyz_mat_mod.f90 b/test/serial/psb_d_xyz_mat_mod.f90 index 08717b8b..245623d3 100644 --- a/test/serial/psb_d_xyz_mat_mod.f90 +++ b/test/serial/psb_d_xyz_mat_mod.f90 @@ -59,6 +59,7 @@ module psb_d_xyz_mat_mod real(psb_dpk_), allocatable :: val(:) contains + procedure, pass(a) :: is_by_rows => d_xyz_is_by_rows procedure, pass(a) :: get_size => d_xyz_get_size procedure, pass(a) :: get_nzeros => d_xyz_get_nzeros procedure, nopass :: get_fmt => d_xyz_get_fmt @@ -313,7 +314,7 @@ module psb_d_xyz_mat_mod !! \see psb_d_base_mat_mod::psb_d_base_csgetrow interface subroutine psb_d_xyz_csgetrow(imin,imax,a,nz,ia,ja,val,info,& - & jmin,jmax,iren,append,nzin,rscale,cscale) + & jmin,jmax,iren,append,nzin,rscale,cscale,chksz) import :: psb_ipk_, psb_d_xyz_sparse_mat, psb_dpk_ class(psb_d_xyz_sparse_mat), intent(in) :: a integer(psb_ipk_), intent(in) :: imin,imax @@ -324,7 +325,7 @@ module psb_d_xyz_mat_mod logical, intent(in), optional :: append integer(psb_ipk_), intent(in), optional :: iren(:) integer(psb_ipk_), intent(in), optional :: jmin,jmax, nzin - logical, intent(in), optional :: rscale,cscale + logical, intent(in), optional :: rscale,cscale,chksz end subroutine psb_d_xyz_csgetrow end interface @@ -518,6 +519,15 @@ contains ! == =================================== + function d_xyz_is_by_rows(a) result(res) + implicit none + class(psb_d_xyz_sparse_mat), intent(in) :: a + logical :: res + res = .true. + + end function d_xyz_is_by_rows + + function d_xyz_sizeof(a) result(res) implicit none class(psb_d_xyz_sparse_mat), intent(in) :: a diff --git a/test/torture/Makefile b/test/torture/Makefile index 2b4e7788..8a98657e 100644 --- a/test/torture/Makefile +++ b/test/torture/Makefile @@ -1,8 +1,8 @@ -BASEDIR=../.. -INCDIR=$(BASEDIR)/include/ +INSTALLDIR=../.. +INCDIR=$(INSTALLDIR)/include/ MODDIR=$(INSTALLDIR)/modules/ include $(INCDIR)/Make.inc.psblas -LIBDIR=$(BASEDIR)/lib/ +LIBDIR=$(INSTALLDIR)/lib/ PSBLAS_LIB= -L$(LIBDIR) -lpsb_util -lpsb_krylov -lpsb_prec -lpsb_base LDLIBS=$(PSBLDLIBS) CCOPT= -g @@ -14,7 +14,11 @@ PSBTOBJS=psbtf.o psb_mvsv_tester.o \ EXEDIR=./runs -all: psbtf +all: runsd psbtf + +runsd: + (if test ! -d runs ; then mkdir runs; fi) + psbtf.o: psb_mvsv_tester.o psb_mvsv_tester.o: psb_s_mvsv_tester.o psb_d_mvsv_tester.o psb_c_mvsv_tester.o \ psb_z_mvsv_tester.o diff --git a/test/util/Makefile b/test/util/Makefile index 37fb3da6..404170fb 100644 --- a/test/util/Makefile +++ b/test/util/Makefile @@ -1,11 +1,11 @@ -BASEDIR=../.. -INCDIR=$(BASEDIR)/include/ +INSTALLDIR=../.. +INCDIR=$(INSTALLDIR)/include/ MODDIR=$(INSTALLDIR)/modules/ include $(INCDIR)/Make.inc.psblas # # Libraries used # -LIBDIR=$(BASEDIR)/lib/ +LIBDIR=$(INSTALLDIR)/lib/ PSBLAS_LIB= -L$(LIBDIR) -lpsb_util -lpsb_krylov -lpsb_prec -lpsb_base LDLIBS=$(PSBLDLIBS)