Compare commits

...
65 Commits
Author SHA1 Message Date
Salvatore Filippone ac42d7b1dd Sync configure with configure_n 2022-04-14 20:33:02 +02:00
Salvatore Filippone 697f325df6 Fix use of SuperLU_Dist, configure checks and ifdefs 2022-04-13 16:36:32 +02:00
Salvatore Filippone 58d00b16c6 Add message to configure 2022-04-07 10:36:28 +02:00
Salvatore Filippone 425743939c Fix for new SuperLU_Dist version, change configure 2022-04-06 11:02:32 +02:00
Salvatore Filippone 7e48a0a742 Fix defines for SLUD v7 2022-04-06 09:02:20 +02:00
Salvatore Filippone 4f9254ebb0 Add log entry for configure check on MPICXX libs 2022-03-18 18:31:42 +01:00
Salvatore Filippone 90657b706f Fix Makefile: mld -> amg 2022-03-15 11:00:52 +01:00
Salvatore Filippone 23a39a6c54 Fix configry redirect check to dev/null 2022-03-15 11:00:22 +01:00
Salvatore Filippone 873f190961 Configry checks for OpenMPI cxx libs 2022-03-15 10:25:58 +01:00
Salvatore Filippone 87cdd76f8d Fix spurious error notification with prec%descr 2022-02-07 10:41:45 +01:00
Salvatore Filippone 45fabb5214 Move reading aggregation ratio above filtering option. 2021-10-25 14:46:43 +02:00
Salvatore Filippone a9182021bb Sample programs adapted for position of ATHRES in control files. 2021-10-25 14:13:25 +02:00
Salvatore Filippone a8f4009cb1 Take out spurious csize and maxnlev from parmatch aggregator object. 2021-10-22 09:39:18 -04:00
Salvatore Filippone 794080e386 Fix target coarse size handling. 2021-10-22 08:14:26 -04:00
Salvatore Filippone 818f7a78a0 Do not call %default on setting coarse_solve 2021-10-18 14:47:28 +02:00
Salvatore Filippone 939d7c9a89 Do not invoke default() after setting KRM for coarse solver. 2021-10-16 08:37:25 +02:00
Salvatore Filippone 92f7cde375 Make test program to dump preconditioner controlled from input file. 2021-09-27 10:38:49 -04:00
Salvatore Filippone af178daa84 Modify dump method to print base level matrix. 2021-09-27 14:50:46 +02:00
Salvatore Filippone 49777a379b Cosmetic change in sample source code 2021-09-27 14:22:34 +02:00
Salvatore Filippone 5768238f66 Typographical fixes. 2021-09-22 05:02:12 -04:00
Salvatore Filippone 4c4b2b282e Merge branch 'development' of github.com:sfilippone/amg4psblas into development 2021-09-22 04:59:54 -04:00
Salvatore Filippone 9d11a99ed4 Fix settings in samples/PDEGEN 2021-09-22 04:58:26 -04:00
Salvatore Filippone 9bc8b540b3 Fix settings in samples/PDEGEN 2021-08-27 11:42:01 +02:00
Salvatore Filippone af75364c54 Fix matchbox internal interface names. 2021-07-16 09:16:54 +02:00
Salvatore Filippone 1270498170 Fix examples 2021-07-16 09:16:44 +02:00
Salvatore Filippone b387308455 Merge branch 'maint-1.0' into development 2021-07-15 12:09:54 +02:00
Salvatore Filippone aba9b29717 Fix samples/simple internal and external docs. 2021-07-15 11:59:34 +02:00
Salvatore Filippone 94ca610bff Do not print matching statistics 2021-06-28 18:47:35 +02:00
Salvatore Filippone 2542c0fda4 Do not print matching statistics 2021-06-28 18:42:56 +02:00
Salvatore Filippone 8482067b52 Deactivate MINNRG 2021-06-28 18:42:34 +02:00
Salvatore Filippone 7319dab30f Deactivate MINNRG 2021-06-21 21:44:09 +02:00
Salvatore Filippone 4bbba3ebd7 Fix interface inconsistencies 2021-06-21 21:38:14 +02:00
Salvatore Filippone 988021ff24 Fix uninitialized warning 2021-06-15 03:33:13 -04:00
Salvatore Filippone 4e177ce926 Merge branch 'development' of github.com:sfilippone/amg4psblas into development 2021-06-14 12:27:38 -04:00
Salvatore Filippone 1fa94d0372 Fix AS%FREE() 2021-06-14 12:26:04 -04:00
Cirdans-Home 0fcbdd74cd Fixed typo 2021-06-08 17:50:21 +02:00
Cirdans-Home ba854379e4 Fixed typo 2021-06-08 17:48:19 +02:00
pasquadambra a6cbd64e65 update 2021-06-08 17:18:02 +02:00
Cirdans-Home 5c589dbf30 Fixed TeX typos and href for issues 2021-06-08 16:15:32 +02:00
pasquadambra 10e9c53e54 updating examples/gpu and doc 2021-06-08 15:15:44 +02:00
Salvatore Filippone 0332920a63 Merge branch 'development' into maint-1.0 2021-05-13 11:39:02 +02:00
Salvatore Filippone 9b9dfbd198 Fix copyright 2021-05-13 11:38:53 +02:00
Salvatore Filippone 5909e541b0 Merge branch 'development' into maint-1.0 2021-05-13 11:36:43 +02:00
Salvatore Filippone 941ca6568a Fix docs for new samples 2021-05-13 11:36:28 +02:00
Salvatore Filippone 39a9c4e4ed Fix copyright 2021-05-12 21:34:59 +02:00
Salvatore Filippone 41b4373494 Merge branch 'development' into maint-1.0 2021-05-12 21:30:11 +02:00
Salvatore Filippone 4bf009a1ab Fix docs for samples 2021-05-12 21:29:36 +02:00
Salvatore Filippone e3d14dfb9e Merge branch 'development' into maint-1.0 2021-05-11 09:51:23 +02:00
Salvatore Filippone 734724e407 Update docs for release 2021-05-11 09:50:41 +02:00
Salvatore Filippone a3a1dc52c5 Merge branch 'master' into maint-1.0 2021-05-07 13:18:02 +02:00
Salvatore Filippone 6dddaaa77b Fixes for samples install 2021-05-07 13:12:23 +02:00
Salvatore Filippone 12fc3ddc3d Merge branch 'master' into maint-1.0 2021-05-07 09:07:26 +02:00
Salvatore Filippone 555d7433b7 Redefine interface of prec%descr to get INFO 2021-05-06 19:17:19 +02:00
Salvatore Filippone b060787911 Merge branch 'master' into maint-1.0 2021-05-05 17:39:52 +02:00
Cirdans-Home 50951ef636 Fixed set of coarse matrix for BJAC 2021-05-05 17:37:45 +02:00
Salvatore Filippone e1e1da18c6 Merge branch 'development' into maint-1.0 2021-05-05 13:27:15 +02:00
Cirdans-Home 47eba23460 Added error check and defaults 2021-05-05 10:04:43 +02:00
Salvatore Filippone f65e1ddaa1 Merge branch 'development' into maint-1.0 2021-05-04 18:59:45 +02:00
Salvatore Filippone 02b46a0f85 Delete obsolete files 2021-05-04 18:58:33 +02:00
Salvatore Filippone 636600f1c7 Merge branch 'master' into maint-1.0 2021-05-03 17:01:59 +02:00
Salvatore Filippone 09c72e8eed Merge branch 'development' into maint-1.0 2021-04-23 09:00:57 +02:00
Salvatore Filippone 257bf46e3b Merge branch 'master' into maint-1.0 2021-04-22 13:45:38 +02:00
Salvatore Filippone c23c4e2729 erge branch 'master' into maint-1.0 2021-04-15 09:09:11 -04:00
Salvatore Filippone 27fafcd579 Merge branch 'master' into maint-1.0 2021-04-14 08:37:15 +02:00
Salvatore Filippone 75d09c6349 Delete spurious test dirs 2021-04-13 09:29:15 +02:00
211 changed files with 5596 additions and 9073 deletions
+8 -8
View File
@@ -3,7 +3,7 @@ include Make.inc
all: library
library: libdir amgp
library: libdir amgp cbnd
#cbnd
libdir:
@@ -33,8 +33,8 @@ install: all
mkdir -p $(INSTALL_SAMPLESDIR) && \
mkdir -p $(INSTALL_SAMPLESDIR)/simple &&\
mkdir -p $(INSTALL_SAMPLESDIR)/advanced && \
(cd examples; /bin/cp -fr pdegen fileread $(INSTALL_SAMPLESDIR)/simple ) && \
(cd tests; /bin/cp -fr pdegen fileread $(INSTALL_SAMPLESDIR)/advanced )
(cd samples/simple; /bin/cp -fr pdegen fileread $(INSTALL_SAMPLESDIR)/simple ) && \
(cd samples/advanced; /bin/cp -fr pdegen fileread $(INSTALL_SAMPLESDIR)/advanced )
cleanlib:
(cd lib; /bin/rm -f *.a *$(.mod) *$(.fh))
(cd include; /bin/rm -f *.a *$(.mod) *$(.fh))
@@ -42,13 +42,13 @@ cleanlib:
veryclean: cleanlib
(cd amgprec; make veryclean)
(cd examples/fileread; make clean)
(cd examples/pdegen; make clean)
(cd tests/fileread; make clean)
(cd tests/pdegen; make clean)
(cd samples/simple/fileread; make clean)
(cd samples/simple/pdegen; make clean)
(cd samples/advanced/fileread; make clean)
(cd samples/advanced/pdegen; make clean)
check: all
make check -C tests/pdegen
make check -C samples/advanced/pdegen
clean:
(cd amgprec; make clean)
+33
View File
@@ -136,6 +136,8 @@ module amg_base_prec_type
integer(psb_lpk_) :: target_coarse_size
! 2. maximum number of levels. Defaults to 20
integer(psb_ipk_) :: max_levs = 20_psb_ipk_
contains
procedure, pass(ag) :: default => i_ag_default
end type amg_iaggr_data
type, extends(amg_iaggr_data) :: amg_saggr_data
@@ -143,6 +145,8 @@ module amg_base_prec_type
real(psb_spk_) :: min_cr_ratio = 1.5_psb_spk_
real(psb_spk_) :: op_complexity = szero
real(psb_spk_) :: avg_cr = szero
contains
procedure, pass(ag) :: default => s_ag_default
end type amg_saggr_data
type, extends(amg_iaggr_data) :: amg_daggr_data
@@ -150,6 +154,8 @@ module amg_base_prec_type
real(psb_dpk_) :: min_cr_ratio = 1.5_psb_dpk_
real(psb_dpk_) :: op_complexity = dzero
real(psb_dpk_) :: avg_cr = dzero
contains
procedure, pass(ag) :: default => d_ag_default
end type amg_daggr_data
@@ -1240,4 +1246,31 @@ contains
& (parms1%aggr_thresh == parms2%aggr_thresh )
end function amg_d_equal_aggregation
subroutine i_ag_default(ag)
class(amg_iaggr_data), intent(inout) :: ag
ag%min_coarse_size = -ione
ag%min_coarse_size_per_process = -ione
ag%max_levs = 20_psb_ipk_
end subroutine i_ag_default
subroutine s_ag_default(ag)
class(amg_saggr_data), intent(inout) :: ag
call ag%amg_iaggr_data%default()
ag%min_cr_ratio = 1.5_psb_spk_
ag%op_complexity = szero
ag%avg_cr = szero
end subroutine s_ag_default
subroutine d_ag_default(ag)
class(amg_daggr_data), intent(inout) :: ag
call ag%amg_iaggr_data%default()
ag%min_cr_ratio = 1.5_psb_dpk_
ag%op_complexity = dzero
ag%avg_cr = dzero
end subroutine d_ag_default
end module amg_base_prec_type
+2 -2
View File
@@ -126,7 +126,7 @@ module amg_c_base_aggregator_mod
& psb_c_coo_sparse_mat, amg_sml_parms, psb_spk_, psb_ipk_, psb_lpk_
implicit none
type(psb_c_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_c_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
@@ -144,7 +144,7 @@ module amg_c_base_aggregator_mod
& psb_c_coo_sparse_mat, amg_sml_parms, psb_spk_, psb_ipk_, psb_lpk_
implicit none
type(psb_c_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_c_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
+2 -1
View File
@@ -155,11 +155,12 @@ module amg_c_prec_type
interface amg_precdescr
subroutine amg_cfile_prec_descr(prec,iout,root,verbosity)
subroutine amg_cfile_prec_descr(prec,info,iout,root,verbosity)
import :: amg_cprec_type, psb_ipk_
implicit none
! Arguments
class(amg_cprec_type), intent(in) :: prec
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: iout
integer(psb_ipk_), intent(in), optional :: root
integer(psb_ipk_), intent(in), optional :: verbosity
+2 -2
View File
@@ -126,7 +126,7 @@ module amg_d_base_aggregator_mod
& psb_d_coo_sparse_mat, amg_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_
implicit none
type(psb_d_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_d_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
@@ -144,7 +144,7 @@ module amg_d_base_aggregator_mod
& psb_d_coo_sparse_mat, amg_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_
implicit none
type(psb_d_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_d_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
+28 -328
View File
@@ -68,7 +68,7 @@
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
module dmatchboxp_mod
module amg_d_matchboxp_mod
use iso_c_binding
use psb_base_cbind_mod
@@ -94,33 +94,25 @@ module dmatchboxp_mod
end subroutine dMatchBoxPC
end interface MatchBoxPC
interface i_aggr_assign
module procedure i_daggr_assign
end interface i_aggr_assign
interface amg_i_aggr_assign
module procedure amg_i_d_aggr_assign
end interface amg_i_aggr_assign
interface build_matching
module procedure dbuild_matching
end interface build_matching
interface amg_par_build_matching
module procedure amg_d_par_build_matching
end interface amg_par_build_matching
interface build_ahat
module procedure dbuild_ahat
end interface build_ahat
interface amg_par_build_ahat
module procedure amg_d_par_build_ahat
end interface amg_par_build_ahat
interface psb_gtranspose
module procedure psb_dgtranspose
end interface psb_gtranspose
interface psb_htranspose
module procedure psb_dhtranspose
end interface psb_htranspose
interface PMatchBox
module procedure dPMatchBox
end interface PMatchBox
interface amg_PMatchBox
module procedure amg_d_PMatchBox
end interface amg_PMatchBox
contains
subroutine dmatchboxp_build_prol(w,a,desc_a,ilaggr,nlaggr,prol,info,&
subroutine amg_d_matchboxp_build_prol(w,a,desc_a,ilaggr,nlaggr,prol,info,&
& symmetrize,reproducible,display_inp, display_out, print_out)
use psb_base_mod
use psb_util_mod
@@ -213,7 +205,7 @@ contains
end if
if (do_timings) call psb_toc(idx_phase1)
if (do_timings) call psb_tic(idx_bldmtc)
call build_matching(w,a,desc_a,mate,info,display_inp=display_inp,symmetrize=symmetrize)
call amg_par_build_matching(w,a,desc_a,mate,info,display_inp=display_inp,symmetrize=symmetrize)
if (do_timings) call psb_toc(idx_bldmtc)
if (debug) write(0,*) iam,' buildprol from buildmatching:',&
& info
@@ -311,7 +303,7 @@ contains
! Should be a symmetric function.
!
call desc_a%indxmap%qry_halo_owner(idx,iown,info)
ip = i_aggr_assign(iam, iown, kg, idxg, wk, widx, nrmagg)
ip = amg_i_aggr_assign(iam, iown, kg, idxg, wk, widx, nrmagg)
if (iam == ip) then
nlaggr(iam) = nlaggr(iam) + 1
ilaggr(k) = nlaggr(iam)
@@ -513,9 +505,9 @@ contains
write(0,*) iam,' : error from Matching: ',info
end if
end subroutine dmatchboxp_build_prol
end subroutine amg_d_matchboxp_build_prol
function i_daggr_assign(iam, iown, kg, idxg, wk, widx, nrmagg) &
function amg_i_d_aggr_assign(iam, iown, kg, idxg, wk, widx, nrmagg) &
& result(iproc)
!
! How to break ties? This
@@ -557,10 +549,10 @@ contains
iproc = iown
end if
end if
end function i_daggr_assign
end function amg_i_d_aggr_assign
subroutine dbuild_matching(w,a,desc_a,mate,info,display_inp, symmetrize)
subroutine amg_d_par_build_matching(w,a,desc_a,mate,info,display_inp, symmetrize)
use psb_base_mod
use psb_util_mod
use iso_c_binding
@@ -609,7 +601,7 @@ contains
if (iam == 0) write(0,*)' Into build_ahat:'
end if
if (do_timings) call psb_tic(idx_bldahat)
call build_ahat(w,a,ahatnd,desc_a,info,symmetrize=symmetrize)
call amg_par_build_ahat(w,a,ahatnd,desc_a,info,symmetrize=symmetrize)
if (do_timings) call psb_toc(idx_bldahat)
if (info /= 0) then
write(0,*) 'Error from build_ahat ', info
@@ -700,7 +692,7 @@ contains
!
if (debug) write(0,*) iam,' buildmatching into PMatchBox:'
if (do_timings) call psb_tic(idx_cmboxp)
call PMatchBox(nr,nz,vlptr,vlind,ewght,&
call amg_PMatchBox(nr,nz,vlptr,vlind,ewght,&
& vnl, mate, iam, np,ictxt,&
& msgis,msgas,msgprc,ph0t,ph1t,ph2t,ph1crd,ph2crd,info,display_inp)
if (do_timings) call psb_toc(idx_cmboxp)
@@ -764,9 +756,9 @@ contains
val(1:n) = tmp(1:n)
end subroutine fix_order
end subroutine dbuild_matching
end subroutine amg_d_par_build_matching
subroutine dbuild_ahat(w,a,ahat,desc_a,info,symmetrize)
subroutine amg_d_par_build_ahat(w,a,ahat,desc_a,info,symmetrize)
use psb_base_mod
implicit none
real(psb_dpk_), intent(in) :: w(:)
@@ -1002,301 +994,9 @@ contains
end block
end if
end subroutine dbuild_ahat
end subroutine amg_d_par_build_ahat
subroutine psb_dgtranspose(ain,aout,desc_a,info)
use psb_base_mod
implicit none
type(psb_ldspmat_type), intent(in) :: ain
type(psb_ldspmat_type), intent(out) :: aout
type(psb_desc_type) :: desc_a
integer(psb_ipk_), intent(out) :: info
!
! BEWARE: This routine works under the assumption
! that the same DESC_A works for both A and A^T, which
! essentially means that A has a symmetric pattern.
!
type(psb_ldspmat_type) :: atmp, ahalo, aglb
type(psb_ld_coo_sparse_mat) :: tmpcoo
type(psb_ld_csr_sparse_mat) :: tmpcsr
type(psb_ctxt_type) :: ictxt
integer(psb_ipk_) :: me, np
integer(psb_lpk_) :: i, j, k, nrow, ncol
integer(psb_lpk_), allocatable :: ilv(:)
character(len=80) :: aname
logical, parameter :: debug=.false., dump=.false., debug_sync=.false.
ictxt = desc_a%get_context()
call psb_info(ictxt,me,np)
nrow = desc_a%get_local_rows()
ncol = desc_a%get_local_cols()
if (debug_sync) then
call psb_barrier(ictxt)
if (me == 0) write(0,*) 'Start gtranspose '
end if
call ain%cscnv(tmpcsr,info)
if (debug) then
ilv = [(i,i=1,ncol)]
call desc_a%l2gip(ilv,info,owned=.false.)
write(aname,'(a,i3.3,a)') 'atmp-preh-',me,'.mtx'
call ain%print(fname=aname,head='atmp before haloTest ',iv=ilv)
end if
if (dump) then
call ain%cscnv(atmp,info)
call psb_gather(aglb,atmp,desc_a,info)
if (me==psb_root_) then
write(aname,'(a,i3.3,a)') 'aglob-prehalo.mtx'
call aglb%print(fname=aname,head='Test ')
end if
end if
!call psb_loc_to_glob(tmpcsr%ja,desc_a,info)
call atmp%mv_from(tmpcsr)
if (debug) then
write(aname,'(a,i3.3,a)') 'tmpcsr-',me,'.mtx'
call atmp%print(fname=aname,head='tmpcsr ',iv=ilv)
!call psb_set_debug_level(9999)
end if
! FIXME THIS NEEDS REWORKING
if (debug) write(0,*) me,' Gtranspose into sphalo :',atmp%get_nrows(),atmp%get_ncols()
call psb_sphalo(atmp,desc_a,ahalo,info,rowscale=.true.)
if (debug) write(0,*) me,' Gtranspose from sphalo :',ahalo%get_nrows(),ahalo%get_ncols()
if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=ahalo)
if (debug) then
write(aname,'(a,i3.3,a)') 'ahalo-',me,'.mtx'
call ahalo%print(fname=aname,head='ahalo after haloTest ',iv=ilv)
write(aname,'(a,i3.3,a)') 'atmp-h-',me,'.mtx'
call atmp%print(fname=aname,head='atmp after haloTest ',iv=ilv)
end if
if (info == psb_success_) call ahalo%free()
call atmp%cp_to(tmpcoo)
call tmpcoo%transp()
!call psb_glob_to_loc(tmpcoo%ia,desc_a,info,iact='I')
if (debug) write(0,*) 'Before cleanup:',tmpcoo%get_nzeros()
j = 0
do k=1, tmpcoo%get_nzeros()
if ((tmpcoo%ia(k) > 0).and.(tmpcoo%ja(k)>0)) then
j = j+1
tmpcoo%ia(j) = tmpcoo%ia(k)
tmpcoo%ja(j) = tmpcoo%ja(k)
tmpcoo%val(j) = tmpcoo%val(k)
end if
end do
call tmpcoo%set_nzeros(j)
if (debug) write(0,*) 'After cleanup:',tmpcoo%get_nzeros()
call ahalo%mv_from(tmpcoo)
if (dump) then
call psb_gather(aglb,ahalo,desc_a,info)
if (me==psb_root_) then
write(aname,'(a,i3.3,a)') 'atran-preclip.mtx'
call aglb%print(fname=aname,head='Test ')
end if
end if
call ahalo%csclip(aout,info,imax=nrow)
if (debug) write(0,*) 'After clip:',aout%get_nzeros()
if (debug_sync) then
call psb_barrier(ictxt)
if (me == 0) write(0,*) 'End gtranspose '
end if
!call aout%cscnv(info,type='csr')
if (dump) then
write(aname,'(a,i3.3,a)') 'atran-',me,'.mtx'
call aout%print(fname=aname,head='atrans ',iv=ilv)
call psb_gather(aglb,aout,desc_a,info)
if (me==psb_root_) then
write(aname,'(a,i3.3,a)') 'atran.mtx'
call aglb%print(fname=aname,head='Test ')
end if
end if
end subroutine psb_dgtranspose
subroutine psb_dhtranspose(ain,aout,desc_a,info)
use psb_base_mod
implicit none
type(psb_ldspmat_type), intent(in) :: ain
type(psb_ldspmat_type), intent(out) :: aout
type(psb_desc_type) :: desc_a
integer(psb_ipk_), intent(out) :: info
!
! BEWARE: This routine works under the assumption
! that the same DESC_A works for both A and A^T, which
! essentially means that A has a symmetric pattern.
!
type(psb_ldspmat_type) :: atmp, ahalo, aglb
type(psb_ld_coo_sparse_mat) :: tmpcoo, tmpc1, tmpc2, tmpch
type(psb_ld_csr_sparse_mat) :: tmpcsr
integer(psb_ipk_) :: nz1, nz2, nzh, nz
type(psb_ctxt_type) :: ictxt
integer(psb_ipk_) :: me, np
integer(psb_lpk_) :: i, j, k, nrow, ncol, nlz
integer(psb_lpk_), allocatable :: ilv(:)
character(len=80) :: aname
logical, parameter :: debug=.false., dump=.false., debug_sync=.false.
ictxt = desc_a%get_context()
call psb_info(ictxt,me,np)
nrow = desc_a%get_local_rows()
ncol = desc_a%get_local_cols()
if (debug_sync) then
call psb_barrier(ictxt)
if (me == 0) write(0,*) 'Start htranspose '
end if
call ain%cscnv(tmpcsr,info)
if (debug) then
ilv = [(i,i=1,ncol)]
call desc_a%l2gip(ilv,info,owned=.false.)
write(aname,'(a,i3.3,a)') 'atmp-preh-',me,'.mtx'
call ain%print(fname=aname,head='atmp before haloTest ',iv=ilv)
end if
if (dump) then
call ain%cscnv(atmp,info)
call psb_gather(aglb,atmp,desc_a,info)
if (me==psb_root_) then
write(aname,'(a,i3.3,a)') 'aglob-prehalo.mtx'
call aglb%print(fname=aname,head='Test ')
end if
end if
!call psb_loc_to_glob(tmpcsr%ja,desc_a,info)
call atmp%mv_from(tmpcsr)
if (debug) then
write(aname,'(a,i3.3,a)') 'tmpcsr-',me,'.mtx'
call atmp%print(fname=aname,head='tmpcsr ',iv=ilv)
!call psb_set_debug_level(9999)
end if
! FIXME THIS NEEDS REWORKING
if (debug) write(0,*) me,' Htranspose into sphalo :',atmp%get_nrows(),atmp%get_ncols()
if (.true.) then
call psb_sphalo(atmp,desc_a,ahalo,info, outfmt='coo ')
call atmp%mv_to(tmpc1)
call ahalo%mv_to(tmpch)
nz1 = tmpc1%get_nzeros()
call psb_loc_to_glob(tmpc1%ia(1:nz1),desc_a,info,iact='I')
call psb_loc_to_glob(tmpc1%ja(1:nz1),desc_a,info,iact='I')
nzh = tmpch%get_nzeros()
call psb_loc_to_glob(tmpch%ia(1:nzh),desc_a,info,iact='I')
call psb_loc_to_glob(tmpch%ja(1:nzh),desc_a,info,iact='I')
nlz = nz1+nzh
call tmpcoo%allocate(ncol,ncol,nlz)
tmpcoo%ia(1:nz1) = tmpc1%ia(1:nz1)
tmpcoo%ja(1:nz1) = tmpc1%ja(1:nz1)
tmpcoo%val(1:nz1) = tmpc1%val(1:nz1)
tmpcoo%ia(nz1+1:nz1+nzh) = tmpch%ia(1:nzh)
tmpcoo%ja(nz1+1:nz1+nzh) = tmpch%ja(1:nzh)
tmpcoo%val(nz1+1:nz1+nzh) = tmpch%val(1:nzh)
call tmpcoo%set_nzeros(nlz)
call tmpcoo%transp()
nz = tmpcoo%get_nzeros()
call psb_glob_to_loc(tmpcoo%ia(1:nz),desc_a,info,iact='I')
call psb_glob_to_loc(tmpcoo%ja(1:nz),desc_a,info,iact='I')
if (.true.) then
call tmpcoo%clean_negidx(info)
else
j = 0
do k=1, tmpcoo%get_nzeros()
if ((tmpcoo%ia(k) > 0).and.(tmpcoo%ja(k)>0)) then
j = j+1
tmpcoo%ia(j) = tmpcoo%ia(k)
tmpcoo%ja(j) = tmpcoo%ja(k)
tmpcoo%val(j) = tmpcoo%val(k)
end if
end do
call tmpcoo%set_nzeros(j)
end if
call ahalo%mv_from(tmpcoo)
call ahalo%csclip(aout,info,imax=nrow)
else
call psb_sphalo(atmp,desc_a,ahalo,info, rowscale=.true.)
if (debug) write(0,*) me,' Htranspose from sphalo :',ahalo%get_nrows(),ahalo%get_ncols()
if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=ahalo)
if (debug) then
write(aname,'(a,i3.3,a)') 'ahalo-',me,'.mtx'
call ahalo%print(fname=aname,head='ahalo after haloTest ',iv=ilv)
write(aname,'(a,i3.3,a)') 'atmp-h-',me,'.mtx'
call atmp%print(fname=aname,head='atmp after haloTest ',iv=ilv)
end if
if (info == psb_success_) call ahalo%free()
call atmp%cp_to(tmpcoo)
call tmpcoo%transp()
if (debug) write(0,*) 'Before cleanup:',tmpcoo%get_nzeros()
if (.true.) then
call tmpcoo%clean_negidx(info)
else
j = 0
do k=1, tmpcoo%get_nzeros()
if ((tmpcoo%ia(k) > 0).and.(tmpcoo%ja(k)>0)) then
j = j+1
tmpcoo%ia(j) = tmpcoo%ia(k)
tmpcoo%ja(j) = tmpcoo%ja(k)
tmpcoo%val(j) = tmpcoo%val(k)
end if
end do
call tmpcoo%set_nzeros(j)
end if
if (debug) write(0,*) 'After cleanup:',tmpcoo%get_nzeros()
call ahalo%mv_from(tmpcoo)
if (dump) then
call psb_gather(aglb,ahalo,desc_a,info)
if (me==psb_root_) then
write(aname,'(a,i3.3,a)') 'atran-preclip.mtx'
call aglb%print(fname=aname,head='Test ')
end if
end if
call ahalo%csclip(aout,info,imax=nrow)
end if
if (debug) write(0,*) 'After clip:',aout%get_nzeros()
if (debug_sync) then
call psb_barrier(ictxt)
if (me == 0) write(0,*) 'End htranspose '
end if
!call aout%cscnv(info,type='csr')
if (dump) then
write(aname,'(a,i3.3,a)') 'atran-',me,'.mtx'
call aout%print(fname=aname,head='atrans ',iv=ilv)
call psb_gather(aglb,aout,desc_a,info)
if (me==psb_root_) then
write(aname,'(a,i3.3,a)') 'atran.mtx'
call aglb%print(fname=aname,head='Test ')
end if
end if
end subroutine psb_dhtranspose
subroutine dPMatchBox(nlver,nledge,verlocptr,verlocind,edgelocweight,&
subroutine amg_d_PMatchBox(nlver,nledge,verlocptr,verlocind,edgelocweight,&
& verdistance, mate, myrank, numprocs, ictxt,&
& msgindsent,msgactualsent,msgpercent,&
& ph0_time, ph1_time, ph2_time, ph1_card, ph2_card,info,display_inp)
@@ -1431,6 +1131,6 @@ contains
end if
where(mate>=0) mate = mate + 1
end subroutine dPMatchBox
end subroutine amg_d_PMatchBox
end module dmatchboxp_mod
end module amg_d_matchboxp_mod
+51 -57
View File
@@ -118,7 +118,7 @@
module amg_d_parmatch_aggregator_mod
use amg_d_base_aggregator_mod
use dmatchboxp_mod
use amg_d_matchboxp_mod
#if defined(SERIAL_MPI)
type, extends(amg_d_base_aggregator_type) :: amg_d_parmatch_aggregator_type
end type amg_d_parmatch_aggregator_type
@@ -132,8 +132,6 @@ module amg_d_parmatch_aggregator_mod
type(psb_dspmat_type), allocatable :: prol, restr
type(psb_dspmat_type), allocatable :: ac, base_a, rwa
type(psb_desc_type), allocatable :: desc_ac, desc_ax, base_desc, rwdesc
integer(psb_ipk_) :: max_csize
integer(psb_ipk_) :: max_nlevels
logical :: reproducible_matching = .false.
logical :: need_symmetrize = .false.
logical :: unsmoothed_hierarchy = .true.
@@ -143,18 +141,18 @@ module amg_d_parmatch_aggregator_mod
procedure, pass(ag) :: mat_asb => amg_d_parmatch_aggregator_mat_asb
procedure, pass(ag) :: inner_mat_asb => amg_d_parmatch_aggregator_inner_mat_asb
procedure, pass(ag) :: bld_map => amg_d_parmatch_aggregator_bld_map
procedure, pass(ag) :: csetc => d_parmatch_aggr_csetc
procedure, pass(ag) :: cseti => d_parmatch_aggr_cseti
procedure, pass(ag) :: default => d_parmatch_aggr_set_default
procedure, pass(ag) :: sizeof => d_parmatch_aggregator_sizeof
procedure, pass(ag) :: update_next => d_parmatch_aggregator_update_next
procedure, pass(ag) :: bld_wnxt => d_parmatch_bld_wnxt
procedure, pass(ag) :: bld_default_w => d_bld_default_w
procedure, pass(ag) :: set_c_default_w => d_set_prm_c_default_w
procedure, pass(ag) :: descr => d_parmatch_aggregator_descr
procedure, pass(ag) :: clone => d_parmatch_aggregator_clone
procedure, pass(ag) :: free => d_parmatch_aggregator_free
procedure, nopass :: fmt => d_parmatch_aggregator_fmt
procedure, pass(ag) :: csetc => amg_d_parmatch_aggr_csetc
procedure, pass(ag) :: cseti => amg_d_parmatch_aggr_cseti
procedure, pass(ag) :: default => amg_d_parmatch_aggr_set_default
procedure, pass(ag) :: sizeof => amg_d_parmatch_aggregator_sizeof
procedure, pass(ag) :: update_next => amg_d_parmatch_aggregator_update_next
procedure, pass(ag) :: bld_wnxt => amg_d_parmatch_bld_wnxt
procedure, pass(ag) :: bld_default_w => amg_d_bld_default_w
procedure, pass(ag) :: set_c_default_w => amg_d_set_prm_c_default_w
procedure, pass(ag) :: descr => amg_d_parmatch_aggregator_descr
procedure, pass(ag) :: clone => amg_d_parmatch_aggregator_clone
procedure, pass(ag) :: free => amg_d_parmatch_aggregator_free
procedure, nopass :: fmt => amg_d_parmatch_aggregator_fmt
procedure, nopass :: xt_desc => amg_d_parmatch_aggregator_xt_desc
end type amg_d_parmatch_aggregator_type
@@ -168,7 +166,7 @@ module amg_d_parmatch_aggregator_mod
type(amg_dml_parms), intent(inout) :: parms
type(amg_daggr_data), intent(in) :: ag_data
type(psb_dspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_ldspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
@@ -235,7 +233,7 @@ module amg_d_parmatch_aggregator_mod
& psb_ldspmat_type, psb_dpk_, psb_ipk_, psb_lpk_, amg_dml_parms, amg_daggr_data
implicit none
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: t_prol
@@ -257,7 +255,7 @@ module amg_d_parmatch_aggregator_mod
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_dspmat_type), intent(out) :: op_prol,ac, op_restr
type(psb_dspmat_type), intent(inout) :: op_prol,ac, op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine amg_d_parmatch_unsmth_bld
@@ -275,7 +273,7 @@ module amg_d_parmatch_aggregator_mod
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_dspmat_type), intent(out) :: op_prol,ac, op_restr
type(psb_dspmat_type), intent(inout) :: op_prol,ac, op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine amg_d_parmatch_smth_bld
@@ -288,11 +286,11 @@ module amg_d_parmatch_aggregator_mod
& psb_ldspmat_type, psb_dpk_, psb_ipk_, psb_lpk_, amg_dml_parms, amg_daggr_data
implicit none
type(psb_dspmat_type), intent(inout) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_dspmat_type), intent(out) :: op_prol,ac, op_restr
type(psb_dspmat_type), intent(inout) :: op_prol,ac, op_restr
type(psb_desc_type), intent(out) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine amg_d_parmatch_spmm_bld_ov
@@ -306,11 +304,11 @@ module amg_d_parmatch_aggregator_mod
& psb_d_csr_sparse_mat, psb_ld_csr_sparse_mat
implicit none
type(psb_d_csr_sparse_mat), intent(inout) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_dspmat_type), intent(out) :: op_prol,ac, op_restr
type(psb_dspmat_type), intent(inout) :: op_prol,ac, op_restr
type(psb_desc_type), intent(out) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine amg_d_parmatch_spmm_bld_inner
@@ -320,7 +318,7 @@ module amg_d_parmatch_aggregator_mod
contains
subroutine d_bld_default_w(ag,nr)
subroutine amg_d_bld_default_w(ag,nr)
use psb_realloc_mod
implicit none
class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag
@@ -330,9 +328,9 @@ contains
if (info /= psb_success_) return
ag%w = done
!call ag%set_c_default_w()
end subroutine d_bld_default_w
end subroutine amg_d_bld_default_w
subroutine d_set_prm_c_default_w(ag)
subroutine amg_d_set_prm_c_default_w(ag)
use psb_realloc_mod
use iso_c_binding
implicit none
@@ -342,9 +340,9 @@ contains
!write(0,*) 'prm_c_deafult_w '
call psb_safe_ab_cpy(ag%w,ag%w_nxt,info)
end subroutine d_set_prm_c_default_w
end subroutine amg_d_set_prm_c_default_w
subroutine d_parmatch_bld_wnxt(ag,ilaggr,valaggr,nx)
subroutine amg_d_parmatch_bld_wnxt(ag,ilaggr,valaggr,nx)
use psb_realloc_mod
implicit none
class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag
@@ -358,14 +356,14 @@ contains
!write(0,*) 'Executing bld_wnxt ',nx
call psb_realloc(nx,ag%w_nxt,info)
end subroutine d_parmatch_bld_wnxt
end subroutine amg_d_parmatch_bld_wnxt
function d_parmatch_aggregator_fmt() result(val)
function amg_d_parmatch_aggregator_fmt() result(val)
implicit none
character(len=32) :: val
val = "Parallel Matching aggregation"
end function d_parmatch_aggregator_fmt
end function amg_d_parmatch_aggregator_fmt
function amg_d_parmatch_aggregator_xt_desc() result(val)
implicit none
@@ -374,7 +372,7 @@ contains
val = .true.
end function amg_d_parmatch_aggregator_xt_desc
function d_parmatch_aggregator_sizeof(ag) result(val)
function amg_d_parmatch_aggregator_sizeof(ag) result(val)
use psb_realloc_mod
implicit none
class(amg_d_parmatch_aggregator_type), intent(in) :: ag
@@ -390,9 +388,9 @@ contains
if (allocated(ag%base_desc)) val = val + ag%base_desc%sizeof()
if (allocated(ag%desc_ax)) val = val + ag%desc_ax%sizeof()
end function d_parmatch_aggregator_sizeof
end function amg_d_parmatch_aggregator_sizeof
subroutine d_parmatch_aggregator_descr(ag,parms,iout,info)
subroutine amg_d_parmatch_aggregator_descr(ag,parms,iout,info)
implicit none
class(amg_d_parmatch_aggregator_type), intent(in) :: ag
type(amg_dml_parms), intent(in) :: parms
@@ -406,7 +404,7 @@ contains
call parms%mldescr(iout,info)
return
end subroutine d_parmatch_aggregator_descr
end subroutine amg_d_parmatch_aggregator_descr
function is_legal_malg(alg) result(val)
logical :: val
@@ -437,7 +435,7 @@ contains
end function is_legal_nlevels
subroutine d_parmatch_aggregator_update_next(ag,agnext,info)
subroutine amg_d_parmatch_aggregator_update_next(ag,agnext,info)
use psb_realloc_mod
implicit none
class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag
@@ -452,10 +450,10 @@ contains
& agnext%matching_alg = ag%matching_alg
if (.not.is_legal_nsweeps(agnext%n_sweeps))&
& agnext%n_sweeps = ag%n_sweeps
if (.not.is_legal_csize(agnext%max_csize))&
& agnext%max_csize = ag%max_csize
if (.not.is_legal_nlevels(agnext%max_nlevels))&
& agnext%max_nlevels = ag%max_nlevels
!!$ if (.not.is_legal_csize(agnext%max_csize))&
!!$ & agnext%max_csize = ag%max_csize
!!$ if (.not.is_legal_nlevels(agnext%max_nlevels))&
!!$ & agnext%max_nlevels = ag%max_nlevels
! Is this going to generate shallow copies/memory leaks/double frees?
! To be investigated further.
call psb_safe_ab_cpy(ag%w_nxt,agnext%w,info)
@@ -470,9 +468,9 @@ contains
! What should we do here?
end select
info = 0
end subroutine d_parmatch_aggregator_update_next
end subroutine amg_d_parmatch_aggregator_update_next
subroutine d_parmatch_aggr_csetc(ag,what,val,info,idx)
subroutine amg_d_parmatch_aggr_csetc(ag,what,val,info,idx)
Implicit None
@@ -514,9 +512,9 @@ contains
! Do nothing
end select
return
end subroutine d_parmatch_aggr_csetc
end subroutine amg_d_parmatch_aggr_csetc
subroutine d_parmatch_aggr_cseti(ag,what,val,info,idx)
subroutine amg_d_parmatch_aggr_cseti(ag,what,val,info,idx)
Implicit None
@@ -540,10 +538,6 @@ contains
case('AGGR_SIZE')
ag%orig_aggr_size = val
ag%n_sweeps=max(1,ceiling(log(val*1.0)/log(2.0)))
case('PRMC_MAX_CSIZE')
ag%max_csize=val
case('PRMC_MAX_NLEVELS')
ag%max_nlevels=val
case('PRMC_W_SIZE')
call ag%bld_default_w(val)
case('PRMC_REPRODUCIBLE_MATCHING')
@@ -556,9 +550,9 @@ contains
! Do nothing
end select
return
end subroutine d_parmatch_aggr_cseti
end subroutine amg_d_parmatch_aggr_cseti
subroutine d_parmatch_aggr_set_default(ag)
subroutine amg_d_parmatch_aggr_set_default(ag)
Implicit None
@@ -569,8 +563,8 @@ contains
ag%matching_alg = 0
ag%n_sweeps = 1
ag%jacobi_sweeps = 0
ag%max_nlevels = 36
ag%max_csize = -1
!!$ ag%max_nlevels = 36
!!$ ag%max_csize = -1
!
! Apparently BootCMatch works better
! by keeping all entries
@@ -579,9 +573,9 @@ contains
return
end subroutine d_parmatch_aggr_set_default
end subroutine amg_d_parmatch_aggr_set_default
subroutine d_parmatch_aggregator_free(ag,info)
subroutine amg_d_parmatch_aggregator_free(ag,info)
use iso_c_binding
implicit none
class(amg_d_parmatch_aggregator_type), intent(inout) :: ag
@@ -618,9 +612,9 @@ contains
call ag%rwdesc%free(info); deallocate(ag%rwdesc,stat=info)
end if
end subroutine d_parmatch_aggregator_free
end subroutine amg_d_parmatch_aggregator_free
subroutine d_parmatch_aggregator_clone(ag,agnext,info)
subroutine amg_d_parmatch_aggregator_clone(ag,agnext,info)
implicit none
class(amg_d_parmatch_aggregator_type), intent(inout) :: ag
class(amg_d_base_aggregator_type), allocatable, intent(inout) :: agnext
@@ -640,7 +634,7 @@ contains
! Should never ever get here
info = -1
end select
end subroutine d_parmatch_aggregator_clone
end subroutine amg_d_parmatch_aggregator_clone
subroutine amg_d_parmatch_aggregator_bld_map(ag,desc_a,desc_ac,ilaggr,nlaggr,&
& op_restr,op_prol,map,info)
+2 -1
View File
@@ -155,11 +155,12 @@ module amg_d_prec_type
interface amg_precdescr
subroutine amg_dfile_prec_descr(prec,iout,root,verbosity)
subroutine amg_dfile_prec_descr(prec,info,iout,root,verbosity)
import :: amg_dprec_type, psb_ipk_
implicit none
! Arguments
class(amg_dprec_type), intent(in) :: prec
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: iout
integer(psb_ipk_), intent(in), optional :: root
integer(psb_ipk_), intent(in), optional :: verbosity
+31 -12
View File
@@ -52,7 +52,7 @@ module amg_d_sludist_solver
use iso_c_binding
use amg_d_base_solver_mod
#if defined(LPK8)
#if (!defined(HAVE_SLUDIST_)) || defined(IPK8)
type, extends(amg_d_base_solver_type) :: amg_d_sludist_solver_type
@@ -270,11 +270,13 @@ contains
! Local variables
type(psb_dspmat_type) :: atmp
type(psb_d_csr_sparse_mat) :: acsr
integer :: n_row,n_col, nrow_a, nztota, nglob, nzt, npr, npc
integer :: ifrst, ibcheck
integer(psb_lpk_), allocatable :: gia(:), gja(:)
type(psb_ctxt_type) :: ctxt
integer :: np,me,i, err_act, debug_unit, debug_level
character(len=20) :: name='d_sludist_solver_bld', ch_err
integer(psb_lpk_) :: lfrst
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota, nglob, nzt, npr, npc
integer(psb_ipk_) :: ifrst, ibcheck
integer(psb_ipk_) :: np,me,i, err_act, debug_unit, debug_level
character(len=20) :: name='d_sludist_solver_bld', ch_err
info=psb_success_
call psb_erractionsave(err_act)
@@ -293,19 +295,37 @@ contains
n_col = desc_a%get_local_cols()
nglob = desc_a%get_global_rows()
call a%cscnv(atmp,info,type='coo')
!
! Strategy here is as follows: because a call to SLUDIST
! as a gobal solver is mostly done at the coarsest level,
! even if we start from a problem requiring 8 bytes, chances
! are that the global size will be suitable for 4 bytes
! anyway, so we hope for the best, and throw an error
! if something goes wrong.
!
if (nglob > huge(1_psb_ipk_)) then
write(0,*) me,' ',trim(name),': Error: overflow of local indices '
info=psb_err_internal_error_
call psb_errpush(info,name)
goto 9999
end if
call a%cscnv(atmp,info,type='csr')
! This in case we are dealing with AS
call psb_rwextd(n_row,atmp,info,b=b)
call atmp%cscnv(info,type='csr',dupl=psb_dupl_add_)
call atmp%mv_to(acsr)
nrow_a = acsr%get_nrows()
nztota = acsr%get_nzeros()
call psb_loc_to_glob(ione,lfrst,desc_a,info)
! Fix the entries to call C-base SuperLU
call psb_loc_to_glob(1,ifrst,desc_a,info)
call psb_loc_to_glob(nrow_a,ibcheck,desc_a,info)
call psb_loc_to_glob(acsr%ja(1:nztota),desc_a,info,iact='I')
call psb_realloc(nztota,gja,info)
call psb_loc_to_glob(acsr%ja(1:nztota),gja(1:nztota), desc_a, info, iact='I')
acsr%ja(1:nztota) = gja(1:nztota)
acsr%ja(:) = acsr%ja(:) - 1
acsr%irp(:) = acsr%irp(:) - 1
ifrst = ifrst - 1
ifrst = lfrst - 1
info = amg_dsludist_fact(nglob,nrow_a,nztota,ifrst,&
& acsr%val,acsr%irp,acsr%ja,sv%lufactors,&
& npr,npc)
@@ -318,7 +338,6 @@ contains
end if
call acsr%free()
call atmp%free()
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),' end'
+2 -2
View File
@@ -126,7 +126,7 @@ module amg_s_base_aggregator_mod
& psb_s_coo_sparse_mat, amg_sml_parms, psb_spk_, psb_ipk_, psb_lpk_
implicit none
type(psb_s_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_s_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
@@ -144,7 +144,7 @@ module amg_s_base_aggregator_mod
& psb_s_coo_sparse_mat, amg_sml_parms, psb_spk_, psb_ipk_, psb_lpk_
implicit none
type(psb_s_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_s_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
+28 -328
View File
@@ -68,7 +68,7 @@
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
module smatchboxp_mod
module amg_s_matchboxp_mod
use iso_c_binding
use psb_base_cbind_mod
@@ -94,33 +94,25 @@ module smatchboxp_mod
end subroutine sMatchBoxPC
end interface MatchBoxPC
interface i_aggr_assign
module procedure i_saggr_assign
end interface i_aggr_assign
interface amg_i_aggr_assign
module procedure amg_i_s_aggr_assign
end interface amg_i_aggr_assign
interface build_matching
module procedure sbuild_matching
end interface build_matching
interface amg_par_build_matching
module procedure amg_s_par_build_matching
end interface amg_par_build_matching
interface build_ahat
module procedure sbuild_ahat
end interface build_ahat
interface amg_par_build_ahat
module procedure amg_s_par_build_ahat
end interface amg_par_build_ahat
interface psb_gtranspose
module procedure psb_sgtranspose
end interface psb_gtranspose
interface psb_htranspose
module procedure psb_shtranspose
end interface psb_htranspose
interface PMatchBox
module procedure sPMatchBox
end interface PMatchBox
interface amg_PMatchBox
module procedure amg_s_PMatchBox
end interface amg_PMatchBox
contains
subroutine smatchboxp_build_prol(w,a,desc_a,ilaggr,nlaggr,prol,info,&
subroutine amg_s_matchboxp_build_prol(w,a,desc_a,ilaggr,nlaggr,prol,info,&
& symmetrize,reproducible,display_inp, display_out, print_out)
use psb_base_mod
use psb_util_mod
@@ -213,7 +205,7 @@ contains
end if
if (do_timings) call psb_toc(idx_phase1)
if (do_timings) call psb_tic(idx_bldmtc)
call build_matching(w,a,desc_a,mate,info,display_inp=display_inp,symmetrize=symmetrize)
call amg_par_build_matching(w,a,desc_a,mate,info,display_inp=display_inp,symmetrize=symmetrize)
if (do_timings) call psb_toc(idx_bldmtc)
if (debug) write(0,*) iam,' buildprol from buildmatching:',&
& info
@@ -311,7 +303,7 @@ contains
! Should be a symmetric function.
!
call desc_a%indxmap%qry_halo_owner(idx,iown,info)
ip = i_aggr_assign(iam, iown, kg, idxg, wk, widx, nrmagg)
ip = amg_i_aggr_assign(iam, iown, kg, idxg, wk, widx, nrmagg)
if (iam == ip) then
nlaggr(iam) = nlaggr(iam) + 1
ilaggr(k) = nlaggr(iam)
@@ -513,9 +505,9 @@ contains
write(0,*) iam,' : error from Matching: ',info
end if
end subroutine smatchboxp_build_prol
end subroutine amg_s_matchboxp_build_prol
function i_saggr_assign(iam, iown, kg, idxg, wk, widx, nrmagg) &
function amg_i_s_aggr_assign(iam, iown, kg, idxg, wk, widx, nrmagg) &
& result(iproc)
!
! How to break ties? This
@@ -557,10 +549,10 @@ contains
iproc = iown
end if
end if
end function i_saggr_assign
end function amg_i_s_aggr_assign
subroutine sbuild_matching(w,a,desc_a,mate,info,display_inp, symmetrize)
subroutine amg_s_par_build_matching(w,a,desc_a,mate,info,display_inp, symmetrize)
use psb_base_mod
use psb_util_mod
use iso_c_binding
@@ -609,7 +601,7 @@ contains
if (iam == 0) write(0,*)' Into build_ahat:'
end if
if (do_timings) call psb_tic(idx_bldahat)
call build_ahat(w,a,ahatnd,desc_a,info,symmetrize=symmetrize)
call amg_par_build_ahat(w,a,ahatnd,desc_a,info,symmetrize=symmetrize)
if (do_timings) call psb_toc(idx_bldahat)
if (info /= 0) then
write(0,*) 'Error from build_ahat ', info
@@ -700,7 +692,7 @@ contains
!
if (debug) write(0,*) iam,' buildmatching into PMatchBox:'
if (do_timings) call psb_tic(idx_cmboxp)
call PMatchBox(nr,nz,vlptr,vlind,ewght,&
call amg_PMatchBox(nr,nz,vlptr,vlind,ewght,&
& vnl, mate, iam, np,ictxt,&
& msgis,msgas,msgprc,ph0t,ph1t,ph2t,ph1crd,ph2crd,info,display_inp)
if (do_timings) call psb_toc(idx_cmboxp)
@@ -764,9 +756,9 @@ contains
val(1:n) = tmp(1:n)
end subroutine fix_order
end subroutine sbuild_matching
end subroutine amg_s_par_build_matching
subroutine sbuild_ahat(w,a,ahat,desc_a,info,symmetrize)
subroutine amg_s_par_build_ahat(w,a,ahat,desc_a,info,symmetrize)
use psb_base_mod
implicit none
real(psb_spk_), intent(in) :: w(:)
@@ -1002,301 +994,9 @@ contains
end block
end if
end subroutine sbuild_ahat
end subroutine amg_s_par_build_ahat
subroutine psb_sgtranspose(ain,aout,desc_a,info)
use psb_base_mod
implicit none
type(psb_lsspmat_type), intent(in) :: ain
type(psb_lsspmat_type), intent(out) :: aout
type(psb_desc_type) :: desc_a
integer(psb_ipk_), intent(out) :: info
!
! BEWARE: This routine works under the assumption
! that the same DESC_A works for both A and A^T, which
! essentially means that A has a symmetric pattern.
!
type(psb_lsspmat_type) :: atmp, ahalo, aglb
type(psb_ls_coo_sparse_mat) :: tmpcoo
type(psb_ls_csr_sparse_mat) :: tmpcsr
type(psb_ctxt_type) :: ictxt
integer(psb_ipk_) :: me, np
integer(psb_lpk_) :: i, j, k, nrow, ncol
integer(psb_lpk_), allocatable :: ilv(:)
character(len=80) :: aname
logical, parameter :: debug=.false., dump=.false., debug_sync=.false.
ictxt = desc_a%get_context()
call psb_info(ictxt,me,np)
nrow = desc_a%get_local_rows()
ncol = desc_a%get_local_cols()
if (debug_sync) then
call psb_barrier(ictxt)
if (me == 0) write(0,*) 'Start gtranspose '
end if
call ain%cscnv(tmpcsr,info)
if (debug) then
ilv = [(i,i=1,ncol)]
call desc_a%l2gip(ilv,info,owned=.false.)
write(aname,'(a,i3.3,a)') 'atmp-preh-',me,'.mtx'
call ain%print(fname=aname,head='atmp before haloTest ',iv=ilv)
end if
if (dump) then
call ain%cscnv(atmp,info)
call psb_gather(aglb,atmp,desc_a,info)
if (me==psb_root_) then
write(aname,'(a,i3.3,a)') 'aglob-prehalo.mtx'
call aglb%print(fname=aname,head='Test ')
end if
end if
!call psb_loc_to_glob(tmpcsr%ja,desc_a,info)
call atmp%mv_from(tmpcsr)
if (debug) then
write(aname,'(a,i3.3,a)') 'tmpcsr-',me,'.mtx'
call atmp%print(fname=aname,head='tmpcsr ',iv=ilv)
!call psb_set_debug_level(9999)
end if
! FIXME THIS NEEDS REWORKING
if (debug) write(0,*) me,' Gtranspose into sphalo :',atmp%get_nrows(),atmp%get_ncols()
call psb_sphalo(atmp,desc_a,ahalo,info,rowscale=.true.)
if (debug) write(0,*) me,' Gtranspose from sphalo :',ahalo%get_nrows(),ahalo%get_ncols()
if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=ahalo)
if (debug) then
write(aname,'(a,i3.3,a)') 'ahalo-',me,'.mtx'
call ahalo%print(fname=aname,head='ahalo after haloTest ',iv=ilv)
write(aname,'(a,i3.3,a)') 'atmp-h-',me,'.mtx'
call atmp%print(fname=aname,head='atmp after haloTest ',iv=ilv)
end if
if (info == psb_success_) call ahalo%free()
call atmp%cp_to(tmpcoo)
call tmpcoo%transp()
!call psb_glob_to_loc(tmpcoo%ia,desc_a,info,iact='I')
if (debug) write(0,*) 'Before cleanup:',tmpcoo%get_nzeros()
j = 0
do k=1, tmpcoo%get_nzeros()
if ((tmpcoo%ia(k) > 0).and.(tmpcoo%ja(k)>0)) then
j = j+1
tmpcoo%ia(j) = tmpcoo%ia(k)
tmpcoo%ja(j) = tmpcoo%ja(k)
tmpcoo%val(j) = tmpcoo%val(k)
end if
end do
call tmpcoo%set_nzeros(j)
if (debug) write(0,*) 'After cleanup:',tmpcoo%get_nzeros()
call ahalo%mv_from(tmpcoo)
if (dump) then
call psb_gather(aglb,ahalo,desc_a,info)
if (me==psb_root_) then
write(aname,'(a,i3.3,a)') 'atran-preclip.mtx'
call aglb%print(fname=aname,head='Test ')
end if
end if
call ahalo%csclip(aout,info,imax=nrow)
if (debug) write(0,*) 'After clip:',aout%get_nzeros()
if (debug_sync) then
call psb_barrier(ictxt)
if (me == 0) write(0,*) 'End gtranspose '
end if
!call aout%cscnv(info,type='csr')
if (dump) then
write(aname,'(a,i3.3,a)') 'atran-',me,'.mtx'
call aout%print(fname=aname,head='atrans ',iv=ilv)
call psb_gather(aglb,aout,desc_a,info)
if (me==psb_root_) then
write(aname,'(a,i3.3,a)') 'atran.mtx'
call aglb%print(fname=aname,head='Test ')
end if
end if
end subroutine psb_sgtranspose
subroutine psb_shtranspose(ain,aout,desc_a,info)
use psb_base_mod
implicit none
type(psb_lsspmat_type), intent(in) :: ain
type(psb_lsspmat_type), intent(out) :: aout
type(psb_desc_type) :: desc_a
integer(psb_ipk_), intent(out) :: info
!
! BEWARE: This routine works under the assumption
! that the same DESC_A works for both A and A^T, which
! essentially means that A has a symmetric pattern.
!
type(psb_lsspmat_type) :: atmp, ahalo, aglb
type(psb_ls_coo_sparse_mat) :: tmpcoo, tmpc1, tmpc2, tmpch
type(psb_ls_csr_sparse_mat) :: tmpcsr
integer(psb_ipk_) :: nz1, nz2, nzh, nz
type(psb_ctxt_type) :: ictxt
integer(psb_ipk_) :: me, np
integer(psb_lpk_) :: i, j, k, nrow, ncol, nlz
integer(psb_lpk_), allocatable :: ilv(:)
character(len=80) :: aname
logical, parameter :: debug=.false., dump=.false., debug_sync=.false.
ictxt = desc_a%get_context()
call psb_info(ictxt,me,np)
nrow = desc_a%get_local_rows()
ncol = desc_a%get_local_cols()
if (debug_sync) then
call psb_barrier(ictxt)
if (me == 0) write(0,*) 'Start htranspose '
end if
call ain%cscnv(tmpcsr,info)
if (debug) then
ilv = [(i,i=1,ncol)]
call desc_a%l2gip(ilv,info,owned=.false.)
write(aname,'(a,i3.3,a)') 'atmp-preh-',me,'.mtx'
call ain%print(fname=aname,head='atmp before haloTest ',iv=ilv)
end if
if (dump) then
call ain%cscnv(atmp,info)
call psb_gather(aglb,atmp,desc_a,info)
if (me==psb_root_) then
write(aname,'(a,i3.3,a)') 'aglob-prehalo.mtx'
call aglb%print(fname=aname,head='Test ')
end if
end if
!call psb_loc_to_glob(tmpcsr%ja,desc_a,info)
call atmp%mv_from(tmpcsr)
if (debug) then
write(aname,'(a,i3.3,a)') 'tmpcsr-',me,'.mtx'
call atmp%print(fname=aname,head='tmpcsr ',iv=ilv)
!call psb_set_debug_level(9999)
end if
! FIXME THIS NEEDS REWORKING
if (debug) write(0,*) me,' Htranspose into sphalo :',atmp%get_nrows(),atmp%get_ncols()
if (.true.) then
call psb_sphalo(atmp,desc_a,ahalo,info, outfmt='coo ')
call atmp%mv_to(tmpc1)
call ahalo%mv_to(tmpch)
nz1 = tmpc1%get_nzeros()
call psb_loc_to_glob(tmpc1%ia(1:nz1),desc_a,info,iact='I')
call psb_loc_to_glob(tmpc1%ja(1:nz1),desc_a,info,iact='I')
nzh = tmpch%get_nzeros()
call psb_loc_to_glob(tmpch%ia(1:nzh),desc_a,info,iact='I')
call psb_loc_to_glob(tmpch%ja(1:nzh),desc_a,info,iact='I')
nlz = nz1+nzh
call tmpcoo%allocate(ncol,ncol,nlz)
tmpcoo%ia(1:nz1) = tmpc1%ia(1:nz1)
tmpcoo%ja(1:nz1) = tmpc1%ja(1:nz1)
tmpcoo%val(1:nz1) = tmpc1%val(1:nz1)
tmpcoo%ia(nz1+1:nz1+nzh) = tmpch%ia(1:nzh)
tmpcoo%ja(nz1+1:nz1+nzh) = tmpch%ja(1:nzh)
tmpcoo%val(nz1+1:nz1+nzh) = tmpch%val(1:nzh)
call tmpcoo%set_nzeros(nlz)
call tmpcoo%transp()
nz = tmpcoo%get_nzeros()
call psb_glob_to_loc(tmpcoo%ia(1:nz),desc_a,info,iact='I')
call psb_glob_to_loc(tmpcoo%ja(1:nz),desc_a,info,iact='I')
if (.true.) then
call tmpcoo%clean_negidx(info)
else
j = 0
do k=1, tmpcoo%get_nzeros()
if ((tmpcoo%ia(k) > 0).and.(tmpcoo%ja(k)>0)) then
j = j+1
tmpcoo%ia(j) = tmpcoo%ia(k)
tmpcoo%ja(j) = tmpcoo%ja(k)
tmpcoo%val(j) = tmpcoo%val(k)
end if
end do
call tmpcoo%set_nzeros(j)
end if
call ahalo%mv_from(tmpcoo)
call ahalo%csclip(aout,info,imax=nrow)
else
call psb_sphalo(atmp,desc_a,ahalo,info, rowscale=.true.)
if (debug) write(0,*) me,' Htranspose from sphalo :',ahalo%get_nrows(),ahalo%get_ncols()
if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=ahalo)
if (debug) then
write(aname,'(a,i3.3,a)') 'ahalo-',me,'.mtx'
call ahalo%print(fname=aname,head='ahalo after haloTest ',iv=ilv)
write(aname,'(a,i3.3,a)') 'atmp-h-',me,'.mtx'
call atmp%print(fname=aname,head='atmp after haloTest ',iv=ilv)
end if
if (info == psb_success_) call ahalo%free()
call atmp%cp_to(tmpcoo)
call tmpcoo%transp()
if (debug) write(0,*) 'Before cleanup:',tmpcoo%get_nzeros()
if (.true.) then
call tmpcoo%clean_negidx(info)
else
j = 0
do k=1, tmpcoo%get_nzeros()
if ((tmpcoo%ia(k) > 0).and.(tmpcoo%ja(k)>0)) then
j = j+1
tmpcoo%ia(j) = tmpcoo%ia(k)
tmpcoo%ja(j) = tmpcoo%ja(k)
tmpcoo%val(j) = tmpcoo%val(k)
end if
end do
call tmpcoo%set_nzeros(j)
end if
if (debug) write(0,*) 'After cleanup:',tmpcoo%get_nzeros()
call ahalo%mv_from(tmpcoo)
if (dump) then
call psb_gather(aglb,ahalo,desc_a,info)
if (me==psb_root_) then
write(aname,'(a,i3.3,a)') 'atran-preclip.mtx'
call aglb%print(fname=aname,head='Test ')
end if
end if
call ahalo%csclip(aout,info,imax=nrow)
end if
if (debug) write(0,*) 'After clip:',aout%get_nzeros()
if (debug_sync) then
call psb_barrier(ictxt)
if (me == 0) write(0,*) 'End htranspose '
end if
!call aout%cscnv(info,type='csr')
if (dump) then
write(aname,'(a,i3.3,a)') 'atran-',me,'.mtx'
call aout%print(fname=aname,head='atrans ',iv=ilv)
call psb_gather(aglb,aout,desc_a,info)
if (me==psb_root_) then
write(aname,'(a,i3.3,a)') 'atran.mtx'
call aglb%print(fname=aname,head='Test ')
end if
end if
end subroutine psb_shtranspose
subroutine sPMatchBox(nlver,nledge,verlocptr,verlocind,edgelocweight,&
subroutine amg_s_PMatchBox(nlver,nledge,verlocptr,verlocind,edgelocweight,&
& verdistance, mate, myrank, numprocs, ictxt,&
& msgindsent,msgactualsent,msgpercent,&
& ph0_time, ph1_time, ph2_time, ph1_card, ph2_card,info,display_inp)
@@ -1431,6 +1131,6 @@ contains
end if
where(mate>=0) mate = mate + 1
end subroutine sPMatchBox
end subroutine amg_s_PMatchBox
end module smatchboxp_mod
end module amg_s_matchboxp_mod
+51 -57
View File
@@ -118,7 +118,7 @@
module amg_s_parmatch_aggregator_mod
use amg_s_base_aggregator_mod
use smatchboxp_mod
use amg_s_matchboxp_mod
#if defined(SERIAL_MPI)
type, extends(amg_s_base_aggregator_type) :: amg_s_parmatch_aggregator_type
end type amg_s_parmatch_aggregator_type
@@ -132,8 +132,6 @@ module amg_s_parmatch_aggregator_mod
type(psb_sspmat_type), allocatable :: prol, restr
type(psb_sspmat_type), allocatable :: ac, base_a, rwa
type(psb_desc_type), allocatable :: desc_ac, desc_ax, base_desc, rwdesc
integer(psb_ipk_) :: max_csize
integer(psb_ipk_) :: max_nlevels
logical :: reproducible_matching = .false.
logical :: need_symmetrize = .false.
logical :: unsmoothed_hierarchy = .true.
@@ -143,18 +141,18 @@ module amg_s_parmatch_aggregator_mod
procedure, pass(ag) :: mat_asb => amg_s_parmatch_aggregator_mat_asb
procedure, pass(ag) :: inner_mat_asb => amg_s_parmatch_aggregator_inner_mat_asb
procedure, pass(ag) :: bld_map => amg_s_parmatch_aggregator_bld_map
procedure, pass(ag) :: csetc => s_parmatch_aggr_csetc
procedure, pass(ag) :: cseti => s_parmatch_aggr_cseti
procedure, pass(ag) :: default => s_parmatch_aggr_set_default
procedure, pass(ag) :: sizeof => s_parmatch_aggregator_sizeof
procedure, pass(ag) :: update_next => s_parmatch_aggregator_update_next
procedure, pass(ag) :: bld_wnxt => s_parmatch_bld_wnxt
procedure, pass(ag) :: bld_default_w => s_bld_default_w
procedure, pass(ag) :: set_c_default_w => s_set_prm_c_default_w
procedure, pass(ag) :: descr => s_parmatch_aggregator_descr
procedure, pass(ag) :: clone => s_parmatch_aggregator_clone
procedure, pass(ag) :: free => s_parmatch_aggregator_free
procedure, nopass :: fmt => s_parmatch_aggregator_fmt
procedure, pass(ag) :: csetc => amg_s_parmatch_aggr_csetc
procedure, pass(ag) :: cseti => amg_s_parmatch_aggr_cseti
procedure, pass(ag) :: default => amg_s_parmatch_aggr_set_default
procedure, pass(ag) :: sizeof => amg_s_parmatch_aggregator_sizeof
procedure, pass(ag) :: update_next => amg_s_parmatch_aggregator_update_next
procedure, pass(ag) :: bld_wnxt => amg_s_parmatch_bld_wnxt
procedure, pass(ag) :: bld_default_w => amg_s_bld_default_w
procedure, pass(ag) :: set_c_default_w => amg_s_set_prm_c_default_w
procedure, pass(ag) :: descr => amg_s_parmatch_aggregator_descr
procedure, pass(ag) :: clone => amg_s_parmatch_aggregator_clone
procedure, pass(ag) :: free => amg_s_parmatch_aggregator_free
procedure, nopass :: fmt => amg_s_parmatch_aggregator_fmt
procedure, nopass :: xt_desc => amg_s_parmatch_aggregator_xt_desc
end type amg_s_parmatch_aggregator_type
@@ -168,7 +166,7 @@ module amg_s_parmatch_aggregator_mod
type(amg_sml_parms), intent(inout) :: parms
type(amg_saggr_data), intent(in) :: ag_data
type(psb_sspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lsspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
@@ -235,7 +233,7 @@ module amg_s_parmatch_aggregator_mod
& psb_lsspmat_type, psb_dpk_, psb_ipk_, psb_lpk_, amg_sml_parms, amg_saggr_data
implicit none
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: t_prol
@@ -257,7 +255,7 @@ module amg_s_parmatch_aggregator_mod
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_sspmat_type), intent(out) :: op_prol,ac, op_restr
type(psb_sspmat_type), intent(inout) :: op_prol,ac, op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine amg_s_parmatch_unsmth_bld
@@ -275,7 +273,7 @@ module amg_s_parmatch_aggregator_mod
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_sspmat_type), intent(out) :: op_prol,ac, op_restr
type(psb_sspmat_type), intent(inout) :: op_prol,ac, op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine amg_s_parmatch_smth_bld
@@ -288,11 +286,11 @@ module amg_s_parmatch_aggregator_mod
& psb_lsspmat_type, psb_dpk_, psb_ipk_, psb_lpk_, amg_sml_parms, amg_saggr_data
implicit none
type(psb_sspmat_type), intent(inout) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_sspmat_type), intent(out) :: op_prol,ac, op_restr
type(psb_sspmat_type), intent(inout) :: op_prol,ac, op_restr
type(psb_desc_type), intent(out) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine amg_s_parmatch_spmm_bld_ov
@@ -306,11 +304,11 @@ module amg_s_parmatch_aggregator_mod
& psb_s_csr_sparse_mat, psb_ls_csr_sparse_mat
implicit none
type(psb_s_csr_sparse_mat), intent(inout) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_sspmat_type), intent(out) :: op_prol,ac, op_restr
type(psb_sspmat_type), intent(inout) :: op_prol,ac, op_restr
type(psb_desc_type), intent(out) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine amg_s_parmatch_spmm_bld_inner
@@ -320,7 +318,7 @@ module amg_s_parmatch_aggregator_mod
contains
subroutine s_bld_default_w(ag,nr)
subroutine amg_s_bld_default_w(ag,nr)
use psb_realloc_mod
implicit none
class(amg_s_parmatch_aggregator_type), target, intent(inout) :: ag
@@ -330,9 +328,9 @@ contains
if (info /= psb_success_) return
ag%w = done
!call ag%set_c_default_w()
end subroutine s_bld_default_w
end subroutine amg_s_bld_default_w
subroutine s_set_prm_c_default_w(ag)
subroutine amg_s_set_prm_c_default_w(ag)
use psb_realloc_mod
use iso_c_binding
implicit none
@@ -342,9 +340,9 @@ contains
!write(0,*) 'prm_c_deafult_w '
call psb_safe_ab_cpy(ag%w,ag%w_nxt,info)
end subroutine s_set_prm_c_default_w
end subroutine amg_s_set_prm_c_default_w
subroutine s_parmatch_bld_wnxt(ag,ilaggr,valaggr,nx)
subroutine amg_s_parmatch_bld_wnxt(ag,ilaggr,valaggr,nx)
use psb_realloc_mod
implicit none
class(amg_s_parmatch_aggregator_type), target, intent(inout) :: ag
@@ -358,14 +356,14 @@ contains
!write(0,*) 'Executing bld_wnxt ',nx
call psb_realloc(nx,ag%w_nxt,info)
end subroutine s_parmatch_bld_wnxt
end subroutine amg_s_parmatch_bld_wnxt
function s_parmatch_aggregator_fmt() result(val)
function amg_s_parmatch_aggregator_fmt() result(val)
implicit none
character(len=32) :: val
val = "Parallel Matching aggregation"
end function s_parmatch_aggregator_fmt
end function amg_s_parmatch_aggregator_fmt
function amg_s_parmatch_aggregator_xt_desc() result(val)
implicit none
@@ -374,7 +372,7 @@ contains
val = .true.
end function amg_s_parmatch_aggregator_xt_desc
function s_parmatch_aggregator_sizeof(ag) result(val)
function amg_s_parmatch_aggregator_sizeof(ag) result(val)
use psb_realloc_mod
implicit none
class(amg_s_parmatch_aggregator_type), intent(in) :: ag
@@ -390,9 +388,9 @@ contains
if (allocated(ag%base_desc)) val = val + ag%base_desc%sizeof()
if (allocated(ag%desc_ax)) val = val + ag%desc_ax%sizeof()
end function s_parmatch_aggregator_sizeof
end function amg_s_parmatch_aggregator_sizeof
subroutine s_parmatch_aggregator_descr(ag,parms,iout,info)
subroutine amg_s_parmatch_aggregator_descr(ag,parms,iout,info)
implicit none
class(amg_s_parmatch_aggregator_type), intent(in) :: ag
type(amg_sml_parms), intent(in) :: parms
@@ -406,7 +404,7 @@ contains
call parms%mldescr(iout,info)
return
end subroutine s_parmatch_aggregator_descr
end subroutine amg_s_parmatch_aggregator_descr
function is_legal_malg(alg) result(val)
logical :: val
@@ -437,7 +435,7 @@ contains
end function is_legal_nlevels
subroutine s_parmatch_aggregator_update_next(ag,agnext,info)
subroutine amg_s_parmatch_aggregator_update_next(ag,agnext,info)
use psb_realloc_mod
implicit none
class(amg_s_parmatch_aggregator_type), target, intent(inout) :: ag
@@ -452,10 +450,10 @@ contains
& agnext%matching_alg = ag%matching_alg
if (.not.is_legal_nsweeps(agnext%n_sweeps))&
& agnext%n_sweeps = ag%n_sweeps
if (.not.is_legal_csize(agnext%max_csize))&
& agnext%max_csize = ag%max_csize
if (.not.is_legal_nlevels(agnext%max_nlevels))&
& agnext%max_nlevels = ag%max_nlevels
!!$ if (.not.is_legal_csize(agnext%max_csize))&
!!$ & agnext%max_csize = ag%max_csize
!!$ if (.not.is_legal_nlevels(agnext%max_nlevels))&
!!$ & agnext%max_nlevels = ag%max_nlevels
! Is this going to generate shallow copies/memory leaks/double frees?
! To be investigated further.
call psb_safe_ab_cpy(ag%w_nxt,agnext%w,info)
@@ -470,9 +468,9 @@ contains
! What should we do here?
end select
info = 0
end subroutine s_parmatch_aggregator_update_next
end subroutine amg_s_parmatch_aggregator_update_next
subroutine s_parmatch_aggr_csetc(ag,what,val,info,idx)
subroutine amg_s_parmatch_aggr_csetc(ag,what,val,info,idx)
Implicit None
@@ -514,9 +512,9 @@ contains
! Do nothing
end select
return
end subroutine s_parmatch_aggr_csetc
end subroutine amg_s_parmatch_aggr_csetc
subroutine s_parmatch_aggr_cseti(ag,what,val,info,idx)
subroutine amg_s_parmatch_aggr_cseti(ag,what,val,info,idx)
Implicit None
@@ -540,10 +538,6 @@ contains
case('AGGR_SIZE')
ag%orig_aggr_size = val
ag%n_sweeps=max(1,ceiling(log(val*1.0)/log(2.0)))
case('PRMC_MAX_CSIZE')
ag%max_csize=val
case('PRMC_MAX_NLEVELS')
ag%max_nlevels=val
case('PRMC_W_SIZE')
call ag%bld_default_w(val)
case('PRMC_REPRODUCIBLE_MATCHING')
@@ -556,9 +550,9 @@ contains
! Do nothing
end select
return
end subroutine s_parmatch_aggr_cseti
end subroutine amg_s_parmatch_aggr_cseti
subroutine s_parmatch_aggr_set_default(ag)
subroutine amg_s_parmatch_aggr_set_default(ag)
Implicit None
@@ -569,8 +563,8 @@ contains
ag%matching_alg = 0
ag%n_sweeps = 1
ag%jacobi_sweeps = 0
ag%max_nlevels = 36
ag%max_csize = -1
!!$ ag%max_nlevels = 36
!!$ ag%max_csize = -1
!
! Apparently BootCMatch works better
! by keeping all entries
@@ -579,9 +573,9 @@ contains
return
end subroutine s_parmatch_aggr_set_default
end subroutine amg_s_parmatch_aggr_set_default
subroutine s_parmatch_aggregator_free(ag,info)
subroutine amg_s_parmatch_aggregator_free(ag,info)
use iso_c_binding
implicit none
class(amg_s_parmatch_aggregator_type), intent(inout) :: ag
@@ -618,9 +612,9 @@ contains
call ag%rwdesc%free(info); deallocate(ag%rwdesc,stat=info)
end if
end subroutine s_parmatch_aggregator_free
end subroutine amg_s_parmatch_aggregator_free
subroutine s_parmatch_aggregator_clone(ag,agnext,info)
subroutine amg_s_parmatch_aggregator_clone(ag,agnext,info)
implicit none
class(amg_s_parmatch_aggregator_type), intent(inout) :: ag
class(amg_s_base_aggregator_type), allocatable, intent(inout) :: agnext
@@ -640,7 +634,7 @@ contains
! Should never ever get here
info = -1
end select
end subroutine s_parmatch_aggregator_clone
end subroutine amg_s_parmatch_aggregator_clone
subroutine amg_s_parmatch_aggregator_bld_map(ag,desc_a,desc_ac,ilaggr,nlaggr,&
& op_restr,op_prol,map,info)
+2 -1
View File
@@ -155,11 +155,12 @@ module amg_s_prec_type
interface amg_precdescr
subroutine amg_sfile_prec_descr(prec,iout,root,verbosity)
subroutine amg_sfile_prec_descr(prec,info,iout,root,verbosity)
import :: amg_sprec_type, psb_ipk_
implicit none
! Arguments
class(amg_sprec_type), intent(in) :: prec
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: iout
integer(psb_ipk_), intent(in), optional :: root
integer(psb_ipk_), intent(in), optional :: verbosity
+2 -2
View File
@@ -126,7 +126,7 @@ module amg_z_base_aggregator_mod
& psb_z_coo_sparse_mat, amg_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_
implicit none
type(psb_z_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_z_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
@@ -144,7 +144,7 @@ module amg_z_base_aggregator_mod
& psb_z_coo_sparse_mat, amg_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_
implicit none
type(psb_z_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_z_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
+2 -1
View File
@@ -155,11 +155,12 @@ module amg_z_prec_type
interface amg_precdescr
subroutine amg_zfile_prec_descr(prec,iout,root,verbosity)
subroutine amg_zfile_prec_descr(prec,info,iout,root,verbosity)
import :: amg_zprec_type, psb_ipk_
implicit none
! Arguments
class(amg_zprec_type), intent(in) :: prec
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: iout
integer(psb_ipk_), intent(in), optional :: root
integer(psb_ipk_), intent(in), optional :: verbosity
+30 -12
View File
@@ -52,7 +52,7 @@ module amg_z_sludist_solver
use iso_c_binding
use amg_z_base_solver_mod
#if defined(LPK8)
#if (!defined(HAVE_SLUDIST_)) || defined(IPK8)
type, extends(amg_z_base_solver_type) :: amg_z_sludist_solver_type
@@ -270,11 +270,13 @@ contains
! Local variables
type(psb_zspmat_type) :: atmp
type(psb_z_csr_sparse_mat) :: acsr
integer :: n_row,n_col, nrow_a, nztota, nglob, nzt, npr, npc
integer :: ifrst, ibcheck
integer(psb_lpk_), allocatable :: gia(:), gja(:)
type(psb_ctxt_type) :: ctxt
integer :: np,me,i, err_act, debug_unit, debug_level
character(len=20) :: name='z_sludist_solver_bld', ch_err
integer(psb_lpk_) :: lfrst
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota, nglob, nzt, npr, npc
integer(psb_ipk_) :: ifrst, ibcheck
integer(psb_ipk_) :: np,me,i, err_act, debug_unit, debug_level
character(len=20) :: name='z_sludist_solver_bld', ch_err
info=psb_success_
call psb_erractionsave(err_act)
@@ -293,19 +295,36 @@ contains
n_col = desc_a%get_local_cols()
nglob = desc_a%get_global_rows()
call a%cscnv(atmp,info,type='coo')
!
! Strategy here is as follows: because a call to SLUDIST
! as a gobal solver is mostly done at the coarsest level,
! even if we start from a problem requiring 8 bytes, chances
! are that the global size will be suitable for 4 bytes
! anyway, so we hope for the best, and throw an error
! if something goes wrong.
!
if (nglob > huge(1_psb_ipk_)) then
write(0,*) me,' ',trim(name),': Error: overflow of local indices '
info=psb_err_internal_error_
call psb_errpush(info,name)
goto 9999
end if
call a%cscnv(atmp,info,type='csr')
! This in case we are dealing with AS
call psb_rwextd(n_row,atmp,info,b=b)
call atmp%cscnv(info,type='csr',dupl=psb_dupl_add_)
call atmp%mv_to(acsr)
nrow_a = acsr%get_nrows()
nztota = acsr%get_nzeros()
call psb_loc_to_glob(ione,lfrst,desc_a,info)
! Fix the entries to call C-base SuperLU
call psb_loc_to_glob(1,ifrst,desc_a,info)
call psb_loc_to_glob(nrow_a,ibcheck,desc_a,info)
call psb_loc_to_glob(acsr%ja(1:nztota),desc_a,info,iact='I')
call psb_realloc(nztota,gja,info)
call psb_loc_to_glob(acsr%ja(1:nztota),gja(1:nztota), desc_a, info, iact='I')
acsr%ja(1:nztota) = gja(1:nztota)
acsr%ja(:) = acsr%ja(:) - 1
acsr%irp(:) = acsr%irp(:) - 1
ifrst = ifrst - 1
ifrst = lfrst - 1
info = amg_zsludist_fact(nglob,nrow_a,nztota,ifrst,&
& acsr%val,acsr%irp,acsr%ja,sv%lufactors,&
& npr,npc)
@@ -318,7 +337,6 @@ contains
end if
call acsr%free()
call atmp%free()
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),' end'
@@ -83,8 +83,8 @@ subroutine amg_c_dec_aggregator_build_tprol(ag,parms,ag_data,&
class(amg_c_dec_aggregator_type), target, intent(inout) :: ag
type(amg_sml_parms), intent(inout) :: parms
type(amg_saggr_data), intent(in) :: ag_data
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_cspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lcspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
@@ -86,8 +86,8 @@ subroutine amg_c_symdec_aggregator_build_tprol(ag,parms,ag_data,&
class(amg_c_symdec_aggregator_type), target, intent(inout) :: ag
type(amg_sml_parms), intent(inout) :: parms
type(amg_saggr_data), intent(in) :: ag_data
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_cspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lcspmat_type), intent(out) :: op_prol
integer(psb_ipk_), intent(out) :: info
@@ -105,7 +105,7 @@
!
!
subroutine amg_caggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,info)
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use amg_base_prec_type
use amg_c_inner_mod, amg_protect_name => amg_caggrmat_minnrg_bld
@@ -117,8 +117,8 @@ subroutine amg_caggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_lcspmat_type), intent(inout) :: op_prol
type(psb_lcspmat_type), intent(out) :: ac,op_restr
type(psb_lcspmat_type), intent(inout) :: t_prol
type(psb_cspmat_type), intent(inout) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
@@ -171,6 +171,8 @@ subroutine amg_caggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
filter_mat = (parms%aggr_filter == amg_filter_mat_)
!NEEDS TO BE REWORKED !!
! naggr: number of local aggregates
! nrow: local rows.
!
@@ -183,361 +185,361 @@ subroutine amg_caggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
goto 9999
end if
! Get the diagonal D
adiag = a%get_diag(info)
if (info == psb_success_) &
& call psb_realloc(ncol,adiag,info)
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%cp_to_l(la)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
goto 9999
end if
do i=1,size(adiag)
if (adiag(i) /= czero) then
adinv(i) = cone / adiag(i)
else
adinv(i) = cone
end if
end do
! 1. Allocate Ptilde in sparse matrix form
call op_prol%mv_to(tmpcoo)
call ptilde%mv_from(tmpcoo)
call ptilde%cscnv(info,type='csr')
if (info == psb_success_) call la%cscnv(am3,info,type='csr',dupl=psb_dupl_add_)
if (info == psb_success_) call la%cscnv(da,info,type='csr',dupl=psb_dupl_add_)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& ' Initial copies done.'
call da%scal(adinv,info)
call psb_spspmm(da,ptilde,dap,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
goto 9999
end if
call dap%clone(atmp,info)
call psb_sphalo(atmp,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.,outfmt='CSR ')
if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=am4)
if (info == psb_success_) call am4%free()
call psb_spspmm(da,atmp,dadap,info)
call atmp%free()
! !$ write(0,*) 'Columns of AP',psb_sp_get_ncols(ap)
! !$ write(0,*) 'Columns of ADAP',psb_sp_get_ncols(adap)
call dap%mv_to(csc_dap)
call dadap%mv_to(csc_dadap)
call csc_mat_col_prod(csc_dap,csc_dadap,omp,info)
call csc_mat_col_prod(csc_dadap,csc_dadap,oden,info)
call psb_sum(ctxt,omp)
call psb_sum(ctxt,oden)
! !$ write(0,*) trim(name),' OMP :',omp
! !$ write(0,*) trim(name),' ODEN:',oden
omp = omp/oden
! !$ write(0,*) 'Check on output prolongator ',omp(1:min(size(omp),10))
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done NUMBMM 1'
call am3%mv_to(acsr3)
! Compute omega_int
ommx = czero
do i=1, ncol
if (ilaggr(i) >0) then
omi(i) = omp(ilaggr(i))
else
omi(i) = czero
end if
if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
end do
! Compute omega_fine
do i=1, nrow
omf(i) = ommx
do j=acsr3%irp(i),acsr3%irp(i+1)-1
if(abs(omi(acsr3%ja(j))) .lt. abs(omf(i))) omf(i)=omi(acsr3%ja(j))
end do
!!$ if(min(real(omf(i)),aimag(omf(i))) < szero) omf(i) = czero
if(psb_minreal(omf(i)) < szero) omf(i) = czero
end do
omf(1:nrow) = omf(1:nrow) * adinv(1:nrow)
if (filter_mat) then
!
! Build the filtered matrix Af from A
!
call la%cscnv(acsrf,info,dupl=psb_dupl_add_)
do i=1,nrow
tmp = czero
jd = -1
do j=acsrf%irp(i),acsrf%irp(i+1)-1
if (acsrf%ja(j) == i) jd = j
if (abs(acsrf%val(j)) < theta*sqrt(abs(adiag(i)*adiag(acsrf%ja(j))))) then
tmp=tmp+acsrf%val(j)
acsrf%val(j)=czero
endif
enddo
if (jd == -1) then
write(0,*) 'Wrong input: we need the diagonal!!!!', i
else
acsrf%val(jd)=acsrf%val(jd)-tmp
end if
enddo
! Take out zeroed terms
call acsrf%clean_zeros(info)
!
! Build the smoothed prolongator using the filtered matrix
!
do i=1,acsrf%get_nrows()
do j=acsrf%irp(i),acsrf%irp(i+1)-1
if (acsrf%ja(j) == i) then
acsrf%val(j) = cone - omf(i)*acsrf%val(j)
else
acsrf%val(j) = - omf(i)*acsrf%val(j)
end if
end do
end do
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done gather, going for SYMBMM 1'
call af%mv_from(acsrf)
!
! op_prol = (I-w*D*Af)Ptilde
! Doing it this way means to consider diag(Af_i)
!
!
call psb_spspmm(af,ptilde,op_prol,info)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 1'
else
!
! Build the smoothed prolongator using the original matrix
!
do i=1,acsr3%get_nrows()
do j=acsr3%irp(i),acsr3%irp(i+1)-1
if (acsr3%ja(j) == i) then
acsr3%val(j) = cone - omf(i)*acsr3%val(j)
else
acsr3%val(j) = - omf(i)*acsr3%val(j)
end if
end do
end do
call am3%mv_from(acsr3)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done gather, going for SYMBMM 1'
!
!
! op_prol = (I-w*D*A)Ptilde
!
!
call psb_spspmm(am3,ptilde,op_prol,info)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done NUMBMM 1'
end if
!
! Ok, let's start over with the restrictor
!
call ptilde%transc(rtilde)
call la%cscnv(atmp,info,type='csr')
call psb_sphalo(atmp,desc_a,am4,info,&
& colcnv=.true.,rowscale=.true.)
nrt = am4%get_nrows()
call am4%csclip(atmp2,info,lone,nrt,lone,ncol)
call atmp2%cscnv(info,type='CSR')
if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=atmp2)
call am4%free()
call atmp2%free()
! This is to compute the transpose. It ONLY works if the
! original A has a symmetric pattern.
call atmp%transc(atmp2)
call atmp2%csclip(dat,info,lone,nrow,lone,ncol)
call dat%cscnv(info,type='csr')
call dat%scal(adinv,info)
! Now for the product.
call psb_spspmm(dat,ptilde,datp,info)
call datp%clone(atmp2,info)
call psb_sphalo(atmp2,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.,outfmt='CSR ')
if (info == psb_success_) call psb_rwextd(ncol,atmp2,info,b=am4)
if (info == psb_success_) call am4%free()
call psb_symbmm(dat,atmp2,datdatp,info)
call psb_numbmm(dat,atmp2,datdatp)
call atmp2%free()
call datp%mv_to(csc_datp)
call datdatp%mv_to(csc_datdatp)
call csc_mat_col_prod(csc_datp,csc_datdatp,omp,info)
call csc_mat_col_prod(csc_datdatp,csc_datdatp,oden,info)
call psb_sum(ctxt,omp)
call psb_sum(ctxt,oden)
! !$ write(debug_unit,*) trim(name),' OMP_R :',omp
! ! $ write(debug_unit,*) trim(name),' ODEN_R:',oden
omp = omp/oden
! !$ write(0,*) 'Check on output restrictor',omp(1:min(size(omp),10))
! Compute omega_int
ommx = czero
do i=1, ncol
if (ilaggr(i) >0) then
omi(i) = omp(ilaggr(i))
else
omi(i) = czero
end if
if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
end do
! Compute omega_fine
! Going over the columns of atmp means going over the rows
! of A^T. Hopefully ;-)
call atmp%cp_to(acsc)
do i=1, nrow
omf(i) = ommx
do j= acsc%icp(i),acsc%icp(i+1)-1
if(abs(omi(acsc%ia(j))) .lt. abs(omf(i))) omf(i)=omi(acsc%ia(j))
end do
!!$ if(min(real(omf(i)),aimag(omf(i))) < szero) omf(i) = czero
if(psb_minreal(omf(i)) < szero) omf(i) = czero
end do
omf(1:nrow) = omf(1:nrow)*adinv(1:nrow)
call psb_halo(omf,desc_a,info)
call acsc%free()
call atmp%mv_to(acsr1)
do i=1,acsr1%get_nrows()
do j=acsr1%irp(i),acsr1%irp(i+1)-1
if (acsr1%ja(j) == i) then
acsr1%val(j) = cone - acsr1%val(j)*omf(acsr1%ja(j))
else
acsr1%val(j) = - acsr1%val(j)*omf(acsr1%ja(j))
end if
end do
end do
call atmp%mv_from(acsr1)
call rtilde%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
i=0
do k=1, nzl
if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
i = i+1
tmpcoo%val(i) = tmpcoo%val(k)
tmpcoo%ia(i) = tmpcoo%ia(k)
tmpcoo%ja(i) = tmpcoo%ja(k)
end if
end do
call tmpcoo%set_nzeros(i)
call rtilde%mv_from(tmpcoo)
call rtilde%cscnv(info,type='csr')
call psb_spspmm(rtilde,atmp,op_restr,info)
!
! Now we have to gather the halo of op_prol, and add it to itself
! to multiply it by A,
!
call op_prol%clone(tmp_prol,info)
if (info == psb_success_) call psb_sphalo(tmp_prol,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.)
if (info == psb_success_) call psb_rwextd(ncol,tmp_prol,info,b=am4)
if (info == psb_success_) call am4%free()
if(info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,a_err='Halo of op_prol')
goto 9999
end if
!
! Now we have to fix this. The only rows of B that are correct
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!
call op_restr%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
i=0
do k=1, nzl
if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
i = i+1
tmpcoo%val(i) = tmpcoo%val(k)
tmpcoo%ia(i) = tmpcoo%ia(k)
tmpcoo%ja(i) = tmpcoo%ja(k)
end if
end do
call tmpcoo%set_nzeros(i)
call op_restr%mv_from(tmpcoo)
call op_restr%cscnv(info,type='csr')
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'starting sphalo/ rwxtd'
call psb_spspmm(la,tmp_prol,am3,info)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 2'
call psb_sphalo(am3,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.)
if (info == psb_success_) call psb_rwextd(ncol,am3,info,b=am4)
if (info == psb_success_) call am4%free()
if(info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
& a_err='Extend am3')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done sphalo/ rwxtd'
call psb_spspmm(op_restr,am3,ac,info)
if (info == psb_success_) call am3%free()
if (info == psb_success_) call ac%cscnv(info,type='coo',dupl=psb_dupl_add_)
if (info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
&a_err='Build ac = op_restr x am3')
goto 9999
end if
!!$ ! Get the diagonal D
!!$ adiag = a%get_diag(info)
!!$ if (info == psb_success_) &
!!$ & call psb_realloc(ncol,adiag,info)
!!$ if (info == psb_success_) &
!!$ & call psb_halo(adiag,desc_a,info)
!!$ if (info == psb_success_) call a%cp_to_l(la)
!!$ if (info /= psb_success_) then
!!$ call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
!!$ goto 9999
!!$ end if
!!$
!!$ do i=1,size(adiag)
!!$ if (adiag(i) /= czero) then
!!$ adinv(i) = cone / adiag(i)
!!$ else
!!$ adinv(i) = cone
!!$ end if
!!$ end do
!!$
!!$
!!$
!!$ ! 1. Allocate Ptilde in sparse matrix form
!!$ call op_prol%mv_to(tmpcoo)
!!$ call ptilde%mv_from(tmpcoo)
!!$ call ptilde%cscnv(info,type='csr')
!!$
!!$ if (info == psb_success_) call la%cscnv(am3,info,type='csr',dupl=psb_dupl_add_)
!!$ if (info == psb_success_) call la%cscnv(da,info,type='csr',dupl=psb_dupl_add_)
!!$ if (info /= psb_success_) then
!!$ call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv')
!!$ goto 9999
!!$ end if
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & ' Initial copies done.'
!!$
!!$ call da%scal(adinv,info)
!!$
!!$ call psb_spspmm(da,ptilde,dap,info)
!!$
!!$ if(info /= psb_success_) then
!!$ call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
!!$ goto 9999
!!$ end if
!!$
!!$ call dap%clone(atmp,info)
!!$
!!$ call psb_sphalo(atmp,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.,outfmt='CSR ')
!!$ if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$ call psb_spspmm(da,atmp,dadap,info)
!!$ call atmp%free()
!!$
!!$ ! !$ write(0,*) 'Columns of AP',psb_sp_get_ncols(ap)
!!$ ! !$ write(0,*) 'Columns of ADAP',psb_sp_get_ncols(adap)
!!$ call dap%mv_to(csc_dap)
!!$ call dadap%mv_to(csc_dadap)
!!$
!!$ call csc_mat_col_prod(csc_dap,csc_dadap,omp,info)
!!$ call csc_mat_col_prod(csc_dadap,csc_dadap,oden,info)
!!$ call psb_sum(ctxt,omp)
!!$ call psb_sum(ctxt,oden)
!!$ ! !$ write(0,*) trim(name),' OMP :',omp
!!$ ! !$ write(0,*) trim(name),' ODEN:',oden
!!$
!!$ omp = omp/oden
!!$
!!$ ! !$ write(0,*) 'Check on output prolongator ',omp(1:min(size(omp),10))
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done NUMBMM 1'
!!$
!!$ call am3%mv_to(acsr3)
!!$ ! Compute omega_int
!!$ ommx = czero
!!$ do i=1, ncol
!!$ if (ilaggr(i) >0) then
!!$ omi(i) = omp(ilaggr(i))
!!$ else
!!$ omi(i) = czero
!!$ end if
!!$ if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
!!$ end do
!!$ ! Compute omega_fine
!!$ do i=1, nrow
!!$ omf(i) = ommx
!!$ do j=acsr3%irp(i),acsr3%irp(i+1)-1
!!$ if(abs(omi(acsr3%ja(j))) .lt. abs(omf(i))) omf(i)=omi(acsr3%ja(j))
!!$ end do
!!$ ! ! if(min(real(omf(i)),aimag(omf(i))) < szero) omf(i) = czero
!!$ if(psb_minreal(omf(i)) < szero) omf(i) = czero
!!$ end do
!!$
!!$ omf(1:nrow) = omf(1:nrow) * adinv(1:nrow)
!!$
!!$ if (filter_mat) then
!!$ !
!!$ ! Build the filtered matrix Af from A
!!$ !
!!$ call la%cscnv(acsrf,info,dupl=psb_dupl_add_)
!!$
!!$ do i=1,nrow
!!$ tmp = czero
!!$ jd = -1
!!$ do j=acsrf%irp(i),acsrf%irp(i+1)-1
!!$ if (acsrf%ja(j) == i) jd = j
!!$ if (abs(acsrf%val(j)) < theta*sqrt(abs(adiag(i)*adiag(acsrf%ja(j))))) then
!!$ tmp=tmp+acsrf%val(j)
!!$ acsrf%val(j)=czero
!!$ endif
!!$ enddo
!!$ if (jd == -1) then
!!$ write(0,*) 'Wrong input: we need the diagonal!!!!', i
!!$ else
!!$ acsrf%val(jd)=acsrf%val(jd)-tmp
!!$ end if
!!$ enddo
!!$ ! Take out zeroed terms
!!$ call acsrf%clean_zeros(info)
!!$
!!$ !
!!$ ! Build the smoothed prolongator using the filtered matrix
!!$ !
!!$ do i=1,acsrf%get_nrows()
!!$ do j=acsrf%irp(i),acsrf%irp(i+1)-1
!!$ if (acsrf%ja(j) == i) then
!!$ acsrf%val(j) = cone - omf(i)*acsrf%val(j)
!!$ else
!!$ acsrf%val(j) = - omf(i)*acsrf%val(j)
!!$ end if
!!$ end do
!!$ end do
!!$
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done gather, going for SYMBMM 1'
!!$
!!$ call af%mv_from(acsrf)
!!$ !
!!$ ! op_prol = (I-w*D*Af)Ptilde
!!$ ! Doing it this way means to consider diag(Af_i)
!!$ !
!!$ !
!!$ call psb_spspmm(af,ptilde,op_prol,info)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done SPSPMM 1'
!!$ else
!!$ !
!!$ ! Build the smoothed prolongator using the original matrix
!!$ !
!!$ do i=1,acsr3%get_nrows()
!!$ do j=acsr3%irp(i),acsr3%irp(i+1)-1
!!$ if (acsr3%ja(j) == i) then
!!$ acsr3%val(j) = cone - omf(i)*acsr3%val(j)
!!$ else
!!$ acsr3%val(j) = - omf(i)*acsr3%val(j)
!!$ end if
!!$ end do
!!$ end do
!!$
!!$ call am3%mv_from(acsr3)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done gather, going for SYMBMM 1'
!!$ !
!!$ !
!!$ ! op_prol = (I-w*D*A)Ptilde
!!$ !
!!$ !
!!$ call psb_spspmm(am3,ptilde,op_prol,info)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done NUMBMM 1'
!!$
!!$ end if
!!$
!!$
!!$ !
!!$ ! Ok, let's start over with the restrictor
!!$ !
!!$ call ptilde%transc(rtilde)
!!$ call la%cscnv(atmp,info,type='csr')
!!$ call psb_sphalo(atmp,desc_a,am4,info,&
!!$ & colcnv=.true.,rowscale=.true.)
!!$ nrt = am4%get_nrows()
!!$ call am4%csclip(atmp2,info,lone,nrt,lone,ncol)
!!$ call atmp2%cscnv(info,type='CSR')
!!$ if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=atmp2)
!!$ call am4%free()
!!$ call atmp2%free()
!!$
!!$ ! This is to compute the transpose. It ONLY works if the
!!$ ! original A has a symmetric pattern.
!!$ call atmp%transc(atmp2)
!!$ call atmp2%csclip(dat,info,lone,nrow,lone,ncol)
!!$ call dat%cscnv(info,type='csr')
!!$ call dat%scal(adinv,info)
!!$
!!$ ! Now for the product.
!!$ call psb_spspmm(dat,ptilde,datp,info)
!!$
!!$ call datp%clone(atmp2,info)
!!$ call psb_sphalo(atmp2,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.,outfmt='CSR ')
!!$ if (info == psb_success_) call psb_rwextd(ncol,atmp2,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$
!!$ call psb_symbmm(dat,atmp2,datdatp,info)
!!$ call psb_numbmm(dat,atmp2,datdatp)
!!$ call atmp2%free()
!!$
!!$ call datp%mv_to(csc_datp)
!!$ call datdatp%mv_to(csc_datdatp)
!!$
!!$ call csc_mat_col_prod(csc_datp,csc_datdatp,omp,info)
!!$ call csc_mat_col_prod(csc_datdatp,csc_datdatp,oden,info)
!!$ call psb_sum(ctxt,omp)
!!$ call psb_sum(ctxt,oden)
!!$
!!$
!!$ ! !$ write(debug_unit,*) trim(name),' OMP_R :',omp
!!$ ! ! $ write(debug_unit,*) trim(name),' ODEN_R:',oden
!!$ omp = omp/oden
!!$ ! !$ write(0,*) 'Check on output restrictor',omp(1:min(size(omp),10))
!!$ ! Compute omega_int
!!$ ommx = czero
!!$ do i=1, ncol
!!$ if (ilaggr(i) >0) then
!!$ omi(i) = omp(ilaggr(i))
!!$ else
!!$ omi(i) = czero
!!$ end if
!!$ if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
!!$ end do
!!$ ! Compute omega_fine
!!$ ! Going over the columns of atmp means going over the rows
!!$ ! of A^T. Hopefully ;-)
!!$ call atmp%cp_to(acsc)
!!$
!!$ do i=1, nrow
!!$ omf(i) = ommx
!!$ do j= acsc%icp(i),acsc%icp(i+1)-1
!!$ if(abs(omi(acsc%ia(j))) .lt. abs(omf(i))) omf(i)=omi(acsc%ia(j))
!!$ end do
!!$ ! ! if(min(real(omf(i)),aimag(omf(i))) < szero) omf(i) = czero
!!$ if(psb_minreal(omf(i)) < szero) omf(i) = czero
!!$ end do
!!$ omf(1:nrow) = omf(1:nrow)*adinv(1:nrow)
!!$ call psb_halo(omf,desc_a,info)
!!$ call acsc%free()
!!$
!!$
!!$ call atmp%mv_to(acsr1)
!!$
!!$ do i=1,acsr1%get_nrows()
!!$ do j=acsr1%irp(i),acsr1%irp(i+1)-1
!!$ if (acsr1%ja(j) == i) then
!!$ acsr1%val(j) = cone - acsr1%val(j)*omf(acsr1%ja(j))
!!$ else
!!$ acsr1%val(j) = - acsr1%val(j)*omf(acsr1%ja(j))
!!$ end if
!!$ end do
!!$ end do
!!$ call atmp%mv_from(acsr1)
!!$
!!$ call rtilde%mv_to(tmpcoo)
!!$ nzl = tmpcoo%get_nzeros()
!!$ i=0
!!$ do k=1, nzl
!!$ if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
!!$ i = i+1
!!$ tmpcoo%val(i) = tmpcoo%val(k)
!!$ tmpcoo%ia(i) = tmpcoo%ia(k)
!!$ tmpcoo%ja(i) = tmpcoo%ja(k)
!!$ end if
!!$ end do
!!$ call tmpcoo%set_nzeros(i)
!!$ call rtilde%mv_from(tmpcoo)
!!$ call rtilde%cscnv(info,type='csr')
!!$
!!$ call psb_spspmm(rtilde,atmp,op_restr,info)
!!$
!!$ !
!!$ ! Now we have to gather the halo of op_prol, and add it to itself
!!$ ! to multiply it by A,
!!$ !
!!$ call op_prol%clone(tmp_prol,info)
!!$ if (info == psb_success_) call psb_sphalo(tmp_prol,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.)
!!$ if (info == psb_success_) call psb_rwextd(ncol,tmp_prol,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$ if(info /= psb_success_) then
!!$ call psb_errpush(psb_err_internal_error_,name,a_err='Halo of op_prol')
!!$ goto 9999
!!$ end if
!!$
!!$ !
!!$ ! Now we have to fix this. The only rows of B that are correct
!!$ ! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!!$ !
!!$ call op_restr%mv_to(tmpcoo)
!!$
!!$ nzl = tmpcoo%get_nzeros()
!!$ i=0
!!$ do k=1, nzl
!!$ if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
!!$ i = i+1
!!$ tmpcoo%val(i) = tmpcoo%val(k)
!!$ tmpcoo%ia(i) = tmpcoo%ia(k)
!!$ tmpcoo%ja(i) = tmpcoo%ja(k)
!!$ end if
!!$ end do
!!$ call tmpcoo%set_nzeros(i)
!!$ call op_restr%mv_from(tmpcoo)
!!$ call op_restr%cscnv(info,type='csr')
!!$
!!$
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'starting sphalo/ rwxtd'
!!$
!!$ call psb_spspmm(la,tmp_prol,am3,info)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done SPSPMM 2'
!!$
!!$ call psb_sphalo(am3,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.)
!!$ if (info == psb_success_) call psb_rwextd(ncol,am3,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$ if(info /= psb_success_) then
!!$ call psb_errpush(psb_err_internal_error_,name,&
!!$ & a_err='Extend am3')
!!$ goto 9999
!!$ end if
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done sphalo/ rwxtd'
!!$
!!$ call psb_spspmm(op_restr,am3,ac,info)
!!$ if (info == psb_success_) call am3%free()
!!$ if (info == psb_success_) call ac%cscnv(info,type='coo',dupl=psb_dupl_add_)
!!$
!!$ if (info /= psb_success_) then
!!$ call psb_errpush(psb_err_internal_error_,name,&
!!$ &a_err='Build ac = op_restr x am3')
!!$ goto 9999
!!$ end if
@@ -116,7 +116,7 @@ subroutine amg_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_cspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_cspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_lcspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
@@ -83,8 +83,8 @@ subroutine amg_d_dec_aggregator_build_tprol(ag,parms,ag_data,&
class(amg_d_dec_aggregator_type), target, intent(inout) :: ag
type(amg_dml_parms), intent(inout) :: parms
type(amg_daggr_data), intent(in) :: ag_data
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_dspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_ldspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
@@ -48,7 +48,7 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
use amg_base_prec_type
use amg_d_inner_mod
#if defined(SERIAL_MPI)
use amg_d_parmatch_aggregator_mod
use amg_d_parmatch_aggregator_mod
#else
use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_aggregator_build_tprol
#endif
@@ -58,7 +58,7 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
type(amg_dml_parms), intent(inout) :: parms
type(amg_daggr_data), intent(in) :: ag_data
type(psb_dspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_ldspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
@@ -68,7 +68,8 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
real(psb_dpk_), allocatable :: tmpw(:), tmpwnxt(:)
integer(psb_lpk_), allocatable :: ixaggr(:), nxaggr(:), tlaggr(:), ivr(:)
type(psb_dspmat_type) :: a_tmp
integer(c_int) :: match_algorithm, n_sweeps, max_csize, max_nlevels
integer(psb_ipk_) :: match_algorithm, n_sweeps
integer(psb_lpk_) :: target_csize
character(len=40) :: name, ch_err
character(len=80) :: fname, prefix_
type(psb_ctxt_type) :: ictxt
@@ -128,27 +129,22 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
write(debug_unit, *) 'Warning: AGGR_SIZE reset to value ',2**n_sweeps
end if
end if
if (ag%max_csize > 0) then
max_csize = ag%max_csize
if (ag_data%target_coarse_size > 0) then
target_csize = ag_data%target_coarse_size
else
max_csize = ag_data%min_coarse_size
end if
if (ag%max_nlevels > 0) then
max_nlevels = ag%max_nlevels
else
max_nlevels = ag_data%max_levs
target_csize = ag_data%min_coarse_size
end if
if (.true.) then
block
integer(psb_ipk_) :: ipv(2)
ipv(1) = max_csize
ipv(1) = target_csize
ipv(2) = n_sweeps
call psb_bcast(ictxt,ipv)
max_csize = ipv(1)
target_csize = ipv(1)
n_sweeps = ipv(2)
end block
else
call psb_bcast(ictxt,max_csize)
call psb_bcast(ictxt,target_csize)
call psb_bcast(ictxt,n_sweeps)
end if
if (n_sweeps /= ag%n_sweeps) then
@@ -156,7 +152,7 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
end if
!!$ if (me==0) write(0,*) 'Matching sweeps: ',n_sweeps
n_sweeps = max(1,n_sweeps)
if (debug) write(0,*) me,' Copies, with n_sweeps: ',n_sweeps,max_csize
if (debug) write(0,*) me,' Copies, with n_sweeps: ',n_sweeps,target_csize
if (ag%unsmoothed_hierarchy.and.allocated(ag%base_a)) then
call ag%base_a%cp_to(acsr)
if (ag%do_clean_zeros) call acsr%clean_zeros(info)
@@ -242,7 +238,7 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
if (debug) then
call psb_barrier(ictxt)
if (me == 0) write(0,*) 'N_sweeps ',n_sweeps,nr,desc_acv(0)%is_ok(),max_csize
if (me == 0) write(0,*) 'N_sweeps ',n_sweeps,nr,desc_acv(0)%is_ok(),target_csize
end if
!
@@ -264,7 +260,7 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
!
if (debug) write(0,*) me,' Into matchbox_build_prol ',info
if (do_timings) call psb_tic(idx_mboxp)
call dmatchboxp_build_prol(tmpw,acv(i-1),desc_acv(i-1),ixaggr,nxaggr,tmp_prol,info,&
call amg_d_matchboxp_build_prol(tmpw,acv(i-1),desc_acv(i-1),ixaggr,nxaggr,tmp_prol,info,&
& symmetrize=ag%need_symmetrize,reproducible=ag%reproducible_matching)
if (do_timings) call psb_toc(idx_mboxp)
if (debug) write(0,*) me,' Out from matchbox_build_prol ',info
@@ -300,11 +296,11 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
if (debug) then
call psb_barrier(ictxt)
if (me==0) write(0,*) me,trim(name),' Done mat_asb:',i,sum(nxaggr),max_csize,info
if (me==0) write(0,*) me,trim(name),' Done mat_asb:',i,sum(nxaggr),target_csize,info
csz = sum(nxaggr)
call psb_bcast(ictxt,csz)
if (csz /= sum(nxaggr)) write(0,*) me,trim(name),' Mismatch matasb',&
& csz,sum(nxaggr),max_csize
& csz,sum(nxaggr),target_csize
end if
if (psb_errstatus_fatal()) write(0,*)me,trim(name),'Error fatal on entry to tmpwnxt 2'
@@ -342,10 +338,10 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
call move_alloc(tmpwnxt,tmpw)
if (debug) then
if (csz /= sum(nlaggr)) write(0,*) me,trim(name),' Mismatch 2 matasb',&
& csz,sum(nlaggr),max_csize, info
& csz,sum(nlaggr),target_csize, info
end if
call acv(i-1)%free()
if ((sum(nlaggr) <= max_csize).or.(any(nlaggr==0))) then
if ((sum(nlaggr) <= target_csize).or.(any(nlaggr==0))) then
x_sweeps = i
exit sweeps_loop
end if
@@ -122,7 +122,7 @@ subroutine amg_d_parmatch_smth_bld(ag,a,desc_a,ilaggr,nlaggr,parms,&
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_dspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_dspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
@@ -108,7 +108,7 @@ subroutine amg_d_parmatch_spmm_bld(a,desc_a,ilaggr,nlaggr,parms,&
! Arguments
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: t_prol
@@ -108,11 +108,11 @@ subroutine amg_d_parmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,&
! Arguments
type(psb_d_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_dspmat_type), intent(out) :: ac, op_prol, op_restr
type(psb_dspmat_type), intent(inout) :: ac, op_prol, op_restr
type(psb_desc_type), intent(out) :: desc_ac
integer(psb_ipk_), intent(out) :: info
@@ -108,7 +108,7 @@ subroutine amg_d_parmatch_spmm_bld_ov(a,desc_a,ilaggr,nlaggr,parms,&
! Arguments
type(psb_dspmat_type), intent(inout) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: t_prol
@@ -86,8 +86,8 @@ subroutine amg_d_symdec_aggregator_build_tprol(ag,parms,ag_data,&
class(amg_d_symdec_aggregator_type), target, intent(inout) :: ag
type(amg_dml_parms), intent(inout) :: parms
type(amg_daggr_data), intent(in) :: ag_data
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_dspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_ldspmat_type), intent(out) :: op_prol
integer(psb_ipk_), intent(out) :: info
@@ -105,7 +105,7 @@
!
!
subroutine amg_daggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,info)
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use amg_base_prec_type
use amg_d_inner_mod, amg_protect_name => amg_daggrmat_minnrg_bld
@@ -117,8 +117,8 @@ subroutine amg_daggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: op_prol
type(psb_ldspmat_type), intent(out) :: ac,op_restr
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_dspmat_type), intent(inout) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
@@ -171,6 +171,8 @@ subroutine amg_daggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
filter_mat = (parms%aggr_filter == amg_filter_mat_)
!NEEDS TO BE REWORKED !!
! naggr: number of local aggregates
! nrow: local rows.
!
@@ -183,361 +185,361 @@ subroutine amg_daggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
goto 9999
end if
! Get the diagonal D
adiag = a%get_diag(info)
if (info == psb_success_) &
& call psb_realloc(ncol,adiag,info)
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%cp_to_l(la)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
goto 9999
end if
do i=1,size(adiag)
if (adiag(i) /= dzero) then
adinv(i) = done / adiag(i)
else
adinv(i) = done
end if
end do
! 1. Allocate Ptilde in sparse matrix form
call op_prol%mv_to(tmpcoo)
call ptilde%mv_from(tmpcoo)
call ptilde%cscnv(info,type='csr')
if (info == psb_success_) call la%cscnv(am3,info,type='csr',dupl=psb_dupl_add_)
if (info == psb_success_) call la%cscnv(da,info,type='csr',dupl=psb_dupl_add_)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& ' Initial copies done.'
call da%scal(adinv,info)
call psb_spspmm(da,ptilde,dap,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
goto 9999
end if
call dap%clone(atmp,info)
call psb_sphalo(atmp,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.,outfmt='CSR ')
if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=am4)
if (info == psb_success_) call am4%free()
call psb_spspmm(da,atmp,dadap,info)
call atmp%free()
! !$ write(0,*) 'Columns of AP',psb_sp_get_ncols(ap)
! !$ write(0,*) 'Columns of ADAP',psb_sp_get_ncols(adap)
call dap%mv_to(csc_dap)
call dadap%mv_to(csc_dadap)
call csc_mat_col_prod(csc_dap,csc_dadap,omp,info)
call csc_mat_col_prod(csc_dadap,csc_dadap,oden,info)
call psb_sum(ctxt,omp)
call psb_sum(ctxt,oden)
! !$ write(0,*) trim(name),' OMP :',omp
! !$ write(0,*) trim(name),' ODEN:',oden
omp = omp/oden
! !$ write(0,*) 'Check on output prolongator ',omp(1:min(size(omp),10))
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done NUMBMM 1'
call am3%mv_to(acsr3)
! Compute omega_int
ommx = dzero
do i=1, ncol
if (ilaggr(i) >0) then
omi(i) = omp(ilaggr(i))
else
omi(i) = dzero
end if
if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
end do
! Compute omega_fine
do i=1, nrow
omf(i) = ommx
do j=acsr3%irp(i),acsr3%irp(i+1)-1
if(abs(omi(acsr3%ja(j))) .lt. abs(omf(i))) omf(i)=omi(acsr3%ja(j))
end do
!!$ if(min(real(omf(i)),aimag(omf(i))) < dzero) omf(i) = dzero
if(psb_minreal(omf(i)) < dzero) omf(i) = dzero
end do
omf(1:nrow) = omf(1:nrow) * adinv(1:nrow)
if (filter_mat) then
!
! Build the filtered matrix Af from A
!
call la%cscnv(acsrf,info,dupl=psb_dupl_add_)
do i=1,nrow
tmp = dzero
jd = -1
do j=acsrf%irp(i),acsrf%irp(i+1)-1
if (acsrf%ja(j) == i) jd = j
if (abs(acsrf%val(j)) < theta*sqrt(abs(adiag(i)*adiag(acsrf%ja(j))))) then
tmp=tmp+acsrf%val(j)
acsrf%val(j)=dzero
endif
enddo
if (jd == -1) then
write(0,*) 'Wrong input: we need the diagonal!!!!', i
else
acsrf%val(jd)=acsrf%val(jd)-tmp
end if
enddo
! Take out zeroed terms
call acsrf%clean_zeros(info)
!
! Build the smoothed prolongator using the filtered matrix
!
do i=1,acsrf%get_nrows()
do j=acsrf%irp(i),acsrf%irp(i+1)-1
if (acsrf%ja(j) == i) then
acsrf%val(j) = done - omf(i)*acsrf%val(j)
else
acsrf%val(j) = - omf(i)*acsrf%val(j)
end if
end do
end do
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done gather, going for SYMBMM 1'
call af%mv_from(acsrf)
!
! op_prol = (I-w*D*Af)Ptilde
! Doing it this way means to consider diag(Af_i)
!
!
call psb_spspmm(af,ptilde,op_prol,info)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 1'
else
!
! Build the smoothed prolongator using the original matrix
!
do i=1,acsr3%get_nrows()
do j=acsr3%irp(i),acsr3%irp(i+1)-1
if (acsr3%ja(j) == i) then
acsr3%val(j) = done - omf(i)*acsr3%val(j)
else
acsr3%val(j) = - omf(i)*acsr3%val(j)
end if
end do
end do
call am3%mv_from(acsr3)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done gather, going for SYMBMM 1'
!
!
! op_prol = (I-w*D*A)Ptilde
!
!
call psb_spspmm(am3,ptilde,op_prol,info)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done NUMBMM 1'
end if
!
! Ok, let's start over with the restrictor
!
call ptilde%transc(rtilde)
call la%cscnv(atmp,info,type='csr')
call psb_sphalo(atmp,desc_a,am4,info,&
& colcnv=.true.,rowscale=.true.)
nrt = am4%get_nrows()
call am4%csclip(atmp2,info,lone,nrt,lone,ncol)
call atmp2%cscnv(info,type='CSR')
if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=atmp2)
call am4%free()
call atmp2%free()
! This is to compute the transpose. It ONLY works if the
! original A has a symmetric pattern.
call atmp%transc(atmp2)
call atmp2%csclip(dat,info,lone,nrow,lone,ncol)
call dat%cscnv(info,type='csr')
call dat%scal(adinv,info)
! Now for the product.
call psb_spspmm(dat,ptilde,datp,info)
call datp%clone(atmp2,info)
call psb_sphalo(atmp2,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.,outfmt='CSR ')
if (info == psb_success_) call psb_rwextd(ncol,atmp2,info,b=am4)
if (info == psb_success_) call am4%free()
call psb_symbmm(dat,atmp2,datdatp,info)
call psb_numbmm(dat,atmp2,datdatp)
call atmp2%free()
call datp%mv_to(csc_datp)
call datdatp%mv_to(csc_datdatp)
call csc_mat_col_prod(csc_datp,csc_datdatp,omp,info)
call csc_mat_col_prod(csc_datdatp,csc_datdatp,oden,info)
call psb_sum(ctxt,omp)
call psb_sum(ctxt,oden)
! !$ write(debug_unit,*) trim(name),' OMP_R :',omp
! ! $ write(debug_unit,*) trim(name),' ODEN_R:',oden
omp = omp/oden
! !$ write(0,*) 'Check on output restrictor',omp(1:min(size(omp),10))
! Compute omega_int
ommx = dzero
do i=1, ncol
if (ilaggr(i) >0) then
omi(i) = omp(ilaggr(i))
else
omi(i) = dzero
end if
if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
end do
! Compute omega_fine
! Going over the columns of atmp means going over the rows
! of A^T. Hopefully ;-)
call atmp%cp_to(acsc)
do i=1, nrow
omf(i) = ommx
do j= acsc%icp(i),acsc%icp(i+1)-1
if(abs(omi(acsc%ia(j))) .lt. abs(omf(i))) omf(i)=omi(acsc%ia(j))
end do
!!$ if(min(real(omf(i)),aimag(omf(i))) < dzero) omf(i) = dzero
if(psb_minreal(omf(i)) < dzero) omf(i) = dzero
end do
omf(1:nrow) = omf(1:nrow)*adinv(1:nrow)
call psb_halo(omf,desc_a,info)
call acsc%free()
call atmp%mv_to(acsr1)
do i=1,acsr1%get_nrows()
do j=acsr1%irp(i),acsr1%irp(i+1)-1
if (acsr1%ja(j) == i) then
acsr1%val(j) = done - acsr1%val(j)*omf(acsr1%ja(j))
else
acsr1%val(j) = - acsr1%val(j)*omf(acsr1%ja(j))
end if
end do
end do
call atmp%mv_from(acsr1)
call rtilde%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
i=0
do k=1, nzl
if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
i = i+1
tmpcoo%val(i) = tmpcoo%val(k)
tmpcoo%ia(i) = tmpcoo%ia(k)
tmpcoo%ja(i) = tmpcoo%ja(k)
end if
end do
call tmpcoo%set_nzeros(i)
call rtilde%mv_from(tmpcoo)
call rtilde%cscnv(info,type='csr')
call psb_spspmm(rtilde,atmp,op_restr,info)
!
! Now we have to gather the halo of op_prol, and add it to itself
! to multiply it by A,
!
call op_prol%clone(tmp_prol,info)
if (info == psb_success_) call psb_sphalo(tmp_prol,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.)
if (info == psb_success_) call psb_rwextd(ncol,tmp_prol,info,b=am4)
if (info == psb_success_) call am4%free()
if(info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,a_err='Halo of op_prol')
goto 9999
end if
!
! Now we have to fix this. The only rows of B that are correct
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!
call op_restr%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
i=0
do k=1, nzl
if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
i = i+1
tmpcoo%val(i) = tmpcoo%val(k)
tmpcoo%ia(i) = tmpcoo%ia(k)
tmpcoo%ja(i) = tmpcoo%ja(k)
end if
end do
call tmpcoo%set_nzeros(i)
call op_restr%mv_from(tmpcoo)
call op_restr%cscnv(info,type='csr')
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'starting sphalo/ rwxtd'
call psb_spspmm(la,tmp_prol,am3,info)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 2'
call psb_sphalo(am3,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.)
if (info == psb_success_) call psb_rwextd(ncol,am3,info,b=am4)
if (info == psb_success_) call am4%free()
if(info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
& a_err='Extend am3')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done sphalo/ rwxtd'
call psb_spspmm(op_restr,am3,ac,info)
if (info == psb_success_) call am3%free()
if (info == psb_success_) call ac%cscnv(info,type='coo',dupl=psb_dupl_add_)
if (info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
&a_err='Build ac = op_restr x am3')
goto 9999
end if
!!$ ! Get the diagonal D
!!$ adiag = a%get_diag(info)
!!$ if (info == psb_success_) &
!!$ & call psb_realloc(ncol,adiag,info)
!!$ if (info == psb_success_) &
!!$ & call psb_halo(adiag,desc_a,info)
!!$ if (info == psb_success_) call a%cp_to_l(la)
!!$ if (info /= psb_success_) then
!!$ call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
!!$ goto 9999
!!$ end if
!!$
!!$ do i=1,size(adiag)
!!$ if (adiag(i) /= dzero) then
!!$ adinv(i) = done / adiag(i)
!!$ else
!!$ adinv(i) = done
!!$ end if
!!$ end do
!!$
!!$
!!$
!!$ ! 1. Allocate Ptilde in sparse matrix form
!!$ call op_prol%mv_to(tmpcoo)
!!$ call ptilde%mv_from(tmpcoo)
!!$ call ptilde%cscnv(info,type='csr')
!!$
!!$ if (info == psb_success_) call la%cscnv(am3,info,type='csr',dupl=psb_dupl_add_)
!!$ if (info == psb_success_) call la%cscnv(da,info,type='csr',dupl=psb_dupl_add_)
!!$ if (info /= psb_success_) then
!!$ call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv')
!!$ goto 9999
!!$ end if
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & ' Initial copies done.'
!!$
!!$ call da%scal(adinv,info)
!!$
!!$ call psb_spspmm(da,ptilde,dap,info)
!!$
!!$ if(info /= psb_success_) then
!!$ call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
!!$ goto 9999
!!$ end if
!!$
!!$ call dap%clone(atmp,info)
!!$
!!$ call psb_sphalo(atmp,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.,outfmt='CSR ')
!!$ if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$ call psb_spspmm(da,atmp,dadap,info)
!!$ call atmp%free()
!!$
!!$ ! !$ write(0,*) 'Columns of AP',psb_sp_get_ncols(ap)
!!$ ! !$ write(0,*) 'Columns of ADAP',psb_sp_get_ncols(adap)
!!$ call dap%mv_to(csc_dap)
!!$ call dadap%mv_to(csc_dadap)
!!$
!!$ call csc_mat_col_prod(csc_dap,csc_dadap,omp,info)
!!$ call csc_mat_col_prod(csc_dadap,csc_dadap,oden,info)
!!$ call psb_sum(ctxt,omp)
!!$ call psb_sum(ctxt,oden)
!!$ ! !$ write(0,*) trim(name),' OMP :',omp
!!$ ! !$ write(0,*) trim(name),' ODEN:',oden
!!$
!!$ omp = omp/oden
!!$
!!$ ! !$ write(0,*) 'Check on output prolongator ',omp(1:min(size(omp),10))
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done NUMBMM 1'
!!$
!!$ call am3%mv_to(acsr3)
!!$ ! Compute omega_int
!!$ ommx = dzero
!!$ do i=1, ncol
!!$ if (ilaggr(i) >0) then
!!$ omi(i) = omp(ilaggr(i))
!!$ else
!!$ omi(i) = dzero
!!$ end if
!!$ if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
!!$ end do
!!$ ! Compute omega_fine
!!$ do i=1, nrow
!!$ omf(i) = ommx
!!$ do j=acsr3%irp(i),acsr3%irp(i+1)-1
!!$ if(abs(omi(acsr3%ja(j))) .lt. abs(omf(i))) omf(i)=omi(acsr3%ja(j))
!!$ end do
!!$ ! ! if(min(real(omf(i)),aimag(omf(i))) < dzero) omf(i) = dzero
!!$ if(psb_minreal(omf(i)) < dzero) omf(i) = dzero
!!$ end do
!!$
!!$ omf(1:nrow) = omf(1:nrow) * adinv(1:nrow)
!!$
!!$ if (filter_mat) then
!!$ !
!!$ ! Build the filtered matrix Af from A
!!$ !
!!$ call la%cscnv(acsrf,info,dupl=psb_dupl_add_)
!!$
!!$ do i=1,nrow
!!$ tmp = dzero
!!$ jd = -1
!!$ do j=acsrf%irp(i),acsrf%irp(i+1)-1
!!$ if (acsrf%ja(j) == i) jd = j
!!$ if (abs(acsrf%val(j)) < theta*sqrt(abs(adiag(i)*adiag(acsrf%ja(j))))) then
!!$ tmp=tmp+acsrf%val(j)
!!$ acsrf%val(j)=dzero
!!$ endif
!!$ enddo
!!$ if (jd == -1) then
!!$ write(0,*) 'Wrong input: we need the diagonal!!!!', i
!!$ else
!!$ acsrf%val(jd)=acsrf%val(jd)-tmp
!!$ end if
!!$ enddo
!!$ ! Take out zeroed terms
!!$ call acsrf%clean_zeros(info)
!!$
!!$ !
!!$ ! Build the smoothed prolongator using the filtered matrix
!!$ !
!!$ do i=1,acsrf%get_nrows()
!!$ do j=acsrf%irp(i),acsrf%irp(i+1)-1
!!$ if (acsrf%ja(j) == i) then
!!$ acsrf%val(j) = done - omf(i)*acsrf%val(j)
!!$ else
!!$ acsrf%val(j) = - omf(i)*acsrf%val(j)
!!$ end if
!!$ end do
!!$ end do
!!$
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done gather, going for SYMBMM 1'
!!$
!!$ call af%mv_from(acsrf)
!!$ !
!!$ ! op_prol = (I-w*D*Af)Ptilde
!!$ ! Doing it this way means to consider diag(Af_i)
!!$ !
!!$ !
!!$ call psb_spspmm(af,ptilde,op_prol,info)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done SPSPMM 1'
!!$ else
!!$ !
!!$ ! Build the smoothed prolongator using the original matrix
!!$ !
!!$ do i=1,acsr3%get_nrows()
!!$ do j=acsr3%irp(i),acsr3%irp(i+1)-1
!!$ if (acsr3%ja(j) == i) then
!!$ acsr3%val(j) = done - omf(i)*acsr3%val(j)
!!$ else
!!$ acsr3%val(j) = - omf(i)*acsr3%val(j)
!!$ end if
!!$ end do
!!$ end do
!!$
!!$ call am3%mv_from(acsr3)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done gather, going for SYMBMM 1'
!!$ !
!!$ !
!!$ ! op_prol = (I-w*D*A)Ptilde
!!$ !
!!$ !
!!$ call psb_spspmm(am3,ptilde,op_prol,info)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done NUMBMM 1'
!!$
!!$ end if
!!$
!!$
!!$ !
!!$ ! Ok, let's start over with the restrictor
!!$ !
!!$ call ptilde%transc(rtilde)
!!$ call la%cscnv(atmp,info,type='csr')
!!$ call psb_sphalo(atmp,desc_a,am4,info,&
!!$ & colcnv=.true.,rowscale=.true.)
!!$ nrt = am4%get_nrows()
!!$ call am4%csclip(atmp2,info,lone,nrt,lone,ncol)
!!$ call atmp2%cscnv(info,type='CSR')
!!$ if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=atmp2)
!!$ call am4%free()
!!$ call atmp2%free()
!!$
!!$ ! This is to compute the transpose. It ONLY works if the
!!$ ! original A has a symmetric pattern.
!!$ call atmp%transc(atmp2)
!!$ call atmp2%csclip(dat,info,lone,nrow,lone,ncol)
!!$ call dat%cscnv(info,type='csr')
!!$ call dat%scal(adinv,info)
!!$
!!$ ! Now for the product.
!!$ call psb_spspmm(dat,ptilde,datp,info)
!!$
!!$ call datp%clone(atmp2,info)
!!$ call psb_sphalo(atmp2,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.,outfmt='CSR ')
!!$ if (info == psb_success_) call psb_rwextd(ncol,atmp2,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$
!!$ call psb_symbmm(dat,atmp2,datdatp,info)
!!$ call psb_numbmm(dat,atmp2,datdatp)
!!$ call atmp2%free()
!!$
!!$ call datp%mv_to(csc_datp)
!!$ call datdatp%mv_to(csc_datdatp)
!!$
!!$ call csc_mat_col_prod(csc_datp,csc_datdatp,omp,info)
!!$ call csc_mat_col_prod(csc_datdatp,csc_datdatp,oden,info)
!!$ call psb_sum(ctxt,omp)
!!$ call psb_sum(ctxt,oden)
!!$
!!$
!!$ ! !$ write(debug_unit,*) trim(name),' OMP_R :',omp
!!$ ! ! $ write(debug_unit,*) trim(name),' ODEN_R:',oden
!!$ omp = omp/oden
!!$ ! !$ write(0,*) 'Check on output restrictor',omp(1:min(size(omp),10))
!!$ ! Compute omega_int
!!$ ommx = dzero
!!$ do i=1, ncol
!!$ if (ilaggr(i) >0) then
!!$ omi(i) = omp(ilaggr(i))
!!$ else
!!$ omi(i) = dzero
!!$ end if
!!$ if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
!!$ end do
!!$ ! Compute omega_fine
!!$ ! Going over the columns of atmp means going over the rows
!!$ ! of A^T. Hopefully ;-)
!!$ call atmp%cp_to(acsc)
!!$
!!$ do i=1, nrow
!!$ omf(i) = ommx
!!$ do j= acsc%icp(i),acsc%icp(i+1)-1
!!$ if(abs(omi(acsc%ia(j))) .lt. abs(omf(i))) omf(i)=omi(acsc%ia(j))
!!$ end do
!!$ ! ! if(min(real(omf(i)),aimag(omf(i))) < dzero) omf(i) = dzero
!!$ if(psb_minreal(omf(i)) < dzero) omf(i) = dzero
!!$ end do
!!$ omf(1:nrow) = omf(1:nrow)*adinv(1:nrow)
!!$ call psb_halo(omf,desc_a,info)
!!$ call acsc%free()
!!$
!!$
!!$ call atmp%mv_to(acsr1)
!!$
!!$ do i=1,acsr1%get_nrows()
!!$ do j=acsr1%irp(i),acsr1%irp(i+1)-1
!!$ if (acsr1%ja(j) == i) then
!!$ acsr1%val(j) = done - acsr1%val(j)*omf(acsr1%ja(j))
!!$ else
!!$ acsr1%val(j) = - acsr1%val(j)*omf(acsr1%ja(j))
!!$ end if
!!$ end do
!!$ end do
!!$ call atmp%mv_from(acsr1)
!!$
!!$ call rtilde%mv_to(tmpcoo)
!!$ nzl = tmpcoo%get_nzeros()
!!$ i=0
!!$ do k=1, nzl
!!$ if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
!!$ i = i+1
!!$ tmpcoo%val(i) = tmpcoo%val(k)
!!$ tmpcoo%ia(i) = tmpcoo%ia(k)
!!$ tmpcoo%ja(i) = tmpcoo%ja(k)
!!$ end if
!!$ end do
!!$ call tmpcoo%set_nzeros(i)
!!$ call rtilde%mv_from(tmpcoo)
!!$ call rtilde%cscnv(info,type='csr')
!!$
!!$ call psb_spspmm(rtilde,atmp,op_restr,info)
!!$
!!$ !
!!$ ! Now we have to gather the halo of op_prol, and add it to itself
!!$ ! to multiply it by A,
!!$ !
!!$ call op_prol%clone(tmp_prol,info)
!!$ if (info == psb_success_) call psb_sphalo(tmp_prol,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.)
!!$ if (info == psb_success_) call psb_rwextd(ncol,tmp_prol,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$ if(info /= psb_success_) then
!!$ call psb_errpush(psb_err_internal_error_,name,a_err='Halo of op_prol')
!!$ goto 9999
!!$ end if
!!$
!!$ !
!!$ ! Now we have to fix this. The only rows of B that are correct
!!$ ! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!!$ !
!!$ call op_restr%mv_to(tmpcoo)
!!$
!!$ nzl = tmpcoo%get_nzeros()
!!$ i=0
!!$ do k=1, nzl
!!$ if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
!!$ i = i+1
!!$ tmpcoo%val(i) = tmpcoo%val(k)
!!$ tmpcoo%ia(i) = tmpcoo%ia(k)
!!$ tmpcoo%ja(i) = tmpcoo%ja(k)
!!$ end if
!!$ end do
!!$ call tmpcoo%set_nzeros(i)
!!$ call op_restr%mv_from(tmpcoo)
!!$ call op_restr%cscnv(info,type='csr')
!!$
!!$
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'starting sphalo/ rwxtd'
!!$
!!$ call psb_spspmm(la,tmp_prol,am3,info)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done SPSPMM 2'
!!$
!!$ call psb_sphalo(am3,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.)
!!$ if (info == psb_success_) call psb_rwextd(ncol,am3,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$ if(info /= psb_success_) then
!!$ call psb_errpush(psb_err_internal_error_,name,&
!!$ & a_err='Extend am3')
!!$ goto 9999
!!$ end if
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done sphalo/ rwxtd'
!!$
!!$ call psb_spspmm(op_restr,am3,ac,info)
!!$ if (info == psb_success_) call am3%free()
!!$ if (info == psb_success_) call ac%cscnv(info,type='coo',dupl=psb_dupl_add_)
!!$
!!$ if (info /= psb_success_) then
!!$ call psb_errpush(psb_err_internal_error_,name,&
!!$ &a_err='Build ac = op_restr x am3')
!!$ goto 9999
!!$ end if
@@ -116,7 +116,7 @@ subroutine amg_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_dspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_dspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
@@ -83,8 +83,8 @@ subroutine amg_s_dec_aggregator_build_tprol(ag,parms,ag_data,&
class(amg_s_dec_aggregator_type), target, intent(inout) :: ag
type(amg_sml_parms), intent(inout) :: parms
type(amg_saggr_data), intent(in) :: ag_data
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_sspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lsspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
@@ -48,7 +48,7 @@ subroutine amg_s_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
use amg_base_prec_type
use amg_s_inner_mod
#if defined(SERIAL_MPI)
use amg_s_parmatch_aggregator_mod
use amg_s_parmatch_aggregator_mod
#else
use amg_s_parmatch_aggregator_mod, amg_protect_name => amg_s_parmatch_aggregator_build_tprol
#endif
@@ -58,7 +58,7 @@ subroutine amg_s_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
type(amg_sml_parms), intent(inout) :: parms
type(amg_saggr_data), intent(in) :: ag_data
type(psb_sspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lsspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
@@ -68,7 +68,8 @@ subroutine amg_s_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
real(psb_spk_), allocatable :: tmpw(:), tmpwnxt(:)
integer(psb_lpk_), allocatable :: ixaggr(:), nxaggr(:), tlaggr(:), ivr(:)
type(psb_sspmat_type) :: a_tmp
integer(c_int) :: match_algorithm, n_sweeps, max_csize, max_nlevels
integer(psb_ipk_) :: match_algorithm, n_sweeps
integer(psb_lpk_) :: target_csize
character(len=40) :: name, ch_err
character(len=80) :: fname, prefix_
type(psb_ctxt_type) :: ictxt
@@ -128,27 +129,22 @@ subroutine amg_s_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
write(debug_unit, *) 'Warning: AGGR_SIZE reset to value ',2**n_sweeps
end if
end if
if (ag%max_csize > 0) then
max_csize = ag%max_csize
if (ag_data%target_coarse_size > 0) then
target_csize = ag_data%target_coarse_size
else
max_csize = ag_data%min_coarse_size
end if
if (ag%max_nlevels > 0) then
max_nlevels = ag%max_nlevels
else
max_nlevels = ag_data%max_levs
target_csize = ag_data%min_coarse_size
end if
if (.true.) then
block
integer(psb_ipk_) :: ipv(2)
ipv(1) = max_csize
ipv(1) = target_csize
ipv(2) = n_sweeps
call psb_bcast(ictxt,ipv)
max_csize = ipv(1)
target_csize = ipv(1)
n_sweeps = ipv(2)
end block
else
call psb_bcast(ictxt,max_csize)
call psb_bcast(ictxt,target_csize)
call psb_bcast(ictxt,n_sweeps)
end if
if (n_sweeps /= ag%n_sweeps) then
@@ -156,7 +152,7 @@ subroutine amg_s_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
end if
!!$ if (me==0) write(0,*) 'Matching sweeps: ',n_sweeps
n_sweeps = max(1,n_sweeps)
if (debug) write(0,*) me,' Copies, with n_sweeps: ',n_sweeps,max_csize
if (debug) write(0,*) me,' Copies, with n_sweeps: ',n_sweeps,target_csize
if (ag%unsmoothed_hierarchy.and.allocated(ag%base_a)) then
call ag%base_a%cp_to(acsr)
if (ag%do_clean_zeros) call acsr%clean_zeros(info)
@@ -242,7 +238,7 @@ subroutine amg_s_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
if (debug) then
call psb_barrier(ictxt)
if (me == 0) write(0,*) 'N_sweeps ',n_sweeps,nr,desc_acv(0)%is_ok(),max_csize
if (me == 0) write(0,*) 'N_sweeps ',n_sweeps,nr,desc_acv(0)%is_ok(),target_csize
end if
!
@@ -264,7 +260,7 @@ subroutine amg_s_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
!
if (debug) write(0,*) me,' Into matchbox_build_prol ',info
if (do_timings) call psb_tic(idx_mboxp)
call smatchboxp_build_prol(tmpw,acv(i-1),desc_acv(i-1),ixaggr,nxaggr,tmp_prol,info,&
call amg_s_matchboxp_build_prol(tmpw,acv(i-1),desc_acv(i-1),ixaggr,nxaggr,tmp_prol,info,&
& symmetrize=ag%need_symmetrize,reproducible=ag%reproducible_matching)
if (do_timings) call psb_toc(idx_mboxp)
if (debug) write(0,*) me,' Out from matchbox_build_prol ',info
@@ -300,11 +296,11 @@ subroutine amg_s_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
if (debug) then
call psb_barrier(ictxt)
if (me==0) write(0,*) me,trim(name),' Done mat_asb:',i,sum(nxaggr),max_csize,info
if (me==0) write(0,*) me,trim(name),' Done mat_asb:',i,sum(nxaggr),target_csize,info
csz = sum(nxaggr)
call psb_bcast(ictxt,csz)
if (csz /= sum(nxaggr)) write(0,*) me,trim(name),' Mismatch matasb',&
& csz,sum(nxaggr),max_csize
& csz,sum(nxaggr),target_csize
end if
if (psb_errstatus_fatal()) write(0,*)me,trim(name),'Error fatal on entry to tmpwnxt 2'
@@ -342,10 +338,10 @@ subroutine amg_s_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
call move_alloc(tmpwnxt,tmpw)
if (debug) then
if (csz /= sum(nlaggr)) write(0,*) me,trim(name),' Mismatch 2 matasb',&
& csz,sum(nlaggr),max_csize, info
& csz,sum(nlaggr),target_csize, info
end if
call acv(i-1)%free()
if ((sum(nlaggr) <= max_csize).or.(any(nlaggr==0))) then
if ((sum(nlaggr) <= target_csize).or.(any(nlaggr==0))) then
x_sweeps = i
exit sweeps_loop
end if
@@ -122,7 +122,7 @@ subroutine amg_s_parmatch_smth_bld(ag,a,desc_a,ilaggr,nlaggr,parms,&
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_sspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_sspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
@@ -108,7 +108,7 @@ subroutine amg_s_parmatch_spmm_bld(a,desc_a,ilaggr,nlaggr,parms,&
! Arguments
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: t_prol
@@ -108,11 +108,11 @@ subroutine amg_s_parmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,&
! Arguments
type(psb_s_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_sspmat_type), intent(out) :: ac, op_prol, op_restr
type(psb_sspmat_type), intent(inout) :: ac, op_prol, op_restr
type(psb_desc_type), intent(out) :: desc_ac
integer(psb_ipk_), intent(out) :: info
@@ -108,7 +108,7 @@ subroutine amg_s_parmatch_spmm_bld_ov(a,desc_a,ilaggr,nlaggr,parms,&
! Arguments
type(psb_sspmat_type), intent(inout) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: t_prol
@@ -86,8 +86,8 @@ subroutine amg_s_symdec_aggregator_build_tprol(ag,parms,ag_data,&
class(amg_s_symdec_aggregator_type), target, intent(inout) :: ag
type(amg_sml_parms), intent(inout) :: parms
type(amg_saggr_data), intent(in) :: ag_data
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_sspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lsspmat_type), intent(out) :: op_prol
integer(psb_ipk_), intent(out) :: info
@@ -105,7 +105,7 @@
!
!
subroutine amg_saggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,info)
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use amg_base_prec_type
use amg_s_inner_mod, amg_protect_name => amg_saggrmat_minnrg_bld
@@ -117,8 +117,8 @@ subroutine amg_saggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: op_prol
type(psb_lsspmat_type), intent(out) :: ac,op_restr
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_sspmat_type), intent(inout) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
@@ -171,6 +171,8 @@ subroutine amg_saggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
filter_mat = (parms%aggr_filter == amg_filter_mat_)
!NEEDS TO BE REWORKED !!
! naggr: number of local aggregates
! nrow: local rows.
!
@@ -183,361 +185,361 @@ subroutine amg_saggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
goto 9999
end if
! Get the diagonal D
adiag = a%get_diag(info)
if (info == psb_success_) &
& call psb_realloc(ncol,adiag,info)
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%cp_to_l(la)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
goto 9999
end if
do i=1,size(adiag)
if (adiag(i) /= szero) then
adinv(i) = sone / adiag(i)
else
adinv(i) = sone
end if
end do
! 1. Allocate Ptilde in sparse matrix form
call op_prol%mv_to(tmpcoo)
call ptilde%mv_from(tmpcoo)
call ptilde%cscnv(info,type='csr')
if (info == psb_success_) call la%cscnv(am3,info,type='csr',dupl=psb_dupl_add_)
if (info == psb_success_) call la%cscnv(da,info,type='csr',dupl=psb_dupl_add_)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& ' Initial copies done.'
call da%scal(adinv,info)
call psb_spspmm(da,ptilde,dap,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
goto 9999
end if
call dap%clone(atmp,info)
call psb_sphalo(atmp,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.,outfmt='CSR ')
if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=am4)
if (info == psb_success_) call am4%free()
call psb_spspmm(da,atmp,dadap,info)
call atmp%free()
! !$ write(0,*) 'Columns of AP',psb_sp_get_ncols(ap)
! !$ write(0,*) 'Columns of ADAP',psb_sp_get_ncols(adap)
call dap%mv_to(csc_dap)
call dadap%mv_to(csc_dadap)
call csc_mat_col_prod(csc_dap,csc_dadap,omp,info)
call csc_mat_col_prod(csc_dadap,csc_dadap,oden,info)
call psb_sum(ctxt,omp)
call psb_sum(ctxt,oden)
! !$ write(0,*) trim(name),' OMP :',omp
! !$ write(0,*) trim(name),' ODEN:',oden
omp = omp/oden
! !$ write(0,*) 'Check on output prolongator ',omp(1:min(size(omp),10))
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done NUMBMM 1'
call am3%mv_to(acsr3)
! Compute omega_int
ommx = szero
do i=1, ncol
if (ilaggr(i) >0) then
omi(i) = omp(ilaggr(i))
else
omi(i) = szero
end if
if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
end do
! Compute omega_fine
do i=1, nrow
omf(i) = ommx
do j=acsr3%irp(i),acsr3%irp(i+1)-1
if(abs(omi(acsr3%ja(j))) .lt. abs(omf(i))) omf(i)=omi(acsr3%ja(j))
end do
!!$ if(min(real(omf(i)),aimag(omf(i))) < szero) omf(i) = szero
if(psb_minreal(omf(i)) < szero) omf(i) = szero
end do
omf(1:nrow) = omf(1:nrow) * adinv(1:nrow)
if (filter_mat) then
!
! Build the filtered matrix Af from A
!
call la%cscnv(acsrf,info,dupl=psb_dupl_add_)
do i=1,nrow
tmp = szero
jd = -1
do j=acsrf%irp(i),acsrf%irp(i+1)-1
if (acsrf%ja(j) == i) jd = j
if (abs(acsrf%val(j)) < theta*sqrt(abs(adiag(i)*adiag(acsrf%ja(j))))) then
tmp=tmp+acsrf%val(j)
acsrf%val(j)=szero
endif
enddo
if (jd == -1) then
write(0,*) 'Wrong input: we need the diagonal!!!!', i
else
acsrf%val(jd)=acsrf%val(jd)-tmp
end if
enddo
! Take out zeroed terms
call acsrf%clean_zeros(info)
!
! Build the smoothed prolongator using the filtered matrix
!
do i=1,acsrf%get_nrows()
do j=acsrf%irp(i),acsrf%irp(i+1)-1
if (acsrf%ja(j) == i) then
acsrf%val(j) = sone - omf(i)*acsrf%val(j)
else
acsrf%val(j) = - omf(i)*acsrf%val(j)
end if
end do
end do
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done gather, going for SYMBMM 1'
call af%mv_from(acsrf)
!
! op_prol = (I-w*D*Af)Ptilde
! Doing it this way means to consider diag(Af_i)
!
!
call psb_spspmm(af,ptilde,op_prol,info)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 1'
else
!
! Build the smoothed prolongator using the original matrix
!
do i=1,acsr3%get_nrows()
do j=acsr3%irp(i),acsr3%irp(i+1)-1
if (acsr3%ja(j) == i) then
acsr3%val(j) = sone - omf(i)*acsr3%val(j)
else
acsr3%val(j) = - omf(i)*acsr3%val(j)
end if
end do
end do
call am3%mv_from(acsr3)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done gather, going for SYMBMM 1'
!
!
! op_prol = (I-w*D*A)Ptilde
!
!
call psb_spspmm(am3,ptilde,op_prol,info)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done NUMBMM 1'
end if
!
! Ok, let's start over with the restrictor
!
call ptilde%transc(rtilde)
call la%cscnv(atmp,info,type='csr')
call psb_sphalo(atmp,desc_a,am4,info,&
& colcnv=.true.,rowscale=.true.)
nrt = am4%get_nrows()
call am4%csclip(atmp2,info,lone,nrt,lone,ncol)
call atmp2%cscnv(info,type='CSR')
if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=atmp2)
call am4%free()
call atmp2%free()
! This is to compute the transpose. It ONLY works if the
! original A has a symmetric pattern.
call atmp%transc(atmp2)
call atmp2%csclip(dat,info,lone,nrow,lone,ncol)
call dat%cscnv(info,type='csr')
call dat%scal(adinv,info)
! Now for the product.
call psb_spspmm(dat,ptilde,datp,info)
call datp%clone(atmp2,info)
call psb_sphalo(atmp2,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.,outfmt='CSR ')
if (info == psb_success_) call psb_rwextd(ncol,atmp2,info,b=am4)
if (info == psb_success_) call am4%free()
call psb_symbmm(dat,atmp2,datdatp,info)
call psb_numbmm(dat,atmp2,datdatp)
call atmp2%free()
call datp%mv_to(csc_datp)
call datdatp%mv_to(csc_datdatp)
call csc_mat_col_prod(csc_datp,csc_datdatp,omp,info)
call csc_mat_col_prod(csc_datdatp,csc_datdatp,oden,info)
call psb_sum(ctxt,omp)
call psb_sum(ctxt,oden)
! !$ write(debug_unit,*) trim(name),' OMP_R :',omp
! ! $ write(debug_unit,*) trim(name),' ODEN_R:',oden
omp = omp/oden
! !$ write(0,*) 'Check on output restrictor',omp(1:min(size(omp),10))
! Compute omega_int
ommx = szero
do i=1, ncol
if (ilaggr(i) >0) then
omi(i) = omp(ilaggr(i))
else
omi(i) = szero
end if
if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
end do
! Compute omega_fine
! Going over the columns of atmp means going over the rows
! of A^T. Hopefully ;-)
call atmp%cp_to(acsc)
do i=1, nrow
omf(i) = ommx
do j= acsc%icp(i),acsc%icp(i+1)-1
if(abs(omi(acsc%ia(j))) .lt. abs(omf(i))) omf(i)=omi(acsc%ia(j))
end do
!!$ if(min(real(omf(i)),aimag(omf(i))) < szero) omf(i) = szero
if(psb_minreal(omf(i)) < szero) omf(i) = szero
end do
omf(1:nrow) = omf(1:nrow)*adinv(1:nrow)
call psb_halo(omf,desc_a,info)
call acsc%free()
call atmp%mv_to(acsr1)
do i=1,acsr1%get_nrows()
do j=acsr1%irp(i),acsr1%irp(i+1)-1
if (acsr1%ja(j) == i) then
acsr1%val(j) = sone - acsr1%val(j)*omf(acsr1%ja(j))
else
acsr1%val(j) = - acsr1%val(j)*omf(acsr1%ja(j))
end if
end do
end do
call atmp%mv_from(acsr1)
call rtilde%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
i=0
do k=1, nzl
if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
i = i+1
tmpcoo%val(i) = tmpcoo%val(k)
tmpcoo%ia(i) = tmpcoo%ia(k)
tmpcoo%ja(i) = tmpcoo%ja(k)
end if
end do
call tmpcoo%set_nzeros(i)
call rtilde%mv_from(tmpcoo)
call rtilde%cscnv(info,type='csr')
call psb_spspmm(rtilde,atmp,op_restr,info)
!
! Now we have to gather the halo of op_prol, and add it to itself
! to multiply it by A,
!
call op_prol%clone(tmp_prol,info)
if (info == psb_success_) call psb_sphalo(tmp_prol,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.)
if (info == psb_success_) call psb_rwextd(ncol,tmp_prol,info,b=am4)
if (info == psb_success_) call am4%free()
if(info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,a_err='Halo of op_prol')
goto 9999
end if
!
! Now we have to fix this. The only rows of B that are correct
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!
call op_restr%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
i=0
do k=1, nzl
if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
i = i+1
tmpcoo%val(i) = tmpcoo%val(k)
tmpcoo%ia(i) = tmpcoo%ia(k)
tmpcoo%ja(i) = tmpcoo%ja(k)
end if
end do
call tmpcoo%set_nzeros(i)
call op_restr%mv_from(tmpcoo)
call op_restr%cscnv(info,type='csr')
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'starting sphalo/ rwxtd'
call psb_spspmm(la,tmp_prol,am3,info)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 2'
call psb_sphalo(am3,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.)
if (info == psb_success_) call psb_rwextd(ncol,am3,info,b=am4)
if (info == psb_success_) call am4%free()
if(info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
& a_err='Extend am3')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done sphalo/ rwxtd'
call psb_spspmm(op_restr,am3,ac,info)
if (info == psb_success_) call am3%free()
if (info == psb_success_) call ac%cscnv(info,type='coo',dupl=psb_dupl_add_)
if (info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
&a_err='Build ac = op_restr x am3')
goto 9999
end if
!!$ ! Get the diagonal D
!!$ adiag = a%get_diag(info)
!!$ if (info == psb_success_) &
!!$ & call psb_realloc(ncol,adiag,info)
!!$ if (info == psb_success_) &
!!$ & call psb_halo(adiag,desc_a,info)
!!$ if (info == psb_success_) call a%cp_to_l(la)
!!$ if (info /= psb_success_) then
!!$ call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
!!$ goto 9999
!!$ end if
!!$
!!$ do i=1,size(adiag)
!!$ if (adiag(i) /= szero) then
!!$ adinv(i) = sone / adiag(i)
!!$ else
!!$ adinv(i) = sone
!!$ end if
!!$ end do
!!$
!!$
!!$
!!$ ! 1. Allocate Ptilde in sparse matrix form
!!$ call op_prol%mv_to(tmpcoo)
!!$ call ptilde%mv_from(tmpcoo)
!!$ call ptilde%cscnv(info,type='csr')
!!$
!!$ if (info == psb_success_) call la%cscnv(am3,info,type='csr',dupl=psb_dupl_add_)
!!$ if (info == psb_success_) call la%cscnv(da,info,type='csr',dupl=psb_dupl_add_)
!!$ if (info /= psb_success_) then
!!$ call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv')
!!$ goto 9999
!!$ end if
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & ' Initial copies done.'
!!$
!!$ call da%scal(adinv,info)
!!$
!!$ call psb_spspmm(da,ptilde,dap,info)
!!$
!!$ if(info /= psb_success_) then
!!$ call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
!!$ goto 9999
!!$ end if
!!$
!!$ call dap%clone(atmp,info)
!!$
!!$ call psb_sphalo(atmp,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.,outfmt='CSR ')
!!$ if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$ call psb_spspmm(da,atmp,dadap,info)
!!$ call atmp%free()
!!$
!!$ ! !$ write(0,*) 'Columns of AP',psb_sp_get_ncols(ap)
!!$ ! !$ write(0,*) 'Columns of ADAP',psb_sp_get_ncols(adap)
!!$ call dap%mv_to(csc_dap)
!!$ call dadap%mv_to(csc_dadap)
!!$
!!$ call csc_mat_col_prod(csc_dap,csc_dadap,omp,info)
!!$ call csc_mat_col_prod(csc_dadap,csc_dadap,oden,info)
!!$ call psb_sum(ctxt,omp)
!!$ call psb_sum(ctxt,oden)
!!$ ! !$ write(0,*) trim(name),' OMP :',omp
!!$ ! !$ write(0,*) trim(name),' ODEN:',oden
!!$
!!$ omp = omp/oden
!!$
!!$ ! !$ write(0,*) 'Check on output prolongator ',omp(1:min(size(omp),10))
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done NUMBMM 1'
!!$
!!$ call am3%mv_to(acsr3)
!!$ ! Compute omega_int
!!$ ommx = szero
!!$ do i=1, ncol
!!$ if (ilaggr(i) >0) then
!!$ omi(i) = omp(ilaggr(i))
!!$ else
!!$ omi(i) = szero
!!$ end if
!!$ if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
!!$ end do
!!$ ! Compute omega_fine
!!$ do i=1, nrow
!!$ omf(i) = ommx
!!$ do j=acsr3%irp(i),acsr3%irp(i+1)-1
!!$ if(abs(omi(acsr3%ja(j))) .lt. abs(omf(i))) omf(i)=omi(acsr3%ja(j))
!!$ end do
!!$ ! ! if(min(real(omf(i)),aimag(omf(i))) < szero) omf(i) = szero
!!$ if(psb_minreal(omf(i)) < szero) omf(i) = szero
!!$ end do
!!$
!!$ omf(1:nrow) = omf(1:nrow) * adinv(1:nrow)
!!$
!!$ if (filter_mat) then
!!$ !
!!$ ! Build the filtered matrix Af from A
!!$ !
!!$ call la%cscnv(acsrf,info,dupl=psb_dupl_add_)
!!$
!!$ do i=1,nrow
!!$ tmp = szero
!!$ jd = -1
!!$ do j=acsrf%irp(i),acsrf%irp(i+1)-1
!!$ if (acsrf%ja(j) == i) jd = j
!!$ if (abs(acsrf%val(j)) < theta*sqrt(abs(adiag(i)*adiag(acsrf%ja(j))))) then
!!$ tmp=tmp+acsrf%val(j)
!!$ acsrf%val(j)=szero
!!$ endif
!!$ enddo
!!$ if (jd == -1) then
!!$ write(0,*) 'Wrong input: we need the diagonal!!!!', i
!!$ else
!!$ acsrf%val(jd)=acsrf%val(jd)-tmp
!!$ end if
!!$ enddo
!!$ ! Take out zeroed terms
!!$ call acsrf%clean_zeros(info)
!!$
!!$ !
!!$ ! Build the smoothed prolongator using the filtered matrix
!!$ !
!!$ do i=1,acsrf%get_nrows()
!!$ do j=acsrf%irp(i),acsrf%irp(i+1)-1
!!$ if (acsrf%ja(j) == i) then
!!$ acsrf%val(j) = sone - omf(i)*acsrf%val(j)
!!$ else
!!$ acsrf%val(j) = - omf(i)*acsrf%val(j)
!!$ end if
!!$ end do
!!$ end do
!!$
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done gather, going for SYMBMM 1'
!!$
!!$ call af%mv_from(acsrf)
!!$ !
!!$ ! op_prol = (I-w*D*Af)Ptilde
!!$ ! Doing it this way means to consider diag(Af_i)
!!$ !
!!$ !
!!$ call psb_spspmm(af,ptilde,op_prol,info)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done SPSPMM 1'
!!$ else
!!$ !
!!$ ! Build the smoothed prolongator using the original matrix
!!$ !
!!$ do i=1,acsr3%get_nrows()
!!$ do j=acsr3%irp(i),acsr3%irp(i+1)-1
!!$ if (acsr3%ja(j) == i) then
!!$ acsr3%val(j) = sone - omf(i)*acsr3%val(j)
!!$ else
!!$ acsr3%val(j) = - omf(i)*acsr3%val(j)
!!$ end if
!!$ end do
!!$ end do
!!$
!!$ call am3%mv_from(acsr3)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done gather, going for SYMBMM 1'
!!$ !
!!$ !
!!$ ! op_prol = (I-w*D*A)Ptilde
!!$ !
!!$ !
!!$ call psb_spspmm(am3,ptilde,op_prol,info)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done NUMBMM 1'
!!$
!!$ end if
!!$
!!$
!!$ !
!!$ ! Ok, let's start over with the restrictor
!!$ !
!!$ call ptilde%transc(rtilde)
!!$ call la%cscnv(atmp,info,type='csr')
!!$ call psb_sphalo(atmp,desc_a,am4,info,&
!!$ & colcnv=.true.,rowscale=.true.)
!!$ nrt = am4%get_nrows()
!!$ call am4%csclip(atmp2,info,lone,nrt,lone,ncol)
!!$ call atmp2%cscnv(info,type='CSR')
!!$ if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=atmp2)
!!$ call am4%free()
!!$ call atmp2%free()
!!$
!!$ ! This is to compute the transpose. It ONLY works if the
!!$ ! original A has a symmetric pattern.
!!$ call atmp%transc(atmp2)
!!$ call atmp2%csclip(dat,info,lone,nrow,lone,ncol)
!!$ call dat%cscnv(info,type='csr')
!!$ call dat%scal(adinv,info)
!!$
!!$ ! Now for the product.
!!$ call psb_spspmm(dat,ptilde,datp,info)
!!$
!!$ call datp%clone(atmp2,info)
!!$ call psb_sphalo(atmp2,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.,outfmt='CSR ')
!!$ if (info == psb_success_) call psb_rwextd(ncol,atmp2,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$
!!$ call psb_symbmm(dat,atmp2,datdatp,info)
!!$ call psb_numbmm(dat,atmp2,datdatp)
!!$ call atmp2%free()
!!$
!!$ call datp%mv_to(csc_datp)
!!$ call datdatp%mv_to(csc_datdatp)
!!$
!!$ call csc_mat_col_prod(csc_datp,csc_datdatp,omp,info)
!!$ call csc_mat_col_prod(csc_datdatp,csc_datdatp,oden,info)
!!$ call psb_sum(ctxt,omp)
!!$ call psb_sum(ctxt,oden)
!!$
!!$
!!$ ! !$ write(debug_unit,*) trim(name),' OMP_R :',omp
!!$ ! ! $ write(debug_unit,*) trim(name),' ODEN_R:',oden
!!$ omp = omp/oden
!!$ ! !$ write(0,*) 'Check on output restrictor',omp(1:min(size(omp),10))
!!$ ! Compute omega_int
!!$ ommx = szero
!!$ do i=1, ncol
!!$ if (ilaggr(i) >0) then
!!$ omi(i) = omp(ilaggr(i))
!!$ else
!!$ omi(i) = szero
!!$ end if
!!$ if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
!!$ end do
!!$ ! Compute omega_fine
!!$ ! Going over the columns of atmp means going over the rows
!!$ ! of A^T. Hopefully ;-)
!!$ call atmp%cp_to(acsc)
!!$
!!$ do i=1, nrow
!!$ omf(i) = ommx
!!$ do j= acsc%icp(i),acsc%icp(i+1)-1
!!$ if(abs(omi(acsc%ia(j))) .lt. abs(omf(i))) omf(i)=omi(acsc%ia(j))
!!$ end do
!!$ ! ! if(min(real(omf(i)),aimag(omf(i))) < szero) omf(i) = szero
!!$ if(psb_minreal(omf(i)) < szero) omf(i) = szero
!!$ end do
!!$ omf(1:nrow) = omf(1:nrow)*adinv(1:nrow)
!!$ call psb_halo(omf,desc_a,info)
!!$ call acsc%free()
!!$
!!$
!!$ call atmp%mv_to(acsr1)
!!$
!!$ do i=1,acsr1%get_nrows()
!!$ do j=acsr1%irp(i),acsr1%irp(i+1)-1
!!$ if (acsr1%ja(j) == i) then
!!$ acsr1%val(j) = sone - acsr1%val(j)*omf(acsr1%ja(j))
!!$ else
!!$ acsr1%val(j) = - acsr1%val(j)*omf(acsr1%ja(j))
!!$ end if
!!$ end do
!!$ end do
!!$ call atmp%mv_from(acsr1)
!!$
!!$ call rtilde%mv_to(tmpcoo)
!!$ nzl = tmpcoo%get_nzeros()
!!$ i=0
!!$ do k=1, nzl
!!$ if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
!!$ i = i+1
!!$ tmpcoo%val(i) = tmpcoo%val(k)
!!$ tmpcoo%ia(i) = tmpcoo%ia(k)
!!$ tmpcoo%ja(i) = tmpcoo%ja(k)
!!$ end if
!!$ end do
!!$ call tmpcoo%set_nzeros(i)
!!$ call rtilde%mv_from(tmpcoo)
!!$ call rtilde%cscnv(info,type='csr')
!!$
!!$ call psb_spspmm(rtilde,atmp,op_restr,info)
!!$
!!$ !
!!$ ! Now we have to gather the halo of op_prol, and add it to itself
!!$ ! to multiply it by A,
!!$ !
!!$ call op_prol%clone(tmp_prol,info)
!!$ if (info == psb_success_) call psb_sphalo(tmp_prol,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.)
!!$ if (info == psb_success_) call psb_rwextd(ncol,tmp_prol,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$ if(info /= psb_success_) then
!!$ call psb_errpush(psb_err_internal_error_,name,a_err='Halo of op_prol')
!!$ goto 9999
!!$ end if
!!$
!!$ !
!!$ ! Now we have to fix this. The only rows of B that are correct
!!$ ! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!!$ !
!!$ call op_restr%mv_to(tmpcoo)
!!$
!!$ nzl = tmpcoo%get_nzeros()
!!$ i=0
!!$ do k=1, nzl
!!$ if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
!!$ i = i+1
!!$ tmpcoo%val(i) = tmpcoo%val(k)
!!$ tmpcoo%ia(i) = tmpcoo%ia(k)
!!$ tmpcoo%ja(i) = tmpcoo%ja(k)
!!$ end if
!!$ end do
!!$ call tmpcoo%set_nzeros(i)
!!$ call op_restr%mv_from(tmpcoo)
!!$ call op_restr%cscnv(info,type='csr')
!!$
!!$
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'starting sphalo/ rwxtd'
!!$
!!$ call psb_spspmm(la,tmp_prol,am3,info)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done SPSPMM 2'
!!$
!!$ call psb_sphalo(am3,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.)
!!$ if (info == psb_success_) call psb_rwextd(ncol,am3,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$ if(info /= psb_success_) then
!!$ call psb_errpush(psb_err_internal_error_,name,&
!!$ & a_err='Extend am3')
!!$ goto 9999
!!$ end if
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done sphalo/ rwxtd'
!!$
!!$ call psb_spspmm(op_restr,am3,ac,info)
!!$ if (info == psb_success_) call am3%free()
!!$ if (info == psb_success_) call ac%cscnv(info,type='coo',dupl=psb_dupl_add_)
!!$
!!$ if (info /= psb_success_) then
!!$ call psb_errpush(psb_err_internal_error_,name,&
!!$ &a_err='Build ac = op_restr x am3')
!!$ goto 9999
!!$ end if
@@ -116,7 +116,7 @@ subroutine amg_saggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_sml_parms), intent(inout) :: parms
type(psb_sspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_sspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
@@ -83,8 +83,8 @@ subroutine amg_z_dec_aggregator_build_tprol(ag,parms,ag_data,&
class(amg_z_dec_aggregator_type), target, intent(inout) :: ag
type(amg_dml_parms), intent(inout) :: parms
type(amg_daggr_data), intent(in) :: ag_data
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_zspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lzspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
@@ -86,8 +86,8 @@ subroutine amg_z_symdec_aggregator_build_tprol(ag,parms,ag_data,&
class(amg_z_symdec_aggregator_type), target, intent(inout) :: ag
type(amg_dml_parms), intent(inout) :: parms
type(amg_daggr_data), intent(in) :: ag_data
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_zspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lzspmat_type), intent(out) :: op_prol
integer(psb_ipk_), intent(out) :: info
@@ -105,7 +105,7 @@
!
!
subroutine amg_zaggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,info)
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use amg_base_prec_type
use amg_z_inner_mod, amg_protect_name => amg_zaggrmat_minnrg_bld
@@ -117,8 +117,8 @@ subroutine amg_zaggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_lzspmat_type), intent(inout) :: op_prol
type(psb_lzspmat_type), intent(out) :: ac,op_restr
type(psb_lzspmat_type), intent(inout) :: t_prol
type(psb_zspmat_type), intent(inout) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
@@ -171,6 +171,8 @@ subroutine amg_zaggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
filter_mat = (parms%aggr_filter == amg_filter_mat_)
!NEEDS TO BE REWORKED !!
! naggr: number of local aggregates
! nrow: local rows.
!
@@ -183,361 +185,361 @@ subroutine amg_zaggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
goto 9999
end if
! Get the diagonal D
adiag = a%get_diag(info)
if (info == psb_success_) &
& call psb_realloc(ncol,adiag,info)
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%cp_to_l(la)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
goto 9999
end if
do i=1,size(adiag)
if (adiag(i) /= zzero) then
adinv(i) = zone / adiag(i)
else
adinv(i) = zone
end if
end do
! 1. Allocate Ptilde in sparse matrix form
call op_prol%mv_to(tmpcoo)
call ptilde%mv_from(tmpcoo)
call ptilde%cscnv(info,type='csr')
if (info == psb_success_) call la%cscnv(am3,info,type='csr',dupl=psb_dupl_add_)
if (info == psb_success_) call la%cscnv(da,info,type='csr',dupl=psb_dupl_add_)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& ' Initial copies done.'
call da%scal(adinv,info)
call psb_spspmm(da,ptilde,dap,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
goto 9999
end if
call dap%clone(atmp,info)
call psb_sphalo(atmp,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.,outfmt='CSR ')
if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=am4)
if (info == psb_success_) call am4%free()
call psb_spspmm(da,atmp,dadap,info)
call atmp%free()
! !$ write(0,*) 'Columns of AP',psb_sp_get_ncols(ap)
! !$ write(0,*) 'Columns of ADAP',psb_sp_get_ncols(adap)
call dap%mv_to(csc_dap)
call dadap%mv_to(csc_dadap)
call csc_mat_col_prod(csc_dap,csc_dadap,omp,info)
call csc_mat_col_prod(csc_dadap,csc_dadap,oden,info)
call psb_sum(ctxt,omp)
call psb_sum(ctxt,oden)
! !$ write(0,*) trim(name),' OMP :',omp
! !$ write(0,*) trim(name),' ODEN:',oden
omp = omp/oden
! !$ write(0,*) 'Check on output prolongator ',omp(1:min(size(omp),10))
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done NUMBMM 1'
call am3%mv_to(acsr3)
! Compute omega_int
ommx = zzero
do i=1, ncol
if (ilaggr(i) >0) then
omi(i) = omp(ilaggr(i))
else
omi(i) = zzero
end if
if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
end do
! Compute omega_fine
do i=1, nrow
omf(i) = ommx
do j=acsr3%irp(i),acsr3%irp(i+1)-1
if(abs(omi(acsr3%ja(j))) .lt. abs(omf(i))) omf(i)=omi(acsr3%ja(j))
end do
!!$ if(min(real(omf(i)),aimag(omf(i))) < dzero) omf(i) = zzero
if(psb_minreal(omf(i)) < dzero) omf(i) = zzero
end do
omf(1:nrow) = omf(1:nrow) * adinv(1:nrow)
if (filter_mat) then
!
! Build the filtered matrix Af from A
!
call la%cscnv(acsrf,info,dupl=psb_dupl_add_)
do i=1,nrow
tmp = zzero
jd = -1
do j=acsrf%irp(i),acsrf%irp(i+1)-1
if (acsrf%ja(j) == i) jd = j
if (abs(acsrf%val(j)) < theta*sqrt(abs(adiag(i)*adiag(acsrf%ja(j))))) then
tmp=tmp+acsrf%val(j)
acsrf%val(j)=zzero
endif
enddo
if (jd == -1) then
write(0,*) 'Wrong input: we need the diagonal!!!!', i
else
acsrf%val(jd)=acsrf%val(jd)-tmp
end if
enddo
! Take out zeroed terms
call acsrf%clean_zeros(info)
!
! Build the smoothed prolongator using the filtered matrix
!
do i=1,acsrf%get_nrows()
do j=acsrf%irp(i),acsrf%irp(i+1)-1
if (acsrf%ja(j) == i) then
acsrf%val(j) = zone - omf(i)*acsrf%val(j)
else
acsrf%val(j) = - omf(i)*acsrf%val(j)
end if
end do
end do
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done gather, going for SYMBMM 1'
call af%mv_from(acsrf)
!
! op_prol = (I-w*D*Af)Ptilde
! Doing it this way means to consider diag(Af_i)
!
!
call psb_spspmm(af,ptilde,op_prol,info)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 1'
else
!
! Build the smoothed prolongator using the original matrix
!
do i=1,acsr3%get_nrows()
do j=acsr3%irp(i),acsr3%irp(i+1)-1
if (acsr3%ja(j) == i) then
acsr3%val(j) = zone - omf(i)*acsr3%val(j)
else
acsr3%val(j) = - omf(i)*acsr3%val(j)
end if
end do
end do
call am3%mv_from(acsr3)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done gather, going for SYMBMM 1'
!
!
! op_prol = (I-w*D*A)Ptilde
!
!
call psb_spspmm(am3,ptilde,op_prol,info)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done NUMBMM 1'
end if
!
! Ok, let's start over with the restrictor
!
call ptilde%transc(rtilde)
call la%cscnv(atmp,info,type='csr')
call psb_sphalo(atmp,desc_a,am4,info,&
& colcnv=.true.,rowscale=.true.)
nrt = am4%get_nrows()
call am4%csclip(atmp2,info,lone,nrt,lone,ncol)
call atmp2%cscnv(info,type='CSR')
if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=atmp2)
call am4%free()
call atmp2%free()
! This is to compute the transpose. It ONLY works if the
! original A has a symmetric pattern.
call atmp%transc(atmp2)
call atmp2%csclip(dat,info,lone,nrow,lone,ncol)
call dat%cscnv(info,type='csr')
call dat%scal(adinv,info)
! Now for the product.
call psb_spspmm(dat,ptilde,datp,info)
call datp%clone(atmp2,info)
call psb_sphalo(atmp2,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.,outfmt='CSR ')
if (info == psb_success_) call psb_rwextd(ncol,atmp2,info,b=am4)
if (info == psb_success_) call am4%free()
call psb_symbmm(dat,atmp2,datdatp,info)
call psb_numbmm(dat,atmp2,datdatp)
call atmp2%free()
call datp%mv_to(csc_datp)
call datdatp%mv_to(csc_datdatp)
call csc_mat_col_prod(csc_datp,csc_datdatp,omp,info)
call csc_mat_col_prod(csc_datdatp,csc_datdatp,oden,info)
call psb_sum(ctxt,omp)
call psb_sum(ctxt,oden)
! !$ write(debug_unit,*) trim(name),' OMP_R :',omp
! ! $ write(debug_unit,*) trim(name),' ODEN_R:',oden
omp = omp/oden
! !$ write(0,*) 'Check on output restrictor',omp(1:min(size(omp),10))
! Compute omega_int
ommx = zzero
do i=1, ncol
if (ilaggr(i) >0) then
omi(i) = omp(ilaggr(i))
else
omi(i) = zzero
end if
if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
end do
! Compute omega_fine
! Going over the columns of atmp means going over the rows
! of A^T. Hopefully ;-)
call atmp%cp_to(acsc)
do i=1, nrow
omf(i) = ommx
do j= acsc%icp(i),acsc%icp(i+1)-1
if(abs(omi(acsc%ia(j))) .lt. abs(omf(i))) omf(i)=omi(acsc%ia(j))
end do
!!$ if(min(real(omf(i)),aimag(omf(i))) < dzero) omf(i) = zzero
if(psb_minreal(omf(i)) < dzero) omf(i) = zzero
end do
omf(1:nrow) = omf(1:nrow)*adinv(1:nrow)
call psb_halo(omf,desc_a,info)
call acsc%free()
call atmp%mv_to(acsr1)
do i=1,acsr1%get_nrows()
do j=acsr1%irp(i),acsr1%irp(i+1)-1
if (acsr1%ja(j) == i) then
acsr1%val(j) = zone - acsr1%val(j)*omf(acsr1%ja(j))
else
acsr1%val(j) = - acsr1%val(j)*omf(acsr1%ja(j))
end if
end do
end do
call atmp%mv_from(acsr1)
call rtilde%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
i=0
do k=1, nzl
if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
i = i+1
tmpcoo%val(i) = tmpcoo%val(k)
tmpcoo%ia(i) = tmpcoo%ia(k)
tmpcoo%ja(i) = tmpcoo%ja(k)
end if
end do
call tmpcoo%set_nzeros(i)
call rtilde%mv_from(tmpcoo)
call rtilde%cscnv(info,type='csr')
call psb_spspmm(rtilde,atmp,op_restr,info)
!
! Now we have to gather the halo of op_prol, and add it to itself
! to multiply it by A,
!
call op_prol%clone(tmp_prol,info)
if (info == psb_success_) call psb_sphalo(tmp_prol,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.)
if (info == psb_success_) call psb_rwextd(ncol,tmp_prol,info,b=am4)
if (info == psb_success_) call am4%free()
if(info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,a_err='Halo of op_prol')
goto 9999
end if
!
! Now we have to fix this. The only rows of B that are correct
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!
call op_restr%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
i=0
do k=1, nzl
if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
i = i+1
tmpcoo%val(i) = tmpcoo%val(k)
tmpcoo%ia(i) = tmpcoo%ia(k)
tmpcoo%ja(i) = tmpcoo%ja(k)
end if
end do
call tmpcoo%set_nzeros(i)
call op_restr%mv_from(tmpcoo)
call op_restr%cscnv(info,type='csr')
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'starting sphalo/ rwxtd'
call psb_spspmm(la,tmp_prol,am3,info)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 2'
call psb_sphalo(am3,desc_a,am4,info,&
& colcnv=.false.,rowscale=.true.)
if (info == psb_success_) call psb_rwextd(ncol,am3,info,b=am4)
if (info == psb_success_) call am4%free()
if(info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
& a_err='Extend am3')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done sphalo/ rwxtd'
call psb_spspmm(op_restr,am3,ac,info)
if (info == psb_success_) call am3%free()
if (info == psb_success_) call ac%cscnv(info,type='coo',dupl=psb_dupl_add_)
if (info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
&a_err='Build ac = op_restr x am3')
goto 9999
end if
!!$ ! Get the diagonal D
!!$ adiag = a%get_diag(info)
!!$ if (info == psb_success_) &
!!$ & call psb_realloc(ncol,adiag,info)
!!$ if (info == psb_success_) &
!!$ & call psb_halo(adiag,desc_a,info)
!!$ if (info == psb_success_) call a%cp_to_l(la)
!!$ if (info /= psb_success_) then
!!$ call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
!!$ goto 9999
!!$ end if
!!$
!!$ do i=1,size(adiag)
!!$ if (adiag(i) /= zzero) then
!!$ adinv(i) = zone / adiag(i)
!!$ else
!!$ adinv(i) = zone
!!$ end if
!!$ end do
!!$
!!$
!!$
!!$ ! 1. Allocate Ptilde in sparse matrix form
!!$ call op_prol%mv_to(tmpcoo)
!!$ call ptilde%mv_from(tmpcoo)
!!$ call ptilde%cscnv(info,type='csr')
!!$
!!$ if (info == psb_success_) call la%cscnv(am3,info,type='csr',dupl=psb_dupl_add_)
!!$ if (info == psb_success_) call la%cscnv(da,info,type='csr',dupl=psb_dupl_add_)
!!$ if (info /= psb_success_) then
!!$ call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv')
!!$ goto 9999
!!$ end if
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & ' Initial copies done.'
!!$
!!$ call da%scal(adinv,info)
!!$
!!$ call psb_spspmm(da,ptilde,dap,info)
!!$
!!$ if(info /= psb_success_) then
!!$ call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
!!$ goto 9999
!!$ end if
!!$
!!$ call dap%clone(atmp,info)
!!$
!!$ call psb_sphalo(atmp,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.,outfmt='CSR ')
!!$ if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$ call psb_spspmm(da,atmp,dadap,info)
!!$ call atmp%free()
!!$
!!$ ! !$ write(0,*) 'Columns of AP',psb_sp_get_ncols(ap)
!!$ ! !$ write(0,*) 'Columns of ADAP',psb_sp_get_ncols(adap)
!!$ call dap%mv_to(csc_dap)
!!$ call dadap%mv_to(csc_dadap)
!!$
!!$ call csc_mat_col_prod(csc_dap,csc_dadap,omp,info)
!!$ call csc_mat_col_prod(csc_dadap,csc_dadap,oden,info)
!!$ call psb_sum(ctxt,omp)
!!$ call psb_sum(ctxt,oden)
!!$ ! !$ write(0,*) trim(name),' OMP :',omp
!!$ ! !$ write(0,*) trim(name),' ODEN:',oden
!!$
!!$ omp = omp/oden
!!$
!!$ ! !$ write(0,*) 'Check on output prolongator ',omp(1:min(size(omp),10))
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done NUMBMM 1'
!!$
!!$ call am3%mv_to(acsr3)
!!$ ! Compute omega_int
!!$ ommx = zzero
!!$ do i=1, ncol
!!$ if (ilaggr(i) >0) then
!!$ omi(i) = omp(ilaggr(i))
!!$ else
!!$ omi(i) = zzero
!!$ end if
!!$ if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
!!$ end do
!!$ ! Compute omega_fine
!!$ do i=1, nrow
!!$ omf(i) = ommx
!!$ do j=acsr3%irp(i),acsr3%irp(i+1)-1
!!$ if(abs(omi(acsr3%ja(j))) .lt. abs(omf(i))) omf(i)=omi(acsr3%ja(j))
!!$ end do
!!$ ! ! if(min(real(omf(i)),aimag(omf(i))) < dzero) omf(i) = zzero
!!$ if(psb_minreal(omf(i)) < dzero) omf(i) = zzero
!!$ end do
!!$
!!$ omf(1:nrow) = omf(1:nrow) * adinv(1:nrow)
!!$
!!$ if (filter_mat) then
!!$ !
!!$ ! Build the filtered matrix Af from A
!!$ !
!!$ call la%cscnv(acsrf,info,dupl=psb_dupl_add_)
!!$
!!$ do i=1,nrow
!!$ tmp = zzero
!!$ jd = -1
!!$ do j=acsrf%irp(i),acsrf%irp(i+1)-1
!!$ if (acsrf%ja(j) == i) jd = j
!!$ if (abs(acsrf%val(j)) < theta*sqrt(abs(adiag(i)*adiag(acsrf%ja(j))))) then
!!$ tmp=tmp+acsrf%val(j)
!!$ acsrf%val(j)=zzero
!!$ endif
!!$ enddo
!!$ if (jd == -1) then
!!$ write(0,*) 'Wrong input: we need the diagonal!!!!', i
!!$ else
!!$ acsrf%val(jd)=acsrf%val(jd)-tmp
!!$ end if
!!$ enddo
!!$ ! Take out zeroed terms
!!$ call acsrf%clean_zeros(info)
!!$
!!$ !
!!$ ! Build the smoothed prolongator using the filtered matrix
!!$ !
!!$ do i=1,acsrf%get_nrows()
!!$ do j=acsrf%irp(i),acsrf%irp(i+1)-1
!!$ if (acsrf%ja(j) == i) then
!!$ acsrf%val(j) = zone - omf(i)*acsrf%val(j)
!!$ else
!!$ acsrf%val(j) = - omf(i)*acsrf%val(j)
!!$ end if
!!$ end do
!!$ end do
!!$
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done gather, going for SYMBMM 1'
!!$
!!$ call af%mv_from(acsrf)
!!$ !
!!$ ! op_prol = (I-w*D*Af)Ptilde
!!$ ! Doing it this way means to consider diag(Af_i)
!!$ !
!!$ !
!!$ call psb_spspmm(af,ptilde,op_prol,info)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done SPSPMM 1'
!!$ else
!!$ !
!!$ ! Build the smoothed prolongator using the original matrix
!!$ !
!!$ do i=1,acsr3%get_nrows()
!!$ do j=acsr3%irp(i),acsr3%irp(i+1)-1
!!$ if (acsr3%ja(j) == i) then
!!$ acsr3%val(j) = zone - omf(i)*acsr3%val(j)
!!$ else
!!$ acsr3%val(j) = - omf(i)*acsr3%val(j)
!!$ end if
!!$ end do
!!$ end do
!!$
!!$ call am3%mv_from(acsr3)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done gather, going for SYMBMM 1'
!!$ !
!!$ !
!!$ ! op_prol = (I-w*D*A)Ptilde
!!$ !
!!$ !
!!$ call psb_spspmm(am3,ptilde,op_prol,info)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done NUMBMM 1'
!!$
!!$ end if
!!$
!!$
!!$ !
!!$ ! Ok, let's start over with the restrictor
!!$ !
!!$ call ptilde%transc(rtilde)
!!$ call la%cscnv(atmp,info,type='csr')
!!$ call psb_sphalo(atmp,desc_a,am4,info,&
!!$ & colcnv=.true.,rowscale=.true.)
!!$ nrt = am4%get_nrows()
!!$ call am4%csclip(atmp2,info,lone,nrt,lone,ncol)
!!$ call atmp2%cscnv(info,type='CSR')
!!$ if (info == psb_success_) call psb_rwextd(ncol,atmp,info,b=atmp2)
!!$ call am4%free()
!!$ call atmp2%free()
!!$
!!$ ! This is to compute the transpose. It ONLY works if the
!!$ ! original A has a symmetric pattern.
!!$ call atmp%transc(atmp2)
!!$ call atmp2%csclip(dat,info,lone,nrow,lone,ncol)
!!$ call dat%cscnv(info,type='csr')
!!$ call dat%scal(adinv,info)
!!$
!!$ ! Now for the product.
!!$ call psb_spspmm(dat,ptilde,datp,info)
!!$
!!$ call datp%clone(atmp2,info)
!!$ call psb_sphalo(atmp2,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.,outfmt='CSR ')
!!$ if (info == psb_success_) call psb_rwextd(ncol,atmp2,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$
!!$ call psb_symbmm(dat,atmp2,datdatp,info)
!!$ call psb_numbmm(dat,atmp2,datdatp)
!!$ call atmp2%free()
!!$
!!$ call datp%mv_to(csc_datp)
!!$ call datdatp%mv_to(csc_datdatp)
!!$
!!$ call csc_mat_col_prod(csc_datp,csc_datdatp,omp,info)
!!$ call csc_mat_col_prod(csc_datdatp,csc_datdatp,oden,info)
!!$ call psb_sum(ctxt,omp)
!!$ call psb_sum(ctxt,oden)
!!$
!!$
!!$ ! !$ write(debug_unit,*) trim(name),' OMP_R :',omp
!!$ ! ! $ write(debug_unit,*) trim(name),' ODEN_R:',oden
!!$ omp = omp/oden
!!$ ! !$ write(0,*) 'Check on output restrictor',omp(1:min(size(omp),10))
!!$ ! Compute omega_int
!!$ ommx = zzero
!!$ do i=1, ncol
!!$ if (ilaggr(i) >0) then
!!$ omi(i) = omp(ilaggr(i))
!!$ else
!!$ omi(i) = zzero
!!$ end if
!!$ if(abs(omi(i)) .gt. abs(ommx)) ommx = omi(i)
!!$ end do
!!$ ! Compute omega_fine
!!$ ! Going over the columns of atmp means going over the rows
!!$ ! of A^T. Hopefully ;-)
!!$ call atmp%cp_to(acsc)
!!$
!!$ do i=1, nrow
!!$ omf(i) = ommx
!!$ do j= acsc%icp(i),acsc%icp(i+1)-1
!!$ if(abs(omi(acsc%ia(j))) .lt. abs(omf(i))) omf(i)=omi(acsc%ia(j))
!!$ end do
!!$ ! ! if(min(real(omf(i)),aimag(omf(i))) < dzero) omf(i) = zzero
!!$ if(psb_minreal(omf(i)) < dzero) omf(i) = zzero
!!$ end do
!!$ omf(1:nrow) = omf(1:nrow)*adinv(1:nrow)
!!$ call psb_halo(omf,desc_a,info)
!!$ call acsc%free()
!!$
!!$
!!$ call atmp%mv_to(acsr1)
!!$
!!$ do i=1,acsr1%get_nrows()
!!$ do j=acsr1%irp(i),acsr1%irp(i+1)-1
!!$ if (acsr1%ja(j) == i) then
!!$ acsr1%val(j) = zone - acsr1%val(j)*omf(acsr1%ja(j))
!!$ else
!!$ acsr1%val(j) = - acsr1%val(j)*omf(acsr1%ja(j))
!!$ end if
!!$ end do
!!$ end do
!!$ call atmp%mv_from(acsr1)
!!$
!!$ call rtilde%mv_to(tmpcoo)
!!$ nzl = tmpcoo%get_nzeros()
!!$ i=0
!!$ do k=1, nzl
!!$ if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
!!$ i = i+1
!!$ tmpcoo%val(i) = tmpcoo%val(k)
!!$ tmpcoo%ia(i) = tmpcoo%ia(k)
!!$ tmpcoo%ja(i) = tmpcoo%ja(k)
!!$ end if
!!$ end do
!!$ call tmpcoo%set_nzeros(i)
!!$ call rtilde%mv_from(tmpcoo)
!!$ call rtilde%cscnv(info,type='csr')
!!$
!!$ call psb_spspmm(rtilde,atmp,op_restr,info)
!!$
!!$ !
!!$ ! Now we have to gather the halo of op_prol, and add it to itself
!!$ ! to multiply it by A,
!!$ !
!!$ call op_prol%clone(tmp_prol,info)
!!$ if (info == psb_success_) call psb_sphalo(tmp_prol,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.)
!!$ if (info == psb_success_) call psb_rwextd(ncol,tmp_prol,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$ if(info /= psb_success_) then
!!$ call psb_errpush(psb_err_internal_error_,name,a_err='Halo of op_prol')
!!$ goto 9999
!!$ end if
!!$
!!$ !
!!$ ! Now we have to fix this. The only rows of B that are correct
!!$ ! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!!$ !
!!$ call op_restr%mv_to(tmpcoo)
!!$
!!$ nzl = tmpcoo%get_nzeros()
!!$ i=0
!!$ do k=1, nzl
!!$ if ((naggrm1 < tmpcoo%ia(k)) .and. (tmpcoo%ia(k) <= naggrp1)) then
!!$ i = i+1
!!$ tmpcoo%val(i) = tmpcoo%val(k)
!!$ tmpcoo%ia(i) = tmpcoo%ia(k)
!!$ tmpcoo%ja(i) = tmpcoo%ja(k)
!!$ end if
!!$ end do
!!$ call tmpcoo%set_nzeros(i)
!!$ call op_restr%mv_from(tmpcoo)
!!$ call op_restr%cscnv(info,type='csr')
!!$
!!$
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'starting sphalo/ rwxtd'
!!$
!!$ call psb_spspmm(la,tmp_prol,am3,info)
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done SPSPMM 2'
!!$
!!$ call psb_sphalo(am3,desc_a,am4,info,&
!!$ & colcnv=.false.,rowscale=.true.)
!!$ if (info == psb_success_) call psb_rwextd(ncol,am3,info,b=am4)
!!$ if (info == psb_success_) call am4%free()
!!$
!!$ if(info /= psb_success_) then
!!$ call psb_errpush(psb_err_internal_error_,name,&
!!$ & a_err='Extend am3')
!!$ goto 9999
!!$ end if
!!$ if (debug_level >= psb_debug_outer_) &
!!$ & write(debug_unit,*) me,' ',trim(name),&
!!$ & 'Done sphalo/ rwxtd'
!!$
!!$ call psb_spspmm(op_restr,am3,ac,info)
!!$ if (info == psb_success_) call am3%free()
!!$ if (info == psb_success_) call ac%cscnv(info,type='coo',dupl=psb_dupl_add_)
!!$
!!$ if (info /= psb_success_) then
!!$ call psb_errpush(psb_err_internal_error_,name,&
!!$ &a_err='Build ac = op_restr x am3')
!!$ goto 9999
!!$ end if
@@ -116,7 +116,7 @@ subroutine amg_zaggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(amg_dml_parms), intent(inout) :: parms
type(psb_zspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_zspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_lzspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
+16 -2
View File
@@ -462,6 +462,14 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
select case (psb_toupper(string))
case('BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
#if defined(HAVE_SLU_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
#elif defined(HAVE_MUMPS_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
#else
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
#endif
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
case('L1-BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
#if defined(HAVE_SLU_)
@@ -563,7 +571,6 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
type(amg_c_krm_solver_type) :: krm_slv
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_krm_,info,pos=pos)
call p%precv(nlev_)%set(krm_slv,info)
call p%precv(nlev_)%default()
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
end block
end select
@@ -612,6 +619,14 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
select case (psb_toupper(trim(string)))
case('BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
#if defined(HAVE_SLU_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
#elif defined(HAVE_MUMPS_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
#else
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
#endif
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
case('L1-BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
#if defined(HAVE_SLU_)
@@ -713,7 +728,6 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
type(amg_c_krm_solver_type) :: krm_slv
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_krm_,info,pos=pos)
call p%precv(nlev_)%set(krm_slv,info)
call p%precv(nlev_)%default()
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
end block
end select
+3 -2
View File
@@ -65,7 +65,7 @@
! 0: normal
! >1: increased details
!
subroutine amg_cfile_prec_descr(prec,iout,root, verbosity)
subroutine amg_cfile_prec_descr(prec,info,iout,root, verbosity)
use psb_base_mod
use amg_c_prec_mod, amg_protect_name => amg_cfile_prec_descr
use amg_c_inner_mod
@@ -74,13 +74,14 @@ subroutine amg_cfile_prec_descr(prec,iout,root, verbosity)
implicit none
! Arguments
class(amg_cprec_type), intent(in) :: prec
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: iout
integer(psb_ipk_), intent(in), optional :: root
integer(psb_ipk_), intent(in), optional :: verbosity
! Local variables
integer(psb_ipk_) :: ilev, nlev, ilmin, info, nswps
integer(psb_ipk_) :: ilev, nlev, ilmin, nswps
type(psb_ctxt_type) :: ctxt
integer(psb_ipk_) :: me, np
logical :: is_symgs
+76 -60
View File
@@ -1,15 +1,15 @@
!
!
!
!
! AMG4PSBLAS version 1.0
! Algebraic Multigrid Package
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
!
! (C) Copyright 2021
!
! Salvatore Filippone
! Pasqua D'Ambra
! Fabio Durastante
!
!
! (C) Copyright 2021
!
! Salvatore Filippone
! Pasqua D'Ambra
! Fabio Durastante
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
@@ -21,7 +21,7 @@
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@@ -33,8 +33,8 @@
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
!
! File: amg_cprecinit.f90
!
! Subroutine: amg_cprecinit
@@ -42,21 +42,21 @@
!
! This routine allocates and initializes the preconditioner data structure,
! according to the preconditioner type chosen by the user.
!
!
! A default preconditioner is set for each preconditioner type
! specified by the user:
!
! 'NOPREC' - no preconditioner
!
! 'DIAG', 'JACOBI' - diagonal/Jacobi
! 'DIAG', 'JACOBI' - diagonal/Jacobi
!
! 'L1-DIAG', 'L1-JACOBI' - diagonal/Jacobi with L1 norm correction
!
! 'GS', 'FBGS' - Hybrid Gauss-Seidel, also symmetrized
!
!
! 'BJAC' - block Jacobi preconditioner, with ILU(0)
! on the local blocks
!
!
! 'L1-BJAC' - block Jacobi preconditioner, with ILU(0)
! on the local blocks and L1 correction for off-diag blocks
!
@@ -70,12 +70,12 @@
! applied as post-smoother at each level, but the
! coarsest one; four sweeps of the block-Jacobi solver,
! with LU from UMFPACK on the blocks, are applied at
! the coarsest level, on the distributed coarse matrix.
! the coarsest level, on the distributed coarse matrix.
! The smoothed aggregation algorithm with threshold 0
! is used to build the coarse matrix.
!
! For the multilevel preconditioners, the levels are numbered in increasing
! order starting from the finest one, i.e. level 1 is the finest level.
! order starting from the finest one, i.e. level 1 is the finest level.
!
!
! Arguments:
@@ -87,7 +87,7 @@
! lowercase strings).
! info - integer, output.
! Error code.
!
!
subroutine amg_cprecinit(ctxt,prec,ptype,info)
use psb_base_mod
@@ -113,98 +113,105 @@ subroutine amg_cprecinit(ctxt,prec,ptype,info)
! Local variables
integer(psb_ipk_) :: nlev_, ilev_
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: debug_level, debug_unit
real(psb_spk_) :: thr
character(len=*), parameter :: name='amg_precinit'
info = psb_success_
call psb_erractionsave(err_act)
if (psb_errstatus_fatal()) then
info = psb_err_internal_error_; goto 9999
end if
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
if (allocated(prec%precv)) then
call prec%free(info)
if (info /= psb_success_) then
! Do we want to do something?
if (allocated(prec%precv)) then
call prec%free(info)
if (info /= psb_success_) then
! Do we want to do something?
endif
endif
prec%ctxt = ctxt
prec%ag_data%min_coarse_size = -1
prec%ag_data%min_coarse_size_per_process = -1
call prec%ag_data%default()
select case(psb_toupper(trim(ptype)))
case ('NOPREC','NONE')
case ('NOPREC','NONE')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_base_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_base_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_c_id_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_c_id_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('JAC','DIAG','JACOBI')
case ('JAC','DIAG','JACOBI')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_c_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_c_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('L1-DIAG','L1-JACOBI','L1_DIAG','L1_JACOBI')
case ('L1-DIAG','L1-JACOBI','L1_DIAG','L1_JACOBI')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_c_l1_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_c_l1_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('GS','FWGS')
case ('GS','FWGS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_c_gs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_c_gs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('BWGS')
case ('BWGS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_c_bwgs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_c_bwgs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('FBGS')
case ('FBGS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
call prec%set('SMOOTHER_TYPE','FBGS',info)
call prec%precv(ilev_)%default()
case ('BJAC')
case ('BJAC')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_c_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_c_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('L1-BJAC','L1_BJAC')
case ('L1-BJAC','L1_BJAC')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_l1_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_l1_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_c_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_c_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('AS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_as_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_c_as_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_c_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_c_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
@@ -213,20 +220,24 @@ subroutine amg_cprecinit(ctxt,prec,ptype,info)
nlev_ = prec%ag_data%max_levs
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
if (info /= psb_success_ ) then
call psb_errpush(info,name,a_err='Error from hierarchy init')
goto 9999
endif
do ilev_ = 1, nlev_
do ilev_ = 1, nlev_
call prec%precv(ilev_)%default()
end do
call prec%set('ML_CYCLE','VCYCLE',info)
call prec%set('SMOOTHER_TYPE','FBGS',info)
#if defined(HAVE_MUMPS_)
call prec%set('COARSE_SOLVE','MUMPS',info)
call prec%set('COARSE_SOLVE','MUMPS',info)
#elif defined(HAVE_SLU_)
call prec%set('COARSE_SOLVE','SLU',info)
#else
call prec%set('COARSE_SOLVE','ILU',info)
#endif
case default
write(psb_err_unit,*) name,&
&': Warning: Unknown preconditioner type request "',ptype,'"'
@@ -234,5 +245,10 @@ subroutine amg_cprecinit(ctxt,prec,ptype,info)
end select
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine amg_cprecinit
+1 -1
View File
@@ -45,7 +45,7 @@ subroutine amg_cprecsetsm(p,val,info,ilev,ilmax,pos)
implicit none
! Arguments
class(amg_cprec_type), intent(inout) :: p
class(amg_cprec_type), target, intent(inout):: p
class(amg_c_base_smoother_type), intent(in) :: val
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax
+20 -2
View File
@@ -474,6 +474,16 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
select case (psb_toupper(string))
case('BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
#if defined(HAVE_UMF_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos)
#elif defined(HAVE_SLU_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
#elif defined(HAVE_MUMPS_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
#else
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
#endif
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
case('L1-BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
#if defined(HAVE_UMF_)
@@ -589,7 +599,6 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
type(amg_d_krm_solver_type) :: krm_slv
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_krm_,info,pos=pos)
call p%precv(nlev_)%set(krm_slv,info)
call p%precv(nlev_)%default()
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
end block
end select
@@ -638,6 +647,16 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
select case (psb_toupper(trim(string)))
case('BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
#if defined(HAVE_UMF_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos)
#elif defined(HAVE_SLU_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
#elif defined(HAVE_MUMPS_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
#else
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
#endif
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
case('L1-BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
#if defined(HAVE_UMF_)
@@ -753,7 +772,6 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
type(amg_d_krm_solver_type) :: krm_slv
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_krm_,info,pos=pos)
call p%precv(nlev_)%set(krm_slv,info)
call p%precv(nlev_)%default()
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
end block
end select
+3 -2
View File
@@ -65,7 +65,7 @@
! 0: normal
! >1: increased details
!
subroutine amg_dfile_prec_descr(prec,iout,root, verbosity)
subroutine amg_dfile_prec_descr(prec,info,iout,root, verbosity)
use psb_base_mod
use amg_d_prec_mod, amg_protect_name => amg_dfile_prec_descr
use amg_d_inner_mod
@@ -74,13 +74,14 @@ subroutine amg_dfile_prec_descr(prec,iout,root, verbosity)
implicit none
! Arguments
class(amg_dprec_type), intent(in) :: prec
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: iout
integer(psb_ipk_), intent(in), optional :: root
integer(psb_ipk_), intent(in), optional :: verbosity
! Local variables
integer(psb_ipk_) :: ilev, nlev, ilmin, info, nswps
integer(psb_ipk_) :: ilev, nlev, ilmin, nswps
type(psb_ctxt_type) :: ctxt
integer(psb_ipk_) :: me, np
logical :: is_symgs
+77 -61
View File
@@ -1,15 +1,15 @@
!
!
!
!
! AMG4PSBLAS version 1.0
! Algebraic Multigrid Package
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
!
! (C) Copyright 2021
!
! Salvatore Filippone
! Pasqua D'Ambra
! Fabio Durastante
!
!
! (C) Copyright 2021
!
! Salvatore Filippone
! Pasqua D'Ambra
! Fabio Durastante
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
@@ -21,7 +21,7 @@
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@@ -33,8 +33,8 @@
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
!
! File: amg_dprecinit.f90
!
! Subroutine: amg_dprecinit
@@ -42,21 +42,21 @@
!
! This routine allocates and initializes the preconditioner data structure,
! according to the preconditioner type chosen by the user.
!
!
! A default preconditioner is set for each preconditioner type
! specified by the user:
!
! 'NOPREC' - no preconditioner
!
! 'DIAG', 'JACOBI' - diagonal/Jacobi
! 'DIAG', 'JACOBI' - diagonal/Jacobi
!
! 'L1-DIAG', 'L1-JACOBI' - diagonal/Jacobi with L1 norm correction
!
! 'GS', 'FBGS' - Hybrid Gauss-Seidel, also symmetrized
!
!
! 'BJAC' - block Jacobi preconditioner, with ILU(0)
! on the local blocks
!
!
! 'L1-BJAC' - block Jacobi preconditioner, with ILU(0)
! on the local blocks and L1 correction for off-diag blocks
!
@@ -70,12 +70,12 @@
! applied as post-smoother at each level, but the
! coarsest one; four sweeps of the block-Jacobi solver,
! with LU from UMFPACK on the blocks, are applied at
! the coarsest level, on the distributed coarse matrix.
! the coarsest level, on the distributed coarse matrix.
! The smoothed aggregation algorithm with threshold 0
! is used to build the coarse matrix.
!
! For the multilevel preconditioners, the levels are numbered in increasing
! order starting from the finest one, i.e. level 1 is the finest level.
! order starting from the finest one, i.e. level 1 is the finest level.
!
!
! Arguments:
@@ -87,7 +87,7 @@
! lowercase strings).
! info - integer, output.
! Error code.
!
!
subroutine amg_dprecinit(ctxt,prec,ptype,info)
use psb_base_mod
@@ -116,98 +116,105 @@ subroutine amg_dprecinit(ctxt,prec,ptype,info)
! Local variables
integer(psb_ipk_) :: nlev_, ilev_
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: debug_level, debug_unit
real(psb_dpk_) :: thr
character(len=*), parameter :: name='amg_precinit'
info = psb_success_
call psb_erractionsave(err_act)
if (psb_errstatus_fatal()) then
info = psb_err_internal_error_; goto 9999
end if
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
if (allocated(prec%precv)) then
call prec%free(info)
if (info /= psb_success_) then
! Do we want to do something?
if (allocated(prec%precv)) then
call prec%free(info)
if (info /= psb_success_) then
! Do we want to do something?
endif
endif
prec%ctxt = ctxt
prec%ag_data%min_coarse_size = -1
prec%ag_data%min_coarse_size_per_process = -1
call prec%ag_data%default()
select case(psb_toupper(trim(ptype)))
case ('NOPREC','NONE')
case ('NOPREC','NONE')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_base_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_base_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_d_id_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_d_id_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('JAC','DIAG','JACOBI')
case ('JAC','DIAG','JACOBI')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_d_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_d_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('L1-DIAG','L1-JACOBI','L1_DIAG','L1_JACOBI')
case ('L1-DIAG','L1-JACOBI','L1_DIAG','L1_JACOBI')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_d_l1_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_d_l1_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('GS','FWGS')
case ('GS','FWGS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_d_gs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_d_gs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('BWGS')
case ('BWGS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_d_bwgs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_d_bwgs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('FBGS')
case ('FBGS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
call prec%set('SMOOTHER_TYPE','FBGS',info)
call prec%precv(ilev_)%default()
case ('BJAC')
case ('BJAC')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_d_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_d_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('L1-BJAC','L1_BJAC')
case ('L1-BJAC','L1_BJAC')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_l1_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_l1_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_d_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_d_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('AS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_as_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_d_as_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_d_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_d_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
@@ -216,22 +223,26 @@ subroutine amg_dprecinit(ctxt,prec,ptype,info)
nlev_ = prec%ag_data%max_levs
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
if (info /= psb_success_ ) then
call psb_errpush(info,name,a_err='Error from hierarchy init')
goto 9999
endif
do ilev_ = 1, nlev_
do ilev_ = 1, nlev_
call prec%precv(ilev_)%default()
end do
call prec%set('ML_CYCLE','VCYCLE',info)
call prec%set('SMOOTHER_TYPE','FBGS',info)
#if defined(HAVE_UMF_)
#if defined(HAVE_UMF_)
call prec%set('COARSE_SOLVE','UMF',info)
#elif defined(HAVE_MUMPS_)
call prec%set('COARSE_SOLVE','MUMPS',info)
call prec%set('COARSE_SOLVE','MUMPS',info)
#elif defined(HAVE_SLU_)
call prec%set('COARSE_SOLVE','SLU',info)
#else
call prec%set('COARSE_SOLVE','ILU',info)
#endif
case default
write(psb_err_unit,*) name,&
&': Warning: Unknown preconditioner type request "',ptype,'"'
@@ -239,5 +250,10 @@ subroutine amg_dprecinit(ctxt,prec,ptype,info)
end select
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine amg_dprecinit
+1 -1
View File
@@ -45,7 +45,7 @@ subroutine amg_dprecsetsm(p,val,info,ilev,ilmax,pos)
implicit none
! Arguments
class(amg_dprec_type), intent(inout) :: p
class(amg_dprec_type), target, intent(inout):: p
class(amg_d_base_smoother_type), intent(in) :: val
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax
+15 -15
View File
@@ -94,7 +94,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define HANDLE_SIZE 8
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
typedef struct {
SuperMatrix *A;
dLUstruct_t *LUstruct;
@@ -135,7 +135,7 @@ int amg_dsludist_fact(int n, int nl, int nnzl, int ffstr,
SuperMatrix *A;
NRformat_loc *Astore;
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
dScalePermstruct_t *ScalePermstruct;
dLUstruct_t *LUstruct;
dSOLVEstruct_t SOLVEstruct;
@@ -148,9 +148,9 @@ int amg_dsludist_fact(int n, int nl, int nnzl, int ffstr,
int i, panel_size, permc_spec, relax, info;
trans_t trans;
double drop_tol = 0.0, b[1], berr[1];
#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_6)||defined(SLUD_VERSION_5)
#if (SLUD_VERSION_>=50)
superlu_dist_options_t options;
#elif defined(SLUD_VERSION_4)||defined(SLUD_VERSION_3)
#elif (SLUD_VERSION_>=30)
superlu_options_t options;
#else
choke_on_me;
@@ -174,7 +174,7 @@ int amg_dsludist_fact(int n, int nl, int nnzl, int ffstr,
SLU_NR_loc, SLU_D, SLU_GE);
/* Initialize ScalePermstruct and LUstruct. */
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
ScalePermstruct = (dScalePermstruct_t *) SUPERLU_MALLOC(sizeof(dScalePermstruct_t));
LUstruct = (dLUstruct_t *) SUPERLU_MALLOC(sizeof(dLUstruct_t));
dScalePermstructInit(n,n, ScalePermstruct);
@@ -183,11 +183,11 @@ int amg_dsludist_fact(int n, int nl, int nnzl, int ffstr,
LUstruct = (LUstruct_t *) SUPERLU_MALLOC(sizeof(LUstruct_t));
ScalePermstructInit(n,n, ScalePermstruct);
#endif
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
dLUstructInit(n, LUstruct);
#elif defined(SLUD_VERSION_4) || defined(SLUD_VERSION_5) || defined(SLUD_VERSION_6)
#elif (SLUD_VERSION_>=40)
LUstructInit(n, LUstruct);
#elif defined(SLUD_VERSION_3)
#elif (SLUD_VERSION_>=30)
LUstructInit(n,n, LUstruct);
#else
choke_on_me;
@@ -245,7 +245,7 @@ int amg_dsludist_solve(int itrans, int n, int nrhs,
*/
#ifdef Have_SLUDist_
SuperMatrix *A;
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
dScalePermstruct_t *ScalePermstruct;
dLUstruct_t *LUstruct;
dSOLVEstruct_t SOLVEstruct;
@@ -259,9 +259,9 @@ int amg_dsludist_solve(int itrans, int n, int nrhs,
trans_t trans;
double drop_tol = 0.0;
double *berr;
#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_6) ||defined(SLUD_VERSION_5)
#if (SLUD_VERSION_>=50)
superlu_dist_options_t options;
#elif defined(SLUD_VERSION_4)|| defined(SLUD_VERSION_3)
#elif (SLUD_VERSION_>=30)
superlu_options_t options;
#else
choke_on_me;
@@ -331,7 +331,7 @@ int amg_dsludist_free(void *f_factors)
*/
#ifdef Have_SLUDist_
SuperMatrix *A;
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
dScalePermstruct_t *ScalePermstruct;
dLUstruct_t *LUstruct;
dSOLVEstruct_t SOLVEstruct;
@@ -345,9 +345,9 @@ int amg_dsludist_free(void *f_factors)
trans_t trans;
double drop_tol = 0.0;
double *berr;
#if defined(SLUD_VERSION_63)||defined(SLUD_VERSION_6)||defined(SLUD_VERSION_5)
#if (SLUD_VERSION_>=50)
superlu_dist_options_t options;
#elif defined(SLUD_VERSION_4)||defined(SLUD_VERSION_3)
#elif (SLUD_VERSION_>=30)
superlu_options_t options;
#else
choke_on_me;
@@ -368,7 +368,7 @@ int amg_dsludist_free(void *f_factors)
// we either have a leak or a segfault here.
// To be investigated further.
//Destroy_CompRowLoc_Matrix_dist(A);
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
dScalePermstructFree(ScalePermstruct);
dLUstructFree(LUstruct);
#else
+16 -2
View File
@@ -462,6 +462,14 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
select case (psb_toupper(string))
case('BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
#if defined(HAVE_SLU_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
#elif defined(HAVE_MUMPS_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
#else
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
#endif
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
case('L1-BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
#if defined(HAVE_SLU_)
@@ -563,7 +571,6 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
type(amg_s_krm_solver_type) :: krm_slv
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_krm_,info,pos=pos)
call p%precv(nlev_)%set(krm_slv,info)
call p%precv(nlev_)%default()
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
end block
end select
@@ -612,6 +619,14 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
select case (psb_toupper(trim(string)))
case('BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
#if defined(HAVE_SLU_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
#elif defined(HAVE_MUMPS_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
#else
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
#endif
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
case('L1-BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
#if defined(HAVE_SLU_)
@@ -713,7 +728,6 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
type(amg_s_krm_solver_type) :: krm_slv
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_krm_,info,pos=pos)
call p%precv(nlev_)%set(krm_slv,info)
call p%precv(nlev_)%default()
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
end block
end select
+3 -2
View File
@@ -65,7 +65,7 @@
! 0: normal
! >1: increased details
!
subroutine amg_sfile_prec_descr(prec,iout,root, verbosity)
subroutine amg_sfile_prec_descr(prec,info,iout,root, verbosity)
use psb_base_mod
use amg_s_prec_mod, amg_protect_name => amg_sfile_prec_descr
use amg_s_inner_mod
@@ -74,13 +74,14 @@ subroutine amg_sfile_prec_descr(prec,iout,root, verbosity)
implicit none
! Arguments
class(amg_sprec_type), intent(in) :: prec
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: iout
integer(psb_ipk_), intent(in), optional :: root
integer(psb_ipk_), intent(in), optional :: verbosity
! Local variables
integer(psb_ipk_) :: ilev, nlev, ilmin, info, nswps
integer(psb_ipk_) :: ilev, nlev, ilmin, nswps
type(psb_ctxt_type) :: ctxt
integer(psb_ipk_) :: me, np
logical :: is_symgs
+76 -60
View File
@@ -1,15 +1,15 @@
!
!
!
!
! AMG4PSBLAS version 1.0
! Algebraic Multigrid Package
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
!
! (C) Copyright 2021
!
! Salvatore Filippone
! Pasqua D'Ambra
! Fabio Durastante
!
!
! (C) Copyright 2021
!
! Salvatore Filippone
! Pasqua D'Ambra
! Fabio Durastante
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
@@ -21,7 +21,7 @@
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@@ -33,8 +33,8 @@
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
!
! File: amg_sprecinit.f90
!
! Subroutine: amg_sprecinit
@@ -42,21 +42,21 @@
!
! This routine allocates and initializes the preconditioner data structure,
! according to the preconditioner type chosen by the user.
!
!
! A default preconditioner is set for each preconditioner type
! specified by the user:
!
! 'NOPREC' - no preconditioner
!
! 'DIAG', 'JACOBI' - diagonal/Jacobi
! 'DIAG', 'JACOBI' - diagonal/Jacobi
!
! 'L1-DIAG', 'L1-JACOBI' - diagonal/Jacobi with L1 norm correction
!
! 'GS', 'FBGS' - Hybrid Gauss-Seidel, also symmetrized
!
!
! 'BJAC' - block Jacobi preconditioner, with ILU(0)
! on the local blocks
!
!
! 'L1-BJAC' - block Jacobi preconditioner, with ILU(0)
! on the local blocks and L1 correction for off-diag blocks
!
@@ -70,12 +70,12 @@
! applied as post-smoother at each level, but the
! coarsest one; four sweeps of the block-Jacobi solver,
! with LU from UMFPACK on the blocks, are applied at
! the coarsest level, on the distributed coarse matrix.
! the coarsest level, on the distributed coarse matrix.
! The smoothed aggregation algorithm with threshold 0
! is used to build the coarse matrix.
!
! For the multilevel preconditioners, the levels are numbered in increasing
! order starting from the finest one, i.e. level 1 is the finest level.
! order starting from the finest one, i.e. level 1 is the finest level.
!
!
! Arguments:
@@ -87,7 +87,7 @@
! lowercase strings).
! info - integer, output.
! Error code.
!
!
subroutine amg_sprecinit(ctxt,prec,ptype,info)
use psb_base_mod
@@ -113,98 +113,105 @@ subroutine amg_sprecinit(ctxt,prec,ptype,info)
! Local variables
integer(psb_ipk_) :: nlev_, ilev_
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: debug_level, debug_unit
real(psb_spk_) :: thr
character(len=*), parameter :: name='amg_precinit'
info = psb_success_
call psb_erractionsave(err_act)
if (psb_errstatus_fatal()) then
info = psb_err_internal_error_; goto 9999
end if
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
if (allocated(prec%precv)) then
call prec%free(info)
if (info /= psb_success_) then
! Do we want to do something?
if (allocated(prec%precv)) then
call prec%free(info)
if (info /= psb_success_) then
! Do we want to do something?
endif
endif
prec%ctxt = ctxt
prec%ag_data%min_coarse_size = -1
prec%ag_data%min_coarse_size_per_process = -1
call prec%ag_data%default()
select case(psb_toupper(trim(ptype)))
case ('NOPREC','NONE')
case ('NOPREC','NONE')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_base_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_base_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_s_id_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_s_id_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('JAC','DIAG','JACOBI')
case ('JAC','DIAG','JACOBI')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_s_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_s_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('L1-DIAG','L1-JACOBI','L1_DIAG','L1_JACOBI')
case ('L1-DIAG','L1-JACOBI','L1_DIAG','L1_JACOBI')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_s_l1_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_s_l1_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('GS','FWGS')
case ('GS','FWGS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_s_gs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_s_gs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('BWGS')
case ('BWGS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_s_bwgs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_s_bwgs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('FBGS')
case ('FBGS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
call prec%set('SMOOTHER_TYPE','FBGS',info)
call prec%precv(ilev_)%default()
case ('BJAC')
case ('BJAC')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_s_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_s_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('L1-BJAC','L1_BJAC')
case ('L1-BJAC','L1_BJAC')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_l1_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_l1_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_s_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_s_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('AS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_as_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_s_as_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_s_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_s_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
@@ -213,20 +220,24 @@ subroutine amg_sprecinit(ctxt,prec,ptype,info)
nlev_ = prec%ag_data%max_levs
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
if (info /= psb_success_ ) then
call psb_errpush(info,name,a_err='Error from hierarchy init')
goto 9999
endif
do ilev_ = 1, nlev_
do ilev_ = 1, nlev_
call prec%precv(ilev_)%default()
end do
call prec%set('ML_CYCLE','VCYCLE',info)
call prec%set('SMOOTHER_TYPE','FBGS',info)
#if defined(HAVE_MUMPS_)
call prec%set('COARSE_SOLVE','MUMPS',info)
call prec%set('COARSE_SOLVE','MUMPS',info)
#elif defined(HAVE_SLU_)
call prec%set('COARSE_SOLVE','SLU',info)
#else
call prec%set('COARSE_SOLVE','ILU',info)
#endif
case default
write(psb_err_unit,*) name,&
&': Warning: Unknown preconditioner type request "',ptype,'"'
@@ -234,5 +245,10 @@ subroutine amg_sprecinit(ctxt,prec,ptype,info)
end select
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine amg_sprecinit
+1 -1
View File
@@ -45,7 +45,7 @@ subroutine amg_sprecsetsm(p,val,info,ilev,ilmax,pos)
implicit none
! Arguments
class(amg_sprec_type), intent(inout) :: p
class(amg_sprec_type), target, intent(inout):: p
class(amg_s_base_smoother_type), intent(in) :: val
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax
+20 -2
View File
@@ -474,6 +474,16 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
select case (psb_toupper(string))
case('BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
#if defined(HAVE_UMF_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos)
#elif defined(HAVE_SLU_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
#elif defined(HAVE_MUMPS_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
#else
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
#endif
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
case('L1-BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
#if defined(HAVE_UMF_)
@@ -589,7 +599,6 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
type(amg_z_krm_solver_type) :: krm_slv
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_krm_,info,pos=pos)
call p%precv(nlev_)%set(krm_slv,info)
call p%precv(nlev_)%default()
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
end block
end select
@@ -638,6 +647,16 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
select case (psb_toupper(trim(string)))
case('BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
#if defined(HAVE_UMF_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos)
#elif defined(HAVE_SLU_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
#elif defined(HAVE_MUMPS_)
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
#else
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
#endif
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
case('L1-BJAC')
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
#if defined(HAVE_UMF_)
@@ -753,7 +772,6 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
type(amg_z_krm_solver_type) :: krm_slv
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_krm_,info,pos=pos)
call p%precv(nlev_)%set(krm_slv,info)
call p%precv(nlev_)%default()
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
end block
end select
+3 -2
View File
@@ -65,7 +65,7 @@
! 0: normal
! >1: increased details
!
subroutine amg_zfile_prec_descr(prec,iout,root, verbosity)
subroutine amg_zfile_prec_descr(prec,info,iout,root, verbosity)
use psb_base_mod
use amg_z_prec_mod, amg_protect_name => amg_zfile_prec_descr
use amg_z_inner_mod
@@ -74,13 +74,14 @@ subroutine amg_zfile_prec_descr(prec,iout,root, verbosity)
implicit none
! Arguments
class(amg_zprec_type), intent(in) :: prec
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: iout
integer(psb_ipk_), intent(in), optional :: root
integer(psb_ipk_), intent(in), optional :: verbosity
! Local variables
integer(psb_ipk_) :: ilev, nlev, ilmin, info, nswps
integer(psb_ipk_) :: ilev, nlev, ilmin, nswps
type(psb_ctxt_type) :: ctxt
integer(psb_ipk_) :: me, np
logical :: is_symgs
+77 -61
View File
@@ -1,15 +1,15 @@
!
!
!
!
! AMG4PSBLAS version 1.0
! Algebraic Multigrid Package
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
!
! (C) Copyright 2021
!
! Salvatore Filippone
! Pasqua D'Ambra
! Fabio Durastante
!
!
! (C) Copyright 2021
!
! Salvatore Filippone
! Pasqua D'Ambra
! Fabio Durastante
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
@@ -21,7 +21,7 @@
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@@ -33,8 +33,8 @@
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
!
! File: amg_zprecinit.f90
!
! Subroutine: amg_zprecinit
@@ -42,21 +42,21 @@
!
! This routine allocates and initializes the preconditioner data structure,
! according to the preconditioner type chosen by the user.
!
!
! A default preconditioner is set for each preconditioner type
! specified by the user:
!
! 'NOPREC' - no preconditioner
!
! 'DIAG', 'JACOBI' - diagonal/Jacobi
! 'DIAG', 'JACOBI' - diagonal/Jacobi
!
! 'L1-DIAG', 'L1-JACOBI' - diagonal/Jacobi with L1 norm correction
!
! 'GS', 'FBGS' - Hybrid Gauss-Seidel, also symmetrized
!
!
! 'BJAC' - block Jacobi preconditioner, with ILU(0)
! on the local blocks
!
!
! 'L1-BJAC' - block Jacobi preconditioner, with ILU(0)
! on the local blocks and L1 correction for off-diag blocks
!
@@ -70,12 +70,12 @@
! applied as post-smoother at each level, but the
! coarsest one; four sweeps of the block-Jacobi solver,
! with LU from UMFPACK on the blocks, are applied at
! the coarsest level, on the distributed coarse matrix.
! the coarsest level, on the distributed coarse matrix.
! The smoothed aggregation algorithm with threshold 0
! is used to build the coarse matrix.
!
! For the multilevel preconditioners, the levels are numbered in increasing
! order starting from the finest one, i.e. level 1 is the finest level.
! order starting from the finest one, i.e. level 1 is the finest level.
!
!
! Arguments:
@@ -87,7 +87,7 @@
! lowercase strings).
! info - integer, output.
! Error code.
!
!
subroutine amg_zprecinit(ctxt,prec,ptype,info)
use psb_base_mod
@@ -116,98 +116,105 @@ subroutine amg_zprecinit(ctxt,prec,ptype,info)
! Local variables
integer(psb_ipk_) :: nlev_, ilev_
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: debug_level, debug_unit
real(psb_dpk_) :: thr
character(len=*), parameter :: name='amg_precinit'
info = psb_success_
call psb_erractionsave(err_act)
if (psb_errstatus_fatal()) then
info = psb_err_internal_error_; goto 9999
end if
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
if (allocated(prec%precv)) then
call prec%free(info)
if (info /= psb_success_) then
! Do we want to do something?
if (allocated(prec%precv)) then
call prec%free(info)
if (info /= psb_success_) then
! Do we want to do something?
endif
endif
prec%ctxt = ctxt
prec%ag_data%min_coarse_size = -1
prec%ag_data%min_coarse_size_per_process = -1
call prec%ag_data%default()
select case(psb_toupper(trim(ptype)))
case ('NOPREC','NONE')
case ('NOPREC','NONE')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_base_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_base_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_z_id_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_z_id_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('JAC','DIAG','JACOBI')
case ('JAC','DIAG','JACOBI')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_z_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_z_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('L1-DIAG','L1-JACOBI','L1_DIAG','L1_JACOBI')
case ('L1-DIAG','L1-JACOBI','L1_DIAG','L1_JACOBI')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_z_l1_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_z_l1_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('GS','FWGS')
case ('GS','FWGS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_z_gs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_z_gs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('BWGS')
case ('BWGS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_z_bwgs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_z_bwgs_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('FBGS')
case ('FBGS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
call prec%set('SMOOTHER_TYPE','FBGS',info)
call prec%precv(ilev_)%default()
case ('BJAC')
case ('BJAC')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_z_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_z_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('L1-BJAC','L1_BJAC')
case ('L1-BJAC','L1_BJAC')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_l1_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_l1_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_z_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_z_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
case ('AS')
nlev_ = 1
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_as_smoother_type :: prec%precv(ilev_)%sm, stat=info)
allocate(prec%precv(nlev_),stat=info)
allocate(amg_z_as_smoother_type :: prec%precv(ilev_)%sm, stat=info)
if (info /= psb_success_) return
allocate(amg_z_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
allocate(amg_z_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info)
call prec%precv(ilev_)%default()
@@ -216,22 +223,26 @@ subroutine amg_zprecinit(ctxt,prec,ptype,info)
nlev_ = prec%ag_data%max_levs
ilev_ = 1
allocate(prec%precv(nlev_),stat=info)
if (info /= psb_success_ ) then
call psb_errpush(info,name,a_err='Error from hierarchy init')
goto 9999
endif
do ilev_ = 1, nlev_
do ilev_ = 1, nlev_
call prec%precv(ilev_)%default()
end do
call prec%set('ML_CYCLE','VCYCLE',info)
call prec%set('SMOOTHER_TYPE','FBGS',info)
#if defined(HAVE_UMF_)
#if defined(HAVE_UMF_)
call prec%set('COARSE_SOLVE','UMF',info)
#elif defined(HAVE_MUMPS_)
call prec%set('COARSE_SOLVE','MUMPS',info)
call prec%set('COARSE_SOLVE','MUMPS',info)
#elif defined(HAVE_SLU_)
call prec%set('COARSE_SOLVE','SLU',info)
#else
call prec%set('COARSE_SOLVE','ILU',info)
#endif
case default
write(psb_err_unit,*) name,&
&': Warning: Unknown preconditioner type request "',ptype,'"'
@@ -239,5 +250,10 @@ subroutine amg_zprecinit(ctxt,prec,ptype,info)
end select
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine amg_zprecinit
+1 -1
View File
@@ -45,7 +45,7 @@ subroutine amg_zprecsetsm(p,val,info,ilev,ilmax,pos)
implicit none
! Arguments
class(amg_zprec_type), intent(inout) :: p
class(amg_zprec_type), target, intent(inout):: p
class(amg_z_base_smoother_type), intent(in) :: val
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax
+15 -15
View File
@@ -94,7 +94,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define HANDLE_SIZE 8
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
typedef struct {
SuperMatrix *A;
zLUstruct_t *LUstruct;
@@ -142,7 +142,7 @@ int amg_zsludist_fact(int n, int nl, int nnzl, int ffstr,
SuperMatrix *A;
NRformat_loc *Astore;
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
zScalePermstruct_t *ScalePermstruct;
zLUstruct_t *LUstruct;
zSOLVEstruct_t SOLVEstruct;
@@ -155,9 +155,9 @@ int amg_zsludist_fact(int n, int nl, int nnzl, int ffstr,
int i, panel_size, permc_spec, relax, info;
trans_t trans;
double drop_tol = 0.0,berr[1];
#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_6)||defined(SLUD_VERSION_5)
#if (SLUD_VERSION_>=50)
superlu_dist_options_t options;
#elif defined(SLUD_VERSION_4)||defined(SLUD_VERSION_3)
#elif (SLUD_VERSION_>=30)
superlu_options_t options;
#else
choke_on_me;
@@ -181,7 +181,7 @@ int amg_zsludist_fact(int n, int nl, int nnzl, int ffstr,
SLU_NR_loc, SLU_Z, SLU_GE);
/* Initialize ScalePermstruct and LUstruct. */
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
ScalePermstruct = (zScalePermstruct_t *) SUPERLU_MALLOC(sizeof(zScalePermstruct_t));
LUstruct = (zLUstruct_t *) SUPERLU_MALLOC(sizeof(zLUstruct_t));
zScalePermstructInit(n,n, ScalePermstruct);
@@ -190,11 +190,11 @@ int amg_zsludist_fact(int n, int nl, int nnzl, int ffstr,
LUstruct = (LUstruct_t *) SUPERLU_MALLOC(sizeof(LUstruct_t));
ScalePermstructInit(n,n, ScalePermstruct);
#endif
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
zLUstructInit(n, LUstruct);
#elif defined(SLUD_VERSION_4) || defined(SLUD_VERSION_5) || defined(SLUD_VERSION_6)
#elif (SLUD_VERSION_>=40)
LUstructInit(n, LUstruct);
#elif defined(SLUD_VERSION_3)
#elif (SLUD_VERSION_>=30)
LUstructInit(n,n, LUstruct);
#else
choke_on_me;
@@ -257,7 +257,7 @@ int amg_zsludist_solve(int itrans, int n, int nrhs,
*/
#ifdef Have_SLUDist_
SuperMatrix *A;
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
zScalePermstruct_t *ScalePermstruct;
zLUstruct_t *LUstruct;
zSOLVEstruct_t SOLVEstruct;
@@ -271,9 +271,9 @@ int amg_zsludist_solve(int itrans, int n, int nrhs,
trans_t trans;
double drop_tol = 0.0;
double *berr;
#if defined(SLUD_VERSION_63) || defined(SLUD_VERSION_6) ||defined(SLUD_VERSION_5)
#if (SLUD_VERSION_>=50)
superlu_dist_options_t options;
#elif defined(SLUD_VERSION_4)|| defined(SLUD_VERSION_3)
#elif (SLUD_VERSION_>=30)
superlu_options_t options;
#else
choke_on_me;
@@ -343,7 +343,7 @@ int amg_zsludist_free(void *f_factors)
*/
#ifdef Have_SLUDist_
SuperMatrix *A;
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
zScalePermstruct_t *ScalePermstruct;
zLUstruct_t *LUstruct;
zSOLVEstruct_t SOLVEstruct;
@@ -357,9 +357,9 @@ int amg_zsludist_free(void *f_factors)
trans_t trans;
double drop_tol = 0.0;
double *berr;
#if defined(SLUD_VERSION_63)||defined(SLUD_VERSION_6)||defined(SLUD_VERSION_5)
#if (SLUD_VERSION_>=50)
superlu_dist_options_t options;
#elif defined(SLUD_VERSION_4)||defined(SLUD_VERSION_3)
#elif (SLUD_VERSION_>=30)
superlu_options_t options;
#else
choke_on_me;
@@ -380,7 +380,7 @@ int amg_zsludist_free(void *f_factors)
// we either have a leak or a segfault here.
// To be investigated further.
//Destroy_CompRowLoc_Matrix_dist(A);
#if defined(SLUD_VERSION_63)
#if (SLUD_VERSION_>=63)
zScalePermstructFree(ScalePermstruct);
zLUstructFree(LUstruct);
#else
@@ -83,6 +83,8 @@ subroutine amg_c_base_onelev_descr(lv,il,nl,ilmin,info,iout,verbosity)
write(iout_,*)
if (il == ilmin) then
call lv%parms%mlcycledsc(iout_,info)
end if
if (((ilmin==1).and.(il==2)).or.((ilmin>1).and.(il==ilmin))) then
if (allocated(lv%aggr)) then
call lv%aggr%descr(lv%parms,iout_,info)
else
+14 -12
View File
@@ -101,7 +101,13 @@ subroutine amg_c_base_onelev_dump(lv,level,info,prefix,head,ac,rp,&
end if
if (global_num_) then
if (level >= 2) then
if (level == 1) then
if (ac_) then
ivr = lv%base_desc%get_global_indices(owned=.false.)
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
call lv%base_a%print(fname,head=head,iv=ivr)
end if
else if (level >= 2) then
if (ac_) then
ivr = lv%desc_ac%get_global_indices(owned=.false.)
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
@@ -126,7 +132,12 @@ subroutine amg_c_base_onelev_dump(lv,level,info,prefix,head,ac,rp,&
end if
end if
else
if (level >= 2) then
if (level == 1) then
if (ac_) then
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
call lv%base_a%print(fname,head=head)
end if
else if (level >= 2) then
if (ac_) then
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
call lv%ac%print(fname,head=head)
@@ -146,16 +157,7 @@ subroutine amg_c_base_onelev_dump(lv,level,info,prefix,head,ac,rp,&
end if
end if
if (level >= 2) then
if (allocated(lv%sm)) then
call lv%sm%dump(lv%desc_ac,level,info,smoother=smoother, &
& solver=solver,prefix=trim(prefix_)//"_sm",global_num=global_num)
end if
if (allocated(lv%sm2a)) then
call lv%sm2a%dump(lv%desc_ac,level,info,smoother=smoother, &
& solver=solver,prefix=trim(prefix_)//"_sm2a",global_num=global_num)
end if
else
if (level >= 1) then
if (allocated(lv%sm)) then
call lv%sm%dump(lv%base_desc,level,info,smoother=smoother, &
& solver=solver,prefix=trim(prefix_)//"_sm",global_num=global_num)
@@ -83,6 +83,8 @@ subroutine amg_d_base_onelev_descr(lv,il,nl,ilmin,info,iout,verbosity)
write(iout_,*)
if (il == ilmin) then
call lv%parms%mlcycledsc(iout_,info)
end if
if (((ilmin==1).and.(il==2)).or.((ilmin>1).and.(il==ilmin))) then
if (allocated(lv%aggr)) then
call lv%aggr%descr(lv%parms,iout_,info)
else
+14 -12
View File
@@ -101,7 +101,13 @@ subroutine amg_d_base_onelev_dump(lv,level,info,prefix,head,ac,rp,&
end if
if (global_num_) then
if (level >= 2) then
if (level == 1) then
if (ac_) then
ivr = lv%base_desc%get_global_indices(owned=.false.)
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
call lv%base_a%print(fname,head=head,iv=ivr)
end if
else if (level >= 2) then
if (ac_) then
ivr = lv%desc_ac%get_global_indices(owned=.false.)
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
@@ -126,7 +132,12 @@ subroutine amg_d_base_onelev_dump(lv,level,info,prefix,head,ac,rp,&
end if
end if
else
if (level >= 2) then
if (level == 1) then
if (ac_) then
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
call lv%base_a%print(fname,head=head)
end if
else if (level >= 2) then
if (ac_) then
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
call lv%ac%print(fname,head=head)
@@ -146,16 +157,7 @@ subroutine amg_d_base_onelev_dump(lv,level,info,prefix,head,ac,rp,&
end if
end if
if (level >= 2) then
if (allocated(lv%sm)) then
call lv%sm%dump(lv%desc_ac,level,info,smoother=smoother, &
& solver=solver,prefix=trim(prefix_)//"_sm",global_num=global_num)
end if
if (allocated(lv%sm2a)) then
call lv%sm2a%dump(lv%desc_ac,level,info,smoother=smoother, &
& solver=solver,prefix=trim(prefix_)//"_sm2a",global_num=global_num)
end if
else
if (level >= 1) then
if (allocated(lv%sm)) then
call lv%sm%dump(lv%base_desc,level,info,smoother=smoother, &
& solver=solver,prefix=trim(prefix_)//"_sm",global_num=global_num)
@@ -83,6 +83,8 @@ subroutine amg_s_base_onelev_descr(lv,il,nl,ilmin,info,iout,verbosity)
write(iout_,*)
if (il == ilmin) then
call lv%parms%mlcycledsc(iout_,info)
end if
if (((ilmin==1).and.(il==2)).or.((ilmin>1).and.(il==ilmin))) then
if (allocated(lv%aggr)) then
call lv%aggr%descr(lv%parms,iout_,info)
else
+14 -12
View File
@@ -101,7 +101,13 @@ subroutine amg_s_base_onelev_dump(lv,level,info,prefix,head,ac,rp,&
end if
if (global_num_) then
if (level >= 2) then
if (level == 1) then
if (ac_) then
ivr = lv%base_desc%get_global_indices(owned=.false.)
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
call lv%base_a%print(fname,head=head,iv=ivr)
end if
else if (level >= 2) then
if (ac_) then
ivr = lv%desc_ac%get_global_indices(owned=.false.)
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
@@ -126,7 +132,12 @@ subroutine amg_s_base_onelev_dump(lv,level,info,prefix,head,ac,rp,&
end if
end if
else
if (level >= 2) then
if (level == 1) then
if (ac_) then
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
call lv%base_a%print(fname,head=head)
end if
else if (level >= 2) then
if (ac_) then
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
call lv%ac%print(fname,head=head)
@@ -146,16 +157,7 @@ subroutine amg_s_base_onelev_dump(lv,level,info,prefix,head,ac,rp,&
end if
end if
if (level >= 2) then
if (allocated(lv%sm)) then
call lv%sm%dump(lv%desc_ac,level,info,smoother=smoother, &
& solver=solver,prefix=trim(prefix_)//"_sm",global_num=global_num)
end if
if (allocated(lv%sm2a)) then
call lv%sm2a%dump(lv%desc_ac,level,info,smoother=smoother, &
& solver=solver,prefix=trim(prefix_)//"_sm2a",global_num=global_num)
end if
else
if (level >= 1) then
if (allocated(lv%sm)) then
call lv%sm%dump(lv%base_desc,level,info,smoother=smoother, &
& solver=solver,prefix=trim(prefix_)//"_sm",global_num=global_num)
@@ -83,6 +83,8 @@ subroutine amg_z_base_onelev_descr(lv,il,nl,ilmin,info,iout,verbosity)
write(iout_,*)
if (il == ilmin) then
call lv%parms%mlcycledsc(iout_,info)
end if
if (((ilmin==1).and.(il==2)).or.((ilmin>1).and.(il==ilmin))) then
if (allocated(lv%aggr)) then
call lv%aggr%descr(lv%parms,iout_,info)
else
+14 -12
View File
@@ -101,7 +101,13 @@ subroutine amg_z_base_onelev_dump(lv,level,info,prefix,head,ac,rp,&
end if
if (global_num_) then
if (level >= 2) then
if (level == 1) then
if (ac_) then
ivr = lv%base_desc%get_global_indices(owned=.false.)
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
call lv%base_a%print(fname,head=head,iv=ivr)
end if
else if (level >= 2) then
if (ac_) then
ivr = lv%desc_ac%get_global_indices(owned=.false.)
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
@@ -126,7 +132,12 @@ subroutine amg_z_base_onelev_dump(lv,level,info,prefix,head,ac,rp,&
end if
end if
else
if (level >= 2) then
if (level == 1) then
if (ac_) then
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
call lv%base_a%print(fname,head=head)
end if
else if (level >= 2) then
if (ac_) then
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_ac.mtx'
call lv%ac%print(fname,head=head)
@@ -146,16 +157,7 @@ subroutine amg_z_base_onelev_dump(lv,level,info,prefix,head,ac,rp,&
end if
end if
if (level >= 2) then
if (allocated(lv%sm)) then
call lv%sm%dump(lv%desc_ac,level,info,smoother=smoother, &
& solver=solver,prefix=trim(prefix_)//"_sm",global_num=global_num)
end if
if (allocated(lv%sm2a)) then
call lv%sm2a%dump(lv%desc_ac,level,info,smoother=smoother, &
& solver=solver,prefix=trim(prefix_)//"_sm2a",global_num=global_num)
end if
else
if (level >= 1) then
if (allocated(lv%sm)) then
call lv%sm%dump(lv%base_desc,level,info,smoother=smoother, &
& solver=solver,prefix=trim(prefix_)//"_sm",global_num=global_num)
@@ -61,6 +61,7 @@ subroutine amg_c_as_smoother_free(sm,info)
end if
end if
call sm%nd%free()
call sm%desc_data%free(info)
call psb_erractionrestore(err_act)
return
@@ -61,6 +61,7 @@ subroutine amg_d_as_smoother_free(sm,info)
end if
end if
call sm%nd%free()
call sm%desc_data%free(info)
call psb_erractionrestore(err_act)
return
@@ -61,6 +61,7 @@ subroutine amg_s_as_smoother_free(sm,info)
end if
end if
call sm%nd%free()
call sm%desc_data%free(info)
call psb_erractionrestore(err_act)
return
@@ -61,6 +61,7 @@ subroutine amg_z_as_smoother_free(sm,info)
end if
end if
call sm%nd%free()
call sm%desc_data%free(info)
call psb_erractionrestore(err_act)
return
@@ -42,7 +42,7 @@ subroutine amg_c_base_solver_csetr(sv,what,val,info,idx)
Implicit None
! Arguments
class(amg_c_base_solver_type), intent(inout) :: sv
integer(psb_ipk_), intent(in) :: what
character(len=*), intent(in) :: what
real(psb_spk_), intent(in) :: val
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: idx
@@ -44,7 +44,7 @@ subroutine amg_c_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
! Arguments
type(psb_cspmat_type), intent(in), target :: a
Type(psb_desc_type), Intent(in) :: desc_a
Type(psb_desc_type), Intent(inout) :: desc_a
class(amg_c_bwgs_solver_type), intent(inout) :: sv
integer(psb_ipk_), intent(out) :: info
type(psb_cspmat_type), intent(in), target, optional :: b
@@ -77,7 +77,7 @@
! This is the implementation file corresponding to amg_c_krm_solver_mod.
!
!
subroutine amg_c_krm_solver_bld(a,desc_a,sv,info,b,amold,vmold)
subroutine amg_c_krm_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
use psb_base_mod
use amg_c_krm_solver, amg_protect_name => amg_c_krm_solver_bld
@@ -85,13 +85,14 @@ subroutine amg_c_krm_solver_bld(a,desc_a,sv,info,b,amold,vmold)
Implicit None
! Arguments
type(psb_cspmat_type), intent(inout), target :: a
type(psb_cspmat_type), intent(in), target :: a
Type(psb_desc_type), Intent(inout) :: desc_a
class(amg_c_krm_solver_type), intent(inout) :: sv
integer(psb_ipk_), intent(out) :: info
type(psb_cspmat_type), intent(in), target, optional :: b
class(psb_c_base_sparse_mat), intent(in), optional :: amold
class(psb_c_base_vect_type), intent(in), optional :: vmold
class(psb_i_base_vect_type), intent(in), optional :: imold
! Local variables
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
integer(psb_lpk_) :: lnr
@@ -42,7 +42,7 @@ subroutine amg_d_base_solver_csetr(sv,what,val,info,idx)
Implicit None
! Arguments
class(amg_d_base_solver_type), intent(inout) :: sv
integer(psb_ipk_), intent(in) :: what
character(len=*), intent(in) :: what
real(psb_dpk_), intent(in) :: val
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: idx
@@ -44,7 +44,7 @@ subroutine amg_d_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
! Arguments
type(psb_dspmat_type), intent(in), target :: a
Type(psb_desc_type), Intent(in) :: desc_a
Type(psb_desc_type), Intent(inout) :: desc_a
class(amg_d_bwgs_solver_type), intent(inout) :: sv
integer(psb_ipk_), intent(out) :: info
type(psb_dspmat_type), intent(in), target, optional :: b
@@ -77,7 +77,7 @@
! This is the implementation file corresponding to amg_d_krm_solver_mod.
!
!
subroutine amg_d_krm_solver_bld(a,desc_a,sv,info,b,amold,vmold)
subroutine amg_d_krm_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
use psb_base_mod
use amg_d_krm_solver, amg_protect_name => amg_d_krm_solver_bld
@@ -85,13 +85,14 @@ subroutine amg_d_krm_solver_bld(a,desc_a,sv,info,b,amold,vmold)
Implicit None
! Arguments
type(psb_dspmat_type), intent(inout), target :: a
type(psb_dspmat_type), intent(in), target :: a
Type(psb_desc_type), Intent(inout) :: desc_a
class(amg_d_krm_solver_type), intent(inout) :: sv
integer(psb_ipk_), intent(out) :: info
type(psb_dspmat_type), intent(in), target, optional :: b
class(psb_d_base_sparse_mat), intent(in), optional :: amold
class(psb_d_base_vect_type), intent(in), optional :: vmold
class(psb_i_base_vect_type), intent(in), optional :: imold
! Local variables
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
integer(psb_lpk_) :: lnr
@@ -42,7 +42,7 @@ subroutine amg_s_base_solver_csetr(sv,what,val,info,idx)
Implicit None
! Arguments
class(amg_s_base_solver_type), intent(inout) :: sv
integer(psb_ipk_), intent(in) :: what
character(len=*), intent(in) :: what
real(psb_spk_), intent(in) :: val
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: idx
@@ -44,7 +44,7 @@ subroutine amg_s_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
! Arguments
type(psb_sspmat_type), intent(in), target :: a
Type(psb_desc_type), Intent(in) :: desc_a
Type(psb_desc_type), Intent(inout) :: desc_a
class(amg_s_bwgs_solver_type), intent(inout) :: sv
integer(psb_ipk_), intent(out) :: info
type(psb_sspmat_type), intent(in), target, optional :: b
@@ -77,7 +77,7 @@
! This is the implementation file corresponding to amg_s_krm_solver_mod.
!
!
subroutine amg_s_krm_solver_bld(a,desc_a,sv,info,b,amold,vmold)
subroutine amg_s_krm_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
use psb_base_mod
use amg_s_krm_solver, amg_protect_name => amg_s_krm_solver_bld
@@ -85,13 +85,14 @@ subroutine amg_s_krm_solver_bld(a,desc_a,sv,info,b,amold,vmold)
Implicit None
! Arguments
type(psb_sspmat_type), intent(inout), target :: a
type(psb_sspmat_type), intent(in), target :: a
Type(psb_desc_type), Intent(inout) :: desc_a
class(amg_s_krm_solver_type), intent(inout) :: sv
integer(psb_ipk_), intent(out) :: info
type(psb_sspmat_type), intent(in), target, optional :: b
class(psb_s_base_sparse_mat), intent(in), optional :: amold
class(psb_s_base_vect_type), intent(in), optional :: vmold
class(psb_i_base_vect_type), intent(in), optional :: imold
! Local variables
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
integer(psb_lpk_) :: lnr
@@ -42,7 +42,7 @@ subroutine amg_z_base_solver_csetr(sv,what,val,info,idx)
Implicit None
! Arguments
class(amg_z_base_solver_type), intent(inout) :: sv
integer(psb_ipk_), intent(in) :: what
character(len=*), intent(in) :: what
real(psb_dpk_), intent(in) :: val
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: idx
@@ -44,7 +44,7 @@ subroutine amg_z_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
! Arguments
type(psb_zspmat_type), intent(in), target :: a
Type(psb_desc_type), Intent(in) :: desc_a
Type(psb_desc_type), Intent(inout) :: desc_a
class(amg_z_bwgs_solver_type), intent(inout) :: sv
integer(psb_ipk_), intent(out) :: info
type(psb_zspmat_type), intent(in), target, optional :: b
@@ -77,7 +77,7 @@
! This is the implementation file corresponding to amg_z_krm_solver_mod.
!
!
subroutine amg_z_krm_solver_bld(a,desc_a,sv,info,b,amold,vmold)
subroutine amg_z_krm_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
use psb_base_mod
use amg_z_krm_solver, amg_protect_name => amg_z_krm_solver_bld
@@ -85,13 +85,14 @@ subroutine amg_z_krm_solver_bld(a,desc_a,sv,info,b,amold,vmold)
Implicit None
! Arguments
type(psb_zspmat_type), intent(inout), target :: a
type(psb_zspmat_type), intent(in), target :: a
Type(psb_desc_type), Intent(inout) :: desc_a
class(amg_z_krm_solver_type), intent(inout) :: sv
integer(psb_ipk_), intent(out) :: info
type(psb_zspmat_type), intent(in), target, optional :: b
class(psb_z_base_sparse_mat), intent(in), optional :: amold
class(psb_z_base_vect_type), intent(in), optional :: vmold
class(psb_i_base_vect_type), intent(in), optional :: imold
! Local variables
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
integer(psb_lpk_) :: lnr
+2 -2
View File
@@ -384,7 +384,7 @@ contains
integer(psb_c_ipk_) :: res
type(psb_c_object_type) :: ph
integer :: info
integer(psb_c_ipk_) :: info
type(amg_dprec_type), pointer :: precp
res = -1
@@ -396,7 +396,7 @@ contains
end if
call precp%descr()
call precp%descr(info)
call flush(psb_out_unit)
info = 0
+2 -2
View File
@@ -384,7 +384,7 @@ contains
integer(psb_c_ipk_) :: res
type(psb_c_object_type) :: ph
integer :: info
integer(psb_c_ipk_) :: info
type(amg_zprec_type), pointer :: precp
res = -1
@@ -396,7 +396,7 @@ contains
end if
call precp%descr()
call precp%descr(info)
call flush(psb_out_unit)
info = 0
+3 -1
View File
@@ -852,6 +852,7 @@ if test "x$pac_sludist_header_ok" == "xyes" ; then
dnl Maybe lib?
SLUDIST_LIBS="$amg4psblas_cv_superludist -L$amg4psblas_cv_superludistdir/lib";
LIBS="$SLUDIST_LIBS -lm $save_LIBS";
AC_MSG_CHECKING([for superlu_malloc_dist in $SLUDIST_LIBS])
AC_TRY_LINK_FUNC(superlu_malloc_dist,
[amg4psblas_cv_have_superludist=yes;pac_sludist_lib_ok=yes;],
[amg4psblas_cv_have_superludist=no;pac_sludist_lib_ok=no;
@@ -861,12 +862,13 @@ if test "x$pac_sludist_header_ok" == "xyes" ; then
dnl Maybe lib64?
SLUDIST_LIBS="$amg4psblas_cv_superludist -L$amg4psblas_cv_superludistdir/lib64";
LIBS="$SLUDIST_LIBS -lm $save_LIBS";
AC_MSG_CHECKING([for superlu_malloc_dist in $SLUDIST_LIBS])
AC_TRY_LINK_FUNC(superlu_malloc_dist,
[amg4psblas_cv_have_superludist=yes;pac_sludist_lib_ok=yes;],
[amg4psblas_cv_have_superludist=no;pac_sludist_lib_ok=no;
SLUDIST_LIBS="";SLUDIST_INCLUDES=""])
fi
AC_MSG_RESULT($pac_sludist_lib_ok)
AC_MSG_RESULT([$pac_sludist_lib_ok $SLUDIST_LIBS])
fi
if test "x$pac_sludist_lib_ok" == "xyes" ; then
Vendored
+1274 -12
View File
File diff suppressed because it is too large Load Diff
+97 -8
View File
@@ -133,6 +133,9 @@ FCFLAGS="$save_FCFLAGS";
save_CFLAGS="$CFLAGS";
AC_PROG_CC([cc xlc pgcc icc gcc ])
CFLAGS="$save_CFLAGS";
save_CXXFLAGS="$CXXFLAGS";
AC_PROG_CXX([CC xlc++ icpc g++])
CXXFLAGS="$save_CXXFLAGS";
dnl AC_PROG_CXX
dnl AC_PROG_F90 doesn't exist, at the time of writing this !
@@ -158,6 +161,16 @@ if eval "$FC -qversion 2>&1 | grep XL 2>/dev/null" ; then
# since (as far as it is known to us) -WF, is not used in earlier versions.
# More problems could be undocumented yet.
fi
if test "X$CC" == "X" ; then
AC_MSG_ERROR([Problem : No C compiler specified nor found!])
fi
AC_PROG_CC_STDC()
if test "x$ac_cv_prog_cc_stdc" == "xno" ; then
AC_MSG_ERROR([Problem : Need a C99 compiler ! ])
else
C99OPT="$ac_cv_prog_cc_stdc";
fi
###############################################################################
# Suitable MPI compilers detection
###############################################################################
@@ -171,6 +184,7 @@ if test x"$pac_cv_serial_mpi" == x"yes" ; then
FAKEMPI="fakempi.o";
MPIFC="$FC";
MPICC="$CC";
MPICXX="$CXX";
CXXDEFINES="-DSERIAL_MPI $CXXDEFINES";
else
@@ -190,9 +204,17 @@ if test "X$MPIFC" = "X" ; then
fi
ACX_MPI([], [AC_MSG_ERROR([[Cannot find any suitable MPI implementation for Fortran]])])
AC_LANG([C++])
if test "X$MPICXX" = "X" ; then
# This is our MPICC compiler preference: it will override ACX_MPI's first try.
AC_CHECK_PROGS([MPICXX],[mpxlc++ mpiicpc mpicxx])
fi
ACX_MPI([], [AC_MSG_ERROR([[Cannot find any suitable MPI implementation for C++]])])
AC_LANG([Fortran])
FC="$MPIFC" ;
CC="$MPICC";
CXX="$MPICXX";
fi
AC_LANG([C])
@@ -217,10 +239,12 @@ fi
dnl NOTE : no spaces before the comma, and no brackets before the second argument!
PAC_ARG_WITH_FLAGS(ccopt,CCOPT)
PAC_ARG_WITH_FLAGS(cxxopt,CXXOPT)
PAC_ARG_WITH_FLAGS(fcopt,FCOPT)
PAC_ARG_WITH_LIBS
PAC_ARG_WITH_FLAGS(clibs,CLIBS)
PAC_ARG_WITH_FLAGS(flibs,FLIBS)
PAC_ARG_WITH_FLAGS(cxxlibs,CXXLIBS)
dnl candidates for removal:
PAC_ARG_WITH_FLAGS(library-path,LIBRARYPATH)
@@ -230,6 +254,20 @@ PAC_ARG_WITH_FLAGS(module-path,MODULE_PATH)
# we just gave the user the chance to append values to these variables
PAC_ARG_WITH_EXTRA_LIBS
# Check if we need extra libs (e.g. for OpenMPI)
AC_MSG_CHECKING([Extra mpicxx libs?])
xtrlibs=`mpicxx --showme:link 2>/dev/null`;
if (( $? == 0 ))
then
EXTRA_LIBS="$EXTRA_LIBS $xtrlibs";
AC_MSG_RESULT([$xtrlibs])
else
AC_MSG_RESULT([none])
fi
###############################################################################
# Sanity checks, although redundant (useful when debugging this configure.ac)!
###############################################################################
@@ -395,6 +433,36 @@ if test "X$CCOPT" == "X" ; then
fi
fi
#CFLAGS="${CCOPT}"
if test "X$CXXOPT" == "X" ; then
CXXOPT="$CXXFLAGS";
fi
if test "X$CXXOPT" == "X" ; then
if test "X$psblas_cv_fc" == "Xgcc" ; then
# note that no space should be placed around the equality symbol in assignements
# Note : 'native' is valid _only_ on GCC/x86 (32/64 bits)
CXXOPT="-g -O3 $CXXOPT"
elif test "X$psblas_cv_fc" == X"xlf" ; then
# XL compiler : consider using -qarch=auto
CXXOPT="-O3 -qarch=auto $CXXOPT"
elif test "X$psblas_cv_fc" == X"ifc" ; then
# other compilers ..
CXXOPT="-O3 $CXXOPT"
elif test "X$psblas_cv_fc" == X"pg" ; then
# other compilers ..
CXXCOPT="-fast $CXXOPT"
# NOTE : PG & Sun use -fast instead -O3
elif test "X$psblas_cv_fc" == X"sun" ; then
# other compilers ..
CXXOPT="-fast $CXXOPT"
elif test "X$psblas_cv_fc" == X"cray" ; then
CXXOPT="-O3 $CXXOPT"
MPICXX="CC"
else
CXXOPT="-g -O3 $CXXOPT"
fi
fi
# Honor FCFLAGS if they were specified explicitly, but --with-fcopt take precedence
if test "X$FCOPT" == "X" ; then
@@ -443,7 +511,8 @@ fi
##############################################################################
FC=${FC}
CC=${CC}
MPCC=${MPICC}
CXX=${CXX}
CCOPT="$CCOPT $C99OPT"
##############################################################################
@@ -478,6 +547,30 @@ fi
if test "X$FLINK" == "X" ; then
FLINK=${MPF90}
fi
# Custom test : do we have a module or include for MPI Fortran interface?
if test x"$pac_cv_serial_mpi" == x"yes" ; then
FDEFINES="$psblas_cv_define_prepend-DSERIAL_MPI $psblas_cv_define_prepend-DMPI_MOD $FDEFINES";
else
PAC_FORTRAN_CHECK_HAVE_MPI_MOD_F08()
if test x"$pac_cv_mpi_f08" == x"yes" ; then
dnl FDEFINES="$psblas_cv_define_prepend-DMPI_MOD_F08 $FDEFINES";
FDEFINES="$psblas_cv_define_prepend-DMPI_MOD $FDEFINES";
else
PAC_FORTRAN_CHECK_HAVE_MPI_MOD(
[FDEFINES="$psblas_cv_define_prepend-DMPI_MOD $FDEFINES"],
[FDEFINES="$psblas_cv_define_prepend-DMPI_H $FDEFINES"])
fi
fi
FLINK="$MPIFC"
PAC_ARG_OPENMP()
if test x"$pac_cv_openmp" == x"yes" ; then
FDEFINES="$psblas_cv_define_prepend-DOPENMP $FDEFINES";
CDEFINES="-DOPENMP $CDEFINES";
FCOPT="$FCOPT $pac_cv_openmp_fcopt";
CCOPT="$CCOPT $pac_cv_openmp_ccopt";
FLINK="$FLINK $pac_cv_openmp_fcopt";
fi
PAC_FORTRAN_HAVE_PSBLAS([AC_MSG_RESULT([yes.])],
[AC_MSG_ERROR([no. Could not find working version of PSBLAS.])])
@@ -693,14 +786,10 @@ fi
PAC_CHECK_SUPERLUDIST()
if test "x$amg4psblas_cv_have_superludist" == "xyes" ; then
pac_sludist_version="$amg4psblas_cv_superludist_major";
if (($amg4psblas_cv_superludist_major==6)); then
if (($amg4psblas_cv_superludist_minor>=3)); then
pac_sludist_version="63";
fi
fi
pac_sludist_version="$amg4psblas_cv_superludist_major$amg4psblas_cv_superludist_minor";
AC_MSG_NOTICE([Configuring with SuperLU_DIST version flag $pac_sludist_version])
SLUDIST_FLAGS=""
SLUDIST_FLAGS="-DHave_SLUDist_ -DSLUD_VERSION_$pac_sludist_version $SLUDIST_INCLUDES"
SLUDIST_FLAGS="-DHave_SLUDist_ -DSLUD_VERSION_="$pac_sludist_version" $SLUDIST_INCLUDES"
FDEFINES="$amg_cv_define_prepend-DHAVE_SLUDIST_ $FDEFINES"
else
SLUDIST_FLAGS=""
+64 -11
View File
@@ -753,6 +753,7 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -877,6 +878,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1129,6 +1131,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1266,7 +1277,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1419,6 +1430,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -8087,6 +8099,44 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran ISO_C_BINDING module" >&5
$as_echo_n "checking support for Fortran ISO_C_BINDING module... " >&6; }
ac_ext=${ac_fc_srcext-f}
ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_fc_compiler_gnu
ac_exeext=''
ac_ext='f90'
ac_fc=${MPIFC-$FC};
cat > conftest.$ac_ext <<_ACEOF
program conftest
use iso_c_binding
end program conftest
_ACEOF
if ac_fn_fc_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
:
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
as_fn_error $? "Sorry, cannot build PSBLAS without support for ISO_C_BINDING.
Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.8." "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ISO_FORTRAN_ENV" >&5
$as_echo_n "checking support for ISO_FORTRAN_ENV... " >&6; }
ac_ext=${ac_fc_srcext-f}
@@ -10706,6 +10756,8 @@ rm -f core conftest.err conftest.$ac_objext \
if test "x$pac_sludist_lib_ok" == "xno" ; then
SLUDIST_LIBS="$amg4psblas_cv_superludist -L$amg4psblas_cv_superludistdir/lib";
LIBS="$SLUDIST_LIBS -lm $save_LIBS";
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for superlu_malloc_dist in $SLUDIST_LIBS" >&5
$as_echo_n "checking for superlu_malloc_dist in $SLUDIST_LIBS... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -10736,6 +10788,8 @@ rm -f core conftest.err conftest.$ac_objext \
if test "x$pac_sludist_lib_ok" == "xno" ; then
SLUDIST_LIBS="$amg4psblas_cv_superludist -L$amg4psblas_cv_superludistdir/lib64";
LIBS="$SLUDIST_LIBS -lm $save_LIBS";
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for superlu_malloc_dist in $SLUDIST_LIBS" >&5
$as_echo_n "checking for superlu_malloc_dist in $SLUDIST_LIBS... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -10763,8 +10817,8 @@ fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_sludist_lib_ok" >&5
$as_echo "$pac_sludist_lib_ok" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_sludist_lib_ok $SLUDIST_LIBS" >&5
$as_echo "$pac_sludist_lib_ok $SLUDIST_LIBS" >&6; }
fi
if test "x$pac_sludist_lib_ok" == "xyes" ; then
@@ -10906,14 +10960,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "x$amg4psblas_cv_have_superludist" == "xyes" ; then
pac_sludist_version="$amg4psblas_cv_superludist_major";
if (($amg4psblas_cv_superludist_major==6)); then
if (($amg4psblas_cv_superludist_minor>=3)); then
pac_sludist_version="63";
fi
fi
pac_sludist_version="$amg4psblas_cv_superludist_major$amg4psblas_cv_superludist_minor";
{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring with SuperLU_DIST version flag $pac_sludist_version" >&5
$as_echo "$as_me: Configuring with SuperLU_DIST version flag $pac_sludist_version" >&6;}
SLUDIST_FLAGS=""
SLUDIST_FLAGS="-DHave_SLUDist_ -DSLUD_VERSION_$pac_sludist_version $SLUDIST_INCLUDES"
SLUDIST_FLAGS="-DHave_SLUDist_ -DSLUD_VERSION_="$pac_sludist_version" $SLUDIST_INCLUDES"
FDEFINES="$amg_cv_define_prepend-DHAVE_SLUDIST_ $FDEFINES"
else
SLUDIST_FLAGS=""
@@ -12275,7 +12326,9 @@ $as_echo X/"$am_mf" |
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
for automatic dependency tracking. If GNU make was not used, consider
re-running the configure script with MAKE=\"gmake\" (or whatever is
necessary). You can also try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).
See \`config.log' for more details" "$LINENO" 5; }
+9 -7
View File
@@ -673,6 +673,12 @@ PAC_FORTRAN_TEST_VOLATILE(
[AC_MSG_ERROR([Sorry, cannot build PSBLAS without support for VOLATILE])]
)
PAC_FORTRAN_TEST_ISO_C_BIND(
[],
[AC_MSG_ERROR([Sorry, cannot build PSBLAS without support for ISO_C_BINDING.
Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.8.])]
)
PAC_FORTRAN_TEST_ISO_FORTRAN_ENV(
[],
[AC_MSG_ERROR([Sorry, cannot build PSBLAS without support for ISO_FORTRAN_ENV])]
@@ -856,14 +862,10 @@ fi
PAC_CHECK_SUPERLUDIST()
if test "x$amg4psblas_cv_have_superludist" == "xyes" ; then
pac_sludist_version="$amg4psblas_cv_superludist_major";
if (($amg4psblas_cv_superludist_major==6)); then
if (($amg4psblas_cv_superludist_minor>=3)); then
pac_sludist_version="63";
fi
fi
pac_sludist_version="$amg4psblas_cv_superludist_major$amg4psblas_cv_superludist_minor";
AC_MSG_NOTICE([Configuring with SuperLU_DIST version flag $pac_sludist_version])
SLUDIST_FLAGS=""
SLUDIST_FLAGS="-DHave_SLUDist_ -DSLUD_VERSION_$pac_sludist_version $SLUDIST_INCLUDES"
SLUDIST_FLAGS="-DHave_SLUDist_ -DSLUD_VERSION_="$pac_sludist_version" $SLUDIST_INCLUDES"
FDEFINES="$amg_cv_define_prepend-DHAVE_SLUDIST_ $FDEFINES"
else
SLUDIST_FLAGS=""
Binary file not shown.
+3 -3
View File
@@ -3,8 +3,8 @@
<html >
<head><title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)">
<meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)">
<meta name="generator" content="TeX4ht (https://tug.org/tex4ht/)">
<meta name="originator" content="TeX4ht (https://tug.org/tex4ht/)">
<!-- html,3 -->
<meta name="src" content="userhtml.tex">
<link rel="stylesheet" type="text/css" href="userhtml.css">
@@ -31,7 +31,7 @@ class="cmr-12">University of Rome Tor-Vergata and IAC-CNR</span><br
class="newline" /> <span
class="cmr-12">Software version: 1.0</span><br
class="newline" /><span
class="cmr-12">April 12, 2021</span>
class="cmr-12">May 11th, 2021</span>
+25 -25
View File
@@ -13,33 +13,35 @@
.cmbx-12{font-size:109%; font-weight: bold;}
.cmbx-12{ font-weight: bold;}
.cmbx-12{ font-weight: bold;}
.cmtt-12{font-size:109%;font-family: monospace;}
.cmtt-12{font-family: monospace;}
.cmtt-12{font-family: monospace;}
.cmtt-12{font-size:109%;font-family: monospace,monospace;}
.cmtt-12{font-family: monospace,monospace;}
.cmtt-12{font-family: monospace,monospace;}
.cmcsc-10x-x-120{font-size:109%;}
.cmr-8{font-size:72%;}
.cmmi-12{font-size:109%;font-style: italic;}
.cmmi-8{font-size:72%;font-style: italic;}
.cmsy-10x-x-120{font-size:109%;}
.cmsy-8{font-size:72%;}
.tctt-1200{font-size:109%;font-family: monospace,monospace;}
.cmmi-10x-x-109{font-style: italic;}
.cmsy-10x-x-109{}
.cmtt-10x-x-109{font-family: monospace;}
.cmtt-10x-x-109{font-family: monospace;}
.cmtt-10x-x-109{font-family: monospace;}
.cmtt-10x-x-109{font-family: monospace,monospace;}
.cmtt-10x-x-109{font-family: monospace,monospace;}
.cmtt-10x-x-109{font-family: monospace,monospace;}
.cmcsc-10x-x-109{}
.cmtt-10{font-size:90%;font-family: monospace;}
.cmtt-10{font-family: monospace;}
.cmtt-10{font-family: monospace;}
.cmtt-10{font-size:90%;font-family: monospace,monospace;}
.cmtt-10{font-family: monospace,monospace;}
.cmtt-10{font-family: monospace,monospace;}
.cmbx-10x-x-109{ font-weight: bold;}
.cmbx-10x-x-109{ font-weight: bold;}
.cmbx-10x-x-109{ font-weight: bold;}
.cmcsc-10{font-size:90%;}
.small-caps{font-variant: small-caps; }
p.noindent { text-indent: 0em }
td p.noindent { text-indent: 0em; margin-top:0em; }
p.nopar { text-indent: 0em; }
p.indent{ text-indent: 1.5em }
p{margin-top:0;margin-bottom:0}
p.indent{text-indent:0;}
p + p{margin-top:1em;}
p + div, p + pre {margin-top:1em;}
div + p, pre + p {margin-top:1em;}
@media print {div.crosslinks {visibility:hidden;}}
a img { border-top: 0; border-left: 0; border-right: 0; }
center { margin-top:1em; margin-bottom:1em; }
@@ -62,7 +64,7 @@ div.obeylines-v p { margin-top:0; margin-bottom:0; }
td.displaylines {text-align:center; white-space:nowrap;}
.centerline {text-align:center;}
.rightline {text-align:right;}
div.verbatim {font-family: monospace; white-space: nowrap; text-align:left; clear:both; }
pre.verbatim {font-family: monospace,monospace; text-align:left; clear:both; }
.fbox {padding-left:3.0pt; padding-right:3.0pt; text-indent:0pt; border:solid black 0.4pt; }
div.fbox {display:table}
div.center div.fbox {text-align:center; clear:both; padding-left:3.0pt; padding-right:3.0pt; text-indent:0pt; border:solid black 0.4pt; }
@@ -95,18 +97,16 @@ td.td01{ padding-left:0pt; padding-right:5pt; }
td.td10{ padding-left:5pt; padding-right:0pt; }
td.td11{ padding-left:5pt; padding-right:5pt; }
table[rules] {border-left:solid black 0.4pt; border-right:solid black 0.4pt; }
.hline hr, .cline hr{ height : 1px; margin:0px; }
.hline hr, .cline hr{ height : 0px; margin:0px; }
.hline td, .cline td{ padding: 0; }
.hline hr, .cline hr{border:none;border-top:1px solid black;}
.tabbing-right {text-align:right;}
span.TEX {letter-spacing: -0.125em; }
span.TEX span.E{ position:relative;top:0.5ex;left:-0.0417em;}
a span.TEX span.E {text-decoration: none; }
span.LATEX span.A{ position:relative; top:-0.5ex; left:-0.4em; font-size:85%;}
span.LATEX span.TEX{ position:relative; left: -0.4em; }
div.float, div.figure {margin-left: auto; margin-right: auto;}
div.float img {text-align:center;}
div.figure img {text-align:center;}
.marginpar {width:20%; float:right; text-align:left; margin-left:auto; margin-top:0.5em; font-size:85%; text-decoration:underline;}
.marginpar p{margin-top:0.4em; margin-bottom:0.4em;}
.marginpar,.reversemarginpar {width:20%; float:right; text-align:left; margin-left:auto; margin-top:0.5em; font-size:85%; text-decoration:underline;}
.marginpar p,.reversemarginpar p{margin-top:0.4em; margin-bottom:0.4em;}
.reversemarginpar{float:left;}
table.equation {width:100%;}
.equation td{text-align:center; }
td.equation { margin-top:1em; margin-bottom:1em; }
@@ -149,10 +149,10 @@ div.abstract {width:100%;}
.Ovalbox-thick { padding-left:3pt; padding-right:3pt; border:solid thick; }
.shadowbox { padding-left:3pt; padding-right:3pt; border:solid thin; border-right:solid thick; border-bottom:solid thick; }
.doublebox { padding-left:3pt; padding-right:3pt; border-style:double; border:solid thick; }
.figure img.graphics {margin-left:10%;}
.rotatebox{display: inline-block;}
.lstlisting .label{margin-right:0.5em; }
div.lstlisting{font-family: monospace; white-space: nowrap; margin-top:0.5em; margin-bottom:0.5em; }
div.lstinputlisting{ font-family: monospace; white-space: nowrap; }
div.lstlisting{font-family: monospace,monospace; white-space: nowrap; margin-top:0.5em; margin-bottom:0.5em; }
div.lstinputlisting{ font-family: monospace,monospace; white-space: nowrap; }
.lstinputlisting .label{margin-right:0.5em;}
#TBL-1 colgroup{border-left: 1px solid black;border-right:1px solid black;}
#TBL-1{border-collapse:collapse;}
+3 -3
View File
@@ -3,8 +3,8 @@
<html >
<head><title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)">
<meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)">
<meta name="generator" content="TeX4ht (https://tug.org/tex4ht/)">
<meta name="originator" content="TeX4ht (https://tug.org/tex4ht/)">
<!-- html,3 -->
<meta name="src" content="userhtml.tex">
<link rel="stylesheet" type="text/css" href="userhtml.css">
@@ -31,7 +31,7 @@ class="cmr-12">University of Rome Tor-Vergata and IAC-CNR</span><br
class="newline" /> <span
class="cmr-12">Software version: 1.0</span><br
class="newline" /><span
class="cmr-12">April 12, 2021</span>
class="cmr-12">May 11th, 2021</span>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 905 B

After

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

+2 -2
View File
@@ -3,8 +3,8 @@
<html >
<head><title>Abstract</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)">
<meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)">
<meta name="generator" content="TeX4ht (https://tug.org/tex4ht/)">
<meta name="originator" content="TeX4ht (https://tug.org/tex4ht/)">
<!-- html,3 -->
<meta name="src" content="userhtml.tex">
<link rel="stylesheet" type="text/css" href="userhtml.css">
+2 -2
View File
@@ -3,8 +3,8 @@
<html >
<head><title>Contents</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)">
<meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)">
<meta name="generator" content="TeX4ht (https://tug.org/tex4ht/)">
<meta name="originator" content="TeX4ht (https://tug.org/tex4ht/)">
<!-- html,3 -->
<meta name="src" content="userhtml.tex">
<link rel="stylesheet" type="text/css" href="userhtml.css">
+2 -2
View File
@@ -3,8 +3,8 @@
<html >
<head><title>Contributors</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)">
<meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)">
<meta name="generator" content="TeX4ht (https://tug.org/tex4ht/)">
<meta name="originator" content="TeX4ht (https://tug.org/tex4ht/)">
<!-- html,3 -->
<meta name="src" content="userhtml.tex">
<link rel="stylesheet" type="text/css" href="userhtml.css">

Some files were not shown because too many files have changed in this diff Show More