From 026ddad716bc436867a09bf8b7bcbf72809aa242 Mon Sep 17 00:00:00 2001 From: Michele Martone Date: Tue, 30 Nov 2010 17:27:13 +0000 Subject: [PATCH] psblas3: initializing the rsb library in the rsb module. initializing a string used uninitialized in ppde.f90. --- opt/psb_d_rsb_mat_mod.F03 | 24 ++++++++++++++++++++---- test/newfmt/ppde.f90 | 15 +++++++++++++++ test/newfmt/runs/ppde.inp | 2 +- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/opt/psb_d_rsb_mat_mod.F03 b/opt/psb_d_rsb_mat_mod.F03 index 5d8970fb..9450b776 100644 --- a/opt/psb_d_rsb_mat_mod.F03 +++ b/opt/psb_d_rsb_mat_mod.F03 @@ -7,6 +7,7 @@ ! * should test and fix all the problems that for sure will occur ! * duplicate handling is not defined ! * the printing function is not complete +! * should substitute -1 with another valid PSBLAS error code ! * .. ! module psb_d_rsb_mat_mod @@ -86,7 +87,7 @@ module psb_d_rsb_mat_mod #ifdef HAVE_LIBRSB contains - function psv_rsb_mat_init() result(res) + function psb_rsb_matmod_init() result(res) implicit none integer :: res !PSBRSB_DEBUG('') @@ -94,13 +95,28 @@ module psb_d_rsb_mat_mod #ifdef HAVE_LIBRSB res=d_rsb_to_psb_info(rsb_init(c_null_ptr)) #endif - end function psv_rsb_mat_init + end function psb_rsb_matmod_init + + function psb_rsb_matmod_exit() result(res) + implicit none + integer :: res + !PSBRSB_DEBUG('') + res=-1 ! FIXME +#ifdef HAVE_LIBRSB + res=d_rsb_to_psb_info(rsb_exit()) +#endif + end function psb_rsb_matmod_exit function d_rsb_to_psb_info(info) result(res) implicit none - integer :: res,info + integer , intent(in) :: info + integer :: res !PSBRSB_DEBUG('') - res=info + if(info.ne.0)then + res=-1 + else + res=psb_success_ + end if end function d_rsb_to_psb_info function d_rsb_get_flags(a) result(flags) diff --git a/test/newfmt/ppde.f90 b/test/newfmt/ppde.f90 index 1f6902ea..e1d72941 100644 --- a/test/newfmt/ppde.f90 +++ b/test/newfmt/ppde.f90 @@ -104,6 +104,12 @@ program ppde call psb_init(ictxt) call psb_info(ictxt,iam,np) + info=psb_rsb_matmod_init() + if(info.ne.psb_success_)then + info=psb_err_from_subroutine_ + ch_err='create_matrix: rsb module initialization failed' + call psb_errpush(info,name,a_err=ch_err) + endif if (iam < 0) then ! This should not happen, but just in case @@ -133,6 +139,7 @@ program ppde goto 9999 end if + fname=''! added by martone call a%cscnv(bm,info,type='CSR') write(fname,'(a,i2.2,a,i2.2,a)') 'mat',iam,'-',np,'.mtx' call bm%print(fname,head='%Test sparse gen RSB') @@ -219,6 +226,14 @@ program ppde if(info /= psb_success_) then call psb_error(ictxt) end if + + info=psb_rsb_matmod_exit() + if(info.ne.psb_success_)then + info=psb_err_from_subroutine_ + ch_err='create_matrix: rsb module finalization failed' + call psb_errpush(info,name,a_err=ch_err) + endif + call psb_exit(ictxt) stop diff --git a/test/newfmt/runs/ppde.inp b/test/newfmt/runs/ppde.inp index e6c56a70..992704d5 100644 --- a/test/newfmt/runs/ppde.inp +++ b/test/newfmt/runs/ppde.inp @@ -2,7 +2,7 @@ BICGSTAB Iterative method BICGSTAB CGS BICG BICGSTABL RGMRES BJAC Preconditioner NONE DIAG BJAC CSR Storage format for matrix A: CSR COO JAD -004 Domain size (acutal system is this**3) +040 Domain size (acutal system is this**3) 2 Stopping criterion 0100 MAXIT -1 ITRACE