mirror of
https://github.com/sfilippone/amg4psblas.git
synced 2026-10-07 07:04:59 +00:00
Compare commits
35
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f523d0195f | ||
|
|
edea0caa63 | ||
|
|
bd8495794a | ||
|
|
0f223ca269 | ||
|
|
c4e584a8d2 | ||
|
|
9004e623fe | ||
|
|
653074995a | ||
|
|
09928af671 | ||
|
|
ba2c6aa721 | ||
|
|
c65304f255 | ||
|
|
cf67905788 | ||
|
|
19325ed390 | ||
|
|
c7b55a452e | ||
|
|
c80d2d8b1d | ||
|
|
8cf193ec5b | ||
|
|
8cf8c0fc7b | ||
|
|
b11a7db667 | ||
|
|
d700e4c7e4 | ||
|
|
43d3659a9e | ||
|
|
82e7e7d7e7 | ||
|
|
5993b79749 | ||
|
|
0523053c49 | ||
|
|
52eaa06f9e | ||
|
|
71156dbb3c | ||
|
|
9dab2a8c7c | ||
|
|
f2cf59c276 | ||
|
|
fa2f8f53d5 | ||
|
|
9609ea262f | ||
|
|
eb30e8be90 | ||
|
|
9779eeec9f | ||
|
|
6f419a2210 | ||
|
|
c4801635b8 | ||
|
|
c18e5720f5 | ||
|
|
9ab599367b | ||
|
|
2396123b44 |
+3
-3
@@ -12,9 +12,9 @@ config.log
|
||||
config.status
|
||||
|
||||
# generated folder
|
||||
/include/
|
||||
/modules/
|
||||
/docs/src/tmp
|
||||
include/
|
||||
modules/
|
||||
docs/src/tmp
|
||||
autom4te.cache
|
||||
|
||||
# the executable from tests
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ CDEFINES=$(AMGCDEFINES)
|
||||
AMGFDEFINES=@AMGFDEFINES@ $(PSBFDEFINES)
|
||||
FDEFINES=$(AMGFDEFINES)
|
||||
|
||||
CXXDEFINES=@AMGCXXDEFINES@
|
||||
CXXDEFINES=@AMGCXXDEFINES@ $(PSBCXXDEFINES)
|
||||
|
||||
@COMPILERULES@
|
||||
|
||||
|
||||
+5
-2
@@ -16,7 +16,8 @@ DMODOBJS=amg_d_prec_type.o \
|
||||
amg_d_dec_aggregator_mod.o amg_d_symdec_aggregator_mod.o \
|
||||
amg_d_ainv_solver.o amg_d_base_ainv_mod.o \
|
||||
amg_d_invk_solver.o amg_d_invt_solver.o amg_d_krm_solver.o \
|
||||
amg_d_matchboxp_mod.o amg_d_parmatch_aggregator_mod.o
|
||||
amg_d_matchboxp_mod.o amg_d_parmatch_aggregator_mod.o \
|
||||
amg_d_newmatch_aggregator_mod.o amg_d_decmatch_mod.o
|
||||
|
||||
SMODOBJS=amg_s_prec_type.o amg_s_ilu_fact_mod.o \
|
||||
amg_s_inner_mod.o amg_s_ilu_solver.o amg_s_diag_solver.o amg_s_jac_smoother.o amg_s_as_smoother.o \
|
||||
@@ -116,7 +117,7 @@ amg_c_prec_type.o: amg_c_onelev_mod.o
|
||||
amg_z_prec_type.o: amg_z_onelev_mod.o
|
||||
|
||||
amg_s_onelev_mod.o: amg_s_base_smoother_mod.o amg_s_dec_aggregator_mod.o amg_s_parmatch_aggregator_mod.o
|
||||
amg_d_onelev_mod.o: amg_d_base_smoother_mod.o amg_d_dec_aggregator_mod.o amg_d_parmatch_aggregator_mod.o
|
||||
amg_d_onelev_mod.o: amg_d_base_smoother_mod.o amg_d_dec_aggregator_mod.o amg_d_parmatch_aggregator_mod.o amg_d_newmatch_aggregator_mod.o
|
||||
amg_c_onelev_mod.o: amg_c_base_smoother_mod.o amg_c_dec_aggregator_mod.o
|
||||
amg_z_onelev_mod.o: amg_z_base_smoother_mod.o amg_z_dec_aggregator_mod.o
|
||||
|
||||
@@ -129,6 +130,8 @@ amg_d_base_aggregator_mod.o: amg_base_prec_type.o
|
||||
amg_d_parmatch_aggregator_mod.o amg_d_dec_aggregator_mod.o: amg_d_base_aggregator_mod.o
|
||||
amg_d_hybrid_aggregator_mod.o amg_d_symdec_aggregator_mod.o: amg_d_dec_aggregator_mod.o
|
||||
amg_d_parmatch_aggregator_mod.o: amg_d_matchboxp_mod.o
|
||||
amg_d_newmatch_aggregator_mod.o: amg_d_base_aggregator_mod.o
|
||||
amg_d_newmatch_aggregator_mod.o: amg_d_decmatch_mod.o
|
||||
|
||||
amg_c_base_aggregator_mod.o: amg_base_prec_type.o
|
||||
amg_c_parmatch_aggregator_mod.o amg_c_dec_aggregator_mod.o: amg_c_base_aggregator_mod.o
|
||||
|
||||
@@ -94,7 +94,6 @@ module amg_base_prec_type
|
||||
integer(psb_ipk_) :: aggr_omega_alg, aggr_eig, aggr_filter
|
||||
integer(psb_ipk_) :: coarse_mat, coarse_solve
|
||||
contains
|
||||
procedure, pass(pm) :: get_coarse_mat => ml_parms_get_coarse_mat
|
||||
procedure, pass(pm) :: get_coarse => ml_parms_get_coarse
|
||||
procedure, pass(pm) :: clone => ml_parms_clone
|
||||
procedure, pass(pm) :: descr => ml_parms_descr
|
||||
@@ -276,7 +275,8 @@ module amg_base_prec_type
|
||||
integer(psb_ipk_), parameter :: amg_sym_dec_aggr_ = 1
|
||||
integer(psb_ipk_), parameter :: amg_ext_aggr_ = 2
|
||||
integer(psb_ipk_), parameter :: amg_coupled_aggr_ = 3
|
||||
integer(psb_ipk_), parameter :: amg_max_par_aggr_alg_ = amg_coupled_aggr_
|
||||
integer(psb_ipk_), parameter :: amg_newmtc_aggr_ = 4
|
||||
integer(psb_ipk_), parameter :: amg_max_par_aggr_alg_ = amg_newmtc_aggr_
|
||||
!
|
||||
! Legal values for entry: amg_aggr_type_
|
||||
!
|
||||
@@ -284,6 +284,7 @@ module amg_base_prec_type
|
||||
integer(psb_ipk_), parameter :: amg_soc1_ = 1
|
||||
integer(psb_ipk_), parameter :: amg_soc2_ = 2
|
||||
integer(psb_ipk_), parameter :: amg_matchboxp_ = 3
|
||||
integer(psb_ipk_), parameter :: amg_newmatch_ = 4
|
||||
!
|
||||
! Legal values for entry: amg_aggr_prol_
|
||||
!
|
||||
@@ -372,13 +373,14 @@ module amg_base_prec_type
|
||||
character(len=15), parameter, private :: &
|
||||
& matrix_names(0:1)=(/'distributed ','replicated '/)
|
||||
character(len=18), parameter, private :: &
|
||||
& aggr_type_names(0:3)=(/'None ',&
|
||||
& aggr_type_names(0:4)=(/'None ',&
|
||||
& 'SOC measure 1 ', 'SOC Measure 2 ',&
|
||||
& 'Parallel Matching '/)
|
||||
& 'Parallel Matching ','Decoupled Matching'/)
|
||||
character(len=18), parameter, private :: &
|
||||
& par_aggr_alg_names(0:3)=(/&
|
||||
& par_aggr_alg_names(0:4)=(/&
|
||||
& 'decoupled aggr. ', 'sym. dec. aggr. ',&
|
||||
& 'user defined aggr.', 'coupled aggr. '/)
|
||||
& 'user defined aggr.', 'coupled aggr. ',&
|
||||
& 'new matching aggr.'/)
|
||||
character(len=18), parameter, private :: &
|
||||
& ord_names(0:1)=(/'Natural ordering ','Desc. degree ord. '/)
|
||||
character(len=6), parameter, private :: &
|
||||
@@ -517,6 +519,10 @@ contains
|
||||
val = amg_soc2_
|
||||
case('SOC1')
|
||||
val = amg_soc1_
|
||||
case('NEWMATCH')
|
||||
val = amg_newmatch_
|
||||
case('NEWMTC')
|
||||
val = amg_newmtc_aggr_
|
||||
case('MATCHBOXP','PARMATCH')
|
||||
val = amg_matchboxp_
|
||||
case('COUPLED','COUP')
|
||||
@@ -578,33 +584,6 @@ contains
|
||||
end select
|
||||
end function amg_stringval
|
||||
|
||||
function amg_get_coarse_mat_name(val) result(res)
|
||||
character(len=15) :: res
|
||||
integer :: val
|
||||
select case(val)
|
||||
case (0,1)
|
||||
res = matrix_names(val)
|
||||
case default
|
||||
res = 'Unknown '
|
||||
end select
|
||||
end function amg_get_coarse_mat_name
|
||||
|
||||
subroutine amg_warn_coarse_mat(val,expected)
|
||||
integer(psb_ipk_) :: val, expected
|
||||
if (val /= expected) then
|
||||
write(0,*) 'Warning: resetting COARSE_MAT on an existing hierarchy from ',&
|
||||
& amg_get_coarse_mat_name(val), ' to ',amg_get_coarse_mat_name(expected)
|
||||
end if
|
||||
end subroutine amg_warn_coarse_mat
|
||||
|
||||
|
||||
function ml_parms_get_coarse_mat(pm) result(res)
|
||||
implicit none
|
||||
class(amg_ml_parms), intent(in) :: pm
|
||||
integer(psb_ipk_) :: res
|
||||
res = pm%coarse_mat
|
||||
end function ml_parms_get_coarse_mat
|
||||
|
||||
subroutine ml_parms_get_coarse(pm,pmin)
|
||||
implicit none
|
||||
class(amg_ml_parms), intent(inout) :: pm
|
||||
|
||||
@@ -58,7 +58,6 @@ module amg_c_ainv_solver
|
||||
procedure, pass(sv) :: check => amg_c_ainv_solver_check
|
||||
procedure, pass(sv) :: build => amg_c_ainv_solver_bld
|
||||
procedure, pass(sv) :: clone => amg_c_ainv_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_c_ainv_solver_clone_settings
|
||||
procedure, pass(sv) :: cseti => amg_c_ainv_solver_cseti
|
||||
procedure, pass(sv) :: csetc => amg_c_ainv_solver_csetc
|
||||
procedure, pass(sv) :: csetr => amg_c_ainv_solver_csetr
|
||||
@@ -86,16 +85,6 @@ module amg_c_ainv_solver
|
||||
end subroutine amg_c_ainv_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_ainv_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
& amg_c_base_solver_type, psb_dpk_, amg_c_ainv_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_c_ainv_solver_type), intent(inout) :: sv
|
||||
class(amg_c_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_ainv_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_ainv_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
@@ -52,7 +52,6 @@ module amg_c_invk_solver
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_c_invk_solver_check
|
||||
procedure, pass(sv) :: clone => amg_c_invk_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_c_invk_solver_clone_settings
|
||||
procedure, pass(sv) :: build => amg_c_invk_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_c_invk_solver_cseti
|
||||
procedure, pass(sv) :: descr => amg_c_invk_solver_descr
|
||||
@@ -74,17 +73,6 @@ module amg_c_invk_solver
|
||||
end subroutine amg_c_invk_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invk_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
& amg_c_base_solver_type, psb_spk_, amg_c_invk_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_c_invk_solver_type), intent(inout) :: sv
|
||||
class(amg_c_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_invk_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invk_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
|
||||
@@ -52,7 +52,6 @@ module amg_c_invt_solver
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_c_invt_solver_check
|
||||
procedure, pass(sv) :: clone => amg_c_invt_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_c_invt_solver_clone_settings
|
||||
procedure, pass(sv) :: build => amg_c_invt_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_c_invt_solver_cseti
|
||||
procedure, pass(sv) :: csetr => amg_c_invt_solver_csetr
|
||||
@@ -74,17 +73,6 @@ module amg_c_invt_solver
|
||||
end subroutine amg_c_invt_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invt_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
& amg_c_base_solver_type, psb_spk_, amg_c_invt_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_c_invt_solver_type), intent(inout) :: sv
|
||||
class(amg_c_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_invt_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invt_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
|
||||
@@ -189,7 +189,6 @@ module amg_c_onelev_mod
|
||||
procedure, pass(lv) :: descr => amg_c_base_onelev_descr
|
||||
procedure, pass(lv) :: default => c_base_onelev_default
|
||||
procedure, pass(lv) :: free => amg_c_base_onelev_free
|
||||
procedure, pass(lv) :: free_smoothers => amg_c_base_onelev_free_smoothers
|
||||
procedure, pass(lv) :: nullify => c_base_onelev_nullify
|
||||
procedure, pass(lv) :: check => amg_c_base_onelev_check
|
||||
procedure, pass(lv) :: dump => amg_c_base_onelev_dump
|
||||
@@ -286,7 +285,7 @@ module amg_c_onelev_mod
|
||||
end subroutine amg_c_base_onelev_cnv
|
||||
end interface
|
||||
|
||||
interface
|
||||
interface
|
||||
subroutine amg_c_base_onelev_free(lv,info)
|
||||
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||||
& psb_clinmap_type, psb_spk_, amg_c_onelev_type, &
|
||||
@@ -298,18 +297,6 @@ module amg_c_onelev_mod
|
||||
end subroutine amg_c_base_onelev_free
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_base_onelev_free_smoothers(lv,info)
|
||||
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||||
& psb_clinmap_type, psb_spk_, amg_c_onelev_type, &
|
||||
& psb_ipk_, psb_epk_, psb_desc_type
|
||||
implicit none
|
||||
|
||||
class(amg_c_onelev_type), intent(inout) :: lv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_base_onelev_free_smoothers
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_base_onelev_check(lv,info)
|
||||
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||||
|
||||
@@ -135,9 +135,7 @@ module amg_c_prec_type
|
||||
procedure, pass(prec) :: build => amg_cprecbld
|
||||
procedure, pass(prec) :: hierarchy_build => amg_c_hierarchy_bld
|
||||
procedure, pass(prec) :: hierarchy_rebuild => amg_c_hierarchy_rebld
|
||||
procedure, pass(prec) :: hierarchy_free => amg_c_hierarchy_free
|
||||
procedure, pass(prec) :: smoothers_build => amg_c_smoothers_bld
|
||||
procedure, pass(prec) :: smoothers_free => amg_c_smoothers_free
|
||||
procedure, pass(prec) :: descr => amg_cfile_prec_descr
|
||||
end type amg_cprec_type
|
||||
|
||||
@@ -347,14 +345,6 @@ module amg_c_prec_type
|
||||
end subroutine amg_c_smoothers_bld
|
||||
end interface amg_smoothers_bld
|
||||
|
||||
interface amg_smoothers_free
|
||||
module procedure amg_c_smoothers_free
|
||||
end interface amg_smoothers_free
|
||||
|
||||
interface amg_hierarchy_free
|
||||
module procedure amg_c_hierarchy_free
|
||||
end interface amg_hierarchy_free
|
||||
|
||||
contains
|
||||
!
|
||||
! Function returning a pointer to the smoother
|
||||
@@ -628,68 +618,6 @@ contains
|
||||
|
||||
end subroutine amg_c_prec_free
|
||||
|
||||
subroutine amg_c_smoothers_free(prec,info)
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_c_smoothers_free'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
call prec%precv(i)%free_smoothers(info)
|
||||
end do
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_c_smoothers_free
|
||||
|
||||
subroutine amg_c_hierarchy_free(prec,info)
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_c_hierarchy_free'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
me=-1
|
||||
write(0,*) 'Missing implementation '
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_c_hierarchy_free
|
||||
|
||||
|
||||
!
|
||||
|
||||
@@ -58,7 +58,6 @@ module amg_d_ainv_solver
|
||||
procedure, pass(sv) :: check => amg_d_ainv_solver_check
|
||||
procedure, pass(sv) :: build => amg_d_ainv_solver_bld
|
||||
procedure, pass(sv) :: clone => amg_d_ainv_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_d_ainv_solver_clone_settings
|
||||
procedure, pass(sv) :: cseti => amg_d_ainv_solver_cseti
|
||||
procedure, pass(sv) :: csetc => amg_d_ainv_solver_csetc
|
||||
procedure, pass(sv) :: csetr => amg_d_ainv_solver_csetr
|
||||
@@ -86,16 +85,6 @@ module amg_d_ainv_solver
|
||||
end subroutine amg_d_ainv_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_ainv_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
& amg_d_base_solver_type, psb_dpk_, amg_d_ainv_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_d_ainv_solver_type), intent(inout) :: sv
|
||||
class(amg_d_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_ainv_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_ainv_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
@@ -0,0 +1,529 @@
|
||||
!
|
||||
!
|
||||
! 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
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
module amg_d_decmatch_mod
|
||||
|
||||
use iso_c_binding
|
||||
use psb_base_cbind_mod
|
||||
|
||||
interface new_Match_If
|
||||
function dnew_Match_If(ipar,matching,lambda,nr, irp, ja, val, diag, w, mate) &
|
||||
& bind(c,name="dnew_Match_If") result(res)
|
||||
use iso_c_binding
|
||||
import :: psb_c_ipk_, psb_c_lpk_, psb_c_mpk_, psb_c_epk_
|
||||
implicit none
|
||||
|
||||
integer(psb_c_ipk_) :: res
|
||||
integer(psb_c_ipk_), value :: nr,ipar,matching
|
||||
real(c_double), value :: lambda
|
||||
type(c_ptr), value :: irp, ja, mate
|
||||
type(c_ptr), value :: val, diag, w
|
||||
end function dnew_Match_If
|
||||
end interface new_Match_If
|
||||
|
||||
interface amg_build_decmatch
|
||||
module procedure amg_dbuild_decmatch
|
||||
end interface amg_build_decmatch
|
||||
|
||||
logical, parameter, private :: print_statistics=.false.
|
||||
contains
|
||||
|
||||
subroutine amg_ddecmatch_build_prol(w,a,desc_a,ilaggr,nlaggr,prol,info,&
|
||||
& symmetrize,reproducible,display_inp, display_out, print_out, &
|
||||
& parallel, matching,lambda)
|
||||
use psb_base_mod
|
||||
use psb_util_mod
|
||||
use iso_c_binding
|
||||
implicit none
|
||||
real(psb_dpk_), allocatable, intent(inout) :: w(:)
|
||||
type(psb_dspmat_type), intent(inout) :: a
|
||||
type(psb_desc_type) :: desc_a
|
||||
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:)
|
||||
integer(psb_lpk_), allocatable, intent(out) :: nlaggr(:)
|
||||
type(psb_ldspmat_type), intent(out) :: prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, optional, intent(in) :: display_inp, display_out, reproducible
|
||||
logical, optional, intent(in) :: symmetrize, print_out, parallel
|
||||
integer(psb_ipk_), optional, intent(in) :: matching
|
||||
real(psb_dpk_), optional, intent(in) :: lambda
|
||||
|
||||
!
|
||||
!
|
||||
type(psb_ctxt_type) :: ictxt
|
||||
integer(psb_ipk_) :: iam, np, iown
|
||||
integer(psb_ipk_) :: nr, nc, sweep, nzl, ncsave, nct, idx
|
||||
integer(psb_lpk_) :: i, k, kg, idxg, ntaggr, naggrm1, naggrp1, &
|
||||
& ip, nlpairs, nlsingl, nunmatched, lnr
|
||||
real(psb_dpk_) :: wk, widx, wmax, nrmagg
|
||||
real(psb_dpk_), allocatable :: wtemp(:)
|
||||
integer(psb_ipk_), allocatable :: mate(:)
|
||||
integer(psb_lpk_), allocatable :: ilv(:)
|
||||
integer(psb_ipk_), save :: cnt=1
|
||||
character(len=256) :: aname
|
||||
type(psb_ld_coo_sparse_mat) :: tmpcoo
|
||||
logical :: display_out_, print_out_, reproducible_, parallel_
|
||||
integer(psb_ipk_) :: matching_
|
||||
real(psb_dpk_) :: lambda_
|
||||
logical, parameter :: dump=.false., debug=.false., dump_mate=.false., &
|
||||
& debug_ilaggr=.false., debug_sync=.false.
|
||||
integer(psb_ipk_), save :: idx_bldmtc=-1, idx_phase1=-1, idx_phase2=-1, idx_phase3=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
ictxt = desc_a%get_ctxt()
|
||||
call psb_info(ictxt,iam,np)
|
||||
|
||||
if ((do_timings).and.(idx_phase1==-1)) &
|
||||
& idx_phase1 = psb_get_timer_idx("MBP_BLDP: phase1 ")
|
||||
if ((do_timings).and.(idx_bldmtc==-1)) &
|
||||
& idx_bldmtc = psb_get_timer_idx("MBP_BLDP: buil_matching")
|
||||
if ((do_timings).and.(idx_phase2==-1)) &
|
||||
& idx_phase2 = psb_get_timer_idx("MBP_BLDP: phase2 ")
|
||||
if ((do_timings).and.(idx_phase3==-1)) &
|
||||
& idx_phase3 = psb_get_timer_idx("MBP_BLDP: phase3 ")
|
||||
|
||||
if (do_timings) call psb_tic(idx_phase1)
|
||||
|
||||
if (present(display_out)) then
|
||||
display_out_ = display_out
|
||||
else
|
||||
display_out_ = .false.
|
||||
end if
|
||||
if (present(print_out)) then
|
||||
print_out_ = print_out
|
||||
else
|
||||
print_out_ = .false.
|
||||
end if
|
||||
if (present(reproducible)) then
|
||||
reproducible_ = reproducible
|
||||
else
|
||||
reproducible_ = .false.
|
||||
end if
|
||||
|
||||
if (present(parallel)) then
|
||||
parallel_ = parallel
|
||||
else
|
||||
parallel_ = .true.
|
||||
end if
|
||||
|
||||
if (present(matching)) then
|
||||
matching_ = matching
|
||||
else
|
||||
matching_ = 2
|
||||
end if
|
||||
|
||||
if (present(lambda)) then
|
||||
lambda_ = lambda
|
||||
else
|
||||
lambda_ = 2.0
|
||||
end if
|
||||
|
||||
allocate(nlaggr(0:np-1),stat=info)
|
||||
if (info /= 0) then
|
||||
return
|
||||
end if
|
||||
|
||||
nlaggr = 0
|
||||
ilv = [(i,i=1,desc_a%get_local_cols())]
|
||||
call desc_a%l2gip(ilv,info,owned=.false.)
|
||||
|
||||
call psb_geall(ilaggr,desc_a,info)
|
||||
ilaggr = -1
|
||||
call psb_geasb(ilaggr,desc_a,info)
|
||||
nr = a%get_nrows()
|
||||
nc = a%get_ncols()
|
||||
if (size(w) < nc) then
|
||||
call psb_realloc(nc,w,info)
|
||||
end if
|
||||
call psb_halo(w,desc_a,info)
|
||||
|
||||
if (debug) write(0,*) iam,' buildprol into buildmatching:',&
|
||||
& nr, nc
|
||||
if (debug_sync) then
|
||||
call psb_barrier(ictxt)
|
||||
if (iam == 0) write(0,*)' buildprol into buildmatching:',&
|
||||
& nr, nc
|
||||
end if
|
||||
if (do_timings) call psb_toc(idx_phase1)
|
||||
if (do_timings) call psb_tic(idx_bldmtc)
|
||||
call amg_dbuild_decmatch(parallel_,matching_,lambda_,w,a,desc_a,mate,info)
|
||||
if (do_timings) call psb_toc(idx_bldmtc)
|
||||
if (debug) write(0,*) iam,' buildprol from buildmatching:',&
|
||||
& info
|
||||
if (debug_sync) then
|
||||
call psb_barrier(ictxt)
|
||||
if (iam == 0) write(0,*)' out from buildmatching:', info
|
||||
end if
|
||||
|
||||
if (info == 0) then
|
||||
if (do_timings) call psb_tic(idx_phase2)
|
||||
if (debug_sync) then
|
||||
call psb_barrier(ictxt)
|
||||
if (iam == 0) write(0,*)' Into building the tentative prol:'
|
||||
end if
|
||||
|
||||
call psb_geall(wtemp,desc_a,info)
|
||||
wtemp = dzero
|
||||
call psb_geasb(wtemp,desc_a,info)
|
||||
|
||||
nlaggr(iam) = 0
|
||||
nlpairs = 0
|
||||
nlsingl = 0
|
||||
nunmatched = 0
|
||||
!
|
||||
! First sweep
|
||||
! On return from build_matching, mate has been converted to local numbering,
|
||||
! so assigning to idx is OK.
|
||||
!
|
||||
do k=1, nr
|
||||
idx = mate(k)
|
||||
!
|
||||
! Figure out an allocation of aggregates to processes
|
||||
!
|
||||
if (idx < 0) then
|
||||
!
|
||||
! Unmatched vertex, potential singleton.
|
||||
!
|
||||
nunmatched = nunmatched + 1
|
||||
if (abs(w(k))<epsilon(nrmagg)) then
|
||||
! Keep it unaggregated
|
||||
wtemp(k) = dzero
|
||||
else
|
||||
! Create a singleton aggregate
|
||||
nlaggr(iam) = nlaggr(iam) + 1
|
||||
ilaggr(k) = nlaggr(iam)
|
||||
wtemp(k) = w(k)/abs(w(k))
|
||||
nlsingl = nlsingl + 1
|
||||
end if
|
||||
!!$ write(0,*) k,mate(k),ilaggr(k),' negative match ',abs(w(k)), epsilon(nrmagg)
|
||||
else if (idx > nc) then
|
||||
write(0,*) 'Impossible: mate(k) > nc'
|
||||
cycle
|
||||
else
|
||||
|
||||
if (ilaggr(k) == -1) then
|
||||
|
||||
wk = w(k)
|
||||
widx = w(idx)
|
||||
wmax = max(abs(wk),abs(widx))
|
||||
nrmagg = wmax*sqrt((wk/wmax)**2+(widx/wmax)**2)
|
||||
if (nrmagg > epsilon(nrmagg)) then
|
||||
if (idx <= nr) then
|
||||
if (ilaggr(idx) == -1) then
|
||||
! Now, if both vertices are local, the aggregate is local
|
||||
! (kinda obvious).
|
||||
nlaggr(iam) = nlaggr(iam) + 1
|
||||
ilaggr(k) = nlaggr(iam)
|
||||
ilaggr(idx) = nlaggr(iam)
|
||||
wtemp(k) = w(k)/nrmagg
|
||||
wtemp(idx) = w(idx)/nrmagg
|
||||
end if
|
||||
nlpairs = nlpairs+1
|
||||
else
|
||||
write(0,*) 'Really? mate(k) > nr? ',mate(k),nr
|
||||
end if
|
||||
else
|
||||
if (abs(w(k))<epsilon(nrmagg)) then
|
||||
! Keep it unaggregated
|
||||
wtemp(k) = dzero
|
||||
else
|
||||
! Create a singleton aggregate
|
||||
nlaggr(iam) = nlaggr(iam) + 1
|
||||
ilaggr(k) = nlaggr(iam)
|
||||
wtemp(k) = w(k)/abs(w(k))
|
||||
nlsingl = nlsingl + 1
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
if (do_timings) call psb_toc(idx_phase2)
|
||||
if (do_timings) call psb_tic(idx_phase3)
|
||||
|
||||
! Ok, now compute offsets, gather halo and fix non-local
|
||||
! aggregates (those where ilaggr == -2)
|
||||
call psb_sum(ictxt,nlaggr)
|
||||
ntaggr = sum(nlaggr(0:np-1))
|
||||
naggrm1 = sum(nlaggr(0:iam-1))
|
||||
naggrp1 = sum(nlaggr(0:iam))
|
||||
!
|
||||
! Shift all indices already assigned (i.e. >0)
|
||||
!
|
||||
do k=1,nr
|
||||
if (ilaggr(k) > 0) then
|
||||
ilaggr(k) = ilaggr(k) + naggrm1
|
||||
!!$ else
|
||||
!!$ write(0,*) 'Leftover ILAGGR',k,ilaggr(k),mate(k),abs(w(k)),epsilon(nrmagg)
|
||||
end if
|
||||
end do
|
||||
call psb_halo(ilaggr,desc_a,info)
|
||||
call psb_halo(wtemp,desc_a,info)
|
||||
! Cleanup as yet unmarked entries
|
||||
do k=1,nr
|
||||
if (ilaggr(k) == -2) then
|
||||
idx = mate(k)
|
||||
if (idx > nr) then
|
||||
i = ilaggr(idx)
|
||||
if (i > 0) then
|
||||
ilaggr(k) = i
|
||||
else
|
||||
write(0,*) 'Error : unresolved (paired) index ',k,idx,i,nr,nc, ilv(k),ilv(idx)
|
||||
end if
|
||||
else
|
||||
write(0,*) 'Error : unresolved (paired) index ',k,idx,i,nr,nc, ilv(k),ilv(idx)
|
||||
end if
|
||||
end if
|
||||
if (ilaggr(k) <0) then
|
||||
write(0,*) 'Decmatch: Funny number: ',k,ilv(k),ilaggr(k),wtemp(k)
|
||||
end if
|
||||
end do
|
||||
if (debug_sync) then
|
||||
call psb_barrier(ictxt)
|
||||
if (iam == 0) write(0,*)' Done building the tentative prol:'
|
||||
end if
|
||||
|
||||
|
||||
if (dump_mate) then
|
||||
block
|
||||
integer(psb_lpk_), allocatable :: glaggr(:)
|
||||
write(aname,'(a,i3.3,a,i3.3,a)') 'mateg-',cnt,'-p',iam,'.mtx'
|
||||
open(20,file=aname)
|
||||
write(20,'(a,I3,a)') '% sparse vector on process ',iam,' '
|
||||
do k=1, nr
|
||||
write(20,'(3(I8,1X))') ilv(k),ilv(mate(k))
|
||||
end do
|
||||
close(20)
|
||||
write(aname,'(a,i3.3,a,i3.3,a)') 'nloc-',cnt,'-p',iam,'.mtx'
|
||||
open(20,file=aname)
|
||||
write(20,'(a,I3,a)') '% sparse vector on process ',iam,' '
|
||||
write(20,'(a,I12,a)') 'nlpairs ',nlpairs
|
||||
write(20,'(a,I12,a)') 'nlsingl ',nlsingl
|
||||
write(20,'(a,I12,a)') 'nlaggr(iam) ',nlaggr(iam)
|
||||
close(20)
|
||||
write(aname,'(a,i3.3,a,i3.3,a,i3.3,a)') 'ilaggr-',cnt,'-i',iam,'-p',np,'.mtx'
|
||||
open(20,file=aname)
|
||||
write(20,'(a,I3,a)') '% sparse vector on process ',iam,' '
|
||||
do k=1, nr
|
||||
write(20,'(3(I8,1X))') ilv(k),ilaggr(k)
|
||||
end do
|
||||
close(20)
|
||||
|
||||
write(aname,'(a,i3.3,a,i3.3,a)') 'glaggr-',cnt,'-p',np,'.mtx'
|
||||
call psb_gather(glaggr,ilaggr,desc_a,info,root=izero)
|
||||
if (iam==0) call mm_array_write(glaggr,'Aggregates ',info,filename=aname)
|
||||
|
||||
cnt=cnt+1
|
||||
end block
|
||||
end if
|
||||
block
|
||||
integer(psb_lpk_) :: v(3)
|
||||
v(1) = nunmatched
|
||||
v(2) = nlsingl
|
||||
v(3) = nlpairs
|
||||
call psb_sum(ictxt,v)
|
||||
nunmatched = v(1)
|
||||
nlsingl = v(2)
|
||||
nlpairs = v(3)
|
||||
|
||||
end block
|
||||
if (print_statistics) then
|
||||
if (iam == 0) then
|
||||
write(0,*) 'Matching statistics: Unmatched nodes ',&
|
||||
& nunmatched,' Singletons:',nlsingl,' Pairs:',nlpairs
|
||||
end if
|
||||
end if
|
||||
|
||||
if (display_out_) then
|
||||
block
|
||||
integer(psb_ipk_) :: idx
|
||||
!
|
||||
! And finally print out
|
||||
!
|
||||
do i=0,np-1
|
||||
call psb_barrier(ictxt)
|
||||
if (iam == i) then
|
||||
write(0,*) 'Process ', iam,' hosts aggregates: (',naggrm1+1,' : ',naggrp1-1,')'
|
||||
do k=1, nr
|
||||
idx = mate(k)
|
||||
kg = ilv(k)
|
||||
if (idx >0) then
|
||||
idxg = ilv(idx)
|
||||
else
|
||||
idxg = -1
|
||||
end if
|
||||
if (idx < 0) then
|
||||
write(0,*) kg,': singleton (',kg,' ( Proc',iam,') ) into aggregate => ', ilaggr(k)
|
||||
else if (idx <= nr) then
|
||||
write(0,*) kg,': paired with (',idxg,' ( Proc',iam,') ) into aggregate => ', ilaggr(k)
|
||||
else
|
||||
call desc_a%indxmap%qry_halo_owner(idx,iown,info)
|
||||
write(0,*) kg,': paired with (',idxg,' ( Proc',iown,') ) into aggregate => ', ilaggr(k)
|
||||
end if
|
||||
end do
|
||||
flush(0)
|
||||
end if
|
||||
end do
|
||||
end block
|
||||
end if
|
||||
|
||||
! Dirty trick: allocate tmpcoo with local
|
||||
! number of aggregates, then change to ntaggr.
|
||||
! Just to make sure the allocation is not global
|
||||
lnr = nr
|
||||
call tmpcoo%allocate(lnr,nlaggr(iam),lnr)
|
||||
k = 0
|
||||
do i=1,nr
|
||||
!
|
||||
! Note: at this point, a value ilaggr(i)<=0
|
||||
! tags an unaggregated row, and it has to be
|
||||
! left alone (i.e.: it should stay at fine level only)
|
||||
!
|
||||
if (ilaggr(i)>0) then
|
||||
k = k + 1
|
||||
tmpcoo%val(k) = wtemp(i)
|
||||
tmpcoo%ia(k) = i
|
||||
tmpcoo%ja(k) = ilaggr(i)
|
||||
end if
|
||||
end do
|
||||
call tmpcoo%set_nzeros(k)
|
||||
call tmpcoo%set_dupl(psb_dupl_add_)
|
||||
call tmpcoo%set_sorted() ! This is now in row-major
|
||||
|
||||
if (display_out_) then
|
||||
call psb_barrier(ictxt)
|
||||
flush(0)
|
||||
|
||||
if (iam == 0) write(0,*) 'Prolongator: '
|
||||
flush(0)
|
||||
do i=0,np-1
|
||||
call psb_barrier(ictxt)
|
||||
if (iam == i) then
|
||||
do k=1, nr
|
||||
write(0,*) ilv(tmpcoo%ia(k)),tmpcoo%ja(k), tmpcoo%val(k)
|
||||
end do
|
||||
flush(0)
|
||||
end if
|
||||
end do
|
||||
end if
|
||||
|
||||
call prol%mv_from(tmpcoo)
|
||||
if (do_timings) call psb_toc(idx_phase3)
|
||||
|
||||
if (print_out_) then
|
||||
write(aname,'(a,i3.3,a)') 'prol-g-',iam,'.mtx'
|
||||
call prol%print(fname=aname,head='Test ',ivr=ilv)
|
||||
write(aname,'(a,i3.3,a)') 'prol-',iam,'.mtx'
|
||||
call prol%print(fname=aname,head='Test ')
|
||||
end if
|
||||
|
||||
else
|
||||
write(0,*) iam,' : error from Matching: ',info
|
||||
end if
|
||||
|
||||
end subroutine amg_ddecmatch_build_prol
|
||||
|
||||
subroutine amg_dbuild_decmatch(parallel,matching,lambda,w,a,desc_a,mate,info)
|
||||
use psb_base_mod
|
||||
use psb_util_mod
|
||||
use iso_c_binding
|
||||
implicit none
|
||||
logical, intent(in) :: parallel
|
||||
integer(psb_ipk_), intent(in) :: matching
|
||||
real(psb_dpk_), intent(in) :: lambda
|
||||
real(psb_dpk_), target :: w(:)
|
||||
type(psb_dspmat_type), intent(inout) :: a
|
||||
type(psb_desc_type) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out), target :: mate(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
type(psb_d_csr_sparse_mat), target :: tcsr
|
||||
real(psb_dpk_), allocatable, target :: diag(:)
|
||||
real(psb_dpk_) :: ph0t,ph1t,ph2t
|
||||
type(psb_ctxt_type) :: ictxt
|
||||
integer(psb_ipk_) :: iam, np
|
||||
integer(psb_ipk_) :: nr, nc, nz, i, nunmatch, ipar
|
||||
integer(psb_ipk_), save :: cnt=2
|
||||
logical, parameter :: debug=.false., dump_ahat=.false., debug_sync=.false.
|
||||
logical, parameter :: old_style=.false., sort_minp=.true.
|
||||
character(len=40) :: name='build_matching', fname
|
||||
integer(psb_ipk_), save :: idx_cmboxp=-1, idx_bldahat=-1, idx_phase2=-1, idx_phase3=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
ictxt = desc_a%get_ctxt()
|
||||
call psb_info(ictxt,iam,np)
|
||||
|
||||
nr = a%get_nrows()
|
||||
call a%cp_to(tcsr)
|
||||
call psb_realloc(nr,mate,info)
|
||||
diag = a%get_diag(info)
|
||||
if (parallel) then
|
||||
ipar = 2
|
||||
else
|
||||
ipar = 1
|
||||
end if
|
||||
!
|
||||
! Now call matching!
|
||||
!
|
||||
if (debug) write(0,*) iam,' buildmatching into NewMatch:'
|
||||
if (do_timings) call psb_tic(idx_cmboxp)
|
||||
info = dnew_Match_If(ipar,matching,lambda,nr,c_loc(tcsr%irp),c_loc(tcsr%ja),&
|
||||
& c_loc(tcsr%val),c_loc(diag),c_loc(w),c_loc(mate))
|
||||
if (do_timings) call psb_toc(idx_cmboxp)
|
||||
if (debug) write(0,*) iam,' buildmatching from NewMatch:', info
|
||||
if (debug_sync) then
|
||||
call psb_max(ictxt,info)
|
||||
if (iam == 0) write(0,*)' done NewMatch', info
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_tic(idx_phase3)
|
||||
nunmatch = count(mate(1:nr)<=0)
|
||||
! call psb_sum(ictxt,nunmatch)
|
||||
!if (nunmatch /= 0) write(0,*) iam,' Unmatched nodes local imbalance ',nunmatch
|
||||
! if (count(mate(1:nr)<0) /= nunmatch) write(0,*) iam,' Matching results ?',&
|
||||
! & nunmatch, count(mate(1:nr)<0)
|
||||
if (debug_sync) then
|
||||
call psb_barrier(ictxt)
|
||||
if (iam == 0) write(0,*)' done build_matching '
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_toc(idx_phase3)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_error(ictxt)
|
||||
|
||||
end subroutine amg_dbuild_decmatch
|
||||
|
||||
end module amg_d_decmatch_mod
|
||||
@@ -52,7 +52,6 @@ module amg_d_invk_solver
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_d_invk_solver_check
|
||||
procedure, pass(sv) :: clone => amg_d_invk_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_d_invk_solver_clone_settings
|
||||
procedure, pass(sv) :: build => amg_d_invk_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_d_invk_solver_cseti
|
||||
procedure, pass(sv) :: descr => amg_d_invk_solver_descr
|
||||
@@ -74,17 +73,6 @@ module amg_d_invk_solver
|
||||
end subroutine amg_d_invk_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invk_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
& amg_d_base_solver_type, psb_dpk_, amg_d_invk_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_d_invk_solver_type), intent(inout) :: sv
|
||||
class(amg_d_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_invk_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invk_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
|
||||
@@ -52,7 +52,6 @@ module amg_d_invt_solver
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_d_invt_solver_check
|
||||
procedure, pass(sv) :: clone => amg_d_invt_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_d_invt_solver_clone_settings
|
||||
procedure, pass(sv) :: build => amg_d_invt_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_d_invt_solver_cseti
|
||||
procedure, pass(sv) :: csetr => amg_d_invt_solver_csetr
|
||||
@@ -74,17 +73,6 @@ module amg_d_invt_solver
|
||||
end subroutine amg_d_invt_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invt_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
& amg_d_base_solver_type, psb_dpk_, amg_d_invt_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_d_invt_solver_type), intent(inout) :: sv
|
||||
class(amg_d_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_invt_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invt_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
|
||||
@@ -0,0 +1,585 @@
|
||||
!
|
||||
!
|
||||
! The aggregator object hosts the aggregation method for building
|
||||
! the multilevel hierarchy. This variant is based on the hybrid method
|
||||
! presented in
|
||||
!
|
||||
!
|
||||
! sm - class(amg_T_base_smoother_type), allocatable
|
||||
! The current level preconditioner (aka smoother).
|
||||
! parms - type(amg_RTml_parms)
|
||||
! The parameters defining the multilevel strategy.
|
||||
! ac - The local part of the current-level matrix, built by
|
||||
! coarsening the previous-level matrix.
|
||||
! desc_ac - type(psb_desc_type).
|
||||
! The communication descriptor associated to the matrix
|
||||
! stored in ac.
|
||||
! base_a - type(psb_Tspmat_type), pointer.
|
||||
! Pointer (really a pointer!) to the local part of the current
|
||||
! matrix (so we have a unified treatment of residuals).
|
||||
! We need this to avoid passing explicitly the current matrix
|
||||
! to the routine which applies the preconditioner.
|
||||
! base_desc - type(psb_desc_type), pointer.
|
||||
! Pointer to the communication descriptor associated to the
|
||||
! matrix pointed by base_a.
|
||||
! map - Stores the maps (restriction and prolongation) between the
|
||||
! vector spaces associated to the index spaces of the previous
|
||||
! and current levels.
|
||||
!
|
||||
! Methods:
|
||||
! Most methods follow the encapsulation hierarchy: they take whatever action
|
||||
! is appropriate for the current object, then call the corresponding method for
|
||||
! the contained object.
|
||||
! As an example: the descr() method prints out a description of the
|
||||
! level. It starts by invoking the descr() method of the parms object,
|
||||
! then calls the descr() method of the smoother object.
|
||||
!
|
||||
! descr - Prints a description of the object.
|
||||
! default - Set default values
|
||||
! dump - Dump to file object contents
|
||||
! set - Sets various parameters; when a request is unknown
|
||||
! it is passed to the smoother object for further processing.
|
||||
! check - Sanity checks.
|
||||
! sizeof - Total memory occupation in bytes
|
||||
! get_nzeros - Number of nonzeros
|
||||
!
|
||||
!
|
||||
|
||||
module amg_d_newmatch_aggregator_mod
|
||||
use amg_d_base_aggregator_mod
|
||||
use iso_c_binding
|
||||
|
||||
type, bind(c):: nwm_Vector
|
||||
type(c_ptr) :: data
|
||||
integer(c_int) :: size
|
||||
integer(c_int) :: owns_data
|
||||
end type nwm_Vector
|
||||
|
||||
type, bind(c):: nwm_CSRMatrix
|
||||
type(c_ptr) :: i
|
||||
type(c_ptr) :: j
|
||||
integer(c_int) :: num_rows
|
||||
integer(c_int) :: num_cols
|
||||
integer(c_int) :: num_nonzeros
|
||||
integer(c_int) :: owns_data
|
||||
type(c_ptr) :: data
|
||||
end type nwm_CSRMatrix
|
||||
|
||||
type, extends(amg_d_base_aggregator_type) :: amg_d_newmatch_aggregator_type
|
||||
integer(psb_ipk_) :: matching_alg
|
||||
integer(psb_ipk_) :: n_sweeps
|
||||
!
|
||||
! Note: the BootCMatch kernel we invoke overwrites
|
||||
! the W argument with its update. Hence, copy it in w_nxt
|
||||
! before passing it to the matching
|
||||
!
|
||||
integer(psb_ipk_) :: orig_aggr_size
|
||||
integer(psb_ipk_) :: jacobi_sweeps
|
||||
real(psb_dpk_), allocatable :: w(:), w_nxt(:)
|
||||
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
|
||||
type(nwm_Vector) :: w_c_nxt
|
||||
integer(psb_ipk_) :: max_csize
|
||||
integer(psb_ipk_) :: max_nlevels
|
||||
real(psb_dpk_) :: lambda
|
||||
logical :: reproducible_matching = .false.
|
||||
logical :: need_symmetrize = .false.
|
||||
logical :: unsmoothed_hierarchy = .true.
|
||||
logical :: parallel_matching = .true.
|
||||
contains
|
||||
procedure, pass(ag) :: bld_tprol => amg_d_newmatch_aggregator_build_tprol
|
||||
procedure, pass(ag) :: csetc => amg_d_newmatch_aggr_csetc
|
||||
procedure, pass(ag) :: csetr => amg_d_newmatch_aggr_csetr
|
||||
procedure, pass(ag) :: cseti => d_newmatch_aggr_cseti
|
||||
procedure, pass(ag) :: default => d_newmatch_aggr_set_default
|
||||
procedure, pass(ag) :: mat_asb => amg_d_newmatch_aggregator_mat_asb
|
||||
procedure, pass(ag) :: mat_bld => amg_d_newmatch_aggregator_mat_bld
|
||||
procedure, pass(ag) :: inner_mat_asb => amg_d_newmatch_aggregator_inner_mat_asb
|
||||
procedure, pass(ag) :: update_next => d_newmatch_aggregator_update_next
|
||||
procedure, pass(ag) :: bld_wnxt => d_newmatch_bld_wnxt
|
||||
procedure, pass(ag) :: bld_default_w => d_bld_default_w
|
||||
procedure, pass(ag) :: set_c_default_w => d_set_default_nwm_w
|
||||
procedure, pass(ag) :: descr => d_newmatch_aggregator_descr
|
||||
procedure, pass(ag) :: clone => d_newmatch_aggregator_clone
|
||||
procedure, pass(ag) :: free => d_newmatch_aggregator_free
|
||||
procedure, nopass :: fmt => d_newmatch_aggregator_fmt
|
||||
end type amg_d_newmatch_aggregator_type
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_d_newmatch_aggregator_build_tprol(ag,parms,ag_data,&
|
||||
& a,desc_a,ilaggr,nlaggr,t_prol,info)
|
||||
import :: amg_d_newmatch_aggregator_type, psb_desc_type, &
|
||||
& psb_dspmat_type, psb_ldspmat_type, psb_dpk_, &
|
||||
& psb_ipk_, psb_lpk_, psb_epk_, amg_dml_parms, amg_daggr_data
|
||||
implicit none
|
||||
class(amg_d_newmatch_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(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
|
||||
end subroutine amg_d_newmatch_aggregator_build_tprol
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_newmatch_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
|
||||
& ac,desc_ac,op_prol,op_restr,t_prol,info)
|
||||
import :: amg_d_newmatch_aggregator_type, psb_desc_type, &
|
||||
& psb_dspmat_type, psb_ldspmat_type, psb_dpk_, &
|
||||
& psb_ipk_, psb_lpk_, psb_epk_, amg_dml_parms
|
||||
implicit none
|
||||
class(amg_d_newmatch_aggregator_type), target, intent(inout) :: ag
|
||||
type(amg_dml_parms), intent(inout) :: parms
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(inout) :: desc_a
|
||||
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
|
||||
type(psb_dspmat_type), intent(out) :: 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
|
||||
end subroutine amg_d_newmatch_aggregator_mat_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_newmatch_aggregator_mat_asb(ag,parms,a,desc_a,&
|
||||
& ac,desc_ac, op_prol,op_restr,info)
|
||||
import :: amg_d_newmatch_aggregator_type, psb_desc_type, &
|
||||
& psb_dspmat_type, psb_ldspmat_type, psb_dpk_, &
|
||||
& psb_ipk_, psb_lpk_, psb_epk_, amg_dml_parms
|
||||
implicit none
|
||||
class(amg_d_newmatch_aggregator_type), target, intent(inout) :: ag
|
||||
type(amg_dml_parms), intent(inout) :: parms
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(inout) :: desc_a
|
||||
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_newmatch_aggregator_mat_asb
|
||||
end interface
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_d_newmatch_map_to_tprol(desc_a,ilaggr,nlaggr,valaggr, op_prol,info)
|
||||
import :: amg_d_newmatch_aggregator_type, psb_desc_type, &
|
||||
& psb_dspmat_type, psb_ldspmat_type, psb_dpk_, &
|
||||
& psb_ipk_, psb_lpk_, psb_epk_, amg_dml_parms
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_lpk_), allocatable, intent(inout) :: ilaggr(:),nlaggr(:)
|
||||
real(psb_dpk_), allocatable, intent(inout) :: valaggr(:)
|
||||
type(psb_ldspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_newmatch_map_to_tprol
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_daggrmat_unsmth_spmm_asb(a,desc_a,ilaggr,nlaggr,parms,&
|
||||
& ac,op_prol,op_restr,info)
|
||||
import :: amg_d_newmatch_aggregator_type, psb_desc_type, &
|
||||
& psb_dspmat_type, psb_ldspmat_type, psb_dpk_, &
|
||||
& psb_ipk_, psb_lpk_, psb_epk_, amg_dml_parms
|
||||
implicit none
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: 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
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_daggrmat_unsmth_spmm_asb
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_newmatch_aggregator_inner_mat_asb(ag,parms,a,desc_a,&
|
||||
& ac,desc_ac, op_prol,op_restr,info)
|
||||
import :: amg_d_newmatch_aggregator_type, psb_desc_type, psb_dspmat_type,&
|
||||
& psb_ldspmat_type, psb_dpk_, psb_ipk_, psb_lpk_, amg_dml_parms, amg_daggr_data
|
||||
implicit none
|
||||
class(amg_d_newmatch_aggregator_type), target, intent(inout) :: ag
|
||||
type(amg_dml_parms), intent(inout) :: parms
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
type(psb_dspmat_type), intent(inout) :: op_prol,op_restr
|
||||
type(psb_dspmat_type), intent(inout) :: ac
|
||||
type(psb_desc_type), intent(inout) :: desc_ac
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_newmatch_aggregator_inner_mat_asb
|
||||
end interface
|
||||
|
||||
|
||||
!!$ interface
|
||||
!!$ subroutine amg_d_newmatch_unsmth_spmm_bld(a,desc_a,ilaggr,nlaggr,parms,&
|
||||
!!$ & ac,desc_ac,op_prol,op_restr,t_prol,info)
|
||||
!!$ import :: amg_d_newmatch_aggregator_type, psb_desc_type, &
|
||||
!!$ & psb_dspmat_type, psb_ldspmat_type, psb_dpk_, &
|
||||
!!$ & psb_ipk_, psb_lpk_, psb_epk_, amg_dml_parms
|
||||
!!$
|
||||
!!$ implicit none
|
||||
!!$
|
||||
!!$ ! Arguments
|
||||
!!$ type(psb_dspmat_type), intent(in) :: a
|
||||
!!$ type(psb_desc_type), intent(in) :: 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(inout) :: op_prol,ac,op_restr
|
||||
!!$ type(psb_desc_type), intent(inout) :: desc_ac
|
||||
!!$ integer(psb_ipk_), intent(out) :: info
|
||||
!!$ end subroutine amg_d_newmatch_unsmth_spmm_bld
|
||||
!!$ end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_newmatch_spmm_bld_ov(a,desc_a,ilaggr,nlaggr,parms,&
|
||||
& ac,desc_ac,op_prol,op_restr,t_prol,info)
|
||||
import :: amg_d_newmatch_aggregator_type, psb_desc_type, psb_dspmat_type,&
|
||||
& 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(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(inout) :: op_prol,ac, op_restr
|
||||
type(psb_desc_type), intent(out) :: desc_ac
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_newmatch_spmm_bld_ov
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_newmatch_spmm_bld_inner(a,desc_a,ilaggr,nlaggr,parms,&
|
||||
& ac,desc_ac,op_prol,op_restr,t_prol,info)
|
||||
import :: amg_d_newmatch_aggregator_type, psb_desc_type, psb_dspmat_type,&
|
||||
& psb_ldspmat_type, psb_dpk_, psb_ipk_, psb_lpk_, amg_dml_parms, amg_daggr_data,&
|
||||
& 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(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(inout) :: op_prol,ac, op_restr
|
||||
type(psb_desc_type), intent(out) :: desc_ac
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_newmatch_spmm_bld_inner
|
||||
end interface
|
||||
|
||||
private :: is_legal_malg, is_legal_csize, is_legal_nsweeps, is_legal_nlevels
|
||||
|
||||
|
||||
contains
|
||||
|
||||
subroutine d_bld_default_w(ag,nr)
|
||||
use psb_realloc_mod
|
||||
implicit none
|
||||
class(amg_d_newmatch_aggregator_type), target, intent(inout) :: ag
|
||||
integer(psb_ipk_), intent(in) :: nr
|
||||
integer(psb_ipk_) :: info
|
||||
call psb_realloc(nr,ag%w,info)
|
||||
if (info /= psb_success_) return
|
||||
ag%w = done
|
||||
call ag%set_c_default_w()
|
||||
end subroutine d_bld_default_w
|
||||
|
||||
subroutine d_set_default_nwm_w(ag)
|
||||
use psb_realloc_mod
|
||||
use iso_c_binding
|
||||
implicit none
|
||||
class(amg_d_newmatch_aggregator_type), target, intent(inout) :: ag
|
||||
integer(psb_ipk_) :: info
|
||||
|
||||
call psb_safe_ab_cpy(ag%w,ag%w_nxt,info)
|
||||
ag%w_c_nxt%size = psb_size(ag%w_nxt)
|
||||
ag%w_c_nxt%owns_data = 0
|
||||
if (ag%w_c_nxt%size > 0) call set_cloc(ag%w_nxt, ag%w_c_nxt)
|
||||
|
||||
end subroutine d_set_default_nwm_w
|
||||
|
||||
subroutine set_cloc(vect,w_c_nxt)
|
||||
use iso_c_binding
|
||||
real(psb_dpk_), target :: vect(:)
|
||||
type(nwm_Vector) :: w_c_nxt
|
||||
|
||||
w_c_nxt%data = c_loc(vect)
|
||||
end subroutine set_cloc
|
||||
|
||||
|
||||
subroutine d_newmatch_bld_wnxt(ag,ilaggr,valaggr,nx)
|
||||
use psb_realloc_mod
|
||||
implicit none
|
||||
class(amg_d_newmatch_aggregator_type), target, intent(inout) :: ag
|
||||
integer(psb_lpk_), intent(in) :: ilaggr(:)
|
||||
real(psb_dpk_), intent(in) :: valaggr(:)
|
||||
integer(psb_ipk_), intent(in) :: nx
|
||||
|
||||
integer(psb_ipk_) :: info,i,j
|
||||
|
||||
! The vector was already fixed in the call to Newmatch.
|
||||
call psb_realloc(nx,ag%w_nxt,info)
|
||||
|
||||
end subroutine d_newmatch_bld_wnxt
|
||||
|
||||
function d_newmatch_aggregator_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "new matching aggregation"
|
||||
end function d_newmatch_aggregator_fmt
|
||||
|
||||
subroutine d_newmatch_aggregator_descr(ag,parms,iout,info,prefix)
|
||||
implicit none
|
||||
class(amg_d_newmatch_aggregator_type), intent(in) :: ag
|
||||
type(amg_dml_parms), intent(in) :: parms
|
||||
integer(psb_ipk_), intent(in) :: iout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), intent(in), optional :: prefix
|
||||
character(1024) :: prefix_
|
||||
if (present(prefix)) then
|
||||
prefix_ = prefix
|
||||
else
|
||||
prefix_ = ""
|
||||
end if
|
||||
|
||||
write(iout,*) trim(prefix_),' ','NewMatch Aggregator'
|
||||
write(iout,*) trim(prefix_),' ',' Number of Matching sweeps: ',ag%n_sweeps
|
||||
write(iout,*) trim(prefix_),' ',' Matching algorithm : ',ag%matching_alg
|
||||
write(iout,*) trim(prefix_),' ','Aggregator object type: ',ag%fmt()
|
||||
call parms%mldescr(iout,info)
|
||||
|
||||
return
|
||||
end subroutine d_newmatch_aggregator_descr
|
||||
|
||||
function is_legal_malg(alg) result(val)
|
||||
logical :: val
|
||||
integer(psb_ipk_) :: alg
|
||||
|
||||
val = ((0<=alg).and.(alg<=2))
|
||||
end function is_legal_malg
|
||||
|
||||
function is_legal_csize(csize) result(val)
|
||||
logical :: val
|
||||
integer(psb_ipk_) :: csize
|
||||
|
||||
val = ((-1==csize).or.(csize >0))
|
||||
end function is_legal_csize
|
||||
|
||||
function is_legal_nsweeps(nsw) result(val)
|
||||
logical :: val
|
||||
integer(psb_ipk_) :: nsw
|
||||
|
||||
val = (1<=nsw)
|
||||
end function is_legal_nsweeps
|
||||
|
||||
function is_legal_nlevels(nlv) result(val)
|
||||
logical :: val
|
||||
integer(psb_ipk_) :: nlv
|
||||
|
||||
val = (1<=nlv)
|
||||
end function is_legal_nlevels
|
||||
|
||||
subroutine d_newmatch_aggregator_update_next(ag,agnext,info)
|
||||
use psb_realloc_mod
|
||||
implicit none
|
||||
class(amg_d_newmatch_aggregator_type), target, intent(inout) :: ag
|
||||
class(amg_d_base_aggregator_type), target, intent(inout) :: agnext
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
!
|
||||
!
|
||||
select type(agnext)
|
||||
class is (amg_d_newmatch_aggregator_type)
|
||||
if (.not.is_legal_malg(agnext%matching_alg)) &
|
||||
& 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
|
||||
! 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)
|
||||
call agnext%set_c_default_w()
|
||||
class default
|
||||
! What should we do here?
|
||||
end select
|
||||
info = 0
|
||||
end subroutine d_newmatch_aggregator_update_next
|
||||
|
||||
|
||||
subroutine amg_d_newmatch_aggr_csetr(ag,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_newmatch_aggregator_type), intent(inout) :: ag
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: idx
|
||||
integer(psb_ipk_) :: err_act, iwhat
|
||||
character(len=20) :: name='d_newmatch_aggr_csetr'
|
||||
info = psb_success_
|
||||
|
||||
! For now we ignore IDX
|
||||
|
||||
select case(psb_toupper(trim(what)))
|
||||
case('NWM_LAMBDA')
|
||||
ag%lambda = val
|
||||
case default
|
||||
! Do nothing
|
||||
end select
|
||||
return
|
||||
end subroutine amg_d_newmatch_aggr_csetr
|
||||
|
||||
subroutine amg_d_newmatch_aggr_csetc(ag,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_newmatch_aggregator_type), intent(inout) :: ag
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: idx
|
||||
integer(psb_ipk_) :: err_act, iwhat
|
||||
character(len=20) :: name='d_newmatch_aggr_csetc'
|
||||
info = psb_success_
|
||||
|
||||
! For now we ignore IDX
|
||||
|
||||
select case(psb_toupper(trim(what)))
|
||||
case('NWM_PARALLEL_MATCHING')
|
||||
select case(psb_toupper(trim(val)))
|
||||
case('SEQUENTIAL','F','FALSE')
|
||||
ag%parallel_matching = .false.
|
||||
case('PARALLEL','TRUE','T')
|
||||
ag%parallel_matching =.true.
|
||||
end select
|
||||
case('NWM_REPRODUCIBLE_MATCHING')
|
||||
select case(psb_toupper(trim(val)))
|
||||
case('F','FALSE')
|
||||
ag%reproducible_matching = .false.
|
||||
case('REPRODUCIBLE','TRUE','T')
|
||||
ag%reproducible_matching =.true.
|
||||
end select
|
||||
case('NWM_NEED_SYMMETRIZE')
|
||||
select case(psb_toupper(trim(val)))
|
||||
case('FALSE','F')
|
||||
ag%need_symmetrize = .false.
|
||||
case('SYMMETRIZE','TRUE','T')
|
||||
ag%need_symmetrize =.true.
|
||||
end select
|
||||
case('NWM_UNSMOOTHED_HIERARCHY')
|
||||
select case(psb_toupper(trim(val)))
|
||||
case('F','FALSE')
|
||||
ag%unsmoothed_hierarchy = .false.
|
||||
case('T','TRUE')
|
||||
ag%unsmoothed_hierarchy =.true.
|
||||
end select
|
||||
case default
|
||||
! Do nothing
|
||||
end select
|
||||
return
|
||||
end subroutine amg_d_newmatch_aggr_csetc
|
||||
|
||||
subroutine d_newmatch_aggr_cseti(ag,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_newmatch_aggregator_type), intent(inout) :: ag
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: idx
|
||||
integer(psb_ipk_) :: err_act, iwhat
|
||||
character(len=20) :: name='d_newmatch_aggr_cseti'
|
||||
info = psb_success_
|
||||
|
||||
! For now we ignore IDX
|
||||
|
||||
select case(psb_toupper(trim(what)))
|
||||
case('NWM_MATCH_ALG','NWM_MATCHING_ALG')
|
||||
ag%matching_alg = val
|
||||
case('NWM_SWEEPS')
|
||||
ag%n_sweeps=val
|
||||
case('NWM_MAX_CSIZE')
|
||||
ag%max_csize = val
|
||||
case('NWM_MAX_NLEVELS')
|
||||
ag%max_nlevels = val
|
||||
case('NWM_W_SIZE')
|
||||
call ag%bld_default_w(val)
|
||||
case('AGGR_SIZE')
|
||||
ag%orig_aggr_size = val
|
||||
ag%n_sweeps=max(1,ceiling(log(val*1.0)/log(2.0)))
|
||||
case default
|
||||
! Do nothing
|
||||
end select
|
||||
return
|
||||
end subroutine d_newmatch_aggr_cseti
|
||||
|
||||
subroutine d_newmatch_aggr_set_default(ag)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_newmatch_aggregator_type), intent(inout) :: ag
|
||||
character(len=20) :: name='d_newmatch_aggr_set_default'
|
||||
ag%matching_alg = 1
|
||||
ag%n_sweeps = 1
|
||||
ag%max_nlevels = 36
|
||||
ag%max_csize = -1
|
||||
ag%lambda = -1
|
||||
!
|
||||
! Apparently newMatch works better
|
||||
! by keeping all entries
|
||||
!
|
||||
ag%do_clean_zeros = .false.
|
||||
|
||||
return
|
||||
|
||||
end subroutine d_newmatch_aggr_set_default
|
||||
|
||||
subroutine d_newmatch_aggregator_free(ag,info)
|
||||
use iso_c_binding
|
||||
implicit none
|
||||
class(amg_d_newmatch_aggregator_type), intent(inout) :: ag
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
info = 0
|
||||
if (allocated(ag%w)) deallocate(ag%w,stat=info)
|
||||
if (info /= 0) return
|
||||
if (allocated(ag%w_nxt)) deallocate(ag%w_nxt,stat=info)
|
||||
if (info /= 0) return
|
||||
ag%w_c_nxt%size = 0
|
||||
ag%w_c_nxt%data = c_null_ptr
|
||||
ag%w_c_nxt%owns_data = 0
|
||||
end subroutine d_newmatch_aggregator_free
|
||||
|
||||
subroutine d_newmatch_aggregator_clone(ag,agnext,info)
|
||||
implicit none
|
||||
class(amg_d_newmatch_aggregator_type), intent(inout) :: ag
|
||||
class(amg_d_base_aggregator_type), allocatable, intent(inout) :: agnext
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
info = 0
|
||||
if (allocated(agnext)) then
|
||||
call agnext%free(info)
|
||||
if (info == 0) deallocate(agnext,stat=info)
|
||||
end if
|
||||
if (info /= 0) return
|
||||
allocate(agnext,source=ag,stat=info)
|
||||
select type(agnext)
|
||||
class is (amg_d_newmatch_aggregator_type)
|
||||
call agnext%set_c_default_w()
|
||||
class default
|
||||
! Should never ever get here
|
||||
info = -1
|
||||
end select
|
||||
end subroutine d_newmatch_aggregator_clone
|
||||
|
||||
end module amg_d_newmatch_aggregator_mod
|
||||
@@ -57,6 +57,7 @@ module amg_d_onelev_mod
|
||||
use amg_d_base_smoother_mod
|
||||
use amg_d_dec_aggregator_mod
|
||||
use amg_d_parmatch_aggregator_mod
|
||||
use amg_d_newmatch_aggregator_mod
|
||||
|
||||
use psb_base_mod, only : psb_dspmat_type, psb_d_vect_type, &
|
||||
& psb_d_base_vect_type, psb_ldspmat_type, psb_dlinmap_type, psb_dpk_, &
|
||||
@@ -190,7 +191,6 @@ module amg_d_onelev_mod
|
||||
procedure, pass(lv) :: descr => amg_d_base_onelev_descr
|
||||
procedure, pass(lv) :: default => d_base_onelev_default
|
||||
procedure, pass(lv) :: free => amg_d_base_onelev_free
|
||||
procedure, pass(lv) :: free_smoothers => amg_d_base_onelev_free_smoothers
|
||||
procedure, pass(lv) :: nullify => d_base_onelev_nullify
|
||||
procedure, pass(lv) :: check => amg_d_base_onelev_check
|
||||
procedure, pass(lv) :: dump => amg_d_base_onelev_dump
|
||||
@@ -287,7 +287,7 @@ module amg_d_onelev_mod
|
||||
end subroutine amg_d_base_onelev_cnv
|
||||
end interface
|
||||
|
||||
interface
|
||||
interface
|
||||
subroutine amg_d_base_onelev_free(lv,info)
|
||||
import :: psb_dspmat_type, psb_d_vect_type, psb_d_base_vect_type, &
|
||||
& psb_dlinmap_type, psb_dpk_, amg_d_onelev_type, &
|
||||
@@ -299,18 +299,6 @@ module amg_d_onelev_mod
|
||||
end subroutine amg_d_base_onelev_free
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_base_onelev_free_smoothers(lv,info)
|
||||
import :: psb_dspmat_type, psb_d_vect_type, psb_d_base_vect_type, &
|
||||
& psb_dlinmap_type, psb_dpk_, amg_d_onelev_type, &
|
||||
& psb_ipk_, psb_epk_, psb_desc_type
|
||||
implicit none
|
||||
|
||||
class(amg_d_onelev_type), intent(inout) :: lv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_base_onelev_free_smoothers
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_base_onelev_check(lv,info)
|
||||
import :: psb_dspmat_type, psb_d_vect_type, psb_d_base_vect_type, &
|
||||
|
||||
@@ -135,9 +135,7 @@ module amg_d_prec_type
|
||||
procedure, pass(prec) :: build => amg_dprecbld
|
||||
procedure, pass(prec) :: hierarchy_build => amg_d_hierarchy_bld
|
||||
procedure, pass(prec) :: hierarchy_rebuild => amg_d_hierarchy_rebld
|
||||
procedure, pass(prec) :: hierarchy_free => amg_d_hierarchy_free
|
||||
procedure, pass(prec) :: smoothers_build => amg_d_smoothers_bld
|
||||
procedure, pass(prec) :: smoothers_free => amg_d_smoothers_free
|
||||
procedure, pass(prec) :: descr => amg_dfile_prec_descr
|
||||
end type amg_dprec_type
|
||||
|
||||
@@ -347,14 +345,6 @@ module amg_d_prec_type
|
||||
end subroutine amg_d_smoothers_bld
|
||||
end interface amg_smoothers_bld
|
||||
|
||||
interface amg_smoothers_free
|
||||
module procedure amg_d_smoothers_free
|
||||
end interface amg_smoothers_free
|
||||
|
||||
interface amg_hierarchy_free
|
||||
module procedure amg_d_hierarchy_free
|
||||
end interface amg_hierarchy_free
|
||||
|
||||
contains
|
||||
!
|
||||
! Function returning a pointer to the smoother
|
||||
@@ -628,68 +618,6 @@ contains
|
||||
|
||||
end subroutine amg_d_prec_free
|
||||
|
||||
subroutine amg_d_smoothers_free(prec,info)
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_d_smoothers_free'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
call prec%precv(i)%free_smoothers(info)
|
||||
end do
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_d_smoothers_free
|
||||
|
||||
subroutine amg_d_hierarchy_free(prec,info)
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_d_hierarchy_free'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
me=-1
|
||||
write(0,*) 'Missing implementation '
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_d_hierarchy_free
|
||||
|
||||
|
||||
!
|
||||
|
||||
@@ -58,7 +58,6 @@ module amg_s_ainv_solver
|
||||
procedure, pass(sv) :: check => amg_s_ainv_solver_check
|
||||
procedure, pass(sv) :: build => amg_s_ainv_solver_bld
|
||||
procedure, pass(sv) :: clone => amg_s_ainv_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_s_ainv_solver_clone_settings
|
||||
procedure, pass(sv) :: cseti => amg_s_ainv_solver_cseti
|
||||
procedure, pass(sv) :: csetc => amg_s_ainv_solver_csetc
|
||||
procedure, pass(sv) :: csetr => amg_s_ainv_solver_csetr
|
||||
@@ -86,16 +85,6 @@ module amg_s_ainv_solver
|
||||
end subroutine amg_s_ainv_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_ainv_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
& amg_s_base_solver_type, psb_dpk_, amg_s_ainv_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_s_ainv_solver_type), intent(inout) :: sv
|
||||
class(amg_s_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_ainv_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_ainv_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
@@ -52,7 +52,6 @@ module amg_s_invk_solver
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_s_invk_solver_check
|
||||
procedure, pass(sv) :: clone => amg_s_invk_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_s_invk_solver_clone_settings
|
||||
procedure, pass(sv) :: build => amg_s_invk_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_s_invk_solver_cseti
|
||||
procedure, pass(sv) :: descr => amg_s_invk_solver_descr
|
||||
@@ -74,17 +73,6 @@ module amg_s_invk_solver
|
||||
end subroutine amg_s_invk_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invk_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
& amg_s_base_solver_type, psb_spk_, amg_s_invk_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_s_invk_solver_type), intent(inout) :: sv
|
||||
class(amg_s_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_invk_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invk_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
|
||||
@@ -52,7 +52,6 @@ module amg_s_invt_solver
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_s_invt_solver_check
|
||||
procedure, pass(sv) :: clone => amg_s_invt_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_s_invt_solver_clone_settings
|
||||
procedure, pass(sv) :: build => amg_s_invt_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_s_invt_solver_cseti
|
||||
procedure, pass(sv) :: csetr => amg_s_invt_solver_csetr
|
||||
@@ -74,17 +73,6 @@ module amg_s_invt_solver
|
||||
end subroutine amg_s_invt_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invt_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
& amg_s_base_solver_type, psb_spk_, amg_s_invt_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_s_invt_solver_type), intent(inout) :: sv
|
||||
class(amg_s_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_invt_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invt_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
|
||||
@@ -190,7 +190,6 @@ module amg_s_onelev_mod
|
||||
procedure, pass(lv) :: descr => amg_s_base_onelev_descr
|
||||
procedure, pass(lv) :: default => s_base_onelev_default
|
||||
procedure, pass(lv) :: free => amg_s_base_onelev_free
|
||||
procedure, pass(lv) :: free_smoothers => amg_s_base_onelev_free_smoothers
|
||||
procedure, pass(lv) :: nullify => s_base_onelev_nullify
|
||||
procedure, pass(lv) :: check => amg_s_base_onelev_check
|
||||
procedure, pass(lv) :: dump => amg_s_base_onelev_dump
|
||||
@@ -287,7 +286,7 @@ module amg_s_onelev_mod
|
||||
end subroutine amg_s_base_onelev_cnv
|
||||
end interface
|
||||
|
||||
interface
|
||||
interface
|
||||
subroutine amg_s_base_onelev_free(lv,info)
|
||||
import :: psb_sspmat_type, psb_s_vect_type, psb_s_base_vect_type, &
|
||||
& psb_slinmap_type, psb_spk_, amg_s_onelev_type, &
|
||||
@@ -299,18 +298,6 @@ module amg_s_onelev_mod
|
||||
end subroutine amg_s_base_onelev_free
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_base_onelev_free_smoothers(lv,info)
|
||||
import :: psb_sspmat_type, psb_s_vect_type, psb_s_base_vect_type, &
|
||||
& psb_slinmap_type, psb_spk_, amg_s_onelev_type, &
|
||||
& psb_ipk_, psb_epk_, psb_desc_type
|
||||
implicit none
|
||||
|
||||
class(amg_s_onelev_type), intent(inout) :: lv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_base_onelev_free_smoothers
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_base_onelev_check(lv,info)
|
||||
import :: psb_sspmat_type, psb_s_vect_type, psb_s_base_vect_type, &
|
||||
|
||||
@@ -135,9 +135,7 @@ module amg_s_prec_type
|
||||
procedure, pass(prec) :: build => amg_sprecbld
|
||||
procedure, pass(prec) :: hierarchy_build => amg_s_hierarchy_bld
|
||||
procedure, pass(prec) :: hierarchy_rebuild => amg_s_hierarchy_rebld
|
||||
procedure, pass(prec) :: hierarchy_free => amg_s_hierarchy_free
|
||||
procedure, pass(prec) :: smoothers_build => amg_s_smoothers_bld
|
||||
procedure, pass(prec) :: smoothers_free => amg_s_smoothers_free
|
||||
procedure, pass(prec) :: descr => amg_sfile_prec_descr
|
||||
end type amg_sprec_type
|
||||
|
||||
@@ -347,14 +345,6 @@ module amg_s_prec_type
|
||||
end subroutine amg_s_smoothers_bld
|
||||
end interface amg_smoothers_bld
|
||||
|
||||
interface amg_smoothers_free
|
||||
module procedure amg_s_smoothers_free
|
||||
end interface amg_smoothers_free
|
||||
|
||||
interface amg_hierarchy_free
|
||||
module procedure amg_s_hierarchy_free
|
||||
end interface amg_hierarchy_free
|
||||
|
||||
contains
|
||||
!
|
||||
! Function returning a pointer to the smoother
|
||||
@@ -628,68 +618,6 @@ contains
|
||||
|
||||
end subroutine amg_s_prec_free
|
||||
|
||||
subroutine amg_s_smoothers_free(prec,info)
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_s_smoothers_free'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
call prec%precv(i)%free_smoothers(info)
|
||||
end do
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_s_smoothers_free
|
||||
|
||||
subroutine amg_s_hierarchy_free(prec,info)
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_s_hierarchy_free'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
me=-1
|
||||
write(0,*) 'Missing implementation '
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_s_hierarchy_free
|
||||
|
||||
|
||||
!
|
||||
|
||||
@@ -58,7 +58,6 @@ module amg_z_ainv_solver
|
||||
procedure, pass(sv) :: check => amg_z_ainv_solver_check
|
||||
procedure, pass(sv) :: build => amg_z_ainv_solver_bld
|
||||
procedure, pass(sv) :: clone => amg_z_ainv_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_z_ainv_solver_clone_settings
|
||||
procedure, pass(sv) :: cseti => amg_z_ainv_solver_cseti
|
||||
procedure, pass(sv) :: csetc => amg_z_ainv_solver_csetc
|
||||
procedure, pass(sv) :: csetr => amg_z_ainv_solver_csetr
|
||||
@@ -86,16 +85,6 @@ module amg_z_ainv_solver
|
||||
end subroutine amg_z_ainv_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_ainv_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
& amg_z_base_solver_type, psb_dpk_, amg_z_ainv_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_z_ainv_solver_type), intent(inout) :: sv
|
||||
class(amg_z_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_ainv_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_ainv_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
@@ -52,7 +52,6 @@ module amg_z_invk_solver
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_z_invk_solver_check
|
||||
procedure, pass(sv) :: clone => amg_z_invk_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_z_invk_solver_clone_settings
|
||||
procedure, pass(sv) :: build => amg_z_invk_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_z_invk_solver_cseti
|
||||
procedure, pass(sv) :: descr => amg_z_invk_solver_descr
|
||||
@@ -74,17 +73,6 @@ module amg_z_invk_solver
|
||||
end subroutine amg_z_invk_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invk_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
& amg_z_base_solver_type, psb_dpk_, amg_z_invk_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_z_invk_solver_type), intent(inout) :: sv
|
||||
class(amg_z_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_invk_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invk_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
|
||||
@@ -52,7 +52,6 @@ module amg_z_invt_solver
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_z_invt_solver_check
|
||||
procedure, pass(sv) :: clone => amg_z_invt_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_z_invt_solver_clone_settings
|
||||
procedure, pass(sv) :: build => amg_z_invt_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_z_invt_solver_cseti
|
||||
procedure, pass(sv) :: csetr => amg_z_invt_solver_csetr
|
||||
@@ -74,17 +73,6 @@ module amg_z_invt_solver
|
||||
end subroutine amg_z_invt_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invt_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
& amg_z_base_solver_type, psb_dpk_, amg_z_invt_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_z_invt_solver_type), intent(inout) :: sv
|
||||
class(amg_z_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_invt_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invt_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
|
||||
@@ -189,7 +189,6 @@ module amg_z_onelev_mod
|
||||
procedure, pass(lv) :: descr => amg_z_base_onelev_descr
|
||||
procedure, pass(lv) :: default => z_base_onelev_default
|
||||
procedure, pass(lv) :: free => amg_z_base_onelev_free
|
||||
procedure, pass(lv) :: free_smoothers => amg_z_base_onelev_free_smoothers
|
||||
procedure, pass(lv) :: nullify => z_base_onelev_nullify
|
||||
procedure, pass(lv) :: check => amg_z_base_onelev_check
|
||||
procedure, pass(lv) :: dump => amg_z_base_onelev_dump
|
||||
@@ -286,7 +285,7 @@ module amg_z_onelev_mod
|
||||
end subroutine amg_z_base_onelev_cnv
|
||||
end interface
|
||||
|
||||
interface
|
||||
interface
|
||||
subroutine amg_z_base_onelev_free(lv,info)
|
||||
import :: psb_zspmat_type, psb_z_vect_type, psb_z_base_vect_type, &
|
||||
& psb_zlinmap_type, psb_dpk_, amg_z_onelev_type, &
|
||||
@@ -298,18 +297,6 @@ module amg_z_onelev_mod
|
||||
end subroutine amg_z_base_onelev_free
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_base_onelev_free_smoothers(lv,info)
|
||||
import :: psb_zspmat_type, psb_z_vect_type, psb_z_base_vect_type, &
|
||||
& psb_zlinmap_type, psb_dpk_, amg_z_onelev_type, &
|
||||
& psb_ipk_, psb_epk_, psb_desc_type
|
||||
implicit none
|
||||
|
||||
class(amg_z_onelev_type), intent(inout) :: lv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_base_onelev_free_smoothers
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_base_onelev_check(lv,info)
|
||||
import :: psb_zspmat_type, psb_z_vect_type, psb_z_base_vect_type, &
|
||||
|
||||
@@ -135,9 +135,7 @@ module amg_z_prec_type
|
||||
procedure, pass(prec) :: build => amg_zprecbld
|
||||
procedure, pass(prec) :: hierarchy_build => amg_z_hierarchy_bld
|
||||
procedure, pass(prec) :: hierarchy_rebuild => amg_z_hierarchy_rebld
|
||||
procedure, pass(prec) :: hierarchy_free => amg_z_hierarchy_free
|
||||
procedure, pass(prec) :: smoothers_build => amg_z_smoothers_bld
|
||||
procedure, pass(prec) :: smoothers_free => amg_z_smoothers_free
|
||||
procedure, pass(prec) :: descr => amg_zfile_prec_descr
|
||||
end type amg_zprec_type
|
||||
|
||||
@@ -347,14 +345,6 @@ module amg_z_prec_type
|
||||
end subroutine amg_z_smoothers_bld
|
||||
end interface amg_smoothers_bld
|
||||
|
||||
interface amg_smoothers_free
|
||||
module procedure amg_z_smoothers_free
|
||||
end interface amg_smoothers_free
|
||||
|
||||
interface amg_hierarchy_free
|
||||
module procedure amg_z_hierarchy_free
|
||||
end interface amg_hierarchy_free
|
||||
|
||||
contains
|
||||
!
|
||||
! Function returning a pointer to the smoother
|
||||
@@ -628,68 +618,6 @@ contains
|
||||
|
||||
end subroutine amg_z_prec_free
|
||||
|
||||
subroutine amg_z_smoothers_free(prec,info)
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_z_smoothers_free'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
call prec%precv(i)%free_smoothers(info)
|
||||
end do
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_z_smoothers_free
|
||||
|
||||
subroutine amg_z_hierarchy_free(prec,info)
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_z_hierarchy_free'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
me=-1
|
||||
write(0,*) 'Missing implementation '
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_z_hierarchy_free
|
||||
|
||||
|
||||
!
|
||||
|
||||
@@ -5,7 +5,7 @@ MODDIR=../../../modules
|
||||
HERE=../..
|
||||
|
||||
FINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) $(PSBLAS_INCLUDES)
|
||||
CXXINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(INCDIR) $(FMFLAG)/.
|
||||
CXXINCLUDES=$(FIFLAG)$(HERE) $(FIFLAG)$(INCDIR) $(FIFLAG)/. -I../../../../ParallelRomaF-main/include -I$(PSBLAS_INCDIR)
|
||||
|
||||
#CINCLUDES= -I${SUPERLU_INCDIR} -I${HSL_INCDIR} -I${SPRAL_INCDIR} -I/home/users/pasqua/Ambra/BootCMatch/include -lBCM -L/home/users/pasqua/Ambra/BootCMatch/lib -lm
|
||||
|
||||
@@ -59,9 +59,18 @@ amg_s_parmatch_spmm_bld.o \
|
||||
amg_s_parmatch_spmm_bld_ov.o \
|
||||
amg_s_parmatch_unsmth_bld.o \
|
||||
amg_s_parmatch_smth_bld.o \
|
||||
amg_s_parmatch_spmm_bld_inner.o
|
||||
amg_s_parmatch_spmm_bld_inner.o \
|
||||
amg_d_newmatch_aggregator_inner_mat_asb.o\
|
||||
amg_d_newmatch_aggregator_mat_asb.o \
|
||||
amg_d_newmatch_aggregator_mat_bld.o \
|
||||
amg_d_newmatch_aggregator_tprol.o \
|
||||
amg_d_newmatch_map_to_tprol.o \
|
||||
amg_d_newmatch_spmm_bld_inner.o \
|
||||
amg_d_newmatch_spmm_bld_ov.o
|
||||
|
||||
MPCOBJS=MatchBoxPC.o \
|
||||
MPCXXOBJS=MatchBoxPC.o \
|
||||
algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC.o \
|
||||
newmatch_interface.o \
|
||||
sendBundledMessages.o \
|
||||
initialize.o \
|
||||
extractUChunk.o \
|
||||
@@ -76,10 +85,10 @@ processCrossEdge.o \
|
||||
queueTransfer.o \
|
||||
processMessages.o \
|
||||
processExposedVertex.o \
|
||||
algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC.o \
|
||||
algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.o
|
||||
algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.o \
|
||||
MatchingAlgorithms.o
|
||||
|
||||
OBJS = $(FOBJS) $(MPCOBJS)
|
||||
OBJS = $(FOBJS) $(MPCOBJS) $(MPCXXOBJS)
|
||||
|
||||
LIBNAME=libamg_prec.a
|
||||
|
||||
@@ -89,10 +98,6 @@ lib: objs
|
||||
$(AR) $(HERE)/$(LIBNAME) $(OBJS)
|
||||
$(RANLIB) $(HERE)/$(LIBNAME)
|
||||
|
||||
mpobjs:
|
||||
(make $(MPFOBJS) F90="$(MPF90)" F90COPT="$(F90COPT)")
|
||||
(make $(MPCOBJS) CC="$(MPCC)" CCOPT="$(CCOPT)")
|
||||
|
||||
veryclean: clean
|
||||
/bin/rm -f $(LIBNAME)
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ subroutine amg_c_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
integer(psb_ipk_) :: nrow, ncol, nrl, nzl, ip, nzt, i, k
|
||||
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
|
||||
logical, parameter :: do_timings=.false., oldstyle=.false., debug=.false.
|
||||
integer(psb_ipk_), save :: idx_spspmm=-1, idx_cpytrans1=-1, idx_cpytrans2=-1
|
||||
integer(psb_ipk_), save :: idx_spspmm=-1
|
||||
|
||||
name='amg_ptap_bld'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
@@ -93,11 +93,7 @@ subroutine amg_c_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
if ((do_timings).and.(idx_spspmm==-1)) &
|
||||
& idx_spspmm = psb_get_timer_idx("PTAP_BLD: par_spspmm")
|
||||
if ((do_timings).and.(idx_cpytrans1==-1)) &
|
||||
& idx_cpytrans1 = psb_get_timer_idx("PTAP_BLD: cpy&trans1")
|
||||
if ((do_timings).and.(idx_cpytrans2==-1)) &
|
||||
& idx_cpytrans2 = psb_get_timer_idx("PTAP_BLD: cpy&trans2")
|
||||
& idx_spspmm = psb_get_timer_idx("SPMM_BLD: par_spspmm")
|
||||
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
@@ -132,7 +128,6 @@ subroutine amg_c_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
! Ok first product done.
|
||||
|
||||
if (present(desc_ax)) then
|
||||
if (do_timings) call psb_tic(idx_cpytrans1)
|
||||
block
|
||||
call coo_prol%cp_to_coo(coo_restr,info)
|
||||
call coo_restr%set_ncols(desc_ac%get_local_cols())
|
||||
@@ -142,7 +137,7 @@ subroutine amg_c_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
call coo_restr%set_ncols(desc_ax%get_local_cols())
|
||||
end block
|
||||
call csr_restr%cp_from_coo(coo_restr,info)
|
||||
if (do_timings) call psb_toc(idx_cpytrans1)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv coo_restr')
|
||||
goto 9999
|
||||
@@ -172,28 +167,27 @@ subroutine amg_c_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
|
||||
call coo_restr%transp()
|
||||
nzl = coo_restr%get_nzeros()
|
||||
nrl = desc_ac%get_local_rows()
|
||||
call coo_restr%fix(info)
|
||||
i=coo_restr%get_nzeros()
|
||||
nrl = desc_ac%get_local_rows()
|
||||
i=0
|
||||
!
|
||||
! Only keep local rows
|
||||
!
|
||||
search: do k=i,1,-1
|
||||
if (coo_restr%ia(k) <= nrl) then
|
||||
call coo_restr%set_nzeros(k)
|
||||
exit search
|
||||
do k=1, nzl
|
||||
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) then
|
||||
i = i+1
|
||||
coo_restr%val(i) = coo_restr%val(k)
|
||||
coo_restr%ia(i) = coo_restr%ia(k)
|
||||
coo_restr%ja(i) = coo_restr%ja(k)
|
||||
end if
|
||||
end do search
|
||||
|
||||
end do
|
||||
call coo_restr%set_nzeros(i)
|
||||
call coo_restr%fix(info)
|
||||
nzl = coo_restr%get_nzeros()
|
||||
call coo_restr%set_nrows(desc_ac%get_local_rows())
|
||||
call coo_restr%set_ncols(desc_a%get_local_cols())
|
||||
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
|
||||
if (do_timings) call psb_tic(idx_cpytrans2)
|
||||
|
||||
call csr_restr%cp_from_coo(coo_restr,info)
|
||||
|
||||
if (do_timings) call psb_toc(idx_cpytrans2)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv coo_restr')
|
||||
goto 9999
|
||||
|
||||
+21
-218
@@ -72,9 +72,7 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
use psb_base_mod
|
||||
use amg_base_prec_type
|
||||
use amg_c_inner_mod
|
||||
#if defined(OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
@@ -87,7 +85,7 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_), allocatable :: neigh(:), irow(:), icol(:),&
|
||||
integer(psb_ipk_), allocatable :: ils(:), neigh(:), irow(:), icol(:),&
|
||||
& ideg(:), idxs(:)
|
||||
integer(psb_lpk_), allocatable :: tmpaggr(:)
|
||||
complex(psb_spk_), allocatable :: val(:), diag(:)
|
||||
@@ -101,9 +99,6 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
integer(psb_ipk_) :: nrow, ncol, n_ne
|
||||
integer(psb_lpk_) :: nrglob
|
||||
character(len=20) :: name, ch_err
|
||||
integer(psb_ipk_), save :: idx_soc1_p1=-1, idx_soc1_p2=-1, idx_soc1_p3=-1
|
||||
integer(psb_ipk_), save :: idx_soc1_p0=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_soc1_map_bld'
|
||||
@@ -119,14 +114,6 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
nrglob = desc_a%get_global_rows()
|
||||
if ((do_timings).and.(idx_soc1_p0==-1)) &
|
||||
& idx_soc1_p0 = psb_get_timer_idx("SOC1_MAP: phase0")
|
||||
if ((do_timings).and.(idx_soc1_p1==-1)) &
|
||||
& idx_soc1_p1 = psb_get_timer_idx("SOC1_MAP: phase1")
|
||||
if ((do_timings).and.(idx_soc1_p2==-1)) &
|
||||
& idx_soc1_p2 = psb_get_timer_idx("SOC1_MAP: phase2")
|
||||
if ((do_timings).and.(idx_soc1_p3==-1)) &
|
||||
& idx_soc1_p3 = psb_get_timer_idx("SOC1_MAP: phase3")
|
||||
|
||||
nr = a%get_nrows()
|
||||
nc = a%get_ncols()
|
||||
@@ -146,204 +133,41 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_tic(idx_soc1_p0)
|
||||
call a%cp_to(acsr)
|
||||
if (do_timings) call psb_toc(idx_soc1_p0)
|
||||
if (clean_zeros) call acsr%clean_zeros(info)
|
||||
if (iorder == amg_aggr_ord_nat_) then
|
||||
!$omp parallel do private(i) schedule(static)
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
idxs(i) = i
|
||||
idxs(i) = i
|
||||
end do
|
||||
!$omp end parallel do
|
||||
else
|
||||
!$omp parallel do private(i) schedule(static)
|
||||
else
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
ideg(i) = acsr%irp(i+1) - acsr%irp(i)
|
||||
end do
|
||||
!$omp end parallel do
|
||||
call psb_msort(ideg,ix=idxs,dir=psb_sort_down_)
|
||||
end if
|
||||
if (do_timings) call psb_tic(idx_soc1_p1)
|
||||
|
||||
|
||||
!
|
||||
! Phase one: Start with disjoint groups.
|
||||
!
|
||||
naggr = 0
|
||||
#if defined(OPENMP)
|
||||
block
|
||||
integer(psb_ipk_), allocatable :: bnds(:), locnaggr(:)
|
||||
integer(psb_ipk_) :: myth,nths, kk
|
||||
! The parallelization makes use of a locaggr(:) array; each thread
|
||||
! keeps its own version of naggr, and when the loop ends, a prefix is applied
|
||||
! to locnaggr to determine:
|
||||
! 1. The total number of aggregaters NAGGR;
|
||||
! 2. How much should each thread shift its own aggregates
|
||||
! Part 2 requires to keep track of which thread defined each entry
|
||||
! of ilaggr(), so that each entry can be adjusted correctly: even
|
||||
! if an entry I belongs to the range BNDS(TH)>BNDS(TH+1)-1, it may have
|
||||
! been set because it is strongly connected to an entry J belonging to a
|
||||
! different thread.
|
||||
|
||||
!$omp parallel shared(bnds,idxs,locnaggr,ilaggr,nr,naggr,diag,theta,nths,info) &
|
||||
!$omp private(icol,val,myth,kk)
|
||||
block
|
||||
integer(psb_ipk_) :: ii,nlp,k,kp,n,ia,isz, nc, i,j,m, nz, ilg, ip, rsz
|
||||
integer(psb_lpk_) :: itmp
|
||||
!$omp master
|
||||
nths = omp_get_num_threads()
|
||||
allocate(bnds(0:nths),locnaggr(0:nths+1))
|
||||
locnaggr(:) = 0
|
||||
bnds(0) = 1
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
myth = omp_get_thread_num()
|
||||
rsz = nr/nths
|
||||
if (myth < mod(nr,nths)) rsz = rsz + 1
|
||||
bnds(myth+1) = rsz
|
||||
!$omp barrier
|
||||
!$omp master
|
||||
do i=1,nths
|
||||
bnds(i) = bnds(i) + bnds(i-1)
|
||||
end do
|
||||
info = 0
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
|
||||
!$omp do schedule(static) private(disjoint)
|
||||
do kk=0, nths-1
|
||||
step1: do ii=bnds(kk), bnds(kk+1)-1
|
||||
i = idxs(ii)
|
||||
if (info /= 0) cycle step1
|
||||
if ((i<1).or.(i>nr)) then
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
end if
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
nz = (acsr%irp(i+1)-acsr%irp(i))
|
||||
if ((nz<0).or.(nz>size(icol))) then
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
end if
|
||||
|
||||
icol(1:nz) = acsr%ja(acsr%irp(i):acsr%irp(i+1)-1)
|
||||
val(1:nz) = acsr%val(acsr%irp(i):acsr%irp(i+1)-1)
|
||||
|
||||
!
|
||||
! Build the set of all strongly coupled nodes
|
||||
!
|
||||
ip = 0
|
||||
do k=1, nz
|
||||
j = icol(k)
|
||||
! If any of the neighbours is already assigned,
|
||||
! we will not reset.
|
||||
if (j>nr) cycle step1
|
||||
if (ilaggr(j) > 0) cycle step1
|
||||
if (abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))) then
|
||||
ip = ip + 1
|
||||
icol(ip) = icol(k)
|
||||
end if
|
||||
enddo
|
||||
|
||||
!
|
||||
! If the whole strongly coupled neighborhood of I is
|
||||
! as yet unconnected, turn it into the next aggregate.
|
||||
! Same if ip==0 (in which case, neighborhood only
|
||||
! contains I even if it does not look like it from matrix)
|
||||
! The fact that DISJOINT is private and not under lock
|
||||
! generates a certain un-repeatability, in that between
|
||||
! computing DISJOINT and assigning, another thread might
|
||||
! alter the values of ILAGGR.
|
||||
! However, a certain unrepeatability is already present
|
||||
! because the sequence of aggregates is computed with a
|
||||
! different order than in serial mode.
|
||||
! In any case, even if the enteries of ILAGGR may be
|
||||
! overwritten, the important thing is that each entry is
|
||||
! consistent and they generate a correct aggregation map.
|
||||
!
|
||||
disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0)
|
||||
if (disjoint) then
|
||||
locnaggr(kk) = locnaggr(kk) + 1
|
||||
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk
|
||||
if (itmp < (bnds(kk)-1+locnaggr(kk))) then
|
||||
!$omp atomic update
|
||||
info = max(12345678,info)
|
||||
!$omp end atomic
|
||||
cycle step1
|
||||
end if
|
||||
!$omp atomic write
|
||||
ilaggr(i) = itmp
|
||||
!$omp end atomic
|
||||
do k=1, ip
|
||||
!$omp atomic write
|
||||
ilaggr(icol(k)) = itmp
|
||||
!$omp end atomic
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
enddo step1
|
||||
end do
|
||||
!$omp end do
|
||||
|
||||
!$omp master
|
||||
naggr = sum(locnaggr(0:nths-1))
|
||||
do i=1,nths
|
||||
locnaggr(i) = locnaggr(i) + locnaggr(i-1)
|
||||
end do
|
||||
do i=nths+1,1,-1
|
||||
locnaggr(i) = locnaggr(i-1)
|
||||
end do
|
||||
locnaggr(0) = 0
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
!$omp do schedule(static)
|
||||
do kk=0, nths-1
|
||||
do ii=bnds(kk), bnds(kk+1)-1
|
||||
if (ilaggr(ii) > 0) then
|
||||
kp = mod(ilaggr(ii),nths)
|
||||
ilaggr(ii) = (ilaggr(ii)/nths)- (bnds(kp)-1) + locnaggr(kp)
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!$omp end do
|
||||
end block
|
||||
!$omp end parallel
|
||||
end block
|
||||
if (info /= 0) then
|
||||
if (info == 12345678) write(0,*) 'Overflow in encoding ILAGGR'
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
#else
|
||||
icnt = 0
|
||||
step1: do ii=1, nr
|
||||
if (info /= 0) cycle
|
||||
i = idxs(ii)
|
||||
if ((i<1).or.(i>nr)) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
nz = (acsr%irp(i+1)-acsr%irp(i))
|
||||
if ((nz<0).or.(nz>size(icol))) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
icol(1:nz) = acsr%ja(acsr%irp(i):acsr%irp(i+1)-1)
|
||||
@@ -352,7 +176,7 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
!
|
||||
! Build the set of all strongly coupled nodes
|
||||
!
|
||||
ip = 0
|
||||
ip = 0
|
||||
do k=1, nz
|
||||
j = icol(k)
|
||||
if ((1<=j).and.(j<=nr)) then
|
||||
@@ -370,7 +194,8 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
! contains I even if it does not look like it from matrix)
|
||||
!
|
||||
disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0)
|
||||
if (disjoint) then
|
||||
if (disjoint) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
do k=1, ip
|
||||
ilaggr(icol(k)) = naggr
|
||||
@@ -379,22 +204,16 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
endif
|
||||
enddo step1
|
||||
#endif
|
||||
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1:',naggr,count(ilaggr(1:nr) == -(nr+1)), count(ilaggr(1:nr)>0),&
|
||||
& count(ilaggr(1:nr) == -(nr+1))+count(ilaggr(1:nr)>0),nr
|
||||
& ' Check 1:',count(ilaggr == -(nr+1))
|
||||
end if
|
||||
if (do_timings) call psb_toc(idx_soc1_p1)
|
||||
if (do_timings) call psb_tic(idx_soc1_p2)
|
||||
|
||||
!
|
||||
! Phase two: join the neighbours
|
||||
!
|
||||
!$omp workshare
|
||||
tmpaggr = ilaggr
|
||||
!$omp end workshare
|
||||
!$omp parallel do schedule(static) shared(tmpaggr,ilaggr,nr,naggr,diag,theta)&
|
||||
!$omp private(ii,i,j,k,nz,icol,val,ip,cpling)
|
||||
step2: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
@@ -425,15 +244,8 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
end if
|
||||
end do step2
|
||||
!$omp end parallel do
|
||||
if (do_timings) call psb_toc(idx_soc1_p2)
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1.5:',naggr,count(ilaggr(1:nr) == -(nr+1)), count(ilaggr(1:nr)>0),&
|
||||
& count(ilaggr(1:nr) == -(nr+1))+count(ilaggr(1:nr)>0),nr
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_tic(idx_soc1_p3)
|
||||
|
||||
!
|
||||
! Phase three: sweep over leftovers, if any
|
||||
!
|
||||
@@ -462,6 +274,7 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
enddo
|
||||
if (ip > 0) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
ilaggr(i) = naggr
|
||||
do k=1, ip
|
||||
@@ -479,10 +292,7 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end do step3
|
||||
|
||||
! Any leftovers?
|
||||
!$omp parallel do schedule(static) shared(ilaggr,info)&
|
||||
!$omp private(ii,i,j,k,nz,icol,val,ip)
|
||||
do i=1, nr
|
||||
if (info /= 0) cycle
|
||||
if (ilaggr(i) < 0) then
|
||||
nz = (acsr%irp(i+1)-acsr%irp(i))
|
||||
if (nz == 1) then
|
||||
@@ -493,18 +303,15 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
! other processes.
|
||||
ilaggr(i) = -(nrglob+nr)
|
||||
else
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name,a_err='Fatal error: non-singleton leftovers')
|
||||
cycle
|
||||
goto 9999
|
||||
endif
|
||||
end if
|
||||
end do
|
||||
!$omp end parallel do
|
||||
if (info /= 0) goto 9999
|
||||
if (do_timings) call psb_toc(idx_soc1_p3)
|
||||
|
||||
if (naggr > ncol) then
|
||||
!write(0,*) name,'Error : naggr > ncol',naggr,ncol
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: naggr>ncol')
|
||||
goto 9999
|
||||
@@ -529,13 +336,9 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
nlaggr(:) = 0
|
||||
nlaggr(me+1) = naggr
|
||||
call psb_sum(ctxt,nlaggr(1:np))
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 2:',naggr,count(ilaggr(1:nr) == -(nr+1)), count(ilaggr(1:nr)>0),&
|
||||
& count(ilaggr(1:nr) == -(nr+1))+count(ilaggr(1:nr)>0),nr
|
||||
end if
|
||||
|
||||
call acsr%free()
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
+16
-205
@@ -68,12 +68,9 @@
|
||||
!
|
||||
subroutine amg_c_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
use psb_base_mod
|
||||
use psb_base_mod
|
||||
use amg_base_prec_type
|
||||
use amg_c_inner_mod
|
||||
#if defined(OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
|
||||
implicit none
|
||||
|
||||
@@ -102,9 +99,6 @@ subroutine amg_c_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
integer(psb_ipk_) :: np, me
|
||||
integer(psb_ipk_) :: nrow, ncol, n_ne
|
||||
character(len=20) :: name, ch_err
|
||||
integer(psb_ipk_), save :: idx_soc2_p1=-1, idx_soc2_p2=-1, idx_soc2_p3=-1
|
||||
integer(psb_ipk_), save :: idx_soc2_p0=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_soc2_map_bld'
|
||||
@@ -120,14 +114,6 @@ subroutine amg_c_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
nrglob = desc_a%get_global_rows()
|
||||
if ((do_timings).and.(idx_soc2_p0==-1)) &
|
||||
& idx_soc2_p0 = psb_get_timer_idx("SOC2_MAP: phase0")
|
||||
if ((do_timings).and.(idx_soc2_p1==-1)) &
|
||||
& idx_soc2_p1 = psb_get_timer_idx("SOC2_MAP: phase1")
|
||||
if ((do_timings).and.(idx_soc2_p2==-1)) &
|
||||
& idx_soc2_p2 = psb_get_timer_idx("SOC2_MAP: phase2")
|
||||
if ((do_timings).and.(idx_soc2_p3==-1)) &
|
||||
& idx_soc2_p3 = psb_get_timer_idx("SOC2_MAP: phase3")
|
||||
|
||||
nr = a%get_nrows()
|
||||
nc = a%get_ncols()
|
||||
@@ -139,7 +125,6 @@ subroutine amg_c_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_tic(idx_soc2_p0)
|
||||
diag = a%get_diag(info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
@@ -152,217 +137,55 @@ subroutine amg_c_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
!
|
||||
call a%cp_to(muij)
|
||||
if (clean_zeros) call muij%clean_zeros(info)
|
||||
!$omp parallel do private(i,j,k) shared(nr,diag,muij) schedule(static)
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
if (j<= nr) muij%val(k) = abs(muij%val(k))/sqrt(abs(diag(i)*diag(j)))
|
||||
end do
|
||||
end do
|
||||
!$omp end parallel do
|
||||
|
||||
!
|
||||
! Compute the 1-neigbour; mark strong links with +1, weak links with -1
|
||||
!
|
||||
call s_neigh_coo%allocate(nr,nr,muij%get_nzeros())
|
||||
!$omp parallel do private(i,j,k) shared(nr,diag,muij) schedule(static)
|
||||
ip = 0
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
s_neigh_coo%ia(k) = i
|
||||
s_neigh_coo%ja(k) = j
|
||||
if (j<=nr) then
|
||||
ip = ip + 1
|
||||
s_neigh_coo%ia(ip) = i
|
||||
s_neigh_coo%ja(ip) = j
|
||||
if (real(muij%val(k)) >= theta) then
|
||||
s_neigh_coo%val(k) = sone
|
||||
s_neigh_coo%val(ip) = sone
|
||||
else
|
||||
s_neigh_coo%val(k) = -sone
|
||||
s_neigh_coo%val(ip) = -sone
|
||||
end if
|
||||
else
|
||||
s_neigh_coo%val(k) = -sone
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!$omp end parallel do
|
||||
!write(*,*) 'S_NEIGH: ',nr,ip
|
||||
call s_neigh_coo%set_nzeros(muij%get_nzeros())
|
||||
call s_neigh_coo%set_nzeros(ip)
|
||||
call s_neigh%mv_from_coo(s_neigh_coo,info)
|
||||
|
||||
if (iorder == amg_aggr_ord_nat_) then
|
||||
|
||||
!$omp parallel do private(i) shared(ilaggr,idxs) schedule(static)
|
||||
if (iorder == amg_aggr_ord_nat_) then
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
idxs(i) = i
|
||||
end do
|
||||
!$omp end parallel do
|
||||
else
|
||||
!$omp parallel do private(i) shared(ilaggr,idxs,muij) schedule(static)
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
ideg(i) = muij%irp(i+1) - muij%irp(i)
|
||||
end do
|
||||
!$omp end parallel do
|
||||
call psb_msort(ideg,ix=idxs,dir=psb_sort_down_)
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_toc(idx_soc2_p0)
|
||||
if (do_timings) call psb_tic(idx_soc2_p1)
|
||||
|
||||
!
|
||||
! Phase one: Start with disjoint groups.
|
||||
!
|
||||
naggr = 0
|
||||
#if defined(OPENMP)
|
||||
block
|
||||
integer(psb_ipk_), allocatable :: bnds(:), locnaggr(:)
|
||||
integer(psb_ipk_) :: myth,nths, kk
|
||||
! The parallelization makes use of a locaggr(:) array; each thread
|
||||
! keeps its own version of naggr, and when the loop ends, a prefix is applied
|
||||
! to locnaggr to determine:
|
||||
! 1. The total number of aggregaters NAGGR;
|
||||
! 2. How much should each thread shift its own aggregates
|
||||
! Part 2 requires to keep track of which thread defined each entry
|
||||
! of ilaggr(), so that each entry can be adjusted correctly: even
|
||||
! if an entry I belongs to the range BNDS(TH)>BNDS(TH+1)-1, it may have
|
||||
! been set because it is strongly connected to an entry J belonging to a
|
||||
! different thread.
|
||||
|
||||
!$omp parallel shared(s_neigh,bnds,idxs,locnaggr,ilaggr,nr,naggr,diag,theta,nths,info) &
|
||||
!$omp private(icol,val,myth,kk)
|
||||
block
|
||||
integer(psb_ipk_) :: ii,nlp,k,kp,n,ia,isz,nc,i,j,m,nz,ilg,ip,rsz,ip1,nzcnt
|
||||
integer(psb_lpk_) :: itmp
|
||||
!$omp master
|
||||
nths = omp_get_num_threads()
|
||||
allocate(bnds(0:nths),locnaggr(0:nths+1))
|
||||
locnaggr(:) = 0
|
||||
bnds(0) = 1
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
myth = omp_get_thread_num()
|
||||
rsz = nr/nths
|
||||
if (myth < mod(nr,nths)) rsz = rsz + 1
|
||||
bnds(myth+1) = rsz
|
||||
!$omp barrier
|
||||
!$omp master
|
||||
do i=1,nths
|
||||
bnds(i) = bnds(i) + bnds(i-1)
|
||||
end do
|
||||
info = 0
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
|
||||
!$omp do schedule(static) private(disjoint)
|
||||
do kk=0, nths-1
|
||||
step1: do ii=bnds(kk), bnds(kk+1)-1
|
||||
i = idxs(ii)
|
||||
if (info /= 0) then
|
||||
write(0,*) ' Step1:',kk,ii,i,info
|
||||
cycle step1
|
||||
end if
|
||||
if ((i<1).or.(i>nr)) then
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
end if
|
||||
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
!
|
||||
! Get the 1-neighbourhood of I
|
||||
!
|
||||
ip1 = s_neigh%irp(i)
|
||||
nz = s_neigh%irp(i+1)-ip1
|
||||
!
|
||||
! If the neighbourhood only contains I, skip it
|
||||
!
|
||||
if (nz ==0) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
if ((nz==1).and.(s_neigh%ja(ip1)==i)) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
|
||||
nzcnt = count(real(s_neigh%val(ip1:ip1+nz-1)) > 0)
|
||||
icol(1:nzcnt) = pack(s_neigh%ja(ip1:ip1+nz-1),(real(s_neigh%val(ip1:ip1+nz-1)) > 0))
|
||||
disjoint = all(ilaggr(icol(1:nzcnt)) == -(nr+1))
|
||||
|
||||
!
|
||||
! If the whole strongly coupled neighborhood of I is
|
||||
! as yet unconnected, turn it into the next aggregate.
|
||||
! Same if ip==0 (in which case, neighborhood only
|
||||
! contains I even if it does not look like it from matrix)
|
||||
! The fact that DISJOINT is private and not under lock
|
||||
! generates a certain un-repeatability, in that between
|
||||
! computing DISJOINT and assigning, another thread might
|
||||
! alter the values of ILAGGR.
|
||||
! However, a certain unrepeatability is already present
|
||||
! because the sequence of aggregates is computed with a
|
||||
! different order than in serial mode.
|
||||
! In any case, even if the enteries of ILAGGR may be
|
||||
! overwritten, the important thing is that each entry is
|
||||
! consistent and they generate a correct aggregation map.
|
||||
!
|
||||
if (disjoint) then
|
||||
locnaggr(kk) = locnaggr(kk) + 1
|
||||
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk
|
||||
if (itmp < (bnds(kk)-1+locnaggr(kk))) then
|
||||
!$omp atomic update
|
||||
info = max(12345678,info)
|
||||
!$omp end atomic
|
||||
cycle step1
|
||||
end if
|
||||
!$omp atomic write
|
||||
ilaggr(i) = itmp
|
||||
!$omp end atomic
|
||||
do k=1, nzcnt
|
||||
!$omp atomic write
|
||||
ilaggr(icol(k)) = itmp
|
||||
!$omp end atomic
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
enddo step1
|
||||
end do
|
||||
!$omp end do
|
||||
|
||||
!$omp master
|
||||
naggr = sum(locnaggr(0:nths-1))
|
||||
do i=1,nths
|
||||
locnaggr(i) = locnaggr(i) + locnaggr(i-1)
|
||||
end do
|
||||
do i=nths+1,1,-1
|
||||
locnaggr(i) = locnaggr(i-1)
|
||||
end do
|
||||
locnaggr(0) = 0
|
||||
!write(0,*) 'LNAG ',locnaggr(nths+1)
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
!$omp do schedule(static)
|
||||
do kk=0, nths-1
|
||||
do ii=bnds(kk), bnds(kk+1)-1
|
||||
if (ilaggr(ii) > 0) then
|
||||
kp = mod(ilaggr(ii),nths)
|
||||
ilaggr(ii) = (ilaggr(ii)/nths)- (bnds(kp)-1) + locnaggr(kp)
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!$omp end do
|
||||
end block
|
||||
!$omp end parallel
|
||||
end block
|
||||
if (info /= 0) then
|
||||
if (info == 12345678) write(0,*) 'Overflow in encoding ILAGGR'
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
#else
|
||||
icnt = 0
|
||||
step1: do ii=1, nr
|
||||
i = idxs(ii)
|
||||
@@ -401,21 +224,16 @@ subroutine amg_c_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
endif
|
||||
enddo step1
|
||||
#endif
|
||||
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1:',count(ilaggr == -(nr+1))
|
||||
end if
|
||||
if (do_timings) call psb_toc(idx_soc2_p1)
|
||||
if (do_timings) call psb_tic(idx_soc2_p2)
|
||||
|
||||
!
|
||||
! Phase two: join the neighbours
|
||||
!
|
||||
!$omp workshare
|
||||
tmpaggr = ilaggr
|
||||
!$omp end workshare
|
||||
!$omp parallel do schedule(static) shared(tmpaggr,ilaggr,nr,naggr,diag,muij,s_neigh)&
|
||||
!$omp private(ii,i,j,k,nz,icol,val,ip,cpling)
|
||||
step2: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
@@ -441,9 +259,8 @@ subroutine amg_c_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
end if
|
||||
end do step2
|
||||
!$omp end parallel do
|
||||
if (do_timings) call psb_toc(idx_soc2_p2)
|
||||
if (do_timings) call psb_tic(idx_soc2_p3)
|
||||
|
||||
|
||||
!
|
||||
! Phase three: sweep over leftovers, if any
|
||||
!
|
||||
@@ -477,8 +294,6 @@ subroutine amg_c_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end do step3
|
||||
|
||||
! Any leftovers?
|
||||
!$omp parallel do schedule(static) shared(ilaggr,s_neigh,info)&
|
||||
!$omp private(ii,i,j,k)
|
||||
do i=1, nr
|
||||
if (ilaggr(i) <= 0) then
|
||||
nz = (s_neigh%irp(i+1)-s_neigh%irp(i))
|
||||
@@ -490,17 +305,13 @@ subroutine amg_c_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
! other processes.
|
||||
ilaggr(i) = -(nrglob+nr)
|
||||
else
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name,a_err='Fatal error: non-singleton leftovers')
|
||||
cycle
|
||||
goto 9999
|
||||
endif
|
||||
end if
|
||||
end do
|
||||
!$omp end parallel do
|
||||
if (info /= 0) goto 9999
|
||||
if (do_timings) call psb_toc(idx_soc2_p3)
|
||||
|
||||
if (naggr > ncol) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: naggr>ncol')
|
||||
@@ -0,0 +1,166 @@
|
||||
!
|
||||
!
|
||||
! 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
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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_d_newmatch_aggregator_mat_asb.f90
|
||||
!
|
||||
! Subroutine: amg_d_newmatch_aggregator_mat_asb
|
||||
! Version: real
|
||||
!
|
||||
!
|
||||
! From a given AC to final format, generating DESC_AC.
|
||||
! This is quite involved, because in the context of aggregation based
|
||||
! on parallel matching we are building the matrix hierarchy within BLD_TPROL
|
||||
! as we go, especially if we have multiple sweeps, hence this code is called
|
||||
! in two completely different contexts:
|
||||
! 1. Within bld_tprol for the internal hierarchy
|
||||
! 2. Outside, from amg_hierarchy_bld
|
||||
! The solution we have found is for bld_tprol to copy its output
|
||||
! into special components ag%ac ag%desc_ac etc so that:
|
||||
! 1. if they are allocated, it means that bld_tprol has been already invoked, we are in
|
||||
! amg_hierarchy_bld and we only need to copy them
|
||||
! 2. If they are not allocated, we are within bld_tprol, and we need to actually
|
||||
! perform the various needed steps.
|
||||
!
|
||||
! Arguments:
|
||||
! ag - type(amg_d_newmatch_aggregator_type), input/output.
|
||||
! The aggregator object
|
||||
! parms - type(amg_dml_parms), input
|
||||
! The aggregation parameters
|
||||
! a - type(psb_dspmat_type), input.
|
||||
! The sparse matrix structure containing the local part of
|
||||
! the fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of the fine-level matrix.
|
||||
! The 'one-level' data structure that will contain the local
|
||||
! part of the matrix to be built as well as the information
|
||||
! concerning the prolongator and its transpose.
|
||||
! ilaggr - integer, dimension(:), input
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
! ilaggr(i)=j means that node i in the adjacency graph
|
||||
! of the fine-level matrix is mapped onto node j in the
|
||||
! adjacency graph of the coarse-level matrix. Note that the indices
|
||||
! are assumed to be shifted so as to make sure the ranges on
|
||||
! the various processes do not overlap.
|
||||
! nlaggr - integer, dimension(:) input
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! ac - type(psb_dspmat_type), inout
|
||||
! The coarse matrix
|
||||
! desc_ac - type(psb_desc_type), output.
|
||||
! The communication descriptor of the fine-level matrix.
|
||||
! The 'one-level' data structure that will contain the local
|
||||
! part of the matrix to be built as well as the information
|
||||
! concerning the prolongator and its transpose.
|
||||
!
|
||||
! op_prol - type(psb_dspmat_type), input/output
|
||||
! The tentative prolongator on input, the computed prolongator on output
|
||||
!
|
||||
! op_restr - type(psb_dspmat_type), input/output
|
||||
! The restrictor operator; normally, it is the transpose of the prolongator.
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine amg_d_newmatch_aggregator_inner_mat_asb(ag,parms,a,desc_a,&
|
||||
& ac,desc_ac, op_prol,op_restr,info)
|
||||
use psb_base_mod
|
||||
use amg_base_prec_type
|
||||
#if defined(SERIAL_MPI)
|
||||
use amg_d_newmatch_aggregator_mod
|
||||
#else
|
||||
use amg_d_newmatch_aggregator_mod, amg_protect_name => amg_d_newmatch_aggregator_inner_mat_asb
|
||||
#endif
|
||||
implicit none
|
||||
class(amg_d_newmatch_aggregator_type), target, intent(inout) :: ag
|
||||
type(amg_dml_parms), intent(inout) :: parms
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
type(psb_dspmat_type), intent(inout) :: op_prol,op_restr
|
||||
type(psb_dspmat_type), intent(inout) :: ac
|
||||
type(psb_desc_type), intent(inout) :: desc_ac
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
type(psb_ctxt_type) :: ictxt
|
||||
integer(psb_ipk_) :: np, me
|
||||
type(psb_ld_coo_sparse_mat) :: acoo, bcoo
|
||||
type(psb_ld_csr_sparse_mat) :: acsr1
|
||||
integer(psb_ipk_) :: nzl, inl
|
||||
integer(psb_lpk_) :: ntaggr
|
||||
integer(psb_ipk_) :: err_act, debug_level, debug_unit
|
||||
character(len=20) :: name='d_newmatch_inner_mat_asb'
|
||||
character(len=80) :: aname
|
||||
logical, parameter :: debug=.false., dump_prol_restr=.false.
|
||||
|
||||
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
info = psb_success_
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
#if !defined(SERIAL_MPI)
|
||||
|
||||
if (debug) write(0,*) me,' ',trim(name),' Start:',&
|
||||
& allocated(ag%ac),allocated(ag%desc_ac), allocated(ag%prol),allocated(ag%restr)
|
||||
|
||||
select case(parms%coarse_mat)
|
||||
|
||||
case(amg_distr_mat_)
|
||||
! Do nothing, it has already been done in spmm_bld_ov.
|
||||
|
||||
case(amg_repl_mat_)
|
||||
!
|
||||
!
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='no repl coarse_mat_ here')
|
||||
goto 9999
|
||||
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='invalid amg_coarse_mat_')
|
||||
goto 9999
|
||||
end select
|
||||
#endif
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_d_newmatch_aggregator_inner_mat_asb
|
||||
@@ -0,0 +1,150 @@
|
||||
!
|
||||
!
|
||||
! File: amg_d_newmatch_aggregator_mat_asb.f90
|
||||
!
|
||||
! Subroutine: amg_d_newmatch_aggregator_mat_asb
|
||||
! Version: real
|
||||
!
|
||||
!
|
||||
! From a given AC to final format, generating DESC_AC
|
||||
!
|
||||
! Arguments:
|
||||
! ag - type(amg_d_newmatch_aggregator_type), input/output.
|
||||
! The aggregator object
|
||||
! parms - type(amg_dml_parms), input
|
||||
! The aggregation parameters
|
||||
! a - type(psb_dspmat_type), input.
|
||||
! The sparse matrix structure containing the local part of
|
||||
! the fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of the fine-level matrix.
|
||||
! The 'one-level' data structure that will contain the local
|
||||
! part of the matrix to be built as well as the information
|
||||
! concerning the prolongator and its transpose.
|
||||
! ilaggr - integer, dimension(:), input
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
! ilaggr(i)=j means that node i in the adjacency graph
|
||||
! of the fine-level matrix is mapped onto node j in the
|
||||
! adjacency graph of the coarse-level matrix. Note that the indices
|
||||
! are assumed to be shifted so as to make sure the ranges on
|
||||
! the various processes do not overlap.
|
||||
! nlaggr - integer, dimension(:) input
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! ac - type(psb_dspmat_type), inout
|
||||
! The coarse matrix
|
||||
! desc_ac - type(psb_desc_type), output.
|
||||
! The communication descriptor of the fine-level matrix.
|
||||
! The 'one-level' data structure that will contain the local
|
||||
! part of the matrix to be built as well as the information
|
||||
! concerning the prolongator and its transpose.
|
||||
!
|
||||
! op_prol - type(psb_dspmat_type), input/output
|
||||
! The tentative prolongator on input, the computed prolongator on output
|
||||
!
|
||||
! op_restr - type(psb_dspmat_type), input/output
|
||||
! The restrictor operator; normally, it is the transpose of the prolongator.
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine amg_d_newmatch_aggregator_mat_asb(ag,parms,a,desc_a,&
|
||||
& ac,desc_ac, op_prol,op_restr,info)
|
||||
use psb_base_mod
|
||||
use amg_base_prec_type
|
||||
use amg_d_newmatch_aggregator_mod, amg_protect_name => amg_d_newmatch_aggregator_mat_asb
|
||||
implicit none
|
||||
class(amg_d_newmatch_aggregator_type), target, intent(inout) :: ag
|
||||
type(amg_dml_parms), intent(inout) :: parms
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(inout) :: desc_a
|
||||
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
|
||||
!
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me
|
||||
type(psb_ld_coo_sparse_mat) :: tmpcoo
|
||||
type(psb_ldspmat_type) :: tmp_ac
|
||||
integer(psb_ipk_) :: i_nr, i_nc, i_nl, nzl
|
||||
integer(psb_lpk_) :: ntaggr
|
||||
integer(psb_ipk_) :: err_act, debug_level, debug_unit
|
||||
character(len=20) :: name='d_newmatch_aggregator_mat_asb'
|
||||
|
||||
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
info = psb_success_
|
||||
ctxt = desc_a%get_context()
|
||||
call psb_info(ctxt,me,np)
|
||||
|
||||
select case(parms%coarse_mat)
|
||||
|
||||
case(amg_distr_mat_)
|
||||
|
||||
call ac%cscnv(info,type='csr')
|
||||
call op_prol%cscnv(info,type='csr')
|
||||
call op_restr%cscnv(info,type='csr')
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),&
|
||||
& 'Done ac '
|
||||
|
||||
case(amg_repl_mat_)
|
||||
!
|
||||
! We are assuming here that an d matrix
|
||||
! can hold all entries
|
||||
!
|
||||
if (desc_ac%get_global_rows() < huge(1_psb_ipk_) ) then
|
||||
ntaggr = desc_ac%get_global_rows()
|
||||
i_nr = ntaggr
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='invalid amg_coarse_mat_')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call op_prol%mv_to(tmpcoo)
|
||||
nzl = tmpcoo%get_nzeros()
|
||||
call psb_loc_to_glob(tmpcoo%ja(1:nzl),desc_ac,info,'I')
|
||||
call op_prol%mv_from(tmpcoo)
|
||||
|
||||
call op_restr%mv_to(tmpcoo)
|
||||
nzl = tmpcoo%get_nzeros()
|
||||
call psb_loc_to_glob(tmpcoo%ia(1:nzl),desc_ac,info,'I')
|
||||
call op_restr%mv_from(tmpcoo)
|
||||
|
||||
call op_prol%set_ncols(i_nr)
|
||||
call op_restr%set_nrows(i_nr)
|
||||
|
||||
call psb_gather(tmp_ac,ac,desc_ac,info,root=-ione,&
|
||||
& dupl=psb_dupl_add_,keeploc=.false.)
|
||||
call tmp_ac%mv_to(tmpcoo)
|
||||
call ac%mv_from(tmpcoo)
|
||||
|
||||
call psb_cdall(ctxt,desc_ac,info,mg=ntaggr,repl=.true.)
|
||||
if (info == psb_success_) call psb_cdasb(desc_ac,info)
|
||||
!
|
||||
! Now that we have the descriptors and the restrictor, we should
|
||||
! update the W. But we don't, because REPL is only valid
|
||||
! at the coarsest level, so no need to carry over.
|
||||
!
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='invalid amg_coarse_mat_')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_d_newmatch_aggregator_mat_asb
|
||||
@@ -0,0 +1,183 @@
|
||||
!
|
||||
!
|
||||
! File: amg_d_base_aggregator_mat_bld.f90
|
||||
!
|
||||
! Subroutine: amg_d_base_aggregator_mat_bld
|
||||
! Version: real
|
||||
!
|
||||
! This routine builds the matrix associated to the current level of the
|
||||
! multilevel preconditioner from the matrix associated to the previous level,
|
||||
! by using the user-specified aggregation technique (therefore, it also builds the
|
||||
! prolongation and restriction operators mapping the current level to the
|
||||
! previous one and vice versa).
|
||||
! The current level is regarded as the coarse one, while the previous as
|
||||
! the fine one. This is in agreement with the fact that the routine is called,
|
||||
! by amg_mlprec_bld, only on levels >=2.
|
||||
! The coarse-level matrix A_C is built from a fine-level matrix A
|
||||
! by using the Galerkin approach, i.e.
|
||||
!
|
||||
! A_C = P_C^T A P_C,
|
||||
!
|
||||
! where P_C is a prolongator from the coarse level to the fine one.
|
||||
!
|
||||
! A mapping from the nodes of the adjacency graph of A to the nodes of the
|
||||
! adjacency graph of A_C has been computed by the amg_aggrmap_bld subroutine.
|
||||
! The prolongator P_C is built here from this mapping, according to the
|
||||
! value of p%iprcparm(amg_aggr_kind_), specified by the user through
|
||||
! amg_dprecinit and amg_zprecset.
|
||||
! On output from this routine the entries of AC, op_prol, op_restr
|
||||
! are still in "global numbering" mode; this is fixed in the calling routine
|
||||
! amg_d_lev_aggrmat_bld.
|
||||
!
|
||||
! Currently four different prolongators are implemented, corresponding to
|
||||
! four aggregation algorithms:
|
||||
! 1. un-smoothed aggregation,
|
||||
! 2. smoothed aggregation,
|
||||
! 3. "bizarre" aggregation.
|
||||
! 4. minimum energy
|
||||
! 1. The non-smoothed aggregation uses as prolongator the piecewise constant
|
||||
! interpolation operator corresponding to the fine-to-coarse level mapping built
|
||||
! by p%aggr%bld_tprol. This is called tentative prolongator.
|
||||
! 2. The smoothed aggregation uses as prolongator the operator obtained by applying
|
||||
! a damped Jacobi smoother to the tentative prolongator.
|
||||
! 3. The "bizarre" aggregation uses a prolongator proposed by the authors of MLD2P4.
|
||||
! This prolongator still requires a deep analysis and testing and its use is
|
||||
! not recommended.
|
||||
! 4. Minimum energy aggregation
|
||||
!
|
||||
! For more details see
|
||||
! M. Brezina and P. Vanek, A black-box iterative solver based on a two-level
|
||||
! Schwarz method, Computing, 63 (1999), 233-263.
|
||||
! P. D'Ambra, D. di Serafino and S. Filippone, On the development of PSBLAS-based
|
||||
! parallel two-level Schwarz preconditioners, Appl. Num. Math., 57 (2007),
|
||||
! 1181-1196.
|
||||
! M. Sala, R. Tuminaro: A new Petrov-Galerkin smoothed aggregation preconditioner
|
||||
! for nonsymmetric linear systems, SIAM J. Sci. Comput., 31(1):143-166 (2008)
|
||||
!
|
||||
!
|
||||
! The main structure is:
|
||||
! 1. Perform sanity checks;
|
||||
! 2. Compute prolongator/restrictor/AC
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
! ag - type(amg_d_base_aggregator_type), input/output.
|
||||
! The aggregator object
|
||||
! parms - type(amg_dml_parms), input
|
||||
! The aggregation parameters
|
||||
! a - type(psb_dspmat_type), input.
|
||||
! The sparse matrix structure containing the local part of
|
||||
! the fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of the fine-level matrix.
|
||||
! The 'one-level' data structure that will contain the local
|
||||
! part of the matrix to be built as well as the information
|
||||
! concerning the prolongator and its transpose.
|
||||
! ilaggr - integer, dimension(:), input
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
! ilaggr(i)=j means that node i in the adjacency graph
|
||||
! of the fine-level matrix is mapped onto node j in the
|
||||
! adjacency graph of the coarse-level matrix. Note that the indices
|
||||
! are assumed to be shifted so as to make sure the ranges on
|
||||
! the various processes do not overlap.
|
||||
! nlaggr - integer, dimension(:) input
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! ac - type(psb_dspmat_type), output
|
||||
! The coarse matrix on output
|
||||
!
|
||||
! op_prol - type(psb_dspmat_type), input/output
|
||||
! The tentative prolongator on input, the computed prolongator on output
|
||||
!
|
||||
! op_restr - type(psb_dspmat_type), output
|
||||
! The restrictor operator; normally, it is the transpose of the prolongator.
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine amg_d_newmatch_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
|
||||
& ac,desc_ac,op_prol,op_restr,t_prol,info)
|
||||
use psb_base_mod
|
||||
use amg_d_inner_mod
|
||||
use amg_d_prec_type, amg_protect_name => amg_d_newmatch_aggregator_mat_bld
|
||||
!use amg_d_newmatch_aggregator_mod, amg_protect_name => amg_d_newmatch_aggregator_mat_bld
|
||||
implicit none
|
||||
|
||||
class(amg_d_newmatch_aggregator_type), target, intent(inout) :: ag
|
||||
type(amg_dml_parms), intent(inout) :: parms
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(inout) :: desc_a
|
||||
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
|
||||
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
|
||||
|
||||
! Local variables
|
||||
character(len=20) :: name
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_mpk_) :: np, me
|
||||
type(psb_ld_coo_sparse_mat) :: acoo, bcoo
|
||||
type(psb_ld_csr_sparse_mat) :: acsr1
|
||||
integer(psb_lpk_) :: nzl,ntaggr
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
|
||||
name='amg_d_newmatch_aggregator_mat_bld'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
info = psb_success_
|
||||
ctxt = desc_a%get_context()
|
||||
call psb_info(ctxt,me,np)
|
||||
|
||||
!
|
||||
! Build the coarse-level matrix from the fine-level one, starting from
|
||||
! the mapping defined by amg_aggrmap_bld and applying the aggregation
|
||||
! algorithm specified by
|
||||
!
|
||||
select case (parms%aggr_prol)
|
||||
case (amg_no_smooth_)
|
||||
|
||||
!!$ call amg_d_newmatch_unsmth_spmm_bld(a,desc_a,ilaggr,nlaggr,&
|
||||
!!$ & parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
|
||||
call amg_daggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr, &
|
||||
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
|
||||
|
||||
|
||||
case(amg_smooth_prol_)
|
||||
|
||||
call amg_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr, &
|
||||
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
|
||||
|
||||
!!$ case(amg_biz_prol_)
|
||||
!!$
|
||||
!!$ call amg_daggrmat_biz_bld(a,desc_a,ilaggr,nlaggr, &
|
||||
!!$ & parms,ac,desc_ac,op_prol,op_restr,info)
|
||||
|
||||
case(amg_min_energy_)
|
||||
|
||||
call amg_daggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr, &
|
||||
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
|
||||
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Invalid aggr kind')
|
||||
goto 9999
|
||||
|
||||
end select
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='Inner aggrmat bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_d_newmatch_aggregator_mat_bld
|
||||
@@ -0,0 +1,448 @@
|
||||
!
|
||||
!
|
||||
! File: amg_d_newmatch_aggregator_tprol.f90
|
||||
!
|
||||
! Subroutine: amg_d_newmatch_aggregator_tprol
|
||||
! Version: real
|
||||
!
|
||||
!
|
||||
|
||||
subroutine amg_d_newmatch_aggregator_build_tprol(ag,parms,ag_data,&
|
||||
& a,desc_a,ilaggr,nlaggr,t_prol,info)
|
||||
use psb_base_mod
|
||||
use amg_base_prec_type
|
||||
use amg_d_inner_mod
|
||||
use amg_d_decmatch_mod
|
||||
#if defined(SERIAL_MPI)
|
||||
use amg_d_newmatch_aggregator_mod
|
||||
#else
|
||||
use amg_d_newmatch_aggregator_mod, amg_protect_name => amg_d_newmatch_aggregator_build_tprol
|
||||
#endif
|
||||
use iso_c_binding
|
||||
implicit none
|
||||
class(amg_d_newmatch_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(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
|
||||
|
||||
|
||||
! Local variables
|
||||
real(psb_dpk_), allocatable :: tmpw(:), tmpwnxt(:)
|
||||
integer(psb_lpk_), allocatable :: ixaggr(:), nxaggr(:), tlaggr(:), ivr(:)
|
||||
type(psb_dspmat_type) :: a_tmp
|
||||
type(nwm_CSRMatrix) :: C, P
|
||||
integer(c_int) :: match_algorithm, n_sweeps, max_csize, max_nlevels
|
||||
character(len=40) :: name, ch_err
|
||||
character(len=80) :: fname, prefix_
|
||||
type(psb_ctxt_type) :: ictxt
|
||||
integer(psb_ipk_) :: np, me
|
||||
integer(psb_ipk_) :: err_act, ierr
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
integer(psb_ipk_) :: i, j, k, nr, nc
|
||||
integer(psb_lpk_) :: isz, num_pcols, nrac, ncac, lname, nz, x_sweeps, csz
|
||||
integer(psb_lpk_) :: psz, sizes(4)
|
||||
type(psb_d_csr_sparse_mat), target :: csr_prol, csr_pvi, csr_prod_res, acsr
|
||||
type(psb_ld_csr_sparse_mat), target :: lcsr_prol
|
||||
type(psb_desc_type), allocatable :: desc_acv(:)
|
||||
type(psb_ld_coo_sparse_mat) :: tmpcoo, transp_coo
|
||||
type(psb_dspmat_type), allocatable :: acv(:)
|
||||
type(psb_dspmat_type), allocatable :: prolv(:), restrv(:)
|
||||
type(psb_ldspmat_type) :: tmp_prol, tmp_pg, tmp_restr
|
||||
type(psb_desc_type) :: tmp_desc_ac, tmp_desc_ax, tmp_desc_p
|
||||
integer(psb_ipk_), save :: idx_mboxp=-1, idx_spmmbld=-1, idx_sweeps_mult=-1
|
||||
logical, parameter :: dump=.false., do_timings=.true., debug=.false., &
|
||||
& dump_prol_restr=.false.
|
||||
name='d_newmatch_tprol'
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
if (psb_get_errstatus().ne.0) then
|
||||
write(0,*) me,trim(name),' Err_status :',psb_get_errstatus()
|
||||
return
|
||||
end if
|
||||
if (debug) write(0,*) me,trim(name),' Start '
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
info = psb_success_
|
||||
|
||||
if ((do_timings).and.(idx_mboxp==-1)) &
|
||||
& idx_mboxp = psb_get_timer_idx("PMC_TPROL: MatchBoxP")
|
||||
if ((do_timings).and.(idx_spmmbld==-1)) &
|
||||
& idx_spmmbld = psb_get_timer_idx("PMC_TPROL: spmm_bld")
|
||||
if ((do_timings).and.(idx_sweeps_mult==-1)) &
|
||||
& idx_sweeps_mult = psb_get_timer_idx("PMC_TPROL: sweeps_mult")
|
||||
|
||||
|
||||
call amg_check_def(parms%ml_cycle,'Multilevel cycle',&
|
||||
& amg_mult_ml_,is_legal_ml_cycle)
|
||||
call amg_check_def(parms%par_aggr_alg,'Aggregation',&
|
||||
& amg_coupled_aggr_,is_legal_decoupled_par_aggr_alg)
|
||||
call amg_check_def(parms%aggr_ord,'Ordering',&
|
||||
& amg_aggr_ord_nat_,is_legal_ml_aggr_ord)
|
||||
call amg_check_def(parms%aggr_thresh,'Aggr_Thresh',dzero,is_legal_d_aggr_thrs)
|
||||
|
||||
#if !defined(SERIAL_MPI)
|
||||
|
||||
match_algorithm = ag%matching_alg
|
||||
n_sweeps = ag%n_sweeps
|
||||
if (2**n_sweeps /= ag%orig_aggr_size) then
|
||||
if (me == 0) then
|
||||
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
|
||||
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
|
||||
end if
|
||||
if (.true.) then
|
||||
block
|
||||
integer(psb_ipk_) :: ipv(2)
|
||||
ipv(1) = max_csize
|
||||
ipv(2) = n_sweeps
|
||||
call psb_bcast(ictxt,ipv)
|
||||
max_csize = ipv(1)
|
||||
n_sweeps = ipv(2)
|
||||
end block
|
||||
else
|
||||
call psb_bcast(ictxt,max_csize)
|
||||
call psb_bcast(ictxt,n_sweeps)
|
||||
end if
|
||||
if (n_sweeps /= ag%n_sweeps) then
|
||||
write(0,*) me,' Inconsistent N_SWEEPS ',n_sweeps,ag%n_sweeps
|
||||
end if
|
||||
n_sweeps = max(1,n_sweeps)
|
||||
|
||||
if (debug) write(0,*) me,' Copies, with n_sweeps: ',n_sweeps,max_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)
|
||||
nr = acsr%get_nrows()
|
||||
if (psb_size(ag%w) < nr) call ag%bld_default_w(nr)
|
||||
isz = acsr%get_ncols()
|
||||
|
||||
call psb_realloc(isz,ixaggr,info)
|
||||
if (info == psb_success_) &
|
||||
& allocate(acv(0:n_sweeps), desc_acv(0:n_sweeps),&
|
||||
& prolv(n_sweeps), restrv(n_sweeps),stat=info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='psb_realloc'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
|
||||
call acv(0)%mv_from(acsr)
|
||||
call ag%base_desc%clone(desc_acv(0),info)
|
||||
|
||||
else
|
||||
call a%cp_to(acsr)
|
||||
if (ag%do_clean_zeros) call acsr%clean_zeros(info)
|
||||
nr = acsr%get_nrows()
|
||||
if (psb_size(ag%w) < nr) call ag%bld_default_w(nr)
|
||||
isz = acsr%get_ncols()
|
||||
|
||||
call psb_realloc(isz,ixaggr,info)
|
||||
if (info == psb_success_) &
|
||||
& allocate(acv(0:n_sweeps), desc_acv(0:n_sweeps),&
|
||||
& prolv(n_sweeps), restrv(n_sweeps),stat=info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='psb_realloc'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
|
||||
call acv(0)%mv_from(acsr)
|
||||
call desc_a%clone(desc_acv(0),info)
|
||||
end if
|
||||
|
||||
nrac = desc_acv(0)%get_local_rows()
|
||||
ncac = desc_acv(0)%get_local_cols()
|
||||
if (debug) write(0,*) me,' On input to level: ',nrac, ncac
|
||||
if (allocated(ag%prol)) then
|
||||
call ag%prol%free()
|
||||
deallocate(ag%prol)
|
||||
end if
|
||||
if (allocated(ag%restr)) then
|
||||
call ag%restr%free()
|
||||
deallocate(ag%restr)
|
||||
end if
|
||||
|
||||
if (dump) then
|
||||
block
|
||||
type(psb_ldspmat_type) :: lac
|
||||
ivr = desc_acv(0)%get_global_indices(owned=.false.)
|
||||
prefix_ = "input_a"
|
||||
lname = len_trim(prefix_)
|
||||
fname = trim(prefix_)
|
||||
write(fname(lname+1:lname+9),'(a,i3.3,a)') '_p',me, '.mtx'
|
||||
call acv(0)%print(fname,head='Debug aggregates')
|
||||
call lac%cp_from(acv(0))
|
||||
write(fname(lname+1:lname+13),'(a,i3.3,a)') '_p',me, '-glb.mtx'
|
||||
call lac%print(fname,head='Debug aggregates',iv=ivr)
|
||||
call lac%free()
|
||||
end block
|
||||
end if
|
||||
|
||||
call psb_geall(tmpw,desc_acv(0),info)
|
||||
|
||||
tmpw(1:nr) = ag%w(1:nr)
|
||||
|
||||
call psb_geasb(tmpw,desc_acv(0),info)
|
||||
|
||||
if (debug) then
|
||||
call psb_barrier(ictxt)
|
||||
if (me == 0) write(0,*) 'N_sweeps ',n_sweeps,nr,desc_acv(0)%is_ok(),max_csize
|
||||
end if
|
||||
|
||||
!
|
||||
! Prepare ag%ac, ag%desc_ac, ag%prol, ag%restr to enable
|
||||
! shortcuts in mat_bld and mat_asb
|
||||
! and ag%desc_ax which will be needed in backfix.
|
||||
!
|
||||
x_sweeps = -1
|
||||
sweeps_loop: do i=1, n_sweeps
|
||||
if (debug) then
|
||||
call psb_barrier(ictxt)
|
||||
if (me==0) write(0,*) me,trim(name),' Start sweeps_loop iteration:',i,' of ',n_sweeps
|
||||
end if
|
||||
|
||||
!
|
||||
! Building prol and restr because this algorithm is not decoupled
|
||||
! On exit from matchbox_build_prol, prolv(i) is in global numbering
|
||||
!
|
||||
!
|
||||
if (debug) write(0,*) me,' Into matchbox_build_prol ',info
|
||||
if (do_timings) call psb_tic(idx_mboxp)
|
||||
call amg_ddecmatch_build_prol(tmpw,acv(i-1),desc_acv(i-1),ixaggr,nxaggr,tmp_prol,info,&
|
||||
& symmetrize=ag%need_symmetrize,reproducible=ag%reproducible_matching,&
|
||||
& parallel=ag%parallel_matching,matching=ag%matching_alg,lambda=ag%lambda)
|
||||
if (do_timings) call psb_toc(idx_mboxp)
|
||||
if (debug) write(0,*) me,' Out from matchbox_build_prol ',info
|
||||
if (psb_errstatus_fatal()) write(0,*)me,trim(name),'Error fatal on exit bld_tprol',info
|
||||
|
||||
|
||||
if (debug) then
|
||||
call psb_barrier(ictxt)
|
||||
!!$ write(0,*) name,' Call spmm_bld sweep:',i,n_sweeps
|
||||
if (me==0) write(0,*) me,trim(name),' Calling spmm_bld NSW>1:',i,&
|
||||
& desc_acv(i-1)%get_local_rows(),desc_acv(i-1)%get_local_cols(),&
|
||||
& desc_acv(i-1)%get_global_rows()
|
||||
end if
|
||||
if (i == n_sweeps) call tmp_prol%clone(tmp_pg,info)
|
||||
if (do_timings) call psb_tic(idx_spmmbld)
|
||||
!
|
||||
! On entry, prolv(i) is in global numbering,
|
||||
!
|
||||
call amg_d_newmatch_spmm_bld_ov(acv(i-1),desc_acv(i-1),ixaggr,nxaggr,parms,&
|
||||
& acv(i),desc_acv(i), prolv(i),restrv(1),tmp_prol,info)
|
||||
if (psb_errstatus_fatal()) write(0,*)me,trim(name),'Error fatal on exit from bld_ov(i)',info
|
||||
if (debug) then
|
||||
call psb_barrier(ictxt)
|
||||
if (me==0) write(0,*) me,trim(name),' Done spmm_bld:',i
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_toc(idx_spmmbld)
|
||||
! Keep a copy of prolv(i) in global numbering for the time being, will
|
||||
! need it to build the final
|
||||
! if (i == n_sweeps) call prolv(i)%clone(tmp_prol,info)
|
||||
call ag%inner_mat_asb(parms,acv(i-1),desc_acv(i-1),&
|
||||
& acv(i),desc_acv(i),prolv(i),restrv(1),info)
|
||||
|
||||
if (debug) then
|
||||
call psb_barrier(ictxt)
|
||||
if (me==0) write(0,*) me,trim(name),' Done mat_asb:',i,sum(nxaggr),max_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
|
||||
end if
|
||||
if (psb_errstatus_fatal()) write(0,*)me,trim(name),'Error fatal on entry to tmpwnxt 2'
|
||||
|
||||
|
||||
!
|
||||
! Fix wnxt
|
||||
!
|
||||
if (info == 0) call psb_geall(tmpwnxt,desc_acv(i),info)
|
||||
if (info == 0) call psb_geasb(tmpwnxt,desc_acv(i),info,scratch=.true.)
|
||||
if (info == 0) call psb_halo(tmpw,desc_acv(i-1),info)
|
||||
!!$ write(0,*) trestr%get_nrows(),size(tmpwnxt),trestr%get_ncols(),size(tmpw)
|
||||
|
||||
if (info == 0) call psb_csmm(done,restrv(1),tmpw,dzero,tmpwnxt,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
write(0,*)me,trim(name),'Error from mat_asb/tmpw ',info
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='mat_asb 2')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
if (i == 1) then
|
||||
nrac = desc_acv(1)%get_local_rows()
|
||||
!!$ write(0,*) 'Copying output w_nxt ',nrac
|
||||
call psb_realloc(nrac,ag%w_nxt,info)
|
||||
ag%w_nxt(1:nrac) = tmpwnxt(1:nrac)
|
||||
!
|
||||
! ILAGGR is fixed later on, but
|
||||
! get a copy in case of an early exit
|
||||
!
|
||||
call psb_safe_ab_cpy(ixaggr,ilaggr,info)
|
||||
end if
|
||||
call psb_safe_ab_cpy(nxaggr,nlaggr,info)
|
||||
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
|
||||
end if
|
||||
call acv(i-1)%free()
|
||||
if ((sum(nlaggr) <= max_csize).or.(any(nlaggr==0))) then
|
||||
x_sweeps = i
|
||||
exit sweeps_loop
|
||||
end if
|
||||
if (debug) then
|
||||
call psb_barrier(ictxt)
|
||||
if (me==0) write(0,*) me,trim(name),' Done sweeps_loop iteration:',i,' of ',n_sweeps
|
||||
end if
|
||||
|
||||
end do sweeps_loop
|
||||
|
||||
if (debug) then
|
||||
call psb_barrier(ictxt)
|
||||
if (me==0) write(0,*) me,trim(name),' Done sweeps_loop:',x_sweeps
|
||||
end if
|
||||
if (x_sweeps<=0) x_sweeps = n_sweeps
|
||||
|
||||
if (do_timings) call psb_tic(idx_sweeps_mult)
|
||||
!
|
||||
! Ok, now we have all the prolongators, including the last one in global numbering.
|
||||
! Build the product of all prolongators. Need a tmp_desc_ax
|
||||
! which is correct but most of the time overdimensioned
|
||||
!
|
||||
if (.not.allocated(ag%desc_ax)) allocate(ag%desc_ax)
|
||||
!
|
||||
block
|
||||
integer(psb_ipk_) :: i, nnz
|
||||
integer(psb_lpk_) :: ncol, ncsave
|
||||
if (.not.allocated(ag%ac)) allocate(ag%ac)
|
||||
if (.not.allocated(ag%desc_ac)) allocate(ag%desc_ac)
|
||||
call desc_acv(x_sweeps)%clone(ag%desc_ac,info)
|
||||
call desc_acv(x_sweeps)%free(info)
|
||||
call acv(x_sweeps)%move_alloc(ag%ac,info)
|
||||
if (.not.allocated(ag%prol)) allocate(ag%prol)
|
||||
if (.not.allocated(ag%restr)) allocate(ag%restr)
|
||||
|
||||
call psb_cd_reinit(ag%desc_ac,info)
|
||||
ncsave = ag%desc_ac%get_global_rows()
|
||||
!
|
||||
! Note: prolv(i) is already in local numbering
|
||||
! because of the call to mat_asb in the loop above.
|
||||
!
|
||||
call prolv(x_sweeps)%mv_to(csr_prol)
|
||||
if (debug) then
|
||||
call psb_barrier(ictxt)
|
||||
if (me == 0) write(0,*) 'Enter prolongator product loop ',x_sweeps
|
||||
end if
|
||||
|
||||
do i=x_sweeps-1, 1, -1
|
||||
call prolv(i)%mv_to(csr_pvi)
|
||||
if (psb_errstatus_fatal()) write(0,*) me,' Fatal error in prolongator loop 1'
|
||||
call psb_par_spspmm(csr_pvi,desc_acv(i),csr_prol,csr_prod_res,ag%desc_ac,info)
|
||||
if ((info /=0).or.psb_errstatus_fatal()) write(0,*) me,' Fatal error in prolongator loop 2',info
|
||||
call csr_pvi%free()
|
||||
call csr_prod_res%mv_to_fmt(csr_prol,info)
|
||||
if ((info /=0).or.psb_errstatus_fatal()) write(0,*) me,' Fatal error in prolongator loop 3',info
|
||||
call csr_prol%set_ncols(ag%desc_ac%get_local_cols())
|
||||
if ((info /=0).or.psb_errstatus_fatal()) write(0,*) me,' Fatal error in prolongator loop 4'
|
||||
end do
|
||||
call csr_prol%mv_to_lfmt(lcsr_prol,info)
|
||||
nnz = lcsr_prol%get_nzeros()
|
||||
call ag%desc_ac%l2gip(lcsr_prol%ja(1:nnz),info)
|
||||
call lcsr_prol%set_ncols(ncsave)
|
||||
if (debug) then
|
||||
call psb_barrier(ictxt)
|
||||
if (me == 0) write(0,*) 'Done prolongator product loop ',x_sweeps
|
||||
end if
|
||||
!
|
||||
! Fix ILAGGR here by copying from CSR_PROL%JA
|
||||
!
|
||||
block
|
||||
integer(psb_ipk_) :: nr
|
||||
nr = lcsr_prol%get_nrows()
|
||||
if (nnz /= nr) then
|
||||
write(0,*) me,name,' Issue with prolongator? ',nr,nnz
|
||||
end if
|
||||
call psb_realloc(nr,ilaggr,info)
|
||||
ilaggr(1:nnz) = lcsr_prol%ja(1:nnz)
|
||||
end block
|
||||
call tmp_prol%mv_from(lcsr_prol)
|
||||
call psb_cdasb(ag%desc_ac,info)
|
||||
call ag%ac%set_ncols(ag%desc_ac%get_local_cols())
|
||||
end block
|
||||
|
||||
call tmp_prol%move_alloc(t_prol,info)
|
||||
call t_prol%set_ncols(ag%desc_ac%get_local_cols())
|
||||
call t_prol%set_nrows(desc_acv(0)%get_local_rows())
|
||||
|
||||
nrac = ag%desc_ac%get_local_rows()
|
||||
ncac = ag%desc_ac%get_local_cols()
|
||||
call psb_realloc(nrac,ag%w_nxt,info)
|
||||
ag%w_nxt(1:nrac) = tmpw(1:nrac)
|
||||
|
||||
|
||||
if (do_timings) call psb_toc(idx_sweeps_mult)
|
||||
|
||||
if (debug) then
|
||||
call psb_barrier(ictxt)
|
||||
if (me == 0) write(0,*) 'Out of build loop ',x_sweeps,': Output size:',sum(nlaggr)
|
||||
end if
|
||||
|
||||
|
||||
!call psb_set_debug_level(0)
|
||||
if (dump) then
|
||||
block
|
||||
ivr = desc_acv(x_sweeps)%get_global_indices(owned=.false.)
|
||||
prefix_ = "final_ac"
|
||||
lname = len_trim(prefix_)
|
||||
fname = trim(prefix_)
|
||||
write(fname(lname+1:lname+9),'(a,i3.3,a)') '_p',me, '.mtx'
|
||||
call acv(x_sweeps)%print(fname,head='Debug aggregates')
|
||||
write(fname(lname+1:lname+13),'(a,i3.3,a)') '_p',me, '-glb.mtx'
|
||||
call acv(x_sweeps)%print(fname,head='Debug aggregates',iv=ivr)
|
||||
prefix_ = "final_tp"
|
||||
lname = len_trim(prefix_)
|
||||
fname = trim(prefix_)
|
||||
write(fname(lname+1:lname+9),'(a,i3.3,a)') '_p',me, '.mtx'
|
||||
call t_prol%print(fname,head='Tentative prolongator')
|
||||
end block
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_bootCMatch_if')
|
||||
goto 9999
|
||||
end if
|
||||
#endif
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_d_newmatch_aggregator_build_tprol
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
!
|
||||
!
|
||||
! File: amg_d_newmatch_map_to_tprol.f90
|
||||
!
|
||||
! Subroutine: amg_d_newmatch_map_to_tprol
|
||||
! Version: real
|
||||
!
|
||||
! This routine uses a mapping from the row indices of the fine-level matrix
|
||||
! to the row indices of the coarse-level matrix to build a tentative
|
||||
! prolongator, i.e. a piecewise constant operator.
|
||||
! This is later used to build the final operator; the code has been refactored here
|
||||
! to be shared among all the methods that provide the tentative prolongator
|
||||
! through a simple integer mapping.
|
||||
!
|
||||
! The aggregation algorithm is a parallel version of that described in
|
||||
! * M. Brezina and P. Vanek, A black-box iterative solver based on a
|
||||
! two-level Schwarz method, Computing, 63 (1999), 233-263.
|
||||
! * P. Vanek, J. Mandel and M. Brezina, Algebraic Multigrid by Smoothed
|
||||
! Aggregation for Second and Fourth Order Elliptic Problems, Computing, 56
|
||||
! (1996), 179-196.
|
||||
! For more details see
|
||||
! P. D'Ambra, D. di Serafino and S. Filippone, On the development of
|
||||
! PSBLAS-based parallel two-level Schwarz preconditioners, Appl. Num. Math.
|
||||
! 57 (2007), 1181-1196.
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
! aggr_type - integer, input.
|
||||
! The scalar used to identify the aggregation algorithm.
|
||||
! theta - real, input.
|
||||
! The aggregation threshold used in the aggregation algorithm.
|
||||
! a - type(psb_dspmat_type), input.
|
||||
! The sparse matrix structure containing the local part of
|
||||
! the fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of the fine-level matrix.
|
||||
! ilaggr - integer, dimension(:), allocatable.
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
! ilaggr(i)=j means that node i in the adjacency graph
|
||||
! of the fine-level matrix is mapped onto node j in the
|
||||
! adjacency graph of the coarse-level matrix. Note that on exit the indices
|
||||
! will be shifted so as to make sure the ranges on the various processes do not
|
||||
! overlap.
|
||||
! nlaggr - integer, dimension(:), allocatable.
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! op_prol - type(psb_dspmat_type).
|
||||
! The tentative prolongator, based on ilaggr.
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine amg_d_newmatch_map_to_tprol(desc_a,ilaggr,nlaggr,valaggr, op_prol,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_inner_mod!, amg_protect_name => amg_d_newmatch_map_to_tprol
|
||||
use amg_d_newmatch_aggregator_mod, amg_protect_name => amg_d_newmatch_map_to_tprol
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_lpk_), allocatable, intent(inout) :: ilaggr(:),nlaggr(:)
|
||||
real(psb_dpk_), allocatable, intent(inout) :: valaggr(:)
|
||||
type(psb_ldspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_lpk_) :: icnt,nlp,k,n,ia,isz,nr, naggr,i,j,m,naggrm1, naggrp1, ntaggr
|
||||
type(psb_ld_coo_sparse_mat) :: tmpcoo
|
||||
integer(psb_ipk_) :: debug_level, debug_unit,err_act
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me
|
||||
integer(psb_lpk_) :: nrow, ncol, n_ne
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'amg_d_newmatch_map_to_tprol'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
!
|
||||
ctxt=desc_a%get_context()
|
||||
call psb_info(ctxt,me,np)
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1 = sum(nlaggr(1:me))
|
||||
naggrp1 = sum(nlaggr(1:me+1))
|
||||
ilaggr(1:nrow) = ilaggr(1:nrow) + naggrm1
|
||||
call psb_halo(ilaggr,desc_a,info)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_halo')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_halo(valaggr,desc_a,info)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_halo')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call tmpcoo%allocate(ncol,ntaggr,ncol)
|
||||
j = 0
|
||||
do i=1,ncol
|
||||
if (valaggr(i) /= dzero) then
|
||||
j = j + 1
|
||||
tmpcoo%val(j) = valaggr(i)
|
||||
tmpcoo%ia(j) = i
|
||||
tmpcoo%ja(j) = ilaggr(i)
|
||||
end if
|
||||
end do
|
||||
call tmpcoo%set_nzeros(j)
|
||||
call tmpcoo%set_dupl(psb_dupl_add_)
|
||||
call tmpcoo%set_sorted() ! At this point this is in row-major
|
||||
call op_prol%mv_from(tmpcoo)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine amg_d_newmatch_map_to_tprol
|
||||
@@ -0,0 +1,218 @@
|
||||
!
|
||||
!
|
||||
! 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
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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_daggrmat_nosmth_bld.F90
|
||||
!
|
||||
! Subroutine: amg_daggrmat_nosmth_bld
|
||||
! Version: real
|
||||
!
|
||||
! This routine builds a coarse-level matrix A_C from a fine-level matrix A
|
||||
! by using the Galerkin approach, i.e.
|
||||
!
|
||||
! A_C = P_C^T A P_C,
|
||||
!
|
||||
! where P_C is the piecewise constant interpolation operator corresponding
|
||||
! the fine-to-coarse level mapping built by amg_aggrmap_bld.
|
||||
!
|
||||
! The coarse-level matrix A_C is distributed among the parallel processes or
|
||||
! replicated on each of them, according to the value of p%parms%coarse_mat
|
||||
! specified by the user through amg_dprecinit and amg_zprecset.
|
||||
! On output from this routine the entries of AC, op_prol, op_restr
|
||||
! are still in "global numbering" mode; this is fixed in the calling routine
|
||||
!
|
||||
! For details see
|
||||
! P. D'Ambra, D. di Serafino and S. Filippone, On the development of
|
||||
! PSBLAS-based parallel two-level Schwarz preconditioners, Appl. Num. Math.,
|
||||
! 57 (2007), 1181-1196.
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
! a - type(psb_dspmat_type), input.
|
||||
! The sparse matrix structure containing the local part of
|
||||
! the fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of the fine-level matrix.
|
||||
! p - type(amg_d_onelev_type), input/output.
|
||||
! The 'one-level' data structure that will contain the local
|
||||
! part of the matrix to be built as well as the information
|
||||
! concerning the prolongator and its transpose.
|
||||
! parms - type(amg_dml_parms), input
|
||||
! Parameters controlling the choice of algorithm
|
||||
! ac - type(psb_dspmat_type), output
|
||||
! The coarse matrix on output
|
||||
!
|
||||
! ilaggr - integer, dimension(:), input
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
! ilaggr(i)=j means that node i in the adjacency graph
|
||||
! of the fine-level matrix is mapped onto node j in the
|
||||
! adjacency graph of the coarse-level matrix. Note that the indices
|
||||
! are assumed to be shifted so as to make sure the ranges on
|
||||
! the various processes do not overlap.
|
||||
! nlaggr - integer, dimension(:) input
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! op_prol - type(psb_dspmat_type), input/output
|
||||
! The tentative prolongator on input, the computed prolongator on output
|
||||
!
|
||||
! op_restr - type(psb_dspmat_type), output
|
||||
! The restrictor operator; normally, it is the transpose of the prolongator.
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_newmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,&
|
||||
& ac,desc_ac,op_prol,op_restr,t_prol,info)
|
||||
use psb_base_mod
|
||||
use amg_d_inner_mod
|
||||
#if defined(SERIAL_MPI)
|
||||
use amg_d_newmatch_aggregator_mod
|
||||
#else
|
||||
use amg_d_newmatch_aggregator_mod, amg_protect_name => amg_d_newmatch_spmm_bld_inner
|
||||
#endif
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
type(psb_d_csr_sparse_mat), intent(inout) :: a_csr
|
||||
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(inout) :: ac, op_prol, op_restr
|
||||
type(psb_desc_type), intent(out) :: desc_ac
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
type(psb_ctxt_type) :: ictxt
|
||||
integer(psb_ipk_) :: np, me, ndx
|
||||
character(len=40) :: name
|
||||
type(psb_ld_coo_sparse_mat) :: tmpcoo
|
||||
type(psb_d_coo_sparse_mat) :: coo_prol, coo_restr
|
||||
type(psb_d_csr_sparse_mat) :: ac_csr, csr_restr
|
||||
type(psb_desc_type), target :: tmp_desc
|
||||
type(psb_ldspmat_type) :: lac
|
||||
integer(psb_ipk_) :: debug_level, debug_unit, naggr
|
||||
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, nrl, nzl, ip, &
|
||||
& nzt, naggrm1, naggrp1, i, k
|
||||
integer(psb_lpk_), allocatable :: ia(:),ja(:)
|
||||
!integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza, nrpsave, ncpsave, nzpsave
|
||||
logical, parameter :: do_timings=.true., oldstyle=.false., debug=.false.
|
||||
integer(psb_ipk_), save :: idx_spspmm=-1, idx_prolcnv=-1, idx_proltrans=-1, idx_asb=-1
|
||||
|
||||
name='amg_newmatch_spmm_bld_inner'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt, me, np)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
nglob = desc_a%get_global_rows()
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
if ((do_timings).and.(idx_spspmm==-1)) &
|
||||
& idx_spspmm = psb_get_timer_idx("SPMM_BLD: spspmm ")
|
||||
if ((do_timings).and.(idx_prolcnv==-1)) &
|
||||
& idx_prolcnv = psb_get_timer_idx("SPMM_BLD: prolcnv ")
|
||||
if ((do_timings).and.(idx_proltrans==-1)) &
|
||||
& idx_proltrans = psb_get_timer_idx("SPMM_BLD: proltrans")
|
||||
if ((do_timings).and.(idx_asb==-1)) &
|
||||
& idx_asb = psb_get_timer_idx("SPMM_BLD: asb ")
|
||||
|
||||
if (do_timings) call psb_tic(idx_prolcnv)
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1 = sum(nlaggr(1:me))
|
||||
naggrp1 = sum(nlaggr(1:me+1))
|
||||
|
||||
#if !defined(SERIAL_MPI)
|
||||
!
|
||||
! Here T_PROL should be arriving with GLOBAL indices on the cols
|
||||
! and LOCAL indices on the rows.
|
||||
!
|
||||
if (debug) write(0,*) me,' ',trim(name),' Size check on entry New: ',&
|
||||
& op_prol%get_fmt(),op_prol%get_nrows(),op_prol%get_ncols(),op_prol%get_nzeros(),&
|
||||
& nrow,ntaggr,naggr
|
||||
|
||||
call t_prol%cp_to(tmpcoo)
|
||||
|
||||
call psb_cdall(ictxt,desc_ac,info,nl=naggr)
|
||||
nzl = tmpcoo%get_nzeros()
|
||||
if (debug) write(0,*) me,' ',trim(name),' coo_prol: ',&
|
||||
& tmpcoo%ia(1:min(10,nzl)),' :',tmpcoo%ja(1:min(10,nzl))
|
||||
call desc_ac%indxmap%g2lip_ins(tmpcoo%ja(1:nzl),info)
|
||||
call tmpcoo%set_ncols(desc_ac%get_local_cols())
|
||||
call tmpcoo%cp_to_icoo(coo_prol,info)
|
||||
|
||||
call amg_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
& coo_prol,desc_ac,coo_restr,info)
|
||||
|
||||
nzl = coo_prol%get_nzeros()
|
||||
if (debug) write(0,*) me,' ',trim(name),' coo_prol: ',&
|
||||
& coo_prol%ia(1:min(10,nzl)),' :',coo_prol%ja(1:min(10,nzl))
|
||||
|
||||
call op_prol%mv_from(coo_prol)
|
||||
call op_restr%mv_from(coo_restr)
|
||||
|
||||
if (debug) then
|
||||
write(0,*) me,' ',trim(name),' Checkpoint at exit'
|
||||
call psb_barrier(ictxt)
|
||||
write(0,*) me,' ',trim(name),' Checkpoint through'
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_internal_error_,name,a_err='Build ac = op_restr x a3')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),&
|
||||
& 'Done smooth_aggregate '
|
||||
#endif
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine amg_d_newmatch_spmm_bld_inner
|
||||
@@ -0,0 +1,169 @@
|
||||
!
|
||||
!
|
||||
! 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
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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_daggrmat_nosmth_bld_ov.F90
|
||||
!
|
||||
! Subroutine: amg_daggrmat_nosmth_bld_ov
|
||||
! Version: real
|
||||
!
|
||||
! This routine builds a coarse-level matrix A_C from a fine-level matrix A
|
||||
! by using the Galerkin approach, i.e.
|
||||
!
|
||||
! A_C = P_C^T A P_C,
|
||||
!
|
||||
! where P_C is the piecewise constant interpolation operator corresponding
|
||||
! the fine-to-coarse level mapping built by amg_aggrmap_bld_ov.
|
||||
!
|
||||
! The coarse-level matrix A_C is distributed among the parallel processes or
|
||||
! replicated on each of them, according to the value of p%parms%coarse_mat
|
||||
! specified by the user through amg_dprecinit and amg_zprecset.
|
||||
! On output from this routine the entries of AC, op_prol, op_restr
|
||||
! are still in "global numbering" mode; this is fixed in the calling routine
|
||||
!
|
||||
! For details see
|
||||
! P. D'Ambra, D. di Serafino and S. Filippone, On the development of
|
||||
! PSBLAS-based parallel two-level Schwarz preconditioners, Appl. Num. Math.,
|
||||
! 57 (2007), 1181-1196.
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
! a - type(psb_dspmat_type), input.
|
||||
! The sparse matrix structure containing the local part of
|
||||
! the fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of the fine-level matrix.
|
||||
! p - type(amg_d_onelev_type), input/output.
|
||||
! The 'one-level' data structure that will contain the local
|
||||
! part of the matrix to be built as well as the information
|
||||
! concerning the prolongator and its transpose.
|
||||
! parms - type(amg_dml_parms), input
|
||||
! Parameters controlling the choice of algorithm
|
||||
! ac - type(psb_dspmat_type), output
|
||||
! The coarse matrix on output
|
||||
!
|
||||
! ilaggr - integer, dimension(:), input
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
! ilaggr(i)=j means that node i in the adjacency graph
|
||||
! of the fine-level matrix is mapped onto node j in the
|
||||
! adjacency graph of the coarse-level matrix. Note that the indices
|
||||
! are assumed to be shifted so as to make sure the ranges on
|
||||
! the various processes do not overlap.
|
||||
! nlaggr - integer, dimension(:) input
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! op_prol - type(psb_dspmat_type), input/output
|
||||
! The tentative prolongator on input, the computed prolongator on output
|
||||
!
|
||||
! op_restr - type(psb_dspmat_type), output
|
||||
! The restrictor operator; normally, it is the transpose of the prolongator.
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_newmatch_spmm_bld_ov(a,desc_a,ilaggr,nlaggr,parms,&
|
||||
& ac,desc_ac,op_prol,op_restr,t_prol,info)
|
||||
use psb_base_mod
|
||||
use amg_d_inner_mod
|
||||
#if defined(SERIAL_MPI)
|
||||
use amg_d_newmatch_aggregator_mod
|
||||
#else
|
||||
use amg_d_newmatch_aggregator_mod, amg_protect_name => amg_d_newmatch_spmm_bld_ov
|
||||
#endif
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
type(psb_dspmat_type), intent(inout) :: 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(inout) :: ac, op_prol, op_restr
|
||||
type(psb_desc_type), intent(out) :: desc_ac
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
type(psb_ctxt_type) :: ictxt
|
||||
integer(psb_ipk_) :: np, me
|
||||
character(len=20) :: name
|
||||
type(psb_d_csr_sparse_mat) :: acsr
|
||||
type(psb_ld_coo_sparse_mat) :: coo_prol, coo_restr
|
||||
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
|
||||
& naggr, nzt, naggrm1, naggrp1, i, k
|
||||
integer(psb_ipk_) :: inaggr, nzlp
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
logical, parameter :: debug=.false., new_version=.true.
|
||||
|
||||
name='amg_newmatch_spmm_bld_ov'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt, me, np)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
#if !defined(SERIAL_MPI)
|
||||
|
||||
call a%mv_to(acsr)
|
||||
|
||||
call amg_d_newmatch_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,&
|
||||
& ac,desc_ac,op_prol,op_restr,t_prol,info)
|
||||
if (psb_errstatus_fatal()) write(0,*)me,trim(name),'Error fatal on exit from bld_inner',info
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err="SPMM_BLD_INNER")
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),&
|
||||
& 'Done spmm_bld '
|
||||
#endif
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine amg_d_newmatch_spmm_bld_ov
|
||||
@@ -76,7 +76,7 @@ subroutine amg_d_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
integer(psb_ipk_) :: nrow, ncol, nrl, nzl, ip, nzt, i, k
|
||||
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
|
||||
logical, parameter :: do_timings=.false., oldstyle=.false., debug=.false.
|
||||
integer(psb_ipk_), save :: idx_spspmm=-1, idx_cpytrans1=-1, idx_cpytrans2=-1
|
||||
integer(psb_ipk_), save :: idx_spspmm=-1
|
||||
|
||||
name='amg_ptap_bld'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
@@ -93,11 +93,7 @@ subroutine amg_d_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
if ((do_timings).and.(idx_spspmm==-1)) &
|
||||
& idx_spspmm = psb_get_timer_idx("PTAP_BLD: par_spspmm")
|
||||
if ((do_timings).and.(idx_cpytrans1==-1)) &
|
||||
& idx_cpytrans1 = psb_get_timer_idx("PTAP_BLD: cpy&trans1")
|
||||
if ((do_timings).and.(idx_cpytrans2==-1)) &
|
||||
& idx_cpytrans2 = psb_get_timer_idx("PTAP_BLD: cpy&trans2")
|
||||
& idx_spspmm = psb_get_timer_idx("SPMM_BLD: par_spspmm")
|
||||
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
@@ -132,7 +128,6 @@ subroutine amg_d_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
! Ok first product done.
|
||||
|
||||
if (present(desc_ax)) then
|
||||
if (do_timings) call psb_tic(idx_cpytrans1)
|
||||
block
|
||||
call coo_prol%cp_to_coo(coo_restr,info)
|
||||
call coo_restr%set_ncols(desc_ac%get_local_cols())
|
||||
@@ -142,7 +137,7 @@ subroutine amg_d_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
call coo_restr%set_ncols(desc_ax%get_local_cols())
|
||||
end block
|
||||
call csr_restr%cp_from_coo(coo_restr,info)
|
||||
if (do_timings) call psb_toc(idx_cpytrans1)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv coo_restr')
|
||||
goto 9999
|
||||
@@ -172,28 +167,27 @@ subroutine amg_d_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
|
||||
call coo_restr%transp()
|
||||
nzl = coo_restr%get_nzeros()
|
||||
nrl = desc_ac%get_local_rows()
|
||||
call coo_restr%fix(info)
|
||||
i=coo_restr%get_nzeros()
|
||||
nrl = desc_ac%get_local_rows()
|
||||
i=0
|
||||
!
|
||||
! Only keep local rows
|
||||
!
|
||||
search: do k=i,1,-1
|
||||
if (coo_restr%ia(k) <= nrl) then
|
||||
call coo_restr%set_nzeros(k)
|
||||
exit search
|
||||
do k=1, nzl
|
||||
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) then
|
||||
i = i+1
|
||||
coo_restr%val(i) = coo_restr%val(k)
|
||||
coo_restr%ia(i) = coo_restr%ia(k)
|
||||
coo_restr%ja(i) = coo_restr%ja(k)
|
||||
end if
|
||||
end do search
|
||||
|
||||
end do
|
||||
call coo_restr%set_nzeros(i)
|
||||
call coo_restr%fix(info)
|
||||
nzl = coo_restr%get_nzeros()
|
||||
call coo_restr%set_nrows(desc_ac%get_local_rows())
|
||||
call coo_restr%set_ncols(desc_a%get_local_cols())
|
||||
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
|
||||
if (do_timings) call psb_tic(idx_cpytrans2)
|
||||
|
||||
call csr_restr%cp_from_coo(coo_restr,info)
|
||||
|
||||
if (do_timings) call psb_toc(idx_cpytrans2)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv coo_restr')
|
||||
goto 9999
|
||||
|
||||
+21
-218
@@ -72,9 +72,7 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
use psb_base_mod
|
||||
use amg_base_prec_type
|
||||
use amg_d_inner_mod
|
||||
#if defined(OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
@@ -87,7 +85,7 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_), allocatable :: neigh(:), irow(:), icol(:),&
|
||||
integer(psb_ipk_), allocatable :: ils(:), neigh(:), irow(:), icol(:),&
|
||||
& ideg(:), idxs(:)
|
||||
integer(psb_lpk_), allocatable :: tmpaggr(:)
|
||||
real(psb_dpk_), allocatable :: val(:), diag(:)
|
||||
@@ -101,9 +99,6 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
integer(psb_ipk_) :: nrow, ncol, n_ne
|
||||
integer(psb_lpk_) :: nrglob
|
||||
character(len=20) :: name, ch_err
|
||||
integer(psb_ipk_), save :: idx_soc1_p1=-1, idx_soc1_p2=-1, idx_soc1_p3=-1
|
||||
integer(psb_ipk_), save :: idx_soc1_p0=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_soc1_map_bld'
|
||||
@@ -119,14 +114,6 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
nrglob = desc_a%get_global_rows()
|
||||
if ((do_timings).and.(idx_soc1_p0==-1)) &
|
||||
& idx_soc1_p0 = psb_get_timer_idx("SOC1_MAP: phase0")
|
||||
if ((do_timings).and.(idx_soc1_p1==-1)) &
|
||||
& idx_soc1_p1 = psb_get_timer_idx("SOC1_MAP: phase1")
|
||||
if ((do_timings).and.(idx_soc1_p2==-1)) &
|
||||
& idx_soc1_p2 = psb_get_timer_idx("SOC1_MAP: phase2")
|
||||
if ((do_timings).and.(idx_soc1_p3==-1)) &
|
||||
& idx_soc1_p3 = psb_get_timer_idx("SOC1_MAP: phase3")
|
||||
|
||||
nr = a%get_nrows()
|
||||
nc = a%get_ncols()
|
||||
@@ -146,204 +133,41 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_tic(idx_soc1_p0)
|
||||
call a%cp_to(acsr)
|
||||
if (do_timings) call psb_toc(idx_soc1_p0)
|
||||
if (clean_zeros) call acsr%clean_zeros(info)
|
||||
if (iorder == amg_aggr_ord_nat_) then
|
||||
!$omp parallel do private(i) schedule(static)
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
idxs(i) = i
|
||||
idxs(i) = i
|
||||
end do
|
||||
!$omp end parallel do
|
||||
else
|
||||
!$omp parallel do private(i) schedule(static)
|
||||
else
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
ideg(i) = acsr%irp(i+1) - acsr%irp(i)
|
||||
end do
|
||||
!$omp end parallel do
|
||||
call psb_msort(ideg,ix=idxs,dir=psb_sort_down_)
|
||||
end if
|
||||
if (do_timings) call psb_tic(idx_soc1_p1)
|
||||
|
||||
|
||||
!
|
||||
! Phase one: Start with disjoint groups.
|
||||
!
|
||||
naggr = 0
|
||||
#if defined(OPENMP)
|
||||
block
|
||||
integer(psb_ipk_), allocatable :: bnds(:), locnaggr(:)
|
||||
integer(psb_ipk_) :: myth,nths, kk
|
||||
! The parallelization makes use of a locaggr(:) array; each thread
|
||||
! keeps its own version of naggr, and when the loop ends, a prefix is applied
|
||||
! to locnaggr to determine:
|
||||
! 1. The total number of aggregaters NAGGR;
|
||||
! 2. How much should each thread shift its own aggregates
|
||||
! Part 2 requires to keep track of which thread defined each entry
|
||||
! of ilaggr(), so that each entry can be adjusted correctly: even
|
||||
! if an entry I belongs to the range BNDS(TH)>BNDS(TH+1)-1, it may have
|
||||
! been set because it is strongly connected to an entry J belonging to a
|
||||
! different thread.
|
||||
|
||||
!$omp parallel shared(bnds,idxs,locnaggr,ilaggr,nr,naggr,diag,theta,nths,info) &
|
||||
!$omp private(icol,val,myth,kk)
|
||||
block
|
||||
integer(psb_ipk_) :: ii,nlp,k,kp,n,ia,isz, nc, i,j,m, nz, ilg, ip, rsz
|
||||
integer(psb_lpk_) :: itmp
|
||||
!$omp master
|
||||
nths = omp_get_num_threads()
|
||||
allocate(bnds(0:nths),locnaggr(0:nths+1))
|
||||
locnaggr(:) = 0
|
||||
bnds(0) = 1
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
myth = omp_get_thread_num()
|
||||
rsz = nr/nths
|
||||
if (myth < mod(nr,nths)) rsz = rsz + 1
|
||||
bnds(myth+1) = rsz
|
||||
!$omp barrier
|
||||
!$omp master
|
||||
do i=1,nths
|
||||
bnds(i) = bnds(i) + bnds(i-1)
|
||||
end do
|
||||
info = 0
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
|
||||
!$omp do schedule(static) private(disjoint)
|
||||
do kk=0, nths-1
|
||||
step1: do ii=bnds(kk), bnds(kk+1)-1
|
||||
i = idxs(ii)
|
||||
if (info /= 0) cycle step1
|
||||
if ((i<1).or.(i>nr)) then
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
end if
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
nz = (acsr%irp(i+1)-acsr%irp(i))
|
||||
if ((nz<0).or.(nz>size(icol))) then
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
end if
|
||||
|
||||
icol(1:nz) = acsr%ja(acsr%irp(i):acsr%irp(i+1)-1)
|
||||
val(1:nz) = acsr%val(acsr%irp(i):acsr%irp(i+1)-1)
|
||||
|
||||
!
|
||||
! Build the set of all strongly coupled nodes
|
||||
!
|
||||
ip = 0
|
||||
do k=1, nz
|
||||
j = icol(k)
|
||||
! If any of the neighbours is already assigned,
|
||||
! we will not reset.
|
||||
if (j>nr) cycle step1
|
||||
if (ilaggr(j) > 0) cycle step1
|
||||
if (abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))) then
|
||||
ip = ip + 1
|
||||
icol(ip) = icol(k)
|
||||
end if
|
||||
enddo
|
||||
|
||||
!
|
||||
! If the whole strongly coupled neighborhood of I is
|
||||
! as yet unconnected, turn it into the next aggregate.
|
||||
! Same if ip==0 (in which case, neighborhood only
|
||||
! contains I even if it does not look like it from matrix)
|
||||
! The fact that DISJOINT is private and not under lock
|
||||
! generates a certain un-repeatability, in that between
|
||||
! computing DISJOINT and assigning, another thread might
|
||||
! alter the values of ILAGGR.
|
||||
! However, a certain unrepeatability is already present
|
||||
! because the sequence of aggregates is computed with a
|
||||
! different order than in serial mode.
|
||||
! In any case, even if the enteries of ILAGGR may be
|
||||
! overwritten, the important thing is that each entry is
|
||||
! consistent and they generate a correct aggregation map.
|
||||
!
|
||||
disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0)
|
||||
if (disjoint) then
|
||||
locnaggr(kk) = locnaggr(kk) + 1
|
||||
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk
|
||||
if (itmp < (bnds(kk)-1+locnaggr(kk))) then
|
||||
!$omp atomic update
|
||||
info = max(12345678,info)
|
||||
!$omp end atomic
|
||||
cycle step1
|
||||
end if
|
||||
!$omp atomic write
|
||||
ilaggr(i) = itmp
|
||||
!$omp end atomic
|
||||
do k=1, ip
|
||||
!$omp atomic write
|
||||
ilaggr(icol(k)) = itmp
|
||||
!$omp end atomic
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
enddo step1
|
||||
end do
|
||||
!$omp end do
|
||||
|
||||
!$omp master
|
||||
naggr = sum(locnaggr(0:nths-1))
|
||||
do i=1,nths
|
||||
locnaggr(i) = locnaggr(i) + locnaggr(i-1)
|
||||
end do
|
||||
do i=nths+1,1,-1
|
||||
locnaggr(i) = locnaggr(i-1)
|
||||
end do
|
||||
locnaggr(0) = 0
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
!$omp do schedule(static)
|
||||
do kk=0, nths-1
|
||||
do ii=bnds(kk), bnds(kk+1)-1
|
||||
if (ilaggr(ii) > 0) then
|
||||
kp = mod(ilaggr(ii),nths)
|
||||
ilaggr(ii) = (ilaggr(ii)/nths)- (bnds(kp)-1) + locnaggr(kp)
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!$omp end do
|
||||
end block
|
||||
!$omp end parallel
|
||||
end block
|
||||
if (info /= 0) then
|
||||
if (info == 12345678) write(0,*) 'Overflow in encoding ILAGGR'
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
#else
|
||||
icnt = 0
|
||||
step1: do ii=1, nr
|
||||
if (info /= 0) cycle
|
||||
i = idxs(ii)
|
||||
if ((i<1).or.(i>nr)) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
nz = (acsr%irp(i+1)-acsr%irp(i))
|
||||
if ((nz<0).or.(nz>size(icol))) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
icol(1:nz) = acsr%ja(acsr%irp(i):acsr%irp(i+1)-1)
|
||||
@@ -352,7 +176,7 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
!
|
||||
! Build the set of all strongly coupled nodes
|
||||
!
|
||||
ip = 0
|
||||
ip = 0
|
||||
do k=1, nz
|
||||
j = icol(k)
|
||||
if ((1<=j).and.(j<=nr)) then
|
||||
@@ -370,7 +194,8 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
! contains I even if it does not look like it from matrix)
|
||||
!
|
||||
disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0)
|
||||
if (disjoint) then
|
||||
if (disjoint) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
do k=1, ip
|
||||
ilaggr(icol(k)) = naggr
|
||||
@@ -379,22 +204,16 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
endif
|
||||
enddo step1
|
||||
#endif
|
||||
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1:',naggr,count(ilaggr(1:nr) == -(nr+1)), count(ilaggr(1:nr)>0),&
|
||||
& count(ilaggr(1:nr) == -(nr+1))+count(ilaggr(1:nr)>0),nr
|
||||
& ' Check 1:',count(ilaggr == -(nr+1))
|
||||
end if
|
||||
if (do_timings) call psb_toc(idx_soc1_p1)
|
||||
if (do_timings) call psb_tic(idx_soc1_p2)
|
||||
|
||||
!
|
||||
! Phase two: join the neighbours
|
||||
!
|
||||
!$omp workshare
|
||||
tmpaggr = ilaggr
|
||||
!$omp end workshare
|
||||
!$omp parallel do schedule(static) shared(tmpaggr,ilaggr,nr,naggr,diag,theta)&
|
||||
!$omp private(ii,i,j,k,nz,icol,val,ip,cpling)
|
||||
step2: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
@@ -425,15 +244,8 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
end if
|
||||
end do step2
|
||||
!$omp end parallel do
|
||||
if (do_timings) call psb_toc(idx_soc1_p2)
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1.5:',naggr,count(ilaggr(1:nr) == -(nr+1)), count(ilaggr(1:nr)>0),&
|
||||
& count(ilaggr(1:nr) == -(nr+1))+count(ilaggr(1:nr)>0),nr
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_tic(idx_soc1_p3)
|
||||
|
||||
!
|
||||
! Phase three: sweep over leftovers, if any
|
||||
!
|
||||
@@ -462,6 +274,7 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
enddo
|
||||
if (ip > 0) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
ilaggr(i) = naggr
|
||||
do k=1, ip
|
||||
@@ -479,10 +292,7 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end do step3
|
||||
|
||||
! Any leftovers?
|
||||
!$omp parallel do schedule(static) shared(ilaggr,info)&
|
||||
!$omp private(ii,i,j,k,nz,icol,val,ip)
|
||||
do i=1, nr
|
||||
if (info /= 0) cycle
|
||||
if (ilaggr(i) < 0) then
|
||||
nz = (acsr%irp(i+1)-acsr%irp(i))
|
||||
if (nz == 1) then
|
||||
@@ -493,18 +303,15 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
! other processes.
|
||||
ilaggr(i) = -(nrglob+nr)
|
||||
else
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name,a_err='Fatal error: non-singleton leftovers')
|
||||
cycle
|
||||
goto 9999
|
||||
endif
|
||||
end if
|
||||
end do
|
||||
!$omp end parallel do
|
||||
if (info /= 0) goto 9999
|
||||
if (do_timings) call psb_toc(idx_soc1_p3)
|
||||
|
||||
if (naggr > ncol) then
|
||||
!write(0,*) name,'Error : naggr > ncol',naggr,ncol
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: naggr>ncol')
|
||||
goto 9999
|
||||
@@ -529,13 +336,9 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
nlaggr(:) = 0
|
||||
nlaggr(me+1) = naggr
|
||||
call psb_sum(ctxt,nlaggr(1:np))
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 2:',naggr,count(ilaggr(1:nr) == -(nr+1)), count(ilaggr(1:nr)>0),&
|
||||
& count(ilaggr(1:nr) == -(nr+1))+count(ilaggr(1:nr)>0),nr
|
||||
end if
|
||||
|
||||
call acsr%free()
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
+16
-205
@@ -68,12 +68,9 @@
|
||||
!
|
||||
subroutine amg_d_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
use psb_base_mod
|
||||
use psb_base_mod
|
||||
use amg_base_prec_type
|
||||
use amg_d_inner_mod
|
||||
#if defined(OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
|
||||
implicit none
|
||||
|
||||
@@ -102,9 +99,6 @@ subroutine amg_d_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
integer(psb_ipk_) :: np, me
|
||||
integer(psb_ipk_) :: nrow, ncol, n_ne
|
||||
character(len=20) :: name, ch_err
|
||||
integer(psb_ipk_), save :: idx_soc2_p1=-1, idx_soc2_p2=-1, idx_soc2_p3=-1
|
||||
integer(psb_ipk_), save :: idx_soc2_p0=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_soc2_map_bld'
|
||||
@@ -120,14 +114,6 @@ subroutine amg_d_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
nrglob = desc_a%get_global_rows()
|
||||
if ((do_timings).and.(idx_soc2_p0==-1)) &
|
||||
& idx_soc2_p0 = psb_get_timer_idx("SOC2_MAP: phase0")
|
||||
if ((do_timings).and.(idx_soc2_p1==-1)) &
|
||||
& idx_soc2_p1 = psb_get_timer_idx("SOC2_MAP: phase1")
|
||||
if ((do_timings).and.(idx_soc2_p2==-1)) &
|
||||
& idx_soc2_p2 = psb_get_timer_idx("SOC2_MAP: phase2")
|
||||
if ((do_timings).and.(idx_soc2_p3==-1)) &
|
||||
& idx_soc2_p3 = psb_get_timer_idx("SOC2_MAP: phase3")
|
||||
|
||||
nr = a%get_nrows()
|
||||
nc = a%get_ncols()
|
||||
@@ -139,7 +125,6 @@ subroutine amg_d_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_tic(idx_soc2_p0)
|
||||
diag = a%get_diag(info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
@@ -152,217 +137,55 @@ subroutine amg_d_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
!
|
||||
call a%cp_to(muij)
|
||||
if (clean_zeros) call muij%clean_zeros(info)
|
||||
!$omp parallel do private(i,j,k) shared(nr,diag,muij) schedule(static)
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
if (j<= nr) muij%val(k) = abs(muij%val(k))/sqrt(abs(diag(i)*diag(j)))
|
||||
end do
|
||||
end do
|
||||
!$omp end parallel do
|
||||
|
||||
!
|
||||
! Compute the 1-neigbour; mark strong links with +1, weak links with -1
|
||||
!
|
||||
call s_neigh_coo%allocate(nr,nr,muij%get_nzeros())
|
||||
!$omp parallel do private(i,j,k) shared(nr,diag,muij) schedule(static)
|
||||
ip = 0
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
s_neigh_coo%ia(k) = i
|
||||
s_neigh_coo%ja(k) = j
|
||||
if (j<=nr) then
|
||||
ip = ip + 1
|
||||
s_neigh_coo%ia(ip) = i
|
||||
s_neigh_coo%ja(ip) = j
|
||||
if (real(muij%val(k)) >= theta) then
|
||||
s_neigh_coo%val(k) = done
|
||||
s_neigh_coo%val(ip) = done
|
||||
else
|
||||
s_neigh_coo%val(k) = -done
|
||||
s_neigh_coo%val(ip) = -done
|
||||
end if
|
||||
else
|
||||
s_neigh_coo%val(k) = -done
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!$omp end parallel do
|
||||
!write(*,*) 'S_NEIGH: ',nr,ip
|
||||
call s_neigh_coo%set_nzeros(muij%get_nzeros())
|
||||
call s_neigh_coo%set_nzeros(ip)
|
||||
call s_neigh%mv_from_coo(s_neigh_coo,info)
|
||||
|
||||
if (iorder == amg_aggr_ord_nat_) then
|
||||
|
||||
!$omp parallel do private(i) shared(ilaggr,idxs) schedule(static)
|
||||
if (iorder == amg_aggr_ord_nat_) then
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
idxs(i) = i
|
||||
end do
|
||||
!$omp end parallel do
|
||||
else
|
||||
!$omp parallel do private(i) shared(ilaggr,idxs,muij) schedule(static)
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
ideg(i) = muij%irp(i+1) - muij%irp(i)
|
||||
end do
|
||||
!$omp end parallel do
|
||||
call psb_msort(ideg,ix=idxs,dir=psb_sort_down_)
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_toc(idx_soc2_p0)
|
||||
if (do_timings) call psb_tic(idx_soc2_p1)
|
||||
|
||||
!
|
||||
! Phase one: Start with disjoint groups.
|
||||
!
|
||||
naggr = 0
|
||||
#if defined(OPENMP)
|
||||
block
|
||||
integer(psb_ipk_), allocatable :: bnds(:), locnaggr(:)
|
||||
integer(psb_ipk_) :: myth,nths, kk
|
||||
! The parallelization makes use of a locaggr(:) array; each thread
|
||||
! keeps its own version of naggr, and when the loop ends, a prefix is applied
|
||||
! to locnaggr to determine:
|
||||
! 1. The total number of aggregaters NAGGR;
|
||||
! 2. How much should each thread shift its own aggregates
|
||||
! Part 2 requires to keep track of which thread defined each entry
|
||||
! of ilaggr(), so that each entry can be adjusted correctly: even
|
||||
! if an entry I belongs to the range BNDS(TH)>BNDS(TH+1)-1, it may have
|
||||
! been set because it is strongly connected to an entry J belonging to a
|
||||
! different thread.
|
||||
|
||||
!$omp parallel shared(s_neigh,bnds,idxs,locnaggr,ilaggr,nr,naggr,diag,theta,nths,info) &
|
||||
!$omp private(icol,val,myth,kk)
|
||||
block
|
||||
integer(psb_ipk_) :: ii,nlp,k,kp,n,ia,isz,nc,i,j,m,nz,ilg,ip,rsz,ip1,nzcnt
|
||||
integer(psb_lpk_) :: itmp
|
||||
!$omp master
|
||||
nths = omp_get_num_threads()
|
||||
allocate(bnds(0:nths),locnaggr(0:nths+1))
|
||||
locnaggr(:) = 0
|
||||
bnds(0) = 1
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
myth = omp_get_thread_num()
|
||||
rsz = nr/nths
|
||||
if (myth < mod(nr,nths)) rsz = rsz + 1
|
||||
bnds(myth+1) = rsz
|
||||
!$omp barrier
|
||||
!$omp master
|
||||
do i=1,nths
|
||||
bnds(i) = bnds(i) + bnds(i-1)
|
||||
end do
|
||||
info = 0
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
|
||||
!$omp do schedule(static) private(disjoint)
|
||||
do kk=0, nths-1
|
||||
step1: do ii=bnds(kk), bnds(kk+1)-1
|
||||
i = idxs(ii)
|
||||
if (info /= 0) then
|
||||
write(0,*) ' Step1:',kk,ii,i,info
|
||||
cycle step1
|
||||
end if
|
||||
if ((i<1).or.(i>nr)) then
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
end if
|
||||
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
!
|
||||
! Get the 1-neighbourhood of I
|
||||
!
|
||||
ip1 = s_neigh%irp(i)
|
||||
nz = s_neigh%irp(i+1)-ip1
|
||||
!
|
||||
! If the neighbourhood only contains I, skip it
|
||||
!
|
||||
if (nz ==0) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
if ((nz==1).and.(s_neigh%ja(ip1)==i)) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
|
||||
nzcnt = count(real(s_neigh%val(ip1:ip1+nz-1)) > 0)
|
||||
icol(1:nzcnt) = pack(s_neigh%ja(ip1:ip1+nz-1),(real(s_neigh%val(ip1:ip1+nz-1)) > 0))
|
||||
disjoint = all(ilaggr(icol(1:nzcnt)) == -(nr+1))
|
||||
|
||||
!
|
||||
! If the whole strongly coupled neighborhood of I is
|
||||
! as yet unconnected, turn it into the next aggregate.
|
||||
! Same if ip==0 (in which case, neighborhood only
|
||||
! contains I even if it does not look like it from matrix)
|
||||
! The fact that DISJOINT is private and not under lock
|
||||
! generates a certain un-repeatability, in that between
|
||||
! computing DISJOINT and assigning, another thread might
|
||||
! alter the values of ILAGGR.
|
||||
! However, a certain unrepeatability is already present
|
||||
! because the sequence of aggregates is computed with a
|
||||
! different order than in serial mode.
|
||||
! In any case, even if the enteries of ILAGGR may be
|
||||
! overwritten, the important thing is that each entry is
|
||||
! consistent and they generate a correct aggregation map.
|
||||
!
|
||||
if (disjoint) then
|
||||
locnaggr(kk) = locnaggr(kk) + 1
|
||||
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk
|
||||
if (itmp < (bnds(kk)-1+locnaggr(kk))) then
|
||||
!$omp atomic update
|
||||
info = max(12345678,info)
|
||||
!$omp end atomic
|
||||
cycle step1
|
||||
end if
|
||||
!$omp atomic write
|
||||
ilaggr(i) = itmp
|
||||
!$omp end atomic
|
||||
do k=1, nzcnt
|
||||
!$omp atomic write
|
||||
ilaggr(icol(k)) = itmp
|
||||
!$omp end atomic
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
enddo step1
|
||||
end do
|
||||
!$omp end do
|
||||
|
||||
!$omp master
|
||||
naggr = sum(locnaggr(0:nths-1))
|
||||
do i=1,nths
|
||||
locnaggr(i) = locnaggr(i) + locnaggr(i-1)
|
||||
end do
|
||||
do i=nths+1,1,-1
|
||||
locnaggr(i) = locnaggr(i-1)
|
||||
end do
|
||||
locnaggr(0) = 0
|
||||
!write(0,*) 'LNAG ',locnaggr(nths+1)
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
!$omp do schedule(static)
|
||||
do kk=0, nths-1
|
||||
do ii=bnds(kk), bnds(kk+1)-1
|
||||
if (ilaggr(ii) > 0) then
|
||||
kp = mod(ilaggr(ii),nths)
|
||||
ilaggr(ii) = (ilaggr(ii)/nths)- (bnds(kp)-1) + locnaggr(kp)
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!$omp end do
|
||||
end block
|
||||
!$omp end parallel
|
||||
end block
|
||||
if (info /= 0) then
|
||||
if (info == 12345678) write(0,*) 'Overflow in encoding ILAGGR'
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
#else
|
||||
icnt = 0
|
||||
step1: do ii=1, nr
|
||||
i = idxs(ii)
|
||||
@@ -401,21 +224,16 @@ subroutine amg_d_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
endif
|
||||
enddo step1
|
||||
#endif
|
||||
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1:',count(ilaggr == -(nr+1))
|
||||
end if
|
||||
if (do_timings) call psb_toc(idx_soc2_p1)
|
||||
if (do_timings) call psb_tic(idx_soc2_p2)
|
||||
|
||||
!
|
||||
! Phase two: join the neighbours
|
||||
!
|
||||
!$omp workshare
|
||||
tmpaggr = ilaggr
|
||||
!$omp end workshare
|
||||
!$omp parallel do schedule(static) shared(tmpaggr,ilaggr,nr,naggr,diag,muij,s_neigh)&
|
||||
!$omp private(ii,i,j,k,nz,icol,val,ip,cpling)
|
||||
step2: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
@@ -441,9 +259,8 @@ subroutine amg_d_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
end if
|
||||
end do step2
|
||||
!$omp end parallel do
|
||||
if (do_timings) call psb_toc(idx_soc2_p2)
|
||||
if (do_timings) call psb_tic(idx_soc2_p3)
|
||||
|
||||
|
||||
!
|
||||
! Phase three: sweep over leftovers, if any
|
||||
!
|
||||
@@ -477,8 +294,6 @@ subroutine amg_d_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end do step3
|
||||
|
||||
! Any leftovers?
|
||||
!$omp parallel do schedule(static) shared(ilaggr,s_neigh,info)&
|
||||
!$omp private(ii,i,j,k)
|
||||
do i=1, nr
|
||||
if (ilaggr(i) <= 0) then
|
||||
nz = (s_neigh%irp(i+1)-s_neigh%irp(i))
|
||||
@@ -490,17 +305,13 @@ subroutine amg_d_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
! other processes.
|
||||
ilaggr(i) = -(nrglob+nr)
|
||||
else
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name,a_err='Fatal error: non-singleton leftovers')
|
||||
cycle
|
||||
goto 9999
|
||||
endif
|
||||
end if
|
||||
end do
|
||||
!$omp end parallel do
|
||||
if (info /= 0) goto 9999
|
||||
if (do_timings) call psb_toc(idx_soc2_p3)
|
||||
|
||||
if (naggr > ncol) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: naggr>ncol')
|
||||
@@ -76,7 +76,7 @@ subroutine amg_s_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
integer(psb_ipk_) :: nrow, ncol, nrl, nzl, ip, nzt, i, k
|
||||
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
|
||||
logical, parameter :: do_timings=.false., oldstyle=.false., debug=.false.
|
||||
integer(psb_ipk_), save :: idx_spspmm=-1, idx_cpytrans1=-1, idx_cpytrans2=-1
|
||||
integer(psb_ipk_), save :: idx_spspmm=-1
|
||||
|
||||
name='amg_ptap_bld'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
@@ -93,11 +93,7 @@ subroutine amg_s_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
if ((do_timings).and.(idx_spspmm==-1)) &
|
||||
& idx_spspmm = psb_get_timer_idx("PTAP_BLD: par_spspmm")
|
||||
if ((do_timings).and.(idx_cpytrans1==-1)) &
|
||||
& idx_cpytrans1 = psb_get_timer_idx("PTAP_BLD: cpy&trans1")
|
||||
if ((do_timings).and.(idx_cpytrans2==-1)) &
|
||||
& idx_cpytrans2 = psb_get_timer_idx("PTAP_BLD: cpy&trans2")
|
||||
& idx_spspmm = psb_get_timer_idx("SPMM_BLD: par_spspmm")
|
||||
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
@@ -132,7 +128,6 @@ subroutine amg_s_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
! Ok first product done.
|
||||
|
||||
if (present(desc_ax)) then
|
||||
if (do_timings) call psb_tic(idx_cpytrans1)
|
||||
block
|
||||
call coo_prol%cp_to_coo(coo_restr,info)
|
||||
call coo_restr%set_ncols(desc_ac%get_local_cols())
|
||||
@@ -142,7 +137,7 @@ subroutine amg_s_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
call coo_restr%set_ncols(desc_ax%get_local_cols())
|
||||
end block
|
||||
call csr_restr%cp_from_coo(coo_restr,info)
|
||||
if (do_timings) call psb_toc(idx_cpytrans1)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv coo_restr')
|
||||
goto 9999
|
||||
@@ -172,28 +167,27 @@ subroutine amg_s_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
|
||||
call coo_restr%transp()
|
||||
nzl = coo_restr%get_nzeros()
|
||||
nrl = desc_ac%get_local_rows()
|
||||
call coo_restr%fix(info)
|
||||
i=coo_restr%get_nzeros()
|
||||
nrl = desc_ac%get_local_rows()
|
||||
i=0
|
||||
!
|
||||
! Only keep local rows
|
||||
!
|
||||
search: do k=i,1,-1
|
||||
if (coo_restr%ia(k) <= nrl) then
|
||||
call coo_restr%set_nzeros(k)
|
||||
exit search
|
||||
do k=1, nzl
|
||||
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) then
|
||||
i = i+1
|
||||
coo_restr%val(i) = coo_restr%val(k)
|
||||
coo_restr%ia(i) = coo_restr%ia(k)
|
||||
coo_restr%ja(i) = coo_restr%ja(k)
|
||||
end if
|
||||
end do search
|
||||
|
||||
end do
|
||||
call coo_restr%set_nzeros(i)
|
||||
call coo_restr%fix(info)
|
||||
nzl = coo_restr%get_nzeros()
|
||||
call coo_restr%set_nrows(desc_ac%get_local_rows())
|
||||
call coo_restr%set_ncols(desc_a%get_local_cols())
|
||||
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
|
||||
if (do_timings) call psb_tic(idx_cpytrans2)
|
||||
|
||||
call csr_restr%cp_from_coo(coo_restr,info)
|
||||
|
||||
if (do_timings) call psb_toc(idx_cpytrans2)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv coo_restr')
|
||||
goto 9999
|
||||
|
||||
+21
-218
@@ -72,9 +72,7 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
use psb_base_mod
|
||||
use amg_base_prec_type
|
||||
use amg_s_inner_mod
|
||||
#if defined(OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
@@ -87,7 +85,7 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_), allocatable :: neigh(:), irow(:), icol(:),&
|
||||
integer(psb_ipk_), allocatable :: ils(:), neigh(:), irow(:), icol(:),&
|
||||
& ideg(:), idxs(:)
|
||||
integer(psb_lpk_), allocatable :: tmpaggr(:)
|
||||
real(psb_spk_), allocatable :: val(:), diag(:)
|
||||
@@ -101,9 +99,6 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
integer(psb_ipk_) :: nrow, ncol, n_ne
|
||||
integer(psb_lpk_) :: nrglob
|
||||
character(len=20) :: name, ch_err
|
||||
integer(psb_ipk_), save :: idx_soc1_p1=-1, idx_soc1_p2=-1, idx_soc1_p3=-1
|
||||
integer(psb_ipk_), save :: idx_soc1_p0=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_soc1_map_bld'
|
||||
@@ -119,14 +114,6 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
nrglob = desc_a%get_global_rows()
|
||||
if ((do_timings).and.(idx_soc1_p0==-1)) &
|
||||
& idx_soc1_p0 = psb_get_timer_idx("SOC1_MAP: phase0")
|
||||
if ((do_timings).and.(idx_soc1_p1==-1)) &
|
||||
& idx_soc1_p1 = psb_get_timer_idx("SOC1_MAP: phase1")
|
||||
if ((do_timings).and.(idx_soc1_p2==-1)) &
|
||||
& idx_soc1_p2 = psb_get_timer_idx("SOC1_MAP: phase2")
|
||||
if ((do_timings).and.(idx_soc1_p3==-1)) &
|
||||
& idx_soc1_p3 = psb_get_timer_idx("SOC1_MAP: phase3")
|
||||
|
||||
nr = a%get_nrows()
|
||||
nc = a%get_ncols()
|
||||
@@ -146,204 +133,41 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_tic(idx_soc1_p0)
|
||||
call a%cp_to(acsr)
|
||||
if (do_timings) call psb_toc(idx_soc1_p0)
|
||||
if (clean_zeros) call acsr%clean_zeros(info)
|
||||
if (iorder == amg_aggr_ord_nat_) then
|
||||
!$omp parallel do private(i) schedule(static)
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
idxs(i) = i
|
||||
idxs(i) = i
|
||||
end do
|
||||
!$omp end parallel do
|
||||
else
|
||||
!$omp parallel do private(i) schedule(static)
|
||||
else
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
ideg(i) = acsr%irp(i+1) - acsr%irp(i)
|
||||
end do
|
||||
!$omp end parallel do
|
||||
call psb_msort(ideg,ix=idxs,dir=psb_sort_down_)
|
||||
end if
|
||||
if (do_timings) call psb_tic(idx_soc1_p1)
|
||||
|
||||
|
||||
!
|
||||
! Phase one: Start with disjoint groups.
|
||||
!
|
||||
naggr = 0
|
||||
#if defined(OPENMP)
|
||||
block
|
||||
integer(psb_ipk_), allocatable :: bnds(:), locnaggr(:)
|
||||
integer(psb_ipk_) :: myth,nths, kk
|
||||
! The parallelization makes use of a locaggr(:) array; each thread
|
||||
! keeps its own version of naggr, and when the loop ends, a prefix is applied
|
||||
! to locnaggr to determine:
|
||||
! 1. The total number of aggregaters NAGGR;
|
||||
! 2. How much should each thread shift its own aggregates
|
||||
! Part 2 requires to keep track of which thread defined each entry
|
||||
! of ilaggr(), so that each entry can be adjusted correctly: even
|
||||
! if an entry I belongs to the range BNDS(TH)>BNDS(TH+1)-1, it may have
|
||||
! been set because it is strongly connected to an entry J belonging to a
|
||||
! different thread.
|
||||
|
||||
!$omp parallel shared(bnds,idxs,locnaggr,ilaggr,nr,naggr,diag,theta,nths,info) &
|
||||
!$omp private(icol,val,myth,kk)
|
||||
block
|
||||
integer(psb_ipk_) :: ii,nlp,k,kp,n,ia,isz, nc, i,j,m, nz, ilg, ip, rsz
|
||||
integer(psb_lpk_) :: itmp
|
||||
!$omp master
|
||||
nths = omp_get_num_threads()
|
||||
allocate(bnds(0:nths),locnaggr(0:nths+1))
|
||||
locnaggr(:) = 0
|
||||
bnds(0) = 1
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
myth = omp_get_thread_num()
|
||||
rsz = nr/nths
|
||||
if (myth < mod(nr,nths)) rsz = rsz + 1
|
||||
bnds(myth+1) = rsz
|
||||
!$omp barrier
|
||||
!$omp master
|
||||
do i=1,nths
|
||||
bnds(i) = bnds(i) + bnds(i-1)
|
||||
end do
|
||||
info = 0
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
|
||||
!$omp do schedule(static) private(disjoint)
|
||||
do kk=0, nths-1
|
||||
step1: do ii=bnds(kk), bnds(kk+1)-1
|
||||
i = idxs(ii)
|
||||
if (info /= 0) cycle step1
|
||||
if ((i<1).or.(i>nr)) then
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
end if
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
nz = (acsr%irp(i+1)-acsr%irp(i))
|
||||
if ((nz<0).or.(nz>size(icol))) then
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
end if
|
||||
|
||||
icol(1:nz) = acsr%ja(acsr%irp(i):acsr%irp(i+1)-1)
|
||||
val(1:nz) = acsr%val(acsr%irp(i):acsr%irp(i+1)-1)
|
||||
|
||||
!
|
||||
! Build the set of all strongly coupled nodes
|
||||
!
|
||||
ip = 0
|
||||
do k=1, nz
|
||||
j = icol(k)
|
||||
! If any of the neighbours is already assigned,
|
||||
! we will not reset.
|
||||
if (j>nr) cycle step1
|
||||
if (ilaggr(j) > 0) cycle step1
|
||||
if (abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))) then
|
||||
ip = ip + 1
|
||||
icol(ip) = icol(k)
|
||||
end if
|
||||
enddo
|
||||
|
||||
!
|
||||
! If the whole strongly coupled neighborhood of I is
|
||||
! as yet unconnected, turn it into the next aggregate.
|
||||
! Same if ip==0 (in which case, neighborhood only
|
||||
! contains I even if it does not look like it from matrix)
|
||||
! The fact that DISJOINT is private and not under lock
|
||||
! generates a certain un-repeatability, in that between
|
||||
! computing DISJOINT and assigning, another thread might
|
||||
! alter the values of ILAGGR.
|
||||
! However, a certain unrepeatability is already present
|
||||
! because the sequence of aggregates is computed with a
|
||||
! different order than in serial mode.
|
||||
! In any case, even if the enteries of ILAGGR may be
|
||||
! overwritten, the important thing is that each entry is
|
||||
! consistent and they generate a correct aggregation map.
|
||||
!
|
||||
disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0)
|
||||
if (disjoint) then
|
||||
locnaggr(kk) = locnaggr(kk) + 1
|
||||
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk
|
||||
if (itmp < (bnds(kk)-1+locnaggr(kk))) then
|
||||
!$omp atomic update
|
||||
info = max(12345678,info)
|
||||
!$omp end atomic
|
||||
cycle step1
|
||||
end if
|
||||
!$omp atomic write
|
||||
ilaggr(i) = itmp
|
||||
!$omp end atomic
|
||||
do k=1, ip
|
||||
!$omp atomic write
|
||||
ilaggr(icol(k)) = itmp
|
||||
!$omp end atomic
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
enddo step1
|
||||
end do
|
||||
!$omp end do
|
||||
|
||||
!$omp master
|
||||
naggr = sum(locnaggr(0:nths-1))
|
||||
do i=1,nths
|
||||
locnaggr(i) = locnaggr(i) + locnaggr(i-1)
|
||||
end do
|
||||
do i=nths+1,1,-1
|
||||
locnaggr(i) = locnaggr(i-1)
|
||||
end do
|
||||
locnaggr(0) = 0
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
!$omp do schedule(static)
|
||||
do kk=0, nths-1
|
||||
do ii=bnds(kk), bnds(kk+1)-1
|
||||
if (ilaggr(ii) > 0) then
|
||||
kp = mod(ilaggr(ii),nths)
|
||||
ilaggr(ii) = (ilaggr(ii)/nths)- (bnds(kp)-1) + locnaggr(kp)
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!$omp end do
|
||||
end block
|
||||
!$omp end parallel
|
||||
end block
|
||||
if (info /= 0) then
|
||||
if (info == 12345678) write(0,*) 'Overflow in encoding ILAGGR'
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
#else
|
||||
icnt = 0
|
||||
step1: do ii=1, nr
|
||||
if (info /= 0) cycle
|
||||
i = idxs(ii)
|
||||
if ((i<1).or.(i>nr)) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
nz = (acsr%irp(i+1)-acsr%irp(i))
|
||||
if ((nz<0).or.(nz>size(icol))) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
icol(1:nz) = acsr%ja(acsr%irp(i):acsr%irp(i+1)-1)
|
||||
@@ -352,7 +176,7 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
!
|
||||
! Build the set of all strongly coupled nodes
|
||||
!
|
||||
ip = 0
|
||||
ip = 0
|
||||
do k=1, nz
|
||||
j = icol(k)
|
||||
if ((1<=j).and.(j<=nr)) then
|
||||
@@ -370,7 +194,8 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
! contains I even if it does not look like it from matrix)
|
||||
!
|
||||
disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0)
|
||||
if (disjoint) then
|
||||
if (disjoint) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
do k=1, ip
|
||||
ilaggr(icol(k)) = naggr
|
||||
@@ -379,22 +204,16 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
endif
|
||||
enddo step1
|
||||
#endif
|
||||
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1:',naggr,count(ilaggr(1:nr) == -(nr+1)), count(ilaggr(1:nr)>0),&
|
||||
& count(ilaggr(1:nr) == -(nr+1))+count(ilaggr(1:nr)>0),nr
|
||||
& ' Check 1:',count(ilaggr == -(nr+1))
|
||||
end if
|
||||
if (do_timings) call psb_toc(idx_soc1_p1)
|
||||
if (do_timings) call psb_tic(idx_soc1_p2)
|
||||
|
||||
!
|
||||
! Phase two: join the neighbours
|
||||
!
|
||||
!$omp workshare
|
||||
tmpaggr = ilaggr
|
||||
!$omp end workshare
|
||||
!$omp parallel do schedule(static) shared(tmpaggr,ilaggr,nr,naggr,diag,theta)&
|
||||
!$omp private(ii,i,j,k,nz,icol,val,ip,cpling)
|
||||
step2: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
@@ -425,15 +244,8 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
end if
|
||||
end do step2
|
||||
!$omp end parallel do
|
||||
if (do_timings) call psb_toc(idx_soc1_p2)
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1.5:',naggr,count(ilaggr(1:nr) == -(nr+1)), count(ilaggr(1:nr)>0),&
|
||||
& count(ilaggr(1:nr) == -(nr+1))+count(ilaggr(1:nr)>0),nr
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_tic(idx_soc1_p3)
|
||||
|
||||
!
|
||||
! Phase three: sweep over leftovers, if any
|
||||
!
|
||||
@@ -462,6 +274,7 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
enddo
|
||||
if (ip > 0) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
ilaggr(i) = naggr
|
||||
do k=1, ip
|
||||
@@ -479,10 +292,7 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end do step3
|
||||
|
||||
! Any leftovers?
|
||||
!$omp parallel do schedule(static) shared(ilaggr,info)&
|
||||
!$omp private(ii,i,j,k,nz,icol,val,ip)
|
||||
do i=1, nr
|
||||
if (info /= 0) cycle
|
||||
if (ilaggr(i) < 0) then
|
||||
nz = (acsr%irp(i+1)-acsr%irp(i))
|
||||
if (nz == 1) then
|
||||
@@ -493,18 +303,15 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
! other processes.
|
||||
ilaggr(i) = -(nrglob+nr)
|
||||
else
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name,a_err='Fatal error: non-singleton leftovers')
|
||||
cycle
|
||||
goto 9999
|
||||
endif
|
||||
end if
|
||||
end do
|
||||
!$omp end parallel do
|
||||
if (info /= 0) goto 9999
|
||||
if (do_timings) call psb_toc(idx_soc1_p3)
|
||||
|
||||
if (naggr > ncol) then
|
||||
!write(0,*) name,'Error : naggr > ncol',naggr,ncol
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: naggr>ncol')
|
||||
goto 9999
|
||||
@@ -529,13 +336,9 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
nlaggr(:) = 0
|
||||
nlaggr(me+1) = naggr
|
||||
call psb_sum(ctxt,nlaggr(1:np))
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 2:',naggr,count(ilaggr(1:nr) == -(nr+1)), count(ilaggr(1:nr)>0),&
|
||||
& count(ilaggr(1:nr) == -(nr+1))+count(ilaggr(1:nr)>0),nr
|
||||
end if
|
||||
|
||||
call acsr%free()
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
+16
-205
@@ -68,12 +68,9 @@
|
||||
!
|
||||
subroutine amg_s_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
use psb_base_mod
|
||||
use psb_base_mod
|
||||
use amg_base_prec_type
|
||||
use amg_s_inner_mod
|
||||
#if defined(OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
|
||||
implicit none
|
||||
|
||||
@@ -102,9 +99,6 @@ subroutine amg_s_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
integer(psb_ipk_) :: np, me
|
||||
integer(psb_ipk_) :: nrow, ncol, n_ne
|
||||
character(len=20) :: name, ch_err
|
||||
integer(psb_ipk_), save :: idx_soc2_p1=-1, idx_soc2_p2=-1, idx_soc2_p3=-1
|
||||
integer(psb_ipk_), save :: idx_soc2_p0=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_soc2_map_bld'
|
||||
@@ -120,14 +114,6 @@ subroutine amg_s_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
nrglob = desc_a%get_global_rows()
|
||||
if ((do_timings).and.(idx_soc2_p0==-1)) &
|
||||
& idx_soc2_p0 = psb_get_timer_idx("SOC2_MAP: phase0")
|
||||
if ((do_timings).and.(idx_soc2_p1==-1)) &
|
||||
& idx_soc2_p1 = psb_get_timer_idx("SOC2_MAP: phase1")
|
||||
if ((do_timings).and.(idx_soc2_p2==-1)) &
|
||||
& idx_soc2_p2 = psb_get_timer_idx("SOC2_MAP: phase2")
|
||||
if ((do_timings).and.(idx_soc2_p3==-1)) &
|
||||
& idx_soc2_p3 = psb_get_timer_idx("SOC2_MAP: phase3")
|
||||
|
||||
nr = a%get_nrows()
|
||||
nc = a%get_ncols()
|
||||
@@ -139,7 +125,6 @@ subroutine amg_s_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_tic(idx_soc2_p0)
|
||||
diag = a%get_diag(info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
@@ -152,217 +137,55 @@ subroutine amg_s_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
!
|
||||
call a%cp_to(muij)
|
||||
if (clean_zeros) call muij%clean_zeros(info)
|
||||
!$omp parallel do private(i,j,k) shared(nr,diag,muij) schedule(static)
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
if (j<= nr) muij%val(k) = abs(muij%val(k))/sqrt(abs(diag(i)*diag(j)))
|
||||
end do
|
||||
end do
|
||||
!$omp end parallel do
|
||||
|
||||
!
|
||||
! Compute the 1-neigbour; mark strong links with +1, weak links with -1
|
||||
!
|
||||
call s_neigh_coo%allocate(nr,nr,muij%get_nzeros())
|
||||
!$omp parallel do private(i,j,k) shared(nr,diag,muij) schedule(static)
|
||||
ip = 0
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
s_neigh_coo%ia(k) = i
|
||||
s_neigh_coo%ja(k) = j
|
||||
if (j<=nr) then
|
||||
ip = ip + 1
|
||||
s_neigh_coo%ia(ip) = i
|
||||
s_neigh_coo%ja(ip) = j
|
||||
if (real(muij%val(k)) >= theta) then
|
||||
s_neigh_coo%val(k) = sone
|
||||
s_neigh_coo%val(ip) = sone
|
||||
else
|
||||
s_neigh_coo%val(k) = -sone
|
||||
s_neigh_coo%val(ip) = -sone
|
||||
end if
|
||||
else
|
||||
s_neigh_coo%val(k) = -sone
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!$omp end parallel do
|
||||
!write(*,*) 'S_NEIGH: ',nr,ip
|
||||
call s_neigh_coo%set_nzeros(muij%get_nzeros())
|
||||
call s_neigh_coo%set_nzeros(ip)
|
||||
call s_neigh%mv_from_coo(s_neigh_coo,info)
|
||||
|
||||
if (iorder == amg_aggr_ord_nat_) then
|
||||
|
||||
!$omp parallel do private(i) shared(ilaggr,idxs) schedule(static)
|
||||
if (iorder == amg_aggr_ord_nat_) then
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
idxs(i) = i
|
||||
end do
|
||||
!$omp end parallel do
|
||||
else
|
||||
!$omp parallel do private(i) shared(ilaggr,idxs,muij) schedule(static)
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
ideg(i) = muij%irp(i+1) - muij%irp(i)
|
||||
end do
|
||||
!$omp end parallel do
|
||||
call psb_msort(ideg,ix=idxs,dir=psb_sort_down_)
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_toc(idx_soc2_p0)
|
||||
if (do_timings) call psb_tic(idx_soc2_p1)
|
||||
|
||||
!
|
||||
! Phase one: Start with disjoint groups.
|
||||
!
|
||||
naggr = 0
|
||||
#if defined(OPENMP)
|
||||
block
|
||||
integer(psb_ipk_), allocatable :: bnds(:), locnaggr(:)
|
||||
integer(psb_ipk_) :: myth,nths, kk
|
||||
! The parallelization makes use of a locaggr(:) array; each thread
|
||||
! keeps its own version of naggr, and when the loop ends, a prefix is applied
|
||||
! to locnaggr to determine:
|
||||
! 1. The total number of aggregaters NAGGR;
|
||||
! 2. How much should each thread shift its own aggregates
|
||||
! Part 2 requires to keep track of which thread defined each entry
|
||||
! of ilaggr(), so that each entry can be adjusted correctly: even
|
||||
! if an entry I belongs to the range BNDS(TH)>BNDS(TH+1)-1, it may have
|
||||
! been set because it is strongly connected to an entry J belonging to a
|
||||
! different thread.
|
||||
|
||||
!$omp parallel shared(s_neigh,bnds,idxs,locnaggr,ilaggr,nr,naggr,diag,theta,nths,info) &
|
||||
!$omp private(icol,val,myth,kk)
|
||||
block
|
||||
integer(psb_ipk_) :: ii,nlp,k,kp,n,ia,isz,nc,i,j,m,nz,ilg,ip,rsz,ip1,nzcnt
|
||||
integer(psb_lpk_) :: itmp
|
||||
!$omp master
|
||||
nths = omp_get_num_threads()
|
||||
allocate(bnds(0:nths),locnaggr(0:nths+1))
|
||||
locnaggr(:) = 0
|
||||
bnds(0) = 1
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
myth = omp_get_thread_num()
|
||||
rsz = nr/nths
|
||||
if (myth < mod(nr,nths)) rsz = rsz + 1
|
||||
bnds(myth+1) = rsz
|
||||
!$omp barrier
|
||||
!$omp master
|
||||
do i=1,nths
|
||||
bnds(i) = bnds(i) + bnds(i-1)
|
||||
end do
|
||||
info = 0
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
|
||||
!$omp do schedule(static) private(disjoint)
|
||||
do kk=0, nths-1
|
||||
step1: do ii=bnds(kk), bnds(kk+1)-1
|
||||
i = idxs(ii)
|
||||
if (info /= 0) then
|
||||
write(0,*) ' Step1:',kk,ii,i,info
|
||||
cycle step1
|
||||
end if
|
||||
if ((i<1).or.(i>nr)) then
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
end if
|
||||
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
!
|
||||
! Get the 1-neighbourhood of I
|
||||
!
|
||||
ip1 = s_neigh%irp(i)
|
||||
nz = s_neigh%irp(i+1)-ip1
|
||||
!
|
||||
! If the neighbourhood only contains I, skip it
|
||||
!
|
||||
if (nz ==0) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
if ((nz==1).and.(s_neigh%ja(ip1)==i)) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
|
||||
nzcnt = count(real(s_neigh%val(ip1:ip1+nz-1)) > 0)
|
||||
icol(1:nzcnt) = pack(s_neigh%ja(ip1:ip1+nz-1),(real(s_neigh%val(ip1:ip1+nz-1)) > 0))
|
||||
disjoint = all(ilaggr(icol(1:nzcnt)) == -(nr+1))
|
||||
|
||||
!
|
||||
! If the whole strongly coupled neighborhood of I is
|
||||
! as yet unconnected, turn it into the next aggregate.
|
||||
! Same if ip==0 (in which case, neighborhood only
|
||||
! contains I even if it does not look like it from matrix)
|
||||
! The fact that DISJOINT is private and not under lock
|
||||
! generates a certain un-repeatability, in that between
|
||||
! computing DISJOINT and assigning, another thread might
|
||||
! alter the values of ILAGGR.
|
||||
! However, a certain unrepeatability is already present
|
||||
! because the sequence of aggregates is computed with a
|
||||
! different order than in serial mode.
|
||||
! In any case, even if the enteries of ILAGGR may be
|
||||
! overwritten, the important thing is that each entry is
|
||||
! consistent and they generate a correct aggregation map.
|
||||
!
|
||||
if (disjoint) then
|
||||
locnaggr(kk) = locnaggr(kk) + 1
|
||||
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk
|
||||
if (itmp < (bnds(kk)-1+locnaggr(kk))) then
|
||||
!$omp atomic update
|
||||
info = max(12345678,info)
|
||||
!$omp end atomic
|
||||
cycle step1
|
||||
end if
|
||||
!$omp atomic write
|
||||
ilaggr(i) = itmp
|
||||
!$omp end atomic
|
||||
do k=1, nzcnt
|
||||
!$omp atomic write
|
||||
ilaggr(icol(k)) = itmp
|
||||
!$omp end atomic
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
enddo step1
|
||||
end do
|
||||
!$omp end do
|
||||
|
||||
!$omp master
|
||||
naggr = sum(locnaggr(0:nths-1))
|
||||
do i=1,nths
|
||||
locnaggr(i) = locnaggr(i) + locnaggr(i-1)
|
||||
end do
|
||||
do i=nths+1,1,-1
|
||||
locnaggr(i) = locnaggr(i-1)
|
||||
end do
|
||||
locnaggr(0) = 0
|
||||
!write(0,*) 'LNAG ',locnaggr(nths+1)
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
!$omp do schedule(static)
|
||||
do kk=0, nths-1
|
||||
do ii=bnds(kk), bnds(kk+1)-1
|
||||
if (ilaggr(ii) > 0) then
|
||||
kp = mod(ilaggr(ii),nths)
|
||||
ilaggr(ii) = (ilaggr(ii)/nths)- (bnds(kp)-1) + locnaggr(kp)
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!$omp end do
|
||||
end block
|
||||
!$omp end parallel
|
||||
end block
|
||||
if (info /= 0) then
|
||||
if (info == 12345678) write(0,*) 'Overflow in encoding ILAGGR'
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
#else
|
||||
icnt = 0
|
||||
step1: do ii=1, nr
|
||||
i = idxs(ii)
|
||||
@@ -401,21 +224,16 @@ subroutine amg_s_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
endif
|
||||
enddo step1
|
||||
#endif
|
||||
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1:',count(ilaggr == -(nr+1))
|
||||
end if
|
||||
if (do_timings) call psb_toc(idx_soc2_p1)
|
||||
if (do_timings) call psb_tic(idx_soc2_p2)
|
||||
|
||||
!
|
||||
! Phase two: join the neighbours
|
||||
!
|
||||
!$omp workshare
|
||||
tmpaggr = ilaggr
|
||||
!$omp end workshare
|
||||
!$omp parallel do schedule(static) shared(tmpaggr,ilaggr,nr,naggr,diag,muij,s_neigh)&
|
||||
!$omp private(ii,i,j,k,nz,icol,val,ip,cpling)
|
||||
step2: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
@@ -441,9 +259,8 @@ subroutine amg_s_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
end if
|
||||
end do step2
|
||||
!$omp end parallel do
|
||||
if (do_timings) call psb_toc(idx_soc2_p2)
|
||||
if (do_timings) call psb_tic(idx_soc2_p3)
|
||||
|
||||
|
||||
!
|
||||
! Phase three: sweep over leftovers, if any
|
||||
!
|
||||
@@ -477,8 +294,6 @@ subroutine amg_s_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end do step3
|
||||
|
||||
! Any leftovers?
|
||||
!$omp parallel do schedule(static) shared(ilaggr,s_neigh,info)&
|
||||
!$omp private(ii,i,j,k)
|
||||
do i=1, nr
|
||||
if (ilaggr(i) <= 0) then
|
||||
nz = (s_neigh%irp(i+1)-s_neigh%irp(i))
|
||||
@@ -490,17 +305,13 @@ subroutine amg_s_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
! other processes.
|
||||
ilaggr(i) = -(nrglob+nr)
|
||||
else
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name,a_err='Fatal error: non-singleton leftovers')
|
||||
cycle
|
||||
goto 9999
|
||||
endif
|
||||
end if
|
||||
end do
|
||||
!$omp end parallel do
|
||||
if (info /= 0) goto 9999
|
||||
if (do_timings) call psb_toc(idx_soc2_p3)
|
||||
|
||||
if (naggr > ncol) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: naggr>ncol')
|
||||
@@ -76,7 +76,7 @@ subroutine amg_z_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
integer(psb_ipk_) :: nrow, ncol, nrl, nzl, ip, nzt, i, k
|
||||
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
|
||||
logical, parameter :: do_timings=.false., oldstyle=.false., debug=.false.
|
||||
integer(psb_ipk_), save :: idx_spspmm=-1, idx_cpytrans1=-1, idx_cpytrans2=-1
|
||||
integer(psb_ipk_), save :: idx_spspmm=-1
|
||||
|
||||
name='amg_ptap_bld'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
@@ -93,11 +93,7 @@ subroutine amg_z_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
if ((do_timings).and.(idx_spspmm==-1)) &
|
||||
& idx_spspmm = psb_get_timer_idx("PTAP_BLD: par_spspmm")
|
||||
if ((do_timings).and.(idx_cpytrans1==-1)) &
|
||||
& idx_cpytrans1 = psb_get_timer_idx("PTAP_BLD: cpy&trans1")
|
||||
if ((do_timings).and.(idx_cpytrans2==-1)) &
|
||||
& idx_cpytrans2 = psb_get_timer_idx("PTAP_BLD: cpy&trans2")
|
||||
& idx_spspmm = psb_get_timer_idx("SPMM_BLD: par_spspmm")
|
||||
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
@@ -132,7 +128,6 @@ subroutine amg_z_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
! Ok first product done.
|
||||
|
||||
if (present(desc_ax)) then
|
||||
if (do_timings) call psb_tic(idx_cpytrans1)
|
||||
block
|
||||
call coo_prol%cp_to_coo(coo_restr,info)
|
||||
call coo_restr%set_ncols(desc_ac%get_local_cols())
|
||||
@@ -142,7 +137,7 @@ subroutine amg_z_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
call coo_restr%set_ncols(desc_ax%get_local_cols())
|
||||
end block
|
||||
call csr_restr%cp_from_coo(coo_restr,info)
|
||||
if (do_timings) call psb_toc(idx_cpytrans1)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv coo_restr')
|
||||
goto 9999
|
||||
@@ -172,28 +167,27 @@ subroutine amg_z_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
|
||||
|
||||
call coo_restr%transp()
|
||||
nzl = coo_restr%get_nzeros()
|
||||
nrl = desc_ac%get_local_rows()
|
||||
call coo_restr%fix(info)
|
||||
i=coo_restr%get_nzeros()
|
||||
nrl = desc_ac%get_local_rows()
|
||||
i=0
|
||||
!
|
||||
! Only keep local rows
|
||||
!
|
||||
search: do k=i,1,-1
|
||||
if (coo_restr%ia(k) <= nrl) then
|
||||
call coo_restr%set_nzeros(k)
|
||||
exit search
|
||||
do k=1, nzl
|
||||
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) then
|
||||
i = i+1
|
||||
coo_restr%val(i) = coo_restr%val(k)
|
||||
coo_restr%ia(i) = coo_restr%ia(k)
|
||||
coo_restr%ja(i) = coo_restr%ja(k)
|
||||
end if
|
||||
end do search
|
||||
|
||||
end do
|
||||
call coo_restr%set_nzeros(i)
|
||||
call coo_restr%fix(info)
|
||||
nzl = coo_restr%get_nzeros()
|
||||
call coo_restr%set_nrows(desc_ac%get_local_rows())
|
||||
call coo_restr%set_ncols(desc_a%get_local_cols())
|
||||
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
|
||||
if (do_timings) call psb_tic(idx_cpytrans2)
|
||||
|
||||
call csr_restr%cp_from_coo(coo_restr,info)
|
||||
|
||||
if (do_timings) call psb_toc(idx_cpytrans2)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv coo_restr')
|
||||
goto 9999
|
||||
|
||||
+21
-218
@@ -72,9 +72,7 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
use psb_base_mod
|
||||
use amg_base_prec_type
|
||||
use amg_z_inner_mod
|
||||
#if defined(OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
@@ -87,7 +85,7 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_), allocatable :: neigh(:), irow(:), icol(:),&
|
||||
integer(psb_ipk_), allocatable :: ils(:), neigh(:), irow(:), icol(:),&
|
||||
& ideg(:), idxs(:)
|
||||
integer(psb_lpk_), allocatable :: tmpaggr(:)
|
||||
complex(psb_dpk_), allocatable :: val(:), diag(:)
|
||||
@@ -101,9 +99,6 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
integer(psb_ipk_) :: nrow, ncol, n_ne
|
||||
integer(psb_lpk_) :: nrglob
|
||||
character(len=20) :: name, ch_err
|
||||
integer(psb_ipk_), save :: idx_soc1_p1=-1, idx_soc1_p2=-1, idx_soc1_p3=-1
|
||||
integer(psb_ipk_), save :: idx_soc1_p0=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_soc1_map_bld'
|
||||
@@ -119,14 +114,6 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
nrglob = desc_a%get_global_rows()
|
||||
if ((do_timings).and.(idx_soc1_p0==-1)) &
|
||||
& idx_soc1_p0 = psb_get_timer_idx("SOC1_MAP: phase0")
|
||||
if ((do_timings).and.(idx_soc1_p1==-1)) &
|
||||
& idx_soc1_p1 = psb_get_timer_idx("SOC1_MAP: phase1")
|
||||
if ((do_timings).and.(idx_soc1_p2==-1)) &
|
||||
& idx_soc1_p2 = psb_get_timer_idx("SOC1_MAP: phase2")
|
||||
if ((do_timings).and.(idx_soc1_p3==-1)) &
|
||||
& idx_soc1_p3 = psb_get_timer_idx("SOC1_MAP: phase3")
|
||||
|
||||
nr = a%get_nrows()
|
||||
nc = a%get_ncols()
|
||||
@@ -146,204 +133,41 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_tic(idx_soc1_p0)
|
||||
call a%cp_to(acsr)
|
||||
if (do_timings) call psb_toc(idx_soc1_p0)
|
||||
if (clean_zeros) call acsr%clean_zeros(info)
|
||||
if (iorder == amg_aggr_ord_nat_) then
|
||||
!$omp parallel do private(i) schedule(static)
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
idxs(i) = i
|
||||
idxs(i) = i
|
||||
end do
|
||||
!$omp end parallel do
|
||||
else
|
||||
!$omp parallel do private(i) schedule(static)
|
||||
else
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
ideg(i) = acsr%irp(i+1) - acsr%irp(i)
|
||||
end do
|
||||
!$omp end parallel do
|
||||
call psb_msort(ideg,ix=idxs,dir=psb_sort_down_)
|
||||
end if
|
||||
if (do_timings) call psb_tic(idx_soc1_p1)
|
||||
|
||||
|
||||
!
|
||||
! Phase one: Start with disjoint groups.
|
||||
!
|
||||
naggr = 0
|
||||
#if defined(OPENMP)
|
||||
block
|
||||
integer(psb_ipk_), allocatable :: bnds(:), locnaggr(:)
|
||||
integer(psb_ipk_) :: myth,nths, kk
|
||||
! The parallelization makes use of a locaggr(:) array; each thread
|
||||
! keeps its own version of naggr, and when the loop ends, a prefix is applied
|
||||
! to locnaggr to determine:
|
||||
! 1. The total number of aggregaters NAGGR;
|
||||
! 2. How much should each thread shift its own aggregates
|
||||
! Part 2 requires to keep track of which thread defined each entry
|
||||
! of ilaggr(), so that each entry can be adjusted correctly: even
|
||||
! if an entry I belongs to the range BNDS(TH)>BNDS(TH+1)-1, it may have
|
||||
! been set because it is strongly connected to an entry J belonging to a
|
||||
! different thread.
|
||||
|
||||
!$omp parallel shared(bnds,idxs,locnaggr,ilaggr,nr,naggr,diag,theta,nths,info) &
|
||||
!$omp private(icol,val,myth,kk)
|
||||
block
|
||||
integer(psb_ipk_) :: ii,nlp,k,kp,n,ia,isz, nc, i,j,m, nz, ilg, ip, rsz
|
||||
integer(psb_lpk_) :: itmp
|
||||
!$omp master
|
||||
nths = omp_get_num_threads()
|
||||
allocate(bnds(0:nths),locnaggr(0:nths+1))
|
||||
locnaggr(:) = 0
|
||||
bnds(0) = 1
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
myth = omp_get_thread_num()
|
||||
rsz = nr/nths
|
||||
if (myth < mod(nr,nths)) rsz = rsz + 1
|
||||
bnds(myth+1) = rsz
|
||||
!$omp barrier
|
||||
!$omp master
|
||||
do i=1,nths
|
||||
bnds(i) = bnds(i) + bnds(i-1)
|
||||
end do
|
||||
info = 0
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
|
||||
!$omp do schedule(static) private(disjoint)
|
||||
do kk=0, nths-1
|
||||
step1: do ii=bnds(kk), bnds(kk+1)-1
|
||||
i = idxs(ii)
|
||||
if (info /= 0) cycle step1
|
||||
if ((i<1).or.(i>nr)) then
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
end if
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
nz = (acsr%irp(i+1)-acsr%irp(i))
|
||||
if ((nz<0).or.(nz>size(icol))) then
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
end if
|
||||
|
||||
icol(1:nz) = acsr%ja(acsr%irp(i):acsr%irp(i+1)-1)
|
||||
val(1:nz) = acsr%val(acsr%irp(i):acsr%irp(i+1)-1)
|
||||
|
||||
!
|
||||
! Build the set of all strongly coupled nodes
|
||||
!
|
||||
ip = 0
|
||||
do k=1, nz
|
||||
j = icol(k)
|
||||
! If any of the neighbours is already assigned,
|
||||
! we will not reset.
|
||||
if (j>nr) cycle step1
|
||||
if (ilaggr(j) > 0) cycle step1
|
||||
if (abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))) then
|
||||
ip = ip + 1
|
||||
icol(ip) = icol(k)
|
||||
end if
|
||||
enddo
|
||||
|
||||
!
|
||||
! If the whole strongly coupled neighborhood of I is
|
||||
! as yet unconnected, turn it into the next aggregate.
|
||||
! Same if ip==0 (in which case, neighborhood only
|
||||
! contains I even if it does not look like it from matrix)
|
||||
! The fact that DISJOINT is private and not under lock
|
||||
! generates a certain un-repeatability, in that between
|
||||
! computing DISJOINT and assigning, another thread might
|
||||
! alter the values of ILAGGR.
|
||||
! However, a certain unrepeatability is already present
|
||||
! because the sequence of aggregates is computed with a
|
||||
! different order than in serial mode.
|
||||
! In any case, even if the enteries of ILAGGR may be
|
||||
! overwritten, the important thing is that each entry is
|
||||
! consistent and they generate a correct aggregation map.
|
||||
!
|
||||
disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0)
|
||||
if (disjoint) then
|
||||
locnaggr(kk) = locnaggr(kk) + 1
|
||||
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk
|
||||
if (itmp < (bnds(kk)-1+locnaggr(kk))) then
|
||||
!$omp atomic update
|
||||
info = max(12345678,info)
|
||||
!$omp end atomic
|
||||
cycle step1
|
||||
end if
|
||||
!$omp atomic write
|
||||
ilaggr(i) = itmp
|
||||
!$omp end atomic
|
||||
do k=1, ip
|
||||
!$omp atomic write
|
||||
ilaggr(icol(k)) = itmp
|
||||
!$omp end atomic
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
enddo step1
|
||||
end do
|
||||
!$omp end do
|
||||
|
||||
!$omp master
|
||||
naggr = sum(locnaggr(0:nths-1))
|
||||
do i=1,nths
|
||||
locnaggr(i) = locnaggr(i) + locnaggr(i-1)
|
||||
end do
|
||||
do i=nths+1,1,-1
|
||||
locnaggr(i) = locnaggr(i-1)
|
||||
end do
|
||||
locnaggr(0) = 0
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
!$omp do schedule(static)
|
||||
do kk=0, nths-1
|
||||
do ii=bnds(kk), bnds(kk+1)-1
|
||||
if (ilaggr(ii) > 0) then
|
||||
kp = mod(ilaggr(ii),nths)
|
||||
ilaggr(ii) = (ilaggr(ii)/nths)- (bnds(kp)-1) + locnaggr(kp)
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!$omp end do
|
||||
end block
|
||||
!$omp end parallel
|
||||
end block
|
||||
if (info /= 0) then
|
||||
if (info == 12345678) write(0,*) 'Overflow in encoding ILAGGR'
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
#else
|
||||
icnt = 0
|
||||
step1: do ii=1, nr
|
||||
if (info /= 0) cycle
|
||||
i = idxs(ii)
|
||||
if ((i<1).or.(i>nr)) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
nz = (acsr%irp(i+1)-acsr%irp(i))
|
||||
if ((nz<0).or.(nz>size(icol))) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
icol(1:nz) = acsr%ja(acsr%irp(i):acsr%irp(i+1)-1)
|
||||
@@ -352,7 +176,7 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
!
|
||||
! Build the set of all strongly coupled nodes
|
||||
!
|
||||
ip = 0
|
||||
ip = 0
|
||||
do k=1, nz
|
||||
j = icol(k)
|
||||
if ((1<=j).and.(j<=nr)) then
|
||||
@@ -370,7 +194,8 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
! contains I even if it does not look like it from matrix)
|
||||
!
|
||||
disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0)
|
||||
if (disjoint) then
|
||||
if (disjoint) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
do k=1, ip
|
||||
ilaggr(icol(k)) = naggr
|
||||
@@ -379,22 +204,16 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
endif
|
||||
enddo step1
|
||||
#endif
|
||||
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1:',naggr,count(ilaggr(1:nr) == -(nr+1)), count(ilaggr(1:nr)>0),&
|
||||
& count(ilaggr(1:nr) == -(nr+1))+count(ilaggr(1:nr)>0),nr
|
||||
& ' Check 1:',count(ilaggr == -(nr+1))
|
||||
end if
|
||||
if (do_timings) call psb_toc(idx_soc1_p1)
|
||||
if (do_timings) call psb_tic(idx_soc1_p2)
|
||||
|
||||
!
|
||||
! Phase two: join the neighbours
|
||||
!
|
||||
!$omp workshare
|
||||
tmpaggr = ilaggr
|
||||
!$omp end workshare
|
||||
!$omp parallel do schedule(static) shared(tmpaggr,ilaggr,nr,naggr,diag,theta)&
|
||||
!$omp private(ii,i,j,k,nz,icol,val,ip,cpling)
|
||||
step2: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
@@ -425,15 +244,8 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
end if
|
||||
end do step2
|
||||
!$omp end parallel do
|
||||
if (do_timings) call psb_toc(idx_soc1_p2)
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1.5:',naggr,count(ilaggr(1:nr) == -(nr+1)), count(ilaggr(1:nr)>0),&
|
||||
& count(ilaggr(1:nr) == -(nr+1))+count(ilaggr(1:nr)>0),nr
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_tic(idx_soc1_p3)
|
||||
|
||||
!
|
||||
! Phase three: sweep over leftovers, if any
|
||||
!
|
||||
@@ -462,6 +274,7 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
enddo
|
||||
if (ip > 0) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
ilaggr(i) = naggr
|
||||
do k=1, ip
|
||||
@@ -479,10 +292,7 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end do step3
|
||||
|
||||
! Any leftovers?
|
||||
!$omp parallel do schedule(static) shared(ilaggr,info)&
|
||||
!$omp private(ii,i,j,k,nz,icol,val,ip)
|
||||
do i=1, nr
|
||||
if (info /= 0) cycle
|
||||
if (ilaggr(i) < 0) then
|
||||
nz = (acsr%irp(i+1)-acsr%irp(i))
|
||||
if (nz == 1) then
|
||||
@@ -493,18 +303,15 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
! other processes.
|
||||
ilaggr(i) = -(nrglob+nr)
|
||||
else
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name,a_err='Fatal error: non-singleton leftovers')
|
||||
cycle
|
||||
goto 9999
|
||||
endif
|
||||
end if
|
||||
end do
|
||||
!$omp end parallel do
|
||||
if (info /= 0) goto 9999
|
||||
if (do_timings) call psb_toc(idx_soc1_p3)
|
||||
|
||||
if (naggr > ncol) then
|
||||
!write(0,*) name,'Error : naggr > ncol',naggr,ncol
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: naggr>ncol')
|
||||
goto 9999
|
||||
@@ -529,13 +336,9 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
nlaggr(:) = 0
|
||||
nlaggr(me+1) = naggr
|
||||
call psb_sum(ctxt,nlaggr(1:np))
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 2:',naggr,count(ilaggr(1:nr) == -(nr+1)), count(ilaggr(1:nr)>0),&
|
||||
& count(ilaggr(1:nr) == -(nr+1))+count(ilaggr(1:nr)>0),nr
|
||||
end if
|
||||
|
||||
call acsr%free()
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
+16
-205
@@ -68,12 +68,9 @@
|
||||
!
|
||||
subroutine amg_z_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
use psb_base_mod
|
||||
use psb_base_mod
|
||||
use amg_base_prec_type
|
||||
use amg_z_inner_mod
|
||||
#if defined(OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
|
||||
implicit none
|
||||
|
||||
@@ -102,9 +99,6 @@ subroutine amg_z_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
integer(psb_ipk_) :: np, me
|
||||
integer(psb_ipk_) :: nrow, ncol, n_ne
|
||||
character(len=20) :: name, ch_err
|
||||
integer(psb_ipk_), save :: idx_soc2_p1=-1, idx_soc2_p2=-1, idx_soc2_p3=-1
|
||||
integer(psb_ipk_), save :: idx_soc2_p0=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_soc2_map_bld'
|
||||
@@ -120,14 +114,6 @@ subroutine amg_z_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
nrglob = desc_a%get_global_rows()
|
||||
if ((do_timings).and.(idx_soc2_p0==-1)) &
|
||||
& idx_soc2_p0 = psb_get_timer_idx("SOC2_MAP: phase0")
|
||||
if ((do_timings).and.(idx_soc2_p1==-1)) &
|
||||
& idx_soc2_p1 = psb_get_timer_idx("SOC2_MAP: phase1")
|
||||
if ((do_timings).and.(idx_soc2_p2==-1)) &
|
||||
& idx_soc2_p2 = psb_get_timer_idx("SOC2_MAP: phase2")
|
||||
if ((do_timings).and.(idx_soc2_p3==-1)) &
|
||||
& idx_soc2_p3 = psb_get_timer_idx("SOC2_MAP: phase3")
|
||||
|
||||
nr = a%get_nrows()
|
||||
nc = a%get_ncols()
|
||||
@@ -139,7 +125,6 @@ subroutine amg_z_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_tic(idx_soc2_p0)
|
||||
diag = a%get_diag(info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
@@ -152,217 +137,55 @@ subroutine amg_z_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
!
|
||||
call a%cp_to(muij)
|
||||
if (clean_zeros) call muij%clean_zeros(info)
|
||||
!$omp parallel do private(i,j,k) shared(nr,diag,muij) schedule(static)
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
if (j<= nr) muij%val(k) = abs(muij%val(k))/sqrt(abs(diag(i)*diag(j)))
|
||||
end do
|
||||
end do
|
||||
!$omp end parallel do
|
||||
|
||||
!
|
||||
! Compute the 1-neigbour; mark strong links with +1, weak links with -1
|
||||
!
|
||||
call s_neigh_coo%allocate(nr,nr,muij%get_nzeros())
|
||||
!$omp parallel do private(i,j,k) shared(nr,diag,muij) schedule(static)
|
||||
ip = 0
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
s_neigh_coo%ia(k) = i
|
||||
s_neigh_coo%ja(k) = j
|
||||
if (j<=nr) then
|
||||
ip = ip + 1
|
||||
s_neigh_coo%ia(ip) = i
|
||||
s_neigh_coo%ja(ip) = j
|
||||
if (real(muij%val(k)) >= theta) then
|
||||
s_neigh_coo%val(k) = done
|
||||
s_neigh_coo%val(ip) = done
|
||||
else
|
||||
s_neigh_coo%val(k) = -done
|
||||
s_neigh_coo%val(ip) = -done
|
||||
end if
|
||||
else
|
||||
s_neigh_coo%val(k) = -done
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!$omp end parallel do
|
||||
!write(*,*) 'S_NEIGH: ',nr,ip
|
||||
call s_neigh_coo%set_nzeros(muij%get_nzeros())
|
||||
call s_neigh_coo%set_nzeros(ip)
|
||||
call s_neigh%mv_from_coo(s_neigh_coo,info)
|
||||
|
||||
if (iorder == amg_aggr_ord_nat_) then
|
||||
|
||||
!$omp parallel do private(i) shared(ilaggr,idxs) schedule(static)
|
||||
if (iorder == amg_aggr_ord_nat_) then
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
idxs(i) = i
|
||||
end do
|
||||
!$omp end parallel do
|
||||
else
|
||||
!$omp parallel do private(i) shared(ilaggr,idxs,muij) schedule(static)
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
ideg(i) = muij%irp(i+1) - muij%irp(i)
|
||||
end do
|
||||
!$omp end parallel do
|
||||
call psb_msort(ideg,ix=idxs,dir=psb_sort_down_)
|
||||
end if
|
||||
|
||||
if (do_timings) call psb_toc(idx_soc2_p0)
|
||||
if (do_timings) call psb_tic(idx_soc2_p1)
|
||||
|
||||
!
|
||||
! Phase one: Start with disjoint groups.
|
||||
!
|
||||
naggr = 0
|
||||
#if defined(OPENMP)
|
||||
block
|
||||
integer(psb_ipk_), allocatable :: bnds(:), locnaggr(:)
|
||||
integer(psb_ipk_) :: myth,nths, kk
|
||||
! The parallelization makes use of a locaggr(:) array; each thread
|
||||
! keeps its own version of naggr, and when the loop ends, a prefix is applied
|
||||
! to locnaggr to determine:
|
||||
! 1. The total number of aggregaters NAGGR;
|
||||
! 2. How much should each thread shift its own aggregates
|
||||
! Part 2 requires to keep track of which thread defined each entry
|
||||
! of ilaggr(), so that each entry can be adjusted correctly: even
|
||||
! if an entry I belongs to the range BNDS(TH)>BNDS(TH+1)-1, it may have
|
||||
! been set because it is strongly connected to an entry J belonging to a
|
||||
! different thread.
|
||||
|
||||
!$omp parallel shared(s_neigh,bnds,idxs,locnaggr,ilaggr,nr,naggr,diag,theta,nths,info) &
|
||||
!$omp private(icol,val,myth,kk)
|
||||
block
|
||||
integer(psb_ipk_) :: ii,nlp,k,kp,n,ia,isz,nc,i,j,m,nz,ilg,ip,rsz,ip1,nzcnt
|
||||
integer(psb_lpk_) :: itmp
|
||||
!$omp master
|
||||
nths = omp_get_num_threads()
|
||||
allocate(bnds(0:nths),locnaggr(0:nths+1))
|
||||
locnaggr(:) = 0
|
||||
bnds(0) = 1
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
myth = omp_get_thread_num()
|
||||
rsz = nr/nths
|
||||
if (myth < mod(nr,nths)) rsz = rsz + 1
|
||||
bnds(myth+1) = rsz
|
||||
!$omp barrier
|
||||
!$omp master
|
||||
do i=1,nths
|
||||
bnds(i) = bnds(i) + bnds(i-1)
|
||||
end do
|
||||
info = 0
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
|
||||
!$omp do schedule(static) private(disjoint)
|
||||
do kk=0, nths-1
|
||||
step1: do ii=bnds(kk), bnds(kk+1)-1
|
||||
i = idxs(ii)
|
||||
if (info /= 0) then
|
||||
write(0,*) ' Step1:',kk,ii,i,info
|
||||
cycle step1
|
||||
end if
|
||||
if ((i<1).or.(i>nr)) then
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name)
|
||||
cycle step1
|
||||
!goto 9999
|
||||
end if
|
||||
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
!
|
||||
! Get the 1-neighbourhood of I
|
||||
!
|
||||
ip1 = s_neigh%irp(i)
|
||||
nz = s_neigh%irp(i+1)-ip1
|
||||
!
|
||||
! If the neighbourhood only contains I, skip it
|
||||
!
|
||||
if (nz ==0) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
if ((nz==1).and.(s_neigh%ja(ip1)==i)) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
|
||||
nzcnt = count(real(s_neigh%val(ip1:ip1+nz-1)) > 0)
|
||||
icol(1:nzcnt) = pack(s_neigh%ja(ip1:ip1+nz-1),(real(s_neigh%val(ip1:ip1+nz-1)) > 0))
|
||||
disjoint = all(ilaggr(icol(1:nzcnt)) == -(nr+1))
|
||||
|
||||
!
|
||||
! If the whole strongly coupled neighborhood of I is
|
||||
! as yet unconnected, turn it into the next aggregate.
|
||||
! Same if ip==0 (in which case, neighborhood only
|
||||
! contains I even if it does not look like it from matrix)
|
||||
! The fact that DISJOINT is private and not under lock
|
||||
! generates a certain un-repeatability, in that between
|
||||
! computing DISJOINT and assigning, another thread might
|
||||
! alter the values of ILAGGR.
|
||||
! However, a certain unrepeatability is already present
|
||||
! because the sequence of aggregates is computed with a
|
||||
! different order than in serial mode.
|
||||
! In any case, even if the enteries of ILAGGR may be
|
||||
! overwritten, the important thing is that each entry is
|
||||
! consistent and they generate a correct aggregation map.
|
||||
!
|
||||
if (disjoint) then
|
||||
locnaggr(kk) = locnaggr(kk) + 1
|
||||
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk
|
||||
if (itmp < (bnds(kk)-1+locnaggr(kk))) then
|
||||
!$omp atomic update
|
||||
info = max(12345678,info)
|
||||
!$omp end atomic
|
||||
cycle step1
|
||||
end if
|
||||
!$omp atomic write
|
||||
ilaggr(i) = itmp
|
||||
!$omp end atomic
|
||||
do k=1, nzcnt
|
||||
!$omp atomic write
|
||||
ilaggr(icol(k)) = itmp
|
||||
!$omp end atomic
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
enddo step1
|
||||
end do
|
||||
!$omp end do
|
||||
|
||||
!$omp master
|
||||
naggr = sum(locnaggr(0:nths-1))
|
||||
do i=1,nths
|
||||
locnaggr(i) = locnaggr(i) + locnaggr(i-1)
|
||||
end do
|
||||
do i=nths+1,1,-1
|
||||
locnaggr(i) = locnaggr(i-1)
|
||||
end do
|
||||
locnaggr(0) = 0
|
||||
!write(0,*) 'LNAG ',locnaggr(nths+1)
|
||||
!$omp end master
|
||||
!$omp barrier
|
||||
!$omp do schedule(static)
|
||||
do kk=0, nths-1
|
||||
do ii=bnds(kk), bnds(kk+1)-1
|
||||
if (ilaggr(ii) > 0) then
|
||||
kp = mod(ilaggr(ii),nths)
|
||||
ilaggr(ii) = (ilaggr(ii)/nths)- (bnds(kp)-1) + locnaggr(kp)
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!$omp end do
|
||||
end block
|
||||
!$omp end parallel
|
||||
end block
|
||||
if (info /= 0) then
|
||||
if (info == 12345678) write(0,*) 'Overflow in encoding ILAGGR'
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
#else
|
||||
icnt = 0
|
||||
step1: do ii=1, nr
|
||||
i = idxs(ii)
|
||||
@@ -401,21 +224,16 @@ subroutine amg_z_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
endif
|
||||
enddo step1
|
||||
#endif
|
||||
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1:',count(ilaggr == -(nr+1))
|
||||
end if
|
||||
if (do_timings) call psb_toc(idx_soc2_p1)
|
||||
if (do_timings) call psb_tic(idx_soc2_p2)
|
||||
|
||||
!
|
||||
! Phase two: join the neighbours
|
||||
!
|
||||
!$omp workshare
|
||||
tmpaggr = ilaggr
|
||||
!$omp end workshare
|
||||
!$omp parallel do schedule(static) shared(tmpaggr,ilaggr,nr,naggr,diag,muij,s_neigh)&
|
||||
!$omp private(ii,i,j,k,nz,icol,val,ip,cpling)
|
||||
step2: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
@@ -441,9 +259,8 @@ subroutine amg_z_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end if
|
||||
end if
|
||||
end do step2
|
||||
!$omp end parallel do
|
||||
if (do_timings) call psb_toc(idx_soc2_p2)
|
||||
if (do_timings) call psb_tic(idx_soc2_p3)
|
||||
|
||||
|
||||
!
|
||||
! Phase three: sweep over leftovers, if any
|
||||
!
|
||||
@@ -477,8 +294,6 @@ subroutine amg_z_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
end do step3
|
||||
|
||||
! Any leftovers?
|
||||
!$omp parallel do schedule(static) shared(ilaggr,s_neigh,info)&
|
||||
!$omp private(ii,i,j,k)
|
||||
do i=1, nr
|
||||
if (ilaggr(i) <= 0) then
|
||||
nz = (s_neigh%irp(i+1)-s_neigh%irp(i))
|
||||
@@ -490,17 +305,13 @@ subroutine amg_z_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
|
||||
! other processes.
|
||||
ilaggr(i) = -(nrglob+nr)
|
||||
else
|
||||
!$omp atomic write
|
||||
info=psb_err_internal_error_
|
||||
!$omp end atomic
|
||||
call psb_errpush(info,name,a_err='Fatal error: non-singleton leftovers')
|
||||
cycle
|
||||
goto 9999
|
||||
endif
|
||||
end if
|
||||
end do
|
||||
!$omp end parallel do
|
||||
if (info /= 0) goto 9999
|
||||
if (do_timings) call psb_toc(idx_soc2_p3)
|
||||
|
||||
if (naggr > ncol) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: naggr>ncol')
|
||||
@@ -0,0 +1,117 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "psb_base_cbind.h"
|
||||
#include "MatchingAlgorithms.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
psb_i_t dnew_Match_If(psb_i_t ipar, psb_i_t matching, psb_d_t lambda,
|
||||
psb_i_t nr, psb_i_t irp[], psb_i_t ja[],
|
||||
psb_d_t val[], psb_d_t diag[],
|
||||
psb_d_t w[], psb_i_t mate[]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
psb_i_t dnew_Match_If(psb_i_t ipar, psb_i_t matching, psb_d_t lambda,
|
||||
psb_i_t nr, psb_i_t irp[], psb_i_t ja[],
|
||||
psb_d_t val[], psb_d_t diag[], psb_d_t w[],
|
||||
psb_i_t mate[])
|
||||
{
|
||||
psb_i_t info;
|
||||
psb_i_t i,j,k;
|
||||
psb_i_t ftcoarse=1;
|
||||
psb_i_t cr_it=0, cr_relax_type=0;
|
||||
psb_d_t cr_relax_weight=0.0;
|
||||
|
||||
vector<NODE_T> s;
|
||||
vector<NODE_T> t;
|
||||
vector<VAL_T> weights;
|
||||
vector<NODE_T> mateNode;
|
||||
NODE_T u,v;
|
||||
VAL_T weight;
|
||||
psb_i_t preprocess = matching; // 0 no greedy 1 greedy
|
||||
psb_i_t romaInput = ipar; // 1 sequential 2 parallel
|
||||
// VAL_T lambda = 2; // positive real value
|
||||
psb_d_t aii, ajj, aij, wii, wjj, tmp1, tmp2, minabs, edgnrm;
|
||||
psb_i_t nt; // number of threads, got with 1 for testing purposes.
|
||||
psb_d_t timeDiff;
|
||||
MatchStat pstat;
|
||||
double eps=1e-16;
|
||||
double minweight,maxweight;
|
||||
char *numthreadsenv;
|
||||
|
||||
numthreadsenv=getenv("OMP_NUM_THREADS");
|
||||
if (numthreadsenv) {
|
||||
sscanf(numthreadsenv,"%d",&nt);
|
||||
} else {
|
||||
nt = 1;
|
||||
}
|
||||
|
||||
minabs = 1e300;
|
||||
// fprintf(stderr,"Sanity check: %d %d \n",nr,nc);
|
||||
k=0;
|
||||
for (i=1; i<nr; i++) {
|
||||
for (j=irp[i-1]; j<irp[i]; j++) {
|
||||
v = i-1; // I
|
||||
u = ja[j-1] - 1; // J
|
||||
if (v>u) {
|
||||
// Define Ahat entry
|
||||
aij = val[j-1];
|
||||
aii = diag[v];
|
||||
ajj = diag[u];
|
||||
wii = w[v];
|
||||
wjj = w[u];
|
||||
edgnrm = aii*(wii*wii) + ajj*(wjj*wjj);
|
||||
if (edgnrm > eps) {
|
||||
weight = abs(1.0 - (2*1.0*aij*wii*wjj)/(aii*(wii*wii) + ajj*(wjj*wjj)));
|
||||
} else {
|
||||
weight = eps;
|
||||
}
|
||||
//
|
||||
s.push_back(u);
|
||||
t.push_back(v);
|
||||
weights.push_back(weight);
|
||||
k = k + 1 ;
|
||||
if (weight<minabs) minabs=weight;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
maxweight = eps;
|
||||
minweight = 1e300;
|
||||
//fprintf(stderr,"minabs %g\n",minabs);
|
||||
for (i=0; i<k; i++) {
|
||||
weights[i] = log(weights[i]/(0.999*minabs));
|
||||
if (weights[i]>maxweight) maxweight=weights[i];
|
||||
if (weights[i]<minweight) minweight=weights[i];
|
||||
}
|
||||
|
||||
if (lambda<0.0){
|
||||
lambda = maxweight-2.0*minweight+eps;
|
||||
if (lambda<0.0) lambda=eps;
|
||||
} else if (lambda >= 0 && lambda <= 1.0){
|
||||
lambda = lambda*eps + (1.0-lambda)*(fmax(maxweight-2.0*minweight,0.0) );
|
||||
}
|
||||
//fprintf(stderr,"Calling matching: pre %d nt %d lambda %g %g %g\n",
|
||||
// preprocess,nt,lambda,maxweight,minweight);
|
||||
|
||||
runRomaWrapper(s,t,weights, nr, mateNode,preprocess,romaInput,lambda ,nt, pstat, timeDiff);
|
||||
/* loop here only makes sense when nr==nz */
|
||||
for (i=0; i< nr; i++) {
|
||||
//fprintf(stderr,"From runRomaWrapper: %d %d\n",i,mateNode[i]);
|
||||
if (mateNode[i]>=0) {
|
||||
mate[i] = mateNode[i]+1;
|
||||
} else {
|
||||
mate[i] = mateNode[i];
|
||||
//fprintf(stderr,"From runRomaWrapper: %d %d\n",i,mateNode[i]);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
@@ -336,8 +336,7 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: ilev_, nlev_,val,ilmax_, il
|
||||
character(len=*), parameter :: name='amg_precsetc'
|
||||
logical :: hier_asb
|
||||
|
||||
|
||||
info = psb_success_
|
||||
|
||||
if (.not.allocated(p%precv)) then
|
||||
@@ -460,7 +459,6 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
return
|
||||
end if
|
||||
if (nlev_ > 1) then
|
||||
hier_asb = p%precv(nlev_)%ac%is_asb()
|
||||
select case (psb_toupper(string))
|
||||
case('BJAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
@@ -471,11 +469,7 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
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_)
|
||||
@@ -485,91 +479,55 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
|
||||
case('SLU')
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('ILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('ILUT')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MUMPS')
|
||||
#if defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('UMF')
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
|
||||
@@ -577,69 +535,42 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('JACOBI','JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
|
||||
case('L1-JACOBI','L1-JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('GS','FBGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('BWGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('L1-GS','L1-FBGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('KRM')
|
||||
block
|
||||
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)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
end block
|
||||
end select
|
||||
@@ -679,16 +610,11 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
|
||||
case('COARSE_MAT')
|
||||
if (nlev_ > 1) then
|
||||
hier_asb = p%precv(nlev_)%ac%is_asb()
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_stringval(string))
|
||||
call p%precv(nlev_)%set('COARSE_MAT',string,info,pos=pos)
|
||||
end if
|
||||
|
||||
case('COARSE_SOLVE')
|
||||
if (nlev_ > 1) then
|
||||
hier_asb = p%precv(nlev_)%ac%is_asb()
|
||||
call p%precv(nlev_)%set('COARSE_SOLVE',string,info,pos=pos)
|
||||
select case (psb_toupper(trim(string)))
|
||||
case('BJAC')
|
||||
@@ -700,9 +626,6 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
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)
|
||||
@@ -713,91 +636,55 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
|
||||
case('SLU')
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('ILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('ILUT')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MUMPS')
|
||||
#if defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('UMF')
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
|
||||
@@ -805,69 +692,42 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('JACOBI','JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
|
||||
case('L1-JACOBI','L1-JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('GS','FBGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('BWGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('L1-FBGS','L1-GS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('KRM')
|
||||
block
|
||||
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)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
end block
|
||||
end select
|
||||
|
||||
@@ -237,6 +237,7 @@ subroutine amg_cprecinit(ctxt,prec,ptype,info)
|
||||
#else
|
||||
call prec%set('COARSE_SOLVE','ILU',info)
|
||||
#endif
|
||||
|
||||
case default
|
||||
write(psb_err_unit,*) name,&
|
||||
&': Warning: Unknown preconditioner type request "',ptype,'"'
|
||||
|
||||
@@ -348,8 +348,7 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: ilev_, nlev_,val,ilmax_, il
|
||||
character(len=*), parameter :: name='amg_precsetc'
|
||||
logical :: hier_asb
|
||||
|
||||
|
||||
info = psb_success_
|
||||
|
||||
if (.not.allocated(p%precv)) then
|
||||
@@ -472,7 +471,6 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
return
|
||||
end if
|
||||
if (nlev_ > 1) then
|
||||
hier_asb = p%precv(nlev_)%ac%is_asb()
|
||||
select case (psb_toupper(string))
|
||||
case('BJAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
@@ -485,11 +483,7 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
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_)
|
||||
@@ -501,98 +495,59 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
|
||||
case('SLU')
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('ILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('ILUT')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MUMPS')
|
||||
#if defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('UMF')
|
||||
#if defined(HAVE_UMF_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
|
||||
@@ -600,83 +555,50 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#if defined(HAVE_SLUDIST_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_sludist_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_UMF_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('JACOBI','JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
|
||||
case('L1-JACOBI','L1-JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('GS','FBGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('BWGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('L1-GS','L1-FBGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('KRM')
|
||||
block
|
||||
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)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
end block
|
||||
end select
|
||||
@@ -716,16 +638,11 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
|
||||
case('COARSE_MAT')
|
||||
if (nlev_ > 1) then
|
||||
hier_asb = p%precv(nlev_)%ac%is_asb()
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_stringval(string))
|
||||
call p%precv(nlev_)%set('COARSE_MAT',string,info,pos=pos)
|
||||
end if
|
||||
|
||||
case('COARSE_SOLVE')
|
||||
if (nlev_ > 1) then
|
||||
hier_asb = p%precv(nlev_)%ac%is_asb()
|
||||
call p%precv(nlev_)%set('COARSE_SOLVE',string,info,pos=pos)
|
||||
select case (psb_toupper(trim(string)))
|
||||
case('BJAC')
|
||||
@@ -739,9 +656,6 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
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)
|
||||
@@ -754,98 +668,59 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
|
||||
case('SLU')
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('ILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('ILUT')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MUMPS')
|
||||
#if defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('UMF')
|
||||
#if defined(HAVE_UMF_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
|
||||
@@ -853,83 +728,50 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#if defined(HAVE_SLUDIST_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_sludist_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_UMF_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('JACOBI','JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
|
||||
case('L1-JACOBI','L1-JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('GS','FBGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('BWGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('L1-FBGS','L1-GS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('KRM')
|
||||
block
|
||||
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)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
end block
|
||||
end select
|
||||
|
||||
@@ -242,6 +242,7 @@ subroutine amg_dprecinit(ctxt,prec,ptype,info)
|
||||
#else
|
||||
call prec%set('COARSE_SOLVE','ILU',info)
|
||||
#endif
|
||||
|
||||
case default
|
||||
write(psb_err_unit,*) name,&
|
||||
&': Warning: Unknown preconditioner type request "',ptype,'"'
|
||||
|
||||
@@ -336,8 +336,7 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: ilev_, nlev_,val,ilmax_, il
|
||||
character(len=*), parameter :: name='amg_precsetc'
|
||||
logical :: hier_asb
|
||||
|
||||
|
||||
info = psb_success_
|
||||
|
||||
if (.not.allocated(p%precv)) then
|
||||
@@ -460,7 +459,6 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
return
|
||||
end if
|
||||
if (nlev_ > 1) then
|
||||
hier_asb = p%precv(nlev_)%ac%is_asb()
|
||||
select case (psb_toupper(string))
|
||||
case('BJAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
@@ -471,11 +469,7 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
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_)
|
||||
@@ -485,91 +479,55 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
|
||||
case('SLU')
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('ILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('ILUT')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MUMPS')
|
||||
#if defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('UMF')
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
|
||||
@@ -577,69 +535,42 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('JACOBI','JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
|
||||
case('L1-JACOBI','L1-JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('GS','FBGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('BWGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('L1-GS','L1-FBGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('KRM')
|
||||
block
|
||||
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)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
end block
|
||||
end select
|
||||
@@ -679,16 +610,11 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
|
||||
case('COARSE_MAT')
|
||||
if (nlev_ > 1) then
|
||||
hier_asb = p%precv(nlev_)%ac%is_asb()
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_stringval(string))
|
||||
call p%precv(nlev_)%set('COARSE_MAT',string,info,pos=pos)
|
||||
end if
|
||||
|
||||
case('COARSE_SOLVE')
|
||||
if (nlev_ > 1) then
|
||||
hier_asb = p%precv(nlev_)%ac%is_asb()
|
||||
call p%precv(nlev_)%set('COARSE_SOLVE',string,info,pos=pos)
|
||||
select case (psb_toupper(trim(string)))
|
||||
case('BJAC')
|
||||
@@ -700,9 +626,6 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
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)
|
||||
@@ -713,91 +636,55 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
|
||||
case('SLU')
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('ILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('ILUT')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MUMPS')
|
||||
#if defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('UMF')
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
|
||||
@@ -805,69 +692,42 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('JACOBI','JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
|
||||
case('L1-JACOBI','L1-JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('GS','FBGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('BWGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('L1-FBGS','L1-GS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('KRM')
|
||||
block
|
||||
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)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
end block
|
||||
end select
|
||||
|
||||
@@ -237,6 +237,7 @@ subroutine amg_sprecinit(ctxt,prec,ptype,info)
|
||||
#else
|
||||
call prec%set('COARSE_SOLVE','ILU',info)
|
||||
#endif
|
||||
|
||||
case default
|
||||
write(psb_err_unit,*) name,&
|
||||
&': Warning: Unknown preconditioner type request "',ptype,'"'
|
||||
|
||||
@@ -348,8 +348,7 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: ilev_, nlev_,val,ilmax_, il
|
||||
character(len=*), parameter :: name='amg_precsetc'
|
||||
logical :: hier_asb
|
||||
|
||||
|
||||
info = psb_success_
|
||||
|
||||
if (.not.allocated(p%precv)) then
|
||||
@@ -472,7 +471,6 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
return
|
||||
end if
|
||||
if (nlev_ > 1) then
|
||||
hier_asb = p%precv(nlev_)%ac%is_asb()
|
||||
select case (psb_toupper(string))
|
||||
case('BJAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
@@ -485,11 +483,7 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
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_)
|
||||
@@ -501,98 +495,59 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
|
||||
case('SLU')
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('ILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('ILUT')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MUMPS')
|
||||
#if defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('UMF')
|
||||
#if defined(HAVE_UMF_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
|
||||
@@ -600,83 +555,50 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#if defined(HAVE_SLUDIST_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_sludist_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_UMF_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('JACOBI','JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
|
||||
case('L1-JACOBI','L1-JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('GS','FBGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('BWGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('L1-GS','L1-FBGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('KRM')
|
||||
block
|
||||
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)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
end block
|
||||
end select
|
||||
@@ -716,16 +638,11 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
|
||||
case('COARSE_MAT')
|
||||
if (nlev_ > 1) then
|
||||
hier_asb = p%precv(nlev_)%ac%is_asb()
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_stringval(string))
|
||||
call p%precv(nlev_)%set('COARSE_MAT',string,info,pos=pos)
|
||||
end if
|
||||
|
||||
case('COARSE_SOLVE')
|
||||
if (nlev_ > 1) then
|
||||
hier_asb = p%precv(nlev_)%ac%is_asb()
|
||||
call p%precv(nlev_)%set('COARSE_SOLVE',string,info,pos=pos)
|
||||
select case (psb_toupper(trim(string)))
|
||||
case('BJAC')
|
||||
@@ -739,9 +656,6 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
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)
|
||||
@@ -754,98 +668,59 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
#endif
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info)
|
||||
case('SLU')
|
||||
#if defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('ILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('ILUT')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MILU')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
case('MUMPS')
|
||||
#if defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('UMF')
|
||||
#if defined(HAVE_UMF_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
|
||||
@@ -853,83 +728,50 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
#if defined(HAVE_SLUDIST_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_sludist_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_UMF_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_SLU_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_repl_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos)
|
||||
#elif defined(HAVE_MUMPS_)
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#else
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
#endif
|
||||
case('JACOBI','JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
|
||||
case('L1-JACOBI','L1-JAC')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('GS','FBGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('BWGS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('L1-FBGS','L1-GS')
|
||||
call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos)
|
||||
call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
case('KRM')
|
||||
block
|
||||
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)
|
||||
if (hier_asb) &
|
||||
& call amg_warn_coarse_mat(p%precv(nlev_)%parms%get_coarse_mat(),&
|
||||
& amg_distr_mat_)
|
||||
call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos)
|
||||
end block
|
||||
end select
|
||||
|
||||
@@ -242,6 +242,7 @@ subroutine amg_zprecinit(ctxt,prec,ptype,info)
|
||||
#else
|
||||
call prec%set('COARSE_SOLVE','ILU',info)
|
||||
#endif
|
||||
|
||||
case default
|
||||
write(psb_err_unit,*) name,&
|
||||
&': Warning: Unknown preconditioner type request "',ptype,'"'
|
||||
|
||||
@@ -17,7 +17,6 @@ amg_c_base_onelev_csetr.o \
|
||||
amg_c_base_onelev_descr.o \
|
||||
amg_c_base_onelev_dump.o \
|
||||
amg_c_base_onelev_free.o \
|
||||
amg_c_base_onelev_free_smoothers.o \
|
||||
amg_c_base_onelev_mat_asb.o \
|
||||
amg_c_base_onelev_setag.o \
|
||||
amg_c_base_onelev_setsm.o \
|
||||
@@ -33,7 +32,6 @@ amg_d_base_onelev_csetr.o \
|
||||
amg_d_base_onelev_descr.o \
|
||||
amg_d_base_onelev_dump.o \
|
||||
amg_d_base_onelev_free.o \
|
||||
amg_d_base_onelev_free_smoothers.o \
|
||||
amg_d_base_onelev_mat_asb.o \
|
||||
amg_d_base_onelev_setag.o \
|
||||
amg_d_base_onelev_setsm.o \
|
||||
@@ -49,7 +47,6 @@ amg_s_base_onelev_csetr.o \
|
||||
amg_s_base_onelev_descr.o \
|
||||
amg_s_base_onelev_dump.o \
|
||||
amg_s_base_onelev_free.o \
|
||||
amg_s_base_onelev_free_smoothers.o \
|
||||
amg_s_base_onelev_mat_asb.o \
|
||||
amg_s_base_onelev_setag.o \
|
||||
amg_s_base_onelev_setsm.o \
|
||||
@@ -65,7 +62,6 @@ amg_z_base_onelev_csetr.o \
|
||||
amg_z_base_onelev_descr.o \
|
||||
amg_z_base_onelev_dump.o \
|
||||
amg_z_base_onelev_free.o \
|
||||
amg_z_base_onelev_free_smoothers.o \
|
||||
amg_z_base_onelev_mat_asb.o \
|
||||
amg_z_base_onelev_setag.o \
|
||||
amg_z_base_onelev_setsm.o \
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
!
|
||||
!
|
||||
! 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
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_c_base_onelev_free_smoothers(lv,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_onelev_mod, amg_protect_name => amg_c_base_onelev_free_smoothers
|
||||
implicit none
|
||||
|
||||
class(amg_c_onelev_type), intent(inout) :: lv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
info = psb_success_
|
||||
|
||||
! We might just deallocate the top level array, except
|
||||
! that there may be inner objects containing C pointers,
|
||||
! e.g. UMFPACK, SLU or CUDA stuff.
|
||||
! We really need FINALs.
|
||||
if (allocated(lv%sm)) &
|
||||
& call lv%sm%free(info)
|
||||
|
||||
if (allocated(lv%sm2a)) &
|
||||
& call lv%sm2a%free(info)
|
||||
|
||||
end subroutine amg_c_base_onelev_free_smoothers
|
||||
@@ -43,6 +43,7 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
use amg_d_dec_aggregator_mod
|
||||
use amg_d_symdec_aggregator_mod
|
||||
use amg_d_parmatch_aggregator_mod
|
||||
use amg_d_newmatch_aggregator_mod
|
||||
use amg_d_jac_smoother
|
||||
use amg_d_as_smoother
|
||||
use amg_d_diag_solver
|
||||
@@ -252,8 +253,6 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
lv%parms%ml_cycle = amg_stringval(val)
|
||||
|
||||
case ('PAR_AGGR_ALG')
|
||||
ival = amg_stringval(val)
|
||||
lv%parms%par_aggr_alg = ival
|
||||
if (allocated(lv%aggr)) then
|
||||
call lv%aggr%free(info)
|
||||
if (info == 0) deallocate(lv%aggr,stat=info)
|
||||
@@ -263,6 +262,9 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
end if
|
||||
end if
|
||||
|
||||
ival = amg_stringval(val)
|
||||
lv%parms%par_aggr_alg = ival
|
||||
|
||||
select case(val)
|
||||
case('DEC')
|
||||
allocate(amg_d_dec_aggregator_type :: lv%aggr, stat=info)
|
||||
@@ -270,9 +272,12 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
allocate(amg_d_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||
case('COUP','COUPLED')
|
||||
allocate(amg_d_parmatch_aggregator_type :: lv%aggr, stat=info)
|
||||
case('NEWMTC')
|
||||
allocate(amg_d_newmatch_aggregator_type :: lv%aggr, stat=info)
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info == psb_success_) call lv%aggr%default()
|
||||
|
||||
case ('AGGR_ORD')
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
!
|
||||
!
|
||||
! 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
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_base_onelev_free_smoothers(lv,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_onelev_mod, amg_protect_name => amg_d_base_onelev_free_smoothers
|
||||
implicit none
|
||||
|
||||
class(amg_d_onelev_type), intent(inout) :: lv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
info = psb_success_
|
||||
|
||||
! We might just deallocate the top level array, except
|
||||
! that there may be inner objects containing C pointers,
|
||||
! e.g. UMFPACK, SLU or CUDA stuff.
|
||||
! We really need FINALs.
|
||||
if (allocated(lv%sm)) &
|
||||
& call lv%sm%free(info)
|
||||
|
||||
if (allocated(lv%sm2a)) &
|
||||
& call lv%sm2a%free(info)
|
||||
|
||||
end subroutine amg_d_base_onelev_free_smoothers
|
||||
@@ -1,60 +0,0 @@
|
||||
!
|
||||
!
|
||||
! 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
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_s_base_onelev_free_smoothers(lv,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_onelev_mod, amg_protect_name => amg_s_base_onelev_free_smoothers
|
||||
implicit none
|
||||
|
||||
class(amg_s_onelev_type), intent(inout) :: lv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
info = psb_success_
|
||||
|
||||
! We might just deallocate the top level array, except
|
||||
! that there may be inner objects containing C pointers,
|
||||
! e.g. UMFPACK, SLU or CUDA stuff.
|
||||
! We really need FINALs.
|
||||
if (allocated(lv%sm)) &
|
||||
& call lv%sm%free(info)
|
||||
|
||||
if (allocated(lv%sm2a)) &
|
||||
& call lv%sm2a%free(info)
|
||||
|
||||
end subroutine amg_s_base_onelev_free_smoothers
|
||||
@@ -1,60 +0,0 @@
|
||||
!
|
||||
!
|
||||
! 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
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_z_base_onelev_free_smoothers(lv,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_z_onelev_mod, amg_protect_name => amg_z_base_onelev_free_smoothers
|
||||
implicit none
|
||||
|
||||
class(amg_z_onelev_type), intent(inout) :: lv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
info = psb_success_
|
||||
|
||||
! We might just deallocate the top level array, except
|
||||
! that there may be inner objects containing C pointers,
|
||||
! e.g. UMFPACK, SLU or CUDA stuff.
|
||||
! We really need FINALs.
|
||||
if (allocated(lv%sm)) &
|
||||
& call lv%sm%free(info)
|
||||
|
||||
if (allocated(lv%sm2a)) &
|
||||
& call lv%sm2a%free(info)
|
||||
|
||||
end subroutine amg_z_base_onelev_free_smoothers
|
||||
@@ -197,7 +197,6 @@ amg_z_mumps_solver_bld.o \
|
||||
amg_s_ainv_solver_bld.o \
|
||||
amg_s_ainv_solver_check.o \
|
||||
amg_s_ainv_solver_clone.o \
|
||||
amg_s_ainv_solver_clone_settings.o \
|
||||
amg_s_ainv_solver_csetc.o \
|
||||
amg_s_ainv_solver_cseti.o \
|
||||
amg_s_ainv_solver_csetr.o \
|
||||
@@ -205,7 +204,6 @@ amg_s_ainv_solver_descr.o \
|
||||
amg_d_ainv_solver_bld.o \
|
||||
amg_d_ainv_solver_check.o \
|
||||
amg_d_ainv_solver_clone.o \
|
||||
amg_d_ainv_solver_clone_settings.o \
|
||||
amg_d_ainv_solver_csetc.o \
|
||||
amg_d_ainv_solver_cseti.o \
|
||||
amg_d_ainv_solver_csetr.o \
|
||||
@@ -213,7 +211,6 @@ amg_d_ainv_solver_descr.o \
|
||||
amg_c_ainv_solver_bld.o \
|
||||
amg_c_ainv_solver_check.o \
|
||||
amg_c_ainv_solver_clone.o \
|
||||
amg_c_ainv_solver_clone_settings.o \
|
||||
amg_c_ainv_solver_csetc.o \
|
||||
amg_c_ainv_solver_cseti.o \
|
||||
amg_c_ainv_solver_csetr.o \
|
||||
@@ -221,7 +218,6 @@ amg_c_ainv_solver_descr.o \
|
||||
amg_z_ainv_solver_bld.o \
|
||||
amg_z_ainv_solver_check.o \
|
||||
amg_z_ainv_solver_clone.o \
|
||||
amg_z_ainv_solver_clone_settings.o \
|
||||
amg_z_ainv_solver_csetc.o \
|
||||
amg_z_ainv_solver_cseti.o \
|
||||
amg_z_ainv_solver_csetr.o \
|
||||
@@ -253,53 +249,45 @@ amg_z_base_ainv_update_a.o \
|
||||
amg_d_invt_solver_bld.o \
|
||||
amg_d_invt_solver_check.o \
|
||||
amg_d_invt_solver_clone.o \
|
||||
amg_d_invt_solver_clone_settings.o \
|
||||
amg_d_invt_solver_cseti.o \
|
||||
amg_d_invt_solver_csetr.o \
|
||||
amg_d_invt_solver_descr.o \
|
||||
amg_d_invk_solver_bld.o \
|
||||
amg_d_invk_solver_check.o \
|
||||
amg_d_invk_solver_clone.o \
|
||||
amg_d_invk_solver_clone_settings.o \
|
||||
amg_d_invk_solver_cseti.o \
|
||||
amg_d_invk_solver_descr.o \
|
||||
amg_s_invt_solver_bld.o \
|
||||
amg_s_invt_solver_check.o \
|
||||
amg_s_invt_solver_clone.o \
|
||||
amg_s_invt_solver_clone_settings.o \
|
||||
amg_s_invt_solver_cseti.o \
|
||||
amg_s_invt_solver_csetr.o \
|
||||
amg_s_invt_solver_descr.o \
|
||||
amg_s_invk_solver_bld.o \
|
||||
amg_s_invk_solver_check.o \
|
||||
amg_s_invk_solver_clone.o \
|
||||
amg_s_invk_solver_clone_settings.o \
|
||||
amg_s_invk_solver_cseti.o \
|
||||
amg_s_invk_solver_descr.o \
|
||||
amg_c_invt_solver_bld.o \
|
||||
amg_c_invt_solver_check.o \
|
||||
amg_c_invt_solver_clone.o \
|
||||
amg_c_invt_solver_clone_settings.o \
|
||||
amg_c_invt_solver_cseti.o \
|
||||
amg_c_invt_solver_csetr.o \
|
||||
amg_c_invt_solver_descr.o \
|
||||
amg_c_invk_solver_bld.o \
|
||||
amg_c_invk_solver_check.o \
|
||||
amg_c_invk_solver_clone.o \
|
||||
amg_c_invk_solver_clone_settings.o \
|
||||
amg_c_invk_solver_cseti.o \
|
||||
amg_c_invk_solver_descr.o \
|
||||
amg_z_invt_solver_bld.o \
|
||||
amg_z_invt_solver_check.o \
|
||||
amg_z_invt_solver_clone.o \
|
||||
amg_z_invt_solver_clone_settings.o \
|
||||
amg_z_invt_solver_cseti.o \
|
||||
amg_z_invt_solver_csetr.o \
|
||||
amg_z_invt_solver_descr.o \
|
||||
amg_z_invk_solver_bld.o \
|
||||
amg_z_invk_solver_check.o \
|
||||
amg_z_invk_solver_clone.o \
|
||||
amg_z_invk_solver_clone_settings.o \
|
||||
amg_z_invk_solver_cseti.o \
|
||||
amg_z_invk_solver_descr.o \
|
||||
amg_z_krm_solver_impl.o
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_c_ainv_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_ainv_solver, amg_protect_name => amg_c_ainv_solver_clone_settings
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_ainv_solver_type), intent(inout) :: sv
|
||||
class(amg_c_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(amg_c_ainv_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_c_ainv_solver_type)
|
||||
svo%alg = sv%alg
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%thresh = sv%thresh
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_ainv_solver_clone_settings
|
||||
@@ -56,8 +56,6 @@ subroutine amg_c_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='d_bwgs_solver_bld', ch_err
|
||||
integer(psb_ipk_), save :: idx_tril=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
@@ -67,8 +65,6 @@ subroutine amg_c_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
if ((do_timings).and.(idx_tril==-1)) &
|
||||
& idx_tril = psb_get_timer_idx("BWGS_BLD: tril")
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
@@ -81,10 +77,7 @@ subroutine amg_c_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
! This cuts out the off-diagonal part, because it's supposed to
|
||||
! be handled by the outer Jacobi smoother.
|
||||
!
|
||||
!write(0,*) 'Calling A%TRIL in bwgs_solver_bld'
|
||||
if (do_timings) call psb_tic(idx_tril)
|
||||
call a%tril(sv%l,info,diag=-ione,jmax=nrow_a,u=sv%u)
|
||||
if (do_timings) call psb_toc(idx_tril)
|
||||
|
||||
else
|
||||
|
||||
|
||||
@@ -56,8 +56,6 @@ subroutine amg_c_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='c_gs_solver_bld', ch_err
|
||||
integer(psb_ipk_), save :: idx_tril=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
@@ -67,8 +65,6 @@ subroutine amg_c_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
if ((do_timings).and.(idx_tril==-1)) &
|
||||
& idx_tril = psb_get_timer_idx("GS_BLD: tril")
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
@@ -80,12 +76,9 @@ subroutine amg_c_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
!
|
||||
! This cuts out the off-diagonal part, because it's supposed to
|
||||
! be handled by the outer Jacobi smoother.
|
||||
!
|
||||
!write(0,*) 'Calling A%TRIL in gs_solver_bld'
|
||||
if (do_timings) call psb_tic(idx_tril)
|
||||
!
|
||||
call a%tril(sv%l,info,diag=izero,jmax=nrow_a,u=sv%u)
|
||||
if (do_timings) call psb_toc(idx_tril)
|
||||
!write(0,*) 'From A%TRIL in gs_solver_bld',a%get_nzeros(),sv%l%get_nzeros(),sv%u%get_nzeros()
|
||||
|
||||
else
|
||||
|
||||
info = psb_err_missing_override_method_
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_c_invk_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invk_solver, amg_protect_name => amg_c_invk_solver_clone_settings
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invk_solver_type), intent(inout) :: sv
|
||||
class(amg_c_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(amg_c_invk_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_c_invk_solver_type)
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%inv_fill = sv%inv_fill
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_invk_solver_clone_settings
|
||||
@@ -1,85 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_c_invt_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invt_solver, amg_protect_name => amg_c_invt_solver_clone_settings
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invt_solver_type), intent(inout) :: sv
|
||||
class(amg_c_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(amg_c_invt_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_c_invt_solver_type)
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%inv_fill = sv%inv_fill
|
||||
svo%thresh = sv%thresh
|
||||
svo%inv_thresh = sv%inv_thresh
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_invt_solver_clone_settings
|
||||
@@ -1,84 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_ainv_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_ainv_solver, amg_protect_name => amg_d_ainv_solver_clone_settings
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_ainv_solver_type), intent(inout) :: sv
|
||||
class(amg_d_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(amg_d_ainv_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_d_ainv_solver_type)
|
||||
svo%alg = sv%alg
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%thresh = sv%thresh
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_ainv_solver_clone_settings
|
||||
@@ -56,8 +56,6 @@ subroutine amg_d_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='d_bwgs_solver_bld', ch_err
|
||||
integer(psb_ipk_), save :: idx_tril=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
@@ -67,8 +65,6 @@ subroutine amg_d_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
if ((do_timings).and.(idx_tril==-1)) &
|
||||
& idx_tril = psb_get_timer_idx("BWGS_BLD: tril")
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
@@ -81,10 +77,7 @@ subroutine amg_d_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
! This cuts out the off-diagonal part, because it's supposed to
|
||||
! be handled by the outer Jacobi smoother.
|
||||
!
|
||||
!write(0,*) 'Calling A%TRIL in bwgs_solver_bld'
|
||||
if (do_timings) call psb_tic(idx_tril)
|
||||
call a%tril(sv%l,info,diag=-ione,jmax=nrow_a,u=sv%u)
|
||||
if (do_timings) call psb_toc(idx_tril)
|
||||
|
||||
else
|
||||
|
||||
|
||||
@@ -56,8 +56,6 @@ subroutine amg_d_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='d_gs_solver_bld', ch_err
|
||||
integer(psb_ipk_), save :: idx_tril=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
@@ -67,8 +65,6 @@ subroutine amg_d_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
if ((do_timings).and.(idx_tril==-1)) &
|
||||
& idx_tril = psb_get_timer_idx("GS_BLD: tril")
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
@@ -80,12 +76,9 @@ subroutine amg_d_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
!
|
||||
! This cuts out the off-diagonal part, because it's supposed to
|
||||
! be handled by the outer Jacobi smoother.
|
||||
!
|
||||
!write(0,*) 'Calling A%TRIL in gs_solver_bld'
|
||||
if (do_timings) call psb_tic(idx_tril)
|
||||
!
|
||||
call a%tril(sv%l,info,diag=izero,jmax=nrow_a,u=sv%u)
|
||||
if (do_timings) call psb_toc(idx_tril)
|
||||
!write(0,*) 'From A%TRIL in gs_solver_bld',a%get_nzeros(),sv%l%get_nzeros(),sv%u%get_nzeros()
|
||||
|
||||
else
|
||||
|
||||
info = psb_err_missing_override_method_
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_invk_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invk_solver, amg_protect_name => amg_d_invk_solver_clone_settings
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invk_solver_type), intent(inout) :: sv
|
||||
class(amg_d_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(amg_d_invk_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_d_invk_solver_type)
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%inv_fill = sv%inv_fill
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_invk_solver_clone_settings
|
||||
@@ -1,85 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_invt_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invt_solver, amg_protect_name => amg_d_invt_solver_clone_settings
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invt_solver_type), intent(inout) :: sv
|
||||
class(amg_d_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(amg_d_invt_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_d_invt_solver_type)
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%inv_fill = sv%inv_fill
|
||||
svo%thresh = sv%thresh
|
||||
svo%inv_thresh = sv%inv_thresh
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_invt_solver_clone_settings
|
||||
@@ -1,84 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_s_ainv_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_ainv_solver, amg_protect_name => amg_s_ainv_solver_clone_settings
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_ainv_solver_type), intent(inout) :: sv
|
||||
class(amg_s_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(amg_s_ainv_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_s_ainv_solver_type)
|
||||
svo%alg = sv%alg
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%thresh = sv%thresh
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_s_ainv_solver_clone_settings
|
||||
@@ -56,8 +56,6 @@ subroutine amg_s_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='d_bwgs_solver_bld', ch_err
|
||||
integer(psb_ipk_), save :: idx_tril=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
@@ -67,8 +65,6 @@ subroutine amg_s_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
if ((do_timings).and.(idx_tril==-1)) &
|
||||
& idx_tril = psb_get_timer_idx("BWGS_BLD: tril")
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
@@ -81,10 +77,7 @@ subroutine amg_s_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
! This cuts out the off-diagonal part, because it's supposed to
|
||||
! be handled by the outer Jacobi smoother.
|
||||
!
|
||||
!write(0,*) 'Calling A%TRIL in bwgs_solver_bld'
|
||||
if (do_timings) call psb_tic(idx_tril)
|
||||
call a%tril(sv%l,info,diag=-ione,jmax=nrow_a,u=sv%u)
|
||||
if (do_timings) call psb_toc(idx_tril)
|
||||
|
||||
else
|
||||
|
||||
|
||||
@@ -56,8 +56,6 @@ subroutine amg_s_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='s_gs_solver_bld', ch_err
|
||||
integer(psb_ipk_), save :: idx_tril=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
@@ -67,8 +65,6 @@ subroutine amg_s_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
if ((do_timings).and.(idx_tril==-1)) &
|
||||
& idx_tril = psb_get_timer_idx("GS_BLD: tril")
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
@@ -80,12 +76,9 @@ subroutine amg_s_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
!
|
||||
! This cuts out the off-diagonal part, because it's supposed to
|
||||
! be handled by the outer Jacobi smoother.
|
||||
!
|
||||
!write(0,*) 'Calling A%TRIL in gs_solver_bld'
|
||||
if (do_timings) call psb_tic(idx_tril)
|
||||
!
|
||||
call a%tril(sv%l,info,diag=izero,jmax=nrow_a,u=sv%u)
|
||||
if (do_timings) call psb_toc(idx_tril)
|
||||
!write(0,*) 'From A%TRIL in gs_solver_bld',a%get_nzeros(),sv%l%get_nzeros(),sv%u%get_nzeros()
|
||||
|
||||
else
|
||||
|
||||
info = psb_err_missing_override_method_
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_s_invk_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_invk_solver, amg_protect_name => amg_s_invk_solver_clone_settings
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_invk_solver_type), intent(inout) :: sv
|
||||
class(amg_s_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(amg_s_invk_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_s_invk_solver_type)
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%inv_fill = sv%inv_fill
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_s_invk_solver_clone_settings
|
||||
@@ -1,85 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_s_invt_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_invt_solver, amg_protect_name => amg_s_invt_solver_clone_settings
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_invt_solver_type), intent(inout) :: sv
|
||||
class(amg_s_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(amg_s_invt_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_s_invt_solver_type)
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%inv_fill = sv%inv_fill
|
||||
svo%thresh = sv%thresh
|
||||
svo%inv_thresh = sv%inv_thresh
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_s_invt_solver_clone_settings
|
||||
@@ -1,84 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_z_ainv_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_z_ainv_solver, amg_protect_name => amg_z_ainv_solver_clone_settings
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_ainv_solver_type), intent(inout) :: sv
|
||||
class(amg_z_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(amg_z_ainv_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_z_ainv_solver_type)
|
||||
svo%alg = sv%alg
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%thresh = sv%thresh
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_z_ainv_solver_clone_settings
|
||||
@@ -56,8 +56,6 @@ subroutine amg_z_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='d_bwgs_solver_bld', ch_err
|
||||
integer(psb_ipk_), save :: idx_tril=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
@@ -67,8 +65,6 @@ subroutine amg_z_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
if ((do_timings).and.(idx_tril==-1)) &
|
||||
& idx_tril = psb_get_timer_idx("BWGS_BLD: tril")
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
@@ -81,10 +77,7 @@ subroutine amg_z_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
! This cuts out the off-diagonal part, because it's supposed to
|
||||
! be handled by the outer Jacobi smoother.
|
||||
!
|
||||
!write(0,*) 'Calling A%TRIL in bwgs_solver_bld'
|
||||
if (do_timings) call psb_tic(idx_tril)
|
||||
call a%tril(sv%l,info,diag=-ione,jmax=nrow_a,u=sv%u)
|
||||
if (do_timings) call psb_toc(idx_tril)
|
||||
|
||||
else
|
||||
|
||||
|
||||
@@ -56,8 +56,6 @@ subroutine amg_z_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='z_gs_solver_bld', ch_err
|
||||
integer(psb_ipk_), save :: idx_tril=-1
|
||||
logical, parameter :: do_timings=.true.
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
@@ -67,8 +65,6 @@ subroutine amg_z_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
if ((do_timings).and.(idx_tril==-1)) &
|
||||
& idx_tril = psb_get_timer_idx("GS_BLD: tril")
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
@@ -80,12 +76,9 @@ subroutine amg_z_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
!
|
||||
! This cuts out the off-diagonal part, because it's supposed to
|
||||
! be handled by the outer Jacobi smoother.
|
||||
!
|
||||
!write(0,*) 'Calling A%TRIL in gs_solver_bld'
|
||||
if (do_timings) call psb_tic(idx_tril)
|
||||
!
|
||||
call a%tril(sv%l,info,diag=izero,jmax=nrow_a,u=sv%u)
|
||||
if (do_timings) call psb_toc(idx_tril)
|
||||
!write(0,*) 'From A%TRIL in gs_solver_bld',a%get_nzeros(),sv%l%get_nzeros(),sv%u%get_nzeros()
|
||||
|
||||
else
|
||||
|
||||
info = psb_err_missing_override_method_
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_z_invk_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_z_invk_solver, amg_protect_name => amg_z_invk_solver_clone_settings
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_invk_solver_type), intent(inout) :: sv
|
||||
class(amg_z_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(amg_z_invk_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_z_invk_solver_type)
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%inv_fill = sv%inv_fill
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_z_invk_solver_clone_settings
|
||||
@@ -1,85 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_z_invt_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_z_invt_solver, amg_protect_name => amg_z_invt_solver_clone_settings
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_invt_solver_type), intent(inout) :: sv
|
||||
class(amg_z_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(amg_z_invt_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_z_invt_solver_type)
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%inv_fill = sv%inv_fill
|
||||
svo%thresh = sv%thresh
|
||||
svo%inv_thresh = sv%inv_thresh
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_z_invt_solver_clone_settings
|
||||
+10
-26
@@ -608,12 +608,8 @@ dnl Maybe new structure with UMFPACK UFconfig AMD?
|
||||
fi
|
||||
|
||||
|
||||
if test "x$pac_umf_header_ok" == "xyes" ; then
|
||||
if test "x$UMF_LIBDIR" == "x" ; then
|
||||
UMF_LIBS="$amg4psblas_cv_umfpack"
|
||||
else
|
||||
UMF_LIBS="$UMF_LIBDIR $amg4psblas_cv_umfpack"
|
||||
fi
|
||||
if test "x$pac_umf_header_ok" == "xyes" ; then
|
||||
UMF_LIBS="$amg4psblas_cv_umfpack $UMF_LIBDIR"
|
||||
LIBS="$UMF_LIBS -lm $LIBS $EXTRA_LIBS";
|
||||
AC_MSG_CHECKING([for umfpack_di_symbolic in $UMF_LIBS])
|
||||
AC_TRY_LINK_FUNC(umfpack_di_symbolic,
|
||||
@@ -623,8 +619,8 @@ if test "x$pac_umf_header_ok" == "xyes" ; then
|
||||
if test "x$pac_umf_lib_ok" == "xno" ; then
|
||||
dnl Maybe Lib or lib?
|
||||
UMF_LIBDIR="-L$amg4psblas_cv_umfpackdir/Lib -L$amg4psblas_cv_umfpackdir/lib"
|
||||
UMF_LIBS="$amg4psblas_cv_umfpack $UMF_LIBDIR -lm"
|
||||
LIBS="$UMF_LIBS $SAVE_LIBS $EXTRA_LIBS "
|
||||
UMF_LIBS="$amg4psblas_cv_umfpack $UMF_LIBDIR -lm $SAVE_LIBS $EXTRA_LIBS"
|
||||
LIBS="$UMF_LIBS"
|
||||
|
||||
AC_MSG_CHECKING([for umfpack_di_symbolic in $UMF_LIBS])
|
||||
AC_TRY_LINK_FUNC(umfpack_di_symbolic,
|
||||
@@ -635,8 +631,8 @@ if test "x$pac_umf_header_ok" == "xyes" ; then
|
||||
if test "x$pac_umf_lib_ok" == "xno" ; then
|
||||
dnl Maybe UMFPACK/Lib?
|
||||
UMF_LIBDIR="-L$amg4psblas_cv_umfpackdir/AMD/Lib -L$amg4psblas_cv_umfpackdir/UMFPACK/Lib"
|
||||
UMF_LIBS="$amg4psblas_cv_umfpack $UMF_LIBDIR -lm"
|
||||
LIBS="$UMF_LIBS $SAVE_LIBS $EXTRA_LIBS"
|
||||
UMF_LIBS="$amg4psblas_cv_umfpack $UMF_LIBDIR -lm $SAVE_LIBS $EXTRA_LIBS"
|
||||
LIBS="$UMF_LIBS"
|
||||
AC_MSG_CHECKING([for umfpack_di_symbolic in $UMF_LIBS])
|
||||
AC_TRY_LINK_FUNC(umfpack_di_symbolic,
|
||||
[amg4psblas_cv_have_umfpack=yes;pac_umf_lib_ok=yes; ],
|
||||
@@ -720,11 +716,7 @@ dnl Maybe Include subdirs?
|
||||
fi
|
||||
|
||||
if test "x$pac_slu_header_ok" == "xyes" ; then
|
||||
if test "x$SLU_LIBS" == "x" ; then
|
||||
SLU_LIBS="$amg4psblas_cv_superlu"
|
||||
else
|
||||
SLU_LIBS="$SLU_LIBS $amg4psblas_cv_superlu"
|
||||
fi
|
||||
SLU_LIBS="$amg4psblas_cv_superlu $SLU_LIBS"
|
||||
LIBS="$SLU_LIBS -lm $save_LIBS";
|
||||
AC_MSG_CHECKING([for superlu_malloc in $SLU_LIBS])
|
||||
AC_TRY_LINK_FUNC(superlu_malloc,
|
||||
@@ -821,7 +813,7 @@ elif test "x$amg4psblas_cv_superludistdir" != "x"; then
|
||||
SLUDIST_LIBS="-L$amg4psblas_cv_superludistdir"
|
||||
fi
|
||||
|
||||
LIBS="$save_LIBS $SLUDIST_LIBS"
|
||||
LIBS="$SLUDIST_LIBS $save_LIBS"
|
||||
CPPFLAGS="$SLUDIST_INCLUDES $save_CPPFLAGS"
|
||||
|
||||
AC_CHECK_HEADERS([superlu_ddefs.h],
|
||||
@@ -849,11 +841,7 @@ dnl Maybe Include subdirs?
|
||||
fi
|
||||
|
||||
if test "x$pac_sludist_header_ok" == "xyes" ; then
|
||||
if test "x$SLUDIST_LIBS" == "x" ; then
|
||||
SLUDIST_LIBS="$amg4psblas_cv_superludist"
|
||||
else
|
||||
SLUDIST_LIBS="$SLUDIST_LIBS $amg4psblas_cv_superludist"
|
||||
fi
|
||||
SLUDIST_LIBS="$amg4psblas_cv_superludist $SLUDIST_LIBS"
|
||||
LIBS="$SLUDIST_LIBS -lm $save_LIBS";
|
||||
AC_MSG_CHECKING([for superlu_malloc_dist in $SLUDIST_LIBS])
|
||||
AC_TRY_LINK_FUNC(superlu_malloc_dist,
|
||||
@@ -1162,11 +1150,7 @@ if test "x$pac_mumps_fmods_ok" == "xno" ; then
|
||||
fi
|
||||
|
||||
if test "x$pac_mumps_fmods_ok" == "xyes" || test "x$pac_mumps_fincs_ok" == "xyes" ; then
|
||||
if test "x$MUMPS_LIBS" == "x" ; then
|
||||
MUMPS_LIBS="$amg4psblas_cv_mumps"
|
||||
else
|
||||
MUMPS_LIBS="$MUMPS_LIBS $amg4psblas_cv_mumps"
|
||||
fi
|
||||
MUMPS_LIBS="$amg4psblas_cv_mumps $MUMPS_LIBS"
|
||||
LIBS="$MUMPS_LIBS $save_LIBS $EXTRA_LIBS";
|
||||
AC_MSG_CHECKING([for dmumps in $MUMPS_LIBS])
|
||||
AC_TRY_LINK_FUNC(dmumps,
|
||||
|
||||
@@ -98,7 +98,6 @@ AC_PREREQ(2.59)
|
||||
#
|
||||
#
|
||||
AC_PROG_INSTALL
|
||||
INSTALL="${INSTALL} -p"
|
||||
|
||||
AC_MSG_CHECKING([where to install])
|
||||
case $prefix in
|
||||
|
||||
+205
-495
@@ -1,541 +1,251 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2020-11-14.01; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
posix_mkdir=
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
# Create dirs (including intermediate dirs) using mode 755.
|
||||
# This is like GNU 'install' as of coreutils 8.32 (2020).
|
||||
mkdir_umask=22
|
||||
|
||||
backupsuffix=
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-p pass -p to $cpprog.
|
||||
-s $stripprog installed files.
|
||||
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
By default, rm is invoked with -f; when overridden with RMPROG,
|
||||
it's up to you to specify -f if you want it.
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
If -S is not specified, no backups are attempted.
|
||||
|
||||
Email bug reports to bug-automake@gnu.org.
|
||||
Automake home page: https://www.gnu.org/software/automake/
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-p) cpprog="$cpprog -p";;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-S) backupsuffix="$2"
|
||||
shift;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
# Don't chown directories that already exist.
|
||||
if test $dstdir_status = 0; then
|
||||
chowncmd=""
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dstbase=`basename "$src"`
|
||||
case $dst in
|
||||
*/) dst=$dst$dstbase;;
|
||||
*) dst=$dst/$dstbase;;
|
||||
esac
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
*/) dstdirslash=$dstdir;;
|
||||
*) dstdirslash=$dstdir/;;
|
||||
esac
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
# The $RANDOM variable is not portable (e.g., dash). Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap '
|
||||
ret=$?
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
|
||||
exit $ret
|
||||
' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p'.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
instcmd=mkdir
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac
|
||||
else
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
# mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
prefixes=
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
pathcomp=''
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=${dstdirslash}_inst.$$_
|
||||
rmtmp=${dstdirslash}_rm.$$_
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask &&
|
||||
{ test -z "$stripcmd" || {
|
||||
# Create $dsttmp read-write so that cp doesn't create it read-only,
|
||||
# which would cause strip to fail.
|
||||
if test -z "$doit"; then
|
||||
: >"$dsttmp" # No need to fork-exec 'touch'.
|
||||
else
|
||||
$doit touch "$dsttmp"
|
||||
fi
|
||||
}
|
||||
} &&
|
||||
$doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# If $backupsuffix is set, and the file being installed
|
||||
# already exists, attempt a backup. Don't worry if it fails,
|
||||
# e.g., if mv doesn't support -f.
|
||||
if test -n "$backupsuffix" && test -f "$dst"; then
|
||||
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
|
||||
fi
|
||||
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -7,20 +7,21 @@ AMG_LIBS=-L$(AMGLIBDIR) -lpsb_krylov -lamg_prec -lpsb_prec
|
||||
FINCLUDES=$(FMFLAG). $(FMFLAG)$(AMGMODDIR) $(FMFLAG)$(AMGINCDIR) $(PSBLAS_INCLUDES) $(FIFLAG).
|
||||
|
||||
LINKOPT=
|
||||
XTRALINK=-lstdc++ -lroma -fopenmp
|
||||
EXEDIR=./runs
|
||||
|
||||
all: amg_s_pde3d amg_d_pde3d amg_s_pde2d amg_d_pde2d
|
||||
|
||||
amg_d_pde3d: amg_d_pde3d.o amg_d_genpde_mod.o amg_d_pde3d_base_mod.o amg_d_pde3d_exp_mod.o amg_d_pde3d_gauss_mod.o data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_d_pde3d.o amg_d_genpde_mod.o amg_d_pde3d_base_mod.o amg_d_pde3d_exp_mod.o amg_d_pde3d_gauss_mod.o data_input.o -o amg_d_pde3d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
/bin/mv amg_d_pde3d $(EXEDIR)
|
||||
$(FLINK) $(LINKOPT) amg_d_pde3d.o amg_d_genpde_mod.o amg_d_pde3d_base_mod.o amg_d_pde3d_exp_mod.o amg_d_pde3d_gauss_mod.o data_input.o -o amg_d_pde3d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS) $(XTRALINK)
|
||||
/bin/mv amg_d_pde3d $(EXEDIR)
|
||||
|
||||
amg_s_pde3d: amg_s_pde3d.o amg_s_genpde_mod.o amg_s_pde3d_base_mod.o amg_s_pde3d_exp_mod.o amg_s_pde3d_gauss_mod.o data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_s_pde3d.o amg_s_genpde_mod.o amg_s_pde3d_base_mod.o amg_s_pde3d_exp_mod.o amg_s_pde3d_gauss_mod.o data_input.o -o amg_s_pde3d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
/bin/mv amg_s_pde3d $(EXEDIR)
|
||||
|
||||
amg_d_pde2d: amg_d_pde2d.o amg_d_genpde_mod.o amg_d_pde2d_base_mod.o amg_d_pde2d_exp_mod.o amg_d_pde2d_box_mod.o data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_d_pde2d.o amg_d_genpde_mod.o amg_d_pde2d_base_mod.o amg_d_pde2d_exp_mod.o amg_d_pde2d_box_mod.o data_input.o -o amg_d_pde2d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
$(FLINK) $(LINKOPT) amg_d_pde2d.o amg_d_genpde_mod.o amg_d_pde2d_base_mod.o amg_d_pde2d_exp_mod.o amg_d_pde2d_box_mod.o data_input.o -o amg_d_pde2d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS) $(XTRALINK)
|
||||
/bin/mv amg_d_pde2d $(EXEDIR)
|
||||
|
||||
amg_s_pde2d: amg_s_pde2d.o amg_s_genpde_mod.o amg_s_pde2d_base_mod.o amg_s_pde2d_exp_mod.o amg_s_pde2d_box_mod.o data_input.o
|
||||
|
||||
@@ -73,9 +73,6 @@ program amg_d_pde2d
|
||||
use amg_d_pde2d_exp_mod
|
||||
use amg_d_pde2d_box_mod
|
||||
use amg_d_genpde_mod
|
||||
#if defined(OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
implicit none
|
||||
|
||||
! input parameters
|
||||
@@ -96,7 +93,7 @@ program amg_d_pde2d
|
||||
type(psb_d_vect_type) :: x,b,r
|
||||
! parallel environment
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: iam, np, nth
|
||||
integer(psb_ipk_) :: iam, np
|
||||
|
||||
! solver parameters
|
||||
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
|
||||
@@ -200,15 +197,6 @@ program amg_d_pde2d
|
||||
|
||||
call psb_init(ctxt)
|
||||
call psb_info(ctxt,iam,np)
|
||||
#if defined(OPENMP)
|
||||
!$OMP parallel shared(nth)
|
||||
!$OMP master
|
||||
nth = omp_get_num_threads()
|
||||
!$OMP end master
|
||||
!$OMP end parallel
|
||||
#else
|
||||
nth = 1
|
||||
#endif
|
||||
|
||||
if (iam < 0) then
|
||||
! This should not happen, but just in case
|
||||
@@ -463,14 +451,12 @@ program amg_d_pde2d
|
||||
call psb_sum(ctxt,precsize)
|
||||
call prec%descr(info,iout=psb_out_unit)
|
||||
if (iam == psb_root_) then
|
||||
write(psb_out_unit,'("Computed solution on ",i8," process(es)")') np
|
||||
write(psb_out_unit,'("Number of threads : ",i12)') nth
|
||||
write(psb_out_unit,'("Total number of tasks : ",i12)') nth*np
|
||||
write(psb_out_unit,'("Computed solution on ",i8," processors")') np
|
||||
write(psb_out_unit,'("Linear system size : ",i12)') system_size
|
||||
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
|
||||
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
|
||||
write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Iterations to convergence : ",i12)') iter
|
||||
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
|
||||
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
|
||||
write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Iterations to convergence : ",i12)') iter
|
||||
write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
|
||||
write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
|
||||
write(psb_out_unit,'("Time to build hierarchy : ",es12.5)') thier
|
||||
@@ -136,6 +136,9 @@ program amg_d_pde3d
|
||||
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
real(psb_dpk_) :: mncrratio ! minimum aggregation ratio
|
||||
integer(psb_ipk_) :: matching_alg ! For NEW matching 1 2 3 variant
|
||||
real(psb_dpk_) :: lambda ! matching LAMBDA
|
||||
|
||||
real(psb_dpk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
|
||||
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
||||
real(psb_dpk_) :: athres ! smoothed aggregation threshold
|
||||
@@ -195,7 +198,7 @@ program amg_d_pde3d
|
||||
! other variables
|
||||
integer(psb_ipk_) :: info, i, k
|
||||
character(len=20) :: name,ch_err
|
||||
type(psb_d_csr_sparse_mat) :: amold
|
||||
|
||||
info=psb_success_
|
||||
|
||||
|
||||
@@ -321,6 +324,11 @@ program amg_d_pde3d
|
||||
call prec%set('par_aggr_alg', p_choice%par_aggr_alg, info)
|
||||
call prec%set('aggr_type', p_choice%aggr_type, info)
|
||||
call prec%set('aggr_size', p_choice%aggr_size, info)
|
||||
write(0,*) 'match variant ',p_choice%matching_alg
|
||||
if (p_choice%matching_alg>0)&
|
||||
& call prec%set('nwm_matching_alg', p_choice%matching_alg, info)
|
||||
if (p_choice%lambda>0)&
|
||||
& call prec%set('nwm_lambda', p_choice%lambda, info)
|
||||
|
||||
call prec%set('aggr_ord', p_choice%aggr_ord, info)
|
||||
call prec%set('aggr_filter', p_choice%aggr_filter,info)
|
||||
@@ -402,7 +410,7 @@ program amg_d_pde3d
|
||||
end if
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
call prec%smoothers_build(a,desc_a,info,amold=amold)
|
||||
call prec%smoothers_build(a,desc_a,info)
|
||||
tprec = psb_wtime()-t1
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_smoothers_bld')
|
||||
@@ -467,7 +475,7 @@ program amg_d_pde3d
|
||||
call psb_sum(ctxt,precsize)
|
||||
call prec%descr(info,iout=psb_out_unit)
|
||||
if (iam == psb_root_) then
|
||||
write(psb_out_unit,'("Computed solution on ",i8," process(es)")') np
|
||||
write(psb_out_unit,'("Computed solution on ",i8," processors")') np
|
||||
write(psb_out_unit,'("Number of threads : ",i12)') nth
|
||||
write(psb_out_unit,'("Total number of tasks : ",i12)') nth*np
|
||||
write(psb_out_unit,'("Linear system size : ",i12)') system_size
|
||||
@@ -492,7 +500,7 @@ program amg_d_pde3d
|
||||
write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
|
||||
|
||||
end if
|
||||
call psb_print_timers(ctxt)
|
||||
|
||||
!
|
||||
! cleanup storage and exit
|
||||
!
|
||||
@@ -599,9 +607,10 @@ contains
|
||||
call read_data(prec%aggr_type,inp_unit) ! type of aggregation
|
||||
call read_data(prec%aggr_size,inp_unit) ! Requested size of the aggregates for MATCHBOXP
|
||||
call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation
|
||||
call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio
|
||||
call read_data(prec%aggr_filter,inp_unit) ! filtering
|
||||
call read_data(prec%athres,inp_unit) ! smoothed aggr thresh
|
||||
call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio
|
||||
call read_data(prec%matching_alg,inp_unit) ! matching variant
|
||||
call read_data(prec%lambda,inp_unit) ! lambda
|
||||
call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector
|
||||
if (prec%thrvsz > 0) then
|
||||
call psb_realloc(prec%thrvsz,prec%athresv,info)
|
||||
@@ -609,6 +618,7 @@ contains
|
||||
else
|
||||
read(inp_unit,*) ! dummy read to skip a record
|
||||
end if
|
||||
call read_data(prec%athres,inp_unit) ! smoothed aggr thresh
|
||||
! coasest-level solver
|
||||
call read_data(prec%csolve,inp_unit) ! coarsest-lev solver
|
||||
call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver
|
||||
@@ -682,6 +692,10 @@ contains
|
||||
call psb_bcast(ctxt,prec%aggr_ord)
|
||||
call psb_bcast(ctxt,prec%aggr_filter)
|
||||
call psb_bcast(ctxt,prec%mncrratio)
|
||||
call psb_bcast(ctxt,prec%matching_alg)
|
||||
call psb_bcast(ctxt,prec%lambda)
|
||||
|
||||
|
||||
call psb_bcast(ctxt,prec%thrvsz)
|
||||
if (prec%thrvsz > 0) then
|
||||
if (iam /= psb_root_) call psb_realloc(prec%thrvsz,prec%athresv,info)
|
||||
|
||||
@@ -73,9 +73,6 @@ program amg_s_pde2d
|
||||
use amg_s_pde2d_exp_mod
|
||||
use amg_s_pde2d_box_mod
|
||||
use amg_s_genpde_mod
|
||||
#if defined(OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
implicit none
|
||||
|
||||
! input parameters
|
||||
@@ -96,7 +93,7 @@ program amg_s_pde2d
|
||||
type(psb_s_vect_type) :: x,b,r
|
||||
! parallel environment
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: iam, np, nth
|
||||
integer(psb_ipk_) :: iam, np
|
||||
|
||||
! solver parameters
|
||||
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
|
||||
@@ -200,15 +197,6 @@ program amg_s_pde2d
|
||||
|
||||
call psb_init(ctxt)
|
||||
call psb_info(ctxt,iam,np)
|
||||
#if defined(OPENMP)
|
||||
!$OMP parallel shared(nth)
|
||||
!$OMP master
|
||||
nth = omp_get_num_threads()
|
||||
!$OMP end master
|
||||
!$OMP end parallel
|
||||
#else
|
||||
nth = 1
|
||||
#endif
|
||||
|
||||
if (iam < 0) then
|
||||
! This should not happen, but just in case
|
||||
@@ -463,14 +451,12 @@ program amg_s_pde2d
|
||||
call psb_sum(ctxt,precsize)
|
||||
call prec%descr(info,iout=psb_out_unit)
|
||||
if (iam == psb_root_) then
|
||||
write(psb_out_unit,'("Computed solution on ",i8," process(es)")') np
|
||||
write(psb_out_unit,'("Number of threads : ",i12)') nth
|
||||
write(psb_out_unit,'("Total number of tasks : ",i12)') nth*np
|
||||
write(psb_out_unit,'("Computed solution on ",i8," processors")') np
|
||||
write(psb_out_unit,'("Linear system size : ",i12)') system_size
|
||||
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
|
||||
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
|
||||
write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Iterations to convergence : ",i12)') iter
|
||||
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
|
||||
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
|
||||
write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Iterations to convergence : ",i12)') iter
|
||||
write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
|
||||
write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
|
||||
write(psb_out_unit,'("Time to build hierarchy : ",es12.5)') thier
|
||||
@@ -74,9 +74,6 @@ program amg_s_pde3d
|
||||
use amg_s_pde3d_exp_mod
|
||||
use amg_s_pde3d_gauss_mod
|
||||
use amg_s_genpde_mod
|
||||
#if defined(OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
implicit none
|
||||
|
||||
! input parameters
|
||||
@@ -97,7 +94,7 @@ program amg_s_pde3d
|
||||
type(psb_s_vect_type) :: x,b,r
|
||||
! parallel environment
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: iam, np, nth
|
||||
integer(psb_ipk_) :: iam, np
|
||||
|
||||
! solver parameters
|
||||
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
|
||||
@@ -195,21 +192,12 @@ program amg_s_pde3d
|
||||
! other variables
|
||||
integer(psb_ipk_) :: info, i, k
|
||||
character(len=20) :: name,ch_err
|
||||
type(psb_s_csr_sparse_mat) :: amold
|
||||
|
||||
info=psb_success_
|
||||
|
||||
|
||||
call psb_init(ctxt)
|
||||
call psb_info(ctxt,iam,np)
|
||||
#if defined(OPENMP)
|
||||
!$OMP parallel shared(nth)
|
||||
!$OMP master
|
||||
nth = omp_get_num_threads()
|
||||
!$OMP end master
|
||||
!$OMP end parallel
|
||||
#else
|
||||
nth = 1
|
||||
#endif
|
||||
|
||||
if (iam < 0) then
|
||||
! This should not happen, but just in case
|
||||
@@ -402,7 +390,7 @@ program amg_s_pde3d
|
||||
end if
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
call prec%smoothers_build(a,desc_a,info,amold=amold)
|
||||
call prec%smoothers_build(a,desc_a,info)
|
||||
tprec = psb_wtime()-t1
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_smoothers_bld')
|
||||
@@ -467,9 +455,7 @@ program amg_s_pde3d
|
||||
call psb_sum(ctxt,precsize)
|
||||
call prec%descr(info,iout=psb_out_unit)
|
||||
if (iam == psb_root_) then
|
||||
write(psb_out_unit,'("Computed solution on ",i8," process(es)")') np
|
||||
write(psb_out_unit,'("Number of threads : ",i12)') nth
|
||||
write(psb_out_unit,'("Total number of tasks : ",i12)') nth*np
|
||||
write(psb_out_unit,'("Computed solution on ",i8," processors")') np
|
||||
write(psb_out_unit,'("Linear system size : ",i12)') system_size
|
||||
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
|
||||
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
|
||||
@@ -492,7 +478,7 @@ program amg_s_pde3d
|
||||
write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
|
||||
|
||||
end if
|
||||
call psb_print_timers(ctxt)
|
||||
|
||||
!
|
||||
! cleanup storage and exit
|
||||
!
|
||||
@@ -1,6 +1,6 @@
|
||||
%%%%%%%%%%% General arguments % Lines starting with % are ignored.
|
||||
CSR ! Storage format CSR COO JAD
|
||||
0200 ! IDIM; domain size. Linear system size is IDIM**3
|
||||
0200 ! IDIM; domain size. Linear system size is IDIM**3
|
||||
CONST ! PDECOEFF: CONST, EXP, GAUSS Coefficients of the PDE
|
||||
BICGSTAB ! Iterative method: BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES
|
||||
2 ! ISTOPC
|
||||
@@ -9,7 +9,7 @@ BICGSTAB ! Iterative method: BiCGSTAB BiCGSTABL BiCG CG CGS F
|
||||
30 ! IRST (restart for RGMRES and BiCGSTABL)
|
||||
1.d-6 ! EPS
|
||||
%%%%%%%%%%% Main preconditioner choices %%%%%%%%%%%%%%%%
|
||||
ML-VBM-VCYCLE-FBGS-D-BJAC ! Longer descriptive name for preconditioner (up to 20 chars)
|
||||
ML-VCYCLE-BJAC-D-BJAC ! Longer descriptive name for preconditioner (up to 20 chars)
|
||||
ML ! Preconditioner type: NONE JACOBI GS FBGS BJAC AS ML
|
||||
%%%%%%%%%%% First smoother (for all levels but coarsest) %%%%%%%%%%%%%%%%
|
||||
FBGS ! Smoother type JACOBI FBGS GS BWGS BJAC AS. For 1-level, repeats previous.
|
||||
@@ -39,8 +39,8 @@ VCYCLE ! Type of multilevel CYCLE: VCYCLE WCYCLE KCYCLE MUL
|
||||
-3 ! Max Number of levels in a multilevel preconditioner; if <0, lib default
|
||||
-3 ! Target coarse matrix size per process; if <0, lib default
|
||||
SMOOTHED ! Type of aggregation: SMOOTHED UNSMOOTHED
|
||||
DEC ! Parallel aggregation: DEC, SYMDEC, COUPLED
|
||||
SOC1 ! aggregation measure SOC1, MATCHBOXP
|
||||
COUPLED ! Parallel aggregation: DEC, SYMDEC, COUPLED
|
||||
MATCHBOXP ! aggregation measure SOC1, MATCHBOXP
|
||||
8 ! Requested size of the aggregates for MATCHBOXP
|
||||
NATURAL ! Ordering of aggregation NATURAL DEGREE
|
||||
-1.5 ! Coarsening ratio, if < 0 use library default
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
%%%%%%%%%%% General arguments % Lines starting with % are ignored.
|
||||
CSR ! Storage format CSR COO JAD
|
||||
0140 ! IDIM; domain size. Linear system size is IDIM**3
|
||||
CONST ! PDECOEFF: CONST, EXP, GAUSS Coefficients of the PDE
|
||||
BICGSTAB ! Iterative method: BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES
|
||||
2 ! ISTOPC
|
||||
00500 ! ITMAX
|
||||
1 ! ITRACE
|
||||
30 ! IRST (restart for RGMRES and BiCGSTABL)
|
||||
1.d-6 ! EPS
|
||||
%%%%%%%%%%% Main preconditioner choices %%%%%%%%%%%%%%%%
|
||||
ML-VCYCLE-BJAC-D-BJAC ! Longer descriptive name for preconditioner (up to 20 chars)
|
||||
ML ! Preconditioner type: NONE JACOBI GS FBGS BJAC AS ML
|
||||
%%%%%%%%%%% First smoother (for all levels but coarsest) %%%%%%%%%%%%%%%%
|
||||
FBGS ! Smoother type JACOBI FBGS GS BWGS BJAC AS. For 1-level, repeats previous.
|
||||
1 ! Number of sweeps for smoother
|
||||
0 ! Number of overlap layers for AS preconditioner
|
||||
HALO ! AS restriction operator: NONE HALO
|
||||
NONE ! AS prolongation operator: NONE SUM AVG
|
||||
INVK ! Subdomain solver for BJAC/AS: JACOBI GS BGS ILU ILUT MILU MUMPS SLU UMF
|
||||
LLK ! AINV variant
|
||||
0 ! Fill level P for ILU(P) and ILU(T,P)
|
||||
1 ! Inverse Fill level P for INVK
|
||||
1.d-4 ! Threshold T for ILU(T,P)
|
||||
%%%%%%%%%%% Second smoother, always ignored for non-ML %%%%%%%%%%%%%%%%
|
||||
NONE ! Second (post) smoother, ignored if NONE
|
||||
1 ! Number of sweeps for (post) smoother
|
||||
0 ! Number of overlap layers for AS preconditioner
|
||||
HALO ! AS restriction operator: NONE HALO
|
||||
NONE ! AS prolongation operator: NONE SUM AVG
|
||||
ILU ! Subdomain solver for BJAC/AS: JACOBI GS BGS ILU ILUT MILU MUMPS SLU UMF
|
||||
LLK ! AINV variant
|
||||
0 ! Fill level P for ILU(P) and ILU(T,P)
|
||||
8 ! Inverse Fill level P for INVK
|
||||
1.d-4 ! Threshold T for ILU(T,P)
|
||||
%%%%%%%%%%% Multilevel parameters %%%%%%%%%%%%%%%%
|
||||
VCYCLE ! Type of multilevel CYCLE: VCYCLE WCYCLE KCYCLE MULT ADD
|
||||
1 ! Number of outer sweeps for ML
|
||||
-3 ! Max Number of levels in a multilevel preconditioner; if <0, lib default
|
||||
-3 ! Target coarse matrix size per process; if <0, lib default
|
||||
SMOOTHED ! Type of aggregation: SMOOTHED UNSMOOTHED
|
||||
NEWMTC ! Parallel aggregation: DEC, SYMDEC, COUPLED NEWMTC
|
||||
NEWMTC ! aggregation measure SOC1, MATCHBOXP NEWMTC
|
||||
8 ! Requested size of the aggregates for MATCHBOXP
|
||||
NATURAL ! Ordering of aggregation NATURAL DEGREE
|
||||
NOFILTER ! Filtering of matrix: FILTER NOFILTER
|
||||
-1.5 ! Coarsening ratio, if < 0 use library default
|
||||
2 ! MATCHING variant
|
||||
8.0 ! LAMBDA
|
||||
-2 ! Number of thresholds in vector, next line ignored if <= 0
|
||||
0.05 0.025 ! Thresholds
|
||||
-0.0100d0 ! Smoothed aggregation threshold, ignored if < 0
|
||||
%%%%%%%%%%% Coarse level solver %%%%%%%%%%%%%%%%
|
||||
BJAC ! Coarsest-level solver: MUMPS UMF SLU SLUDIST JACOBI GS BJAC
|
||||
ILU ! Coarsest-level subsolver for BJAC: ILU ILUT MILU UMF MUMPS SLU
|
||||
DIST ! Coarsest-level matrix distribution: DIST REPL
|
||||
1 ! Coarsest-level fillin P for ILU(P) and ILU(T,P)
|
||||
1.d-4 ! Coarsest-level threshold T for ILU(T,P)
|
||||
1 ! Number of sweeps for JACOBI/GS/BJAC coarsest-level solver
|
||||
%%%%%%%%%%% Dump parms %%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
F ! Dump preconditioner on file
|
||||
1 ! Min level
|
||||
20 ! Max level
|
||||
T ! Dump AC
|
||||
T ! Dump RP
|
||||
F ! Dump TPROL
|
||||
F ! Dump SMOOTHER
|
||||
F ! Dump SOLVER
|
||||
F ! Global numering ?
|
||||
Reference in New Issue
Block a user