Merge branch 'development' into cmake
commit
886e03ab65
@ -1,165 +0,0 @@
|
||||
Changelog. A lot less detailed than usual, at least for past
|
||||
history.
|
||||
2022/05/20: Restart ChangeLog. Updated to new name AMG4PSBLAS, now using PSB3.8
|
||||
2018/10/28: Fix interface to MUMPS and configry machinery. Require PSB 3.6.
|
||||
2018/10/10: ICTXT argument in prec%init().
|
||||
2018/07/30: Fixes for Intel compilers. BootCMatch interface in examples.
|
||||
2018/05/14: Interface for extension of aggregation methods.
|
||||
2018/02/28: New cartesian distribution for sample programs.
|
||||
2017/12/15: New WRK component of preconditioner levels, preallocation.
|
||||
2017/10/25: New example input file formats. Added sample matrices.
|
||||
2017/10/02: New CBIND in PSBLAS 3.5.0
|
||||
2017/07/30: Refactored examples. Change default thresholds.
|
||||
2017/05/31: New internal description of ML.
|
||||
2017/05/16: Improve build process.
|
||||
2017/04/20: Force %set interface. Update docs.
|
||||
2017/04/03: Remove obsolete stuff.
|
||||
2017/03/17: Fixed level%cnv; add coarse _solver tracker.
|
||||
2017/02/18: Take out clean_zeros; changed NOFILTER; defined FBGS; take out
|
||||
n_prec_levs.
|
||||
2017/02/12: Updated mat_dist usage, dubious SP shell for UMFPACK, fixes
|
||||
for RPM packaging.
|
||||
2017/02/02: Fix superlu configury
|
||||
2016/11/12: Fix hierarchy/smoothers build to handle 1 level.
|
||||
2016/10/03: Merged changes to hierearchy building.
|
||||
2016/08/20: Reimplemented decoupled aggregation
|
||||
2016/07/20: Refactored application of multilevel. Defined V,W and
|
||||
K-cycles.
|
||||
2016/05/18: Reworked internals of PRECSET. Defined Forward-Backward
|
||||
Gauss-Seidel solver. Now available separate PRE and POST smoother
|
||||
objects.
|
||||
2016/03/30: MUMPS interface.
|
||||
2016/02/28: Hybrid Gauss-Seidel method.
|
||||
2016/02/03: unify integer argument checks.
|
||||
2015/12/15: defaults single vs. double precision. Use clean_zeros.
|
||||
2015/12/08: new matdist interface
|
||||
2015/10/17: configry fixes
|
||||
2015/10/13: Fixes for SLUDIST versions 3 and 4
|
||||
2015/05/03: New heap interface
|
||||
2015/04/21: INTENT fixes
|
||||
|
||||
2014/12/21: New error handling
|
||||
|
||||
2014/10/27: Added versioncheck to configure.
|
||||
|
||||
2014/03/31: New get_diag.
|
||||
|
||||
2013/11/07: Merged changes from experimental branch. Fix INCDIR in
|
||||
makefiles.
|
||||
|
||||
2013/07/15: Fixes for UMFPACK 5.4, SuperLU 4.3, SuperLU_Dist 3.3
|
||||
|
||||
2013/04/05: CLONE method.
|
||||
|
||||
2013/03/08: Reworked SET routines.
|
||||
|
||||
2012/12/10: Enable long_integers.
|
||||
|
||||
2012/12/05: Split smoother/solver objects.
|
||||
|
||||
2012/04/30: New scheme to find dynamically the number of level based on
|
||||
the size of the coarse matrix
|
||||
|
||||
2012/01/10: Done split interface/implementation, plus subdir restructure.
|
||||
|
||||
2011/12/13: Start split interface/implementation to improve build time.
|
||||
|
||||
2011/11/25: Now works with _vect methods from PSBLAS.
|
||||
|
||||
2011/10/24: New test generation methods.
|
||||
|
||||
2011/06/15: Dump prolongator/restrictor
|
||||
|
||||
2011/04/14: Added MOLD argument(s) to precbld.
|
||||
|
||||
2011/03/30: Fixed: descriptive methods, example programs.
|
||||
|
||||
2011/03/08: Re-factored modules for ILU methods.
|
||||
|
||||
2011/03/04: Make X intent(inout) in APPLY to allow for preconditioners
|
||||
using SPMM.
|
||||
|
||||
2011/03/02: New set methods.
|
||||
|
||||
2011/01/07: Fixed UMF interfacing for Z data.
|
||||
|
||||
2011/01/04: Added UMF inteface for D data.
|
||||
|
||||
2011/01/02: Fix usage of DESC_DATA. Switched all names to F90 ending.
|
||||
|
||||
2010/12/16: Fix usage of replicated space descriptor.
|
||||
|
||||
2010/11/16: Fix Jacobi smoother in case of empty off-diagonal.
|
||||
|
||||
2010/11/04: Defined and tested single real and complex.
|
||||
|
||||
2010/11/02: Aligned usage of sparse data type with psblas3.
|
||||
|
||||
2009/12/22: Aligned constants with mld2p4 v1.2
|
||||
|
||||
2009/12/11: First working version of double multilevel.
|
||||
|
||||
2009/12/05: Inttroduction of Smoother/Solver object hierarchy.
|
||||
|
||||
2009/09/23: Initial F2003 version.
|
||||
|
||||
|
||||
2009/01/28: Changed names from XbaseprcY to XbaseprecY.
|
||||
2009/01/27: Changed names from mld_transfer to mld_move_alloc.
|
||||
|
||||
2009/01/13: Repackaged the one-level preconditioners. Reorganized the
|
||||
build routines, taking out mlprec_bld, and switching the
|
||||
number of levels when needed.
|
||||
2008/10/27: Changed the definition of prec_type: repackaged with a
|
||||
onelev-prec-type, containing a baseprec and maps between
|
||||
index spaces. No performance impact; no changes to
|
||||
user-level interfaces.
|
||||
|
||||
2008/09/18: Changed mld_sizeof to integer(8); updated samples.
|
||||
|
||||
2008/08/26: Fixed matrix generation in sample programs.
|
||||
|
||||
2008/07/25: missing implicit none in mld_prec_type.
|
||||
|
||||
2008/07/23: added HTML documentation
|
||||
|
||||
2008/06/13: Fixed aggregation for replicated index spaces.
|
||||
|
||||
2008/06/02: Threshold into decoupled aggregation algorithm.
|
||||
|
||||
2008/05/27: Single precision version.
|
||||
|
||||
2008/03/09: Introduced configure script.
|
||||
|
||||
2008/02/08: Merged changes from intermesh branch: we now have an
|
||||
inter_desc_type object. Cleaned up data allocation and
|
||||
variable initialization in multilevel prec application.
|
||||
|
||||
2008/01/10: Merged various fixes for: prologues, unused variables,
|
||||
interface details.
|
||||
2007/12/21: Merge version with prologues and internal docs.
|
||||
|
||||
2007/11/15: Created pargen example.
|
||||
|
||||
2007/11/14: Fix INTENT(IN) on X vector in preconditioner routines.
|
||||
|
||||
2007/10/19: Merged in ILU(P,T). To be tested extensively.
|
||||
|
||||
2007/10/17: Merged ILU(K) into trunk.
|
||||
|
||||
2007/10/16: Fixed ILU(K), it now performs satisfactorily. Also updated
|
||||
ILU(0) to be more legible.
|
||||
|
||||
2007/10/11: First working version of ILU(K). Still slow, there should
|
||||
be room for improvement.
|
||||
|
||||
2007/10/09: Added benchmark code.
|
||||
|
||||
2007/10/09: Added MILU_N_. Beware: values for UMF_ etc. have been
|
||||
shifted.
|
||||
|
||||
2007/10/02: To do: decide whether to name MLD_KRYLOV_MOD or
|
||||
PSB_KRYLOV_MOD.
|
||||
|
||||
2007/10/01: Start of this changelog. MLD2P4 now has a different
|
||||
structure, to enable a build not embedded in PSBLAS.
|
||||
@ -1,125 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
! The aggregator object hosts the aggregation method for building
|
||||
! the multilevel hierarchy. This variant is based on the hybrid method
|
||||
! presented in
|
||||
!
|
||||
! S. Gratton, P. Henon, P. Jiranek and X. Vasseur:
|
||||
! Reducing complexity of algebraic multigrid by aggregation
|
||||
! Numerical Lin. Algebra with Applications, 2016, 23:501-518
|
||||
!
|
||||
module amg_c_hybrid_aggregator_mod
|
||||
|
||||
use amg_c_dec_aggregator_mod
|
||||
!
|
||||
! 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
|
||||
!
|
||||
!
|
||||
type, extends(amg_c_dec_aggregator_type) :: amg_c_hybrid_aggregator_type
|
||||
|
||||
contains
|
||||
procedure, pass(ag) :: bld_tprol => amg_c_hybrid_aggregator_build_tprol
|
||||
procedure, nopass :: fmt => amg_c_hybrid_aggregator_fmt
|
||||
end type amg_c_hybrid_aggregator_type
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_c_hybrid_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
import :: amg_c_hybrid_aggregator_type, psb_desc_type, psb_cspmat_type, psb_spk_, &
|
||||
& psb_ipk_, psb_long_int_k_, amg_sml_parms
|
||||
implicit none
|
||||
class(amg_c_hybrid_aggregator_type), target, intent(inout) :: ag
|
||||
type(amg_sml_parms), intent(inout) :: parms
|
||||
type(psb_cspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_cspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_hybrid_aggregator_build_tprol
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
|
||||
function amg_c_hybrid_aggregator_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "Hybrid Decoupled aggregation"
|
||||
end function amg_c_hybrid_aggregator_fmt
|
||||
|
||||
|
||||
end module amg_c_hybrid_aggregator_mod
|
||||
@ -0,0 +1,17 @@
|
||||
#ifndef AMG_CONFIG_H
|
||||
#define AMG_CONFIG_H
|
||||
|
||||
#include "psb_config.h"
|
||||
|
||||
@CHAVEUMF@
|
||||
@CHAVESLU@
|
||||
@CSLUVERSION@
|
||||
@CHAVESLUDIST@
|
||||
@CSLUDISTVERSION@
|
||||
@CHAVEMUMPS@
|
||||
@CHAVEMUMPSMODULES@
|
||||
@CHAVEMUMPSINCLUDES@
|
||||
@CXXMATCHBOXBIT@
|
||||
|
||||
|
||||
#endif
|
||||
@ -1,125 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
! The aggregator object hosts the aggregation method for building
|
||||
! the multilevel hierarchy. This variant is based on the hybrid method
|
||||
! presented in
|
||||
!
|
||||
! S. Gratton, P. Henon, P. Jiranek and X. Vasseur:
|
||||
! Reducing complexity of algebraic multigrid by aggregation
|
||||
! Numerical Lin. Algebra with Applications, 2016, 23:501-518
|
||||
!
|
||||
module amg_d_hybrid_aggregator_mod
|
||||
|
||||
use amg_d_dec_aggregator_mod
|
||||
!
|
||||
! 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
|
||||
!
|
||||
!
|
||||
type, extends(amg_d_dec_aggregator_type) :: amg_d_hybrid_aggregator_type
|
||||
|
||||
contains
|
||||
procedure, pass(ag) :: bld_tprol => amg_d_hybrid_aggregator_build_tprol
|
||||
procedure, nopass :: fmt => amg_d_hybrid_aggregator_fmt
|
||||
end type amg_d_hybrid_aggregator_type
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_d_hybrid_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
import :: amg_d_hybrid_aggregator_type, psb_desc_type, psb_dspmat_type, psb_dpk_, &
|
||||
& psb_ipk_, psb_long_int_k_, amg_dml_parms
|
||||
implicit none
|
||||
class(amg_d_hybrid_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
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_dspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_hybrid_aggregator_build_tprol
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
|
||||
function amg_d_hybrid_aggregator_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "Hybrid Decoupled aggregation"
|
||||
end function amg_d_hybrid_aggregator_fmt
|
||||
|
||||
|
||||
end module amg_d_hybrid_aggregator_mod
|
||||
@ -1,125 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
! The aggregator object hosts the aggregation method for building
|
||||
! the multilevel hierarchy. This variant is based on the hybrid method
|
||||
! presented in
|
||||
!
|
||||
! S. Gratton, P. Henon, P. Jiranek and X. Vasseur:
|
||||
! Reducing complexity of algebraic multigrid by aggregation
|
||||
! Numerical Lin. Algebra with Applications, 2016, 23:501-518
|
||||
!
|
||||
module amg_s_hybrid_aggregator_mod
|
||||
|
||||
use amg_s_dec_aggregator_mod
|
||||
!
|
||||
! 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
|
||||
!
|
||||
!
|
||||
type, extends(amg_s_dec_aggregator_type) :: amg_s_hybrid_aggregator_type
|
||||
|
||||
contains
|
||||
procedure, pass(ag) :: bld_tprol => amg_s_hybrid_aggregator_build_tprol
|
||||
procedure, nopass :: fmt => amg_s_hybrid_aggregator_fmt
|
||||
end type amg_s_hybrid_aggregator_type
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_s_hybrid_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
import :: amg_s_hybrid_aggregator_type, psb_desc_type, psb_sspmat_type, psb_spk_, &
|
||||
& psb_ipk_, psb_long_int_k_, amg_sml_parms
|
||||
implicit none
|
||||
class(amg_s_hybrid_aggregator_type), target, intent(inout) :: ag
|
||||
type(amg_sml_parms), intent(inout) :: parms
|
||||
type(psb_sspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_sspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_hybrid_aggregator_build_tprol
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
|
||||
function amg_s_hybrid_aggregator_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "Hybrid Decoupled aggregation"
|
||||
end function amg_s_hybrid_aggregator_fmt
|
||||
|
||||
|
||||
end module amg_s_hybrid_aggregator_mod
|
||||
@ -1,125 +0,0 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
! The aggregator object hosts the aggregation method for building
|
||||
! the multilevel hierarchy. This variant is based on the hybrid method
|
||||
! presented in
|
||||
!
|
||||
! S. Gratton, P. Henon, P. Jiranek and X. Vasseur:
|
||||
! Reducing complexity of algebraic multigrid by aggregation
|
||||
! Numerical Lin. Algebra with Applications, 2016, 23:501-518
|
||||
!
|
||||
module amg_z_hybrid_aggregator_mod
|
||||
|
||||
use amg_z_dec_aggregator_mod
|
||||
!
|
||||
! 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
|
||||
!
|
||||
!
|
||||
type, extends(amg_z_dec_aggregator_type) :: amg_z_hybrid_aggregator_type
|
||||
|
||||
contains
|
||||
procedure, pass(ag) :: bld_tprol => amg_z_hybrid_aggregator_build_tprol
|
||||
procedure, nopass :: fmt => amg_z_hybrid_aggregator_fmt
|
||||
end type amg_z_hybrid_aggregator_type
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_z_hybrid_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
import :: amg_z_hybrid_aggregator_type, psb_desc_type, psb_zspmat_type, psb_dpk_, &
|
||||
& psb_ipk_, psb_long_int_k_, amg_dml_parms
|
||||
implicit none
|
||||
class(amg_z_hybrid_aggregator_type), target, intent(inout) :: ag
|
||||
type(amg_dml_parms), intent(inout) :: parms
|
||||
type(psb_zspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_zspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_hybrid_aggregator_build_tprol
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
|
||||
function amg_z_hybrid_aggregator_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "Hybrid Decoupled aggregation"
|
||||
end function amg_z_hybrid_aggregator_fmt
|
||||
|
||||
|
||||
end module amg_z_hybrid_aggregator_mod
|
||||
@ -0,0 +1,504 @@
|
||||
/*
|
||||
AMG4PSBLAS version 1.2
|
||||
Algebraic Multigrid Package
|
||||
based on PSBLAS (Parallel Sparse BLAS version 3.9)
|
||||
|
||||
(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.
|
||||
|
||||
Includes material from BootCMatch, see copyright below.
|
||||
*/
|
||||
|
||||
/*
|
||||
BootCMatch
|
||||
Bootstrap AMG based on Compatible weighted Matching, version 0.9
|
||||
(C) Copyright 2017
|
||||
Pasqua D'Ambra IAC-CNR, IT
|
||||
Panayot S. Vassilevski Portland State University, OR USA
|
||||
|
||||
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 BootCMatch 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 BootCMatch 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.
|
||||
|
||||
*/
|
||||
#include "amg_config.h"
|
||||
#if defined(PSB_SERIAL_MPI)
|
||||
#include <stdlib.h>
|
||||
#include "psb_types.h"
|
||||
|
||||
psb_l_t d_trymatch(psb_l_t rowindex, psb_l_t colindex,
|
||||
psb_l_t nrows_W, psb_l_t *W_i, psb_l_t *W_j, psb_d_t *W_data,
|
||||
psb_l_t *jrowindex, psb_l_t ljrowindex,
|
||||
psb_l_t *jcolindex, psb_l_t ljcolindex, psb_l_t *rmatch)
|
||||
{
|
||||
|
||||
psb_l_t tryrowmatch, trycolmatch;
|
||||
psb_l_t i, j, k, nzrow_W, startj, kindex;
|
||||
psb_d_t cweight, nweight;
|
||||
|
||||
// psb_l_t *W_i = bcm_CSRMatrixI(W);
|
||||
// psb_l_t *W_j = bcm_CSRMatrixJ(W);
|
||||
// psb_l_t nrows_W = bcm_CSRMatrixNumRows(W);
|
||||
// psb_d_t *W_data=bcm_CSRMatrixData(W);
|
||||
|
||||
k=-1;
|
||||
i=0;
|
||||
while (i<ljrowindex && k ==-1)
|
||||
{
|
||||
if(jrowindex[i]==colindex) k=i;
|
||||
i++;
|
||||
}
|
||||
if(k >= 0)
|
||||
{
|
||||
ljrowindex=ljrowindex-1;
|
||||
for(i=k; i<ljrowindex; ++i) jrowindex[i]=jrowindex[i+1];
|
||||
}
|
||||
|
||||
k=-1;
|
||||
i=0;
|
||||
while(i<ljcolindex && k==-1)
|
||||
{
|
||||
if(jcolindex[i]==rowindex) k=i;
|
||||
i++;
|
||||
}
|
||||
if(k >= 0)
|
||||
{
|
||||
ljcolindex=ljcolindex-1;
|
||||
for(i=k; i<ljcolindex; ++i) jcolindex[i]=jcolindex[i+1];
|
||||
}
|
||||
|
||||
nzrow_W=W_i[rowindex+1]-W_i[rowindex];
|
||||
startj=W_i[rowindex];
|
||||
kindex=-1;
|
||||
k=0;
|
||||
while(k<nzrow_W && kindex==-1)
|
||||
{
|
||||
if(W_j[startj+k]==colindex) kindex=startj+k;
|
||||
k++;
|
||||
}
|
||||
cweight=W_data[kindex];
|
||||
|
||||
while((rmatch[rowindex]==-1 && rmatch[colindex]==-1)
|
||||
&& (ljrowindex !=0 || ljcolindex !=0))
|
||||
{
|
||||
|
||||
if (rmatch[rowindex] == -1 && ljrowindex !=0)
|
||||
{
|
||||
tryrowmatch=jrowindex[0];
|
||||
nzrow_W=W_i[rowindex+1]-W_i[rowindex];
|
||||
startj=W_i[rowindex];
|
||||
k=0;
|
||||
kindex=-1;
|
||||
while(k<nzrow_W && kindex==-1)
|
||||
{
|
||||
if(W_j[startj+k]==tryrowmatch) kindex=startj+k;
|
||||
k++;
|
||||
}
|
||||
nweight=W_data[kindex];
|
||||
|
||||
ljrowindex=ljrowindex-1;
|
||||
for(i=0; i<ljrowindex; ++i) jrowindex[i]=jrowindex[i+1];
|
||||
|
||||
if(nweight > cweight && rmatch[tryrowmatch]==-1)
|
||||
{
|
||||
|
||||
nzrow_W=W_i[tryrowmatch+1]-W_i[tryrowmatch];
|
||||
psb_l_t *trymatchindexrow;
|
||||
trymatchindexrow= (psb_l_t *) calloc(nzrow_W, sizeof(psb_l_t));
|
||||
|
||||
startj=W_i[tryrowmatch];
|
||||
for(k=0; k<nzrow_W; ++k) trymatchindexrow[k]=W_j[startj+k];
|
||||
|
||||
d_trymatch(rowindex,tryrowmatch,
|
||||
nrows_W, W_i, W_j, W_data,
|
||||
jrowindex,ljrowindex,
|
||||
trymatchindexrow,nzrow_W,rmatch);
|
||||
free(trymatchindexrow);
|
||||
}
|
||||
}
|
||||
|
||||
if(rmatch[colindex]==-1 && ljcolindex!=0)
|
||||
{
|
||||
trycolmatch=jcolindex[0];
|
||||
nzrow_W=W_i[colindex+1]-W_i[colindex];
|
||||
startj=W_i[colindex];
|
||||
k=0;
|
||||
kindex=-1;
|
||||
while(k<nzrow_W && kindex==-1)
|
||||
{
|
||||
if(W_j[startj+k]==trycolmatch) kindex=startj+k;
|
||||
k++;
|
||||
}
|
||||
nweight=W_data[kindex];
|
||||
|
||||
ljcolindex=ljcolindex-1;
|
||||
for(i=0; i<ljcolindex; ++i) jcolindex[i]=jcolindex[i+1];
|
||||
|
||||
if(nweight > cweight && rmatch[trycolmatch]==-1)
|
||||
{
|
||||
nzrow_W=W_i[trycolmatch+1]-W_i[trycolmatch];
|
||||
psb_l_t *trymatchindexcol;
|
||||
trymatchindexcol= (psb_l_t *) calloc(nzrow_W, sizeof(psb_l_t));
|
||||
|
||||
startj=W_i[trycolmatch];
|
||||
for(k=0; k<nzrow_W; ++k) trymatchindexcol[k]=W_j[startj+k];
|
||||
|
||||
d_trymatch(colindex,trycolmatch,
|
||||
nrows_W, W_i, W_j, W_data,
|
||||
jcolindex,ljcolindex,
|
||||
trymatchindexcol,nzrow_W,rmatch);
|
||||
free(trymatchindexcol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(rmatch[rowindex]==-1 & rmatch[colindex]==-1)
|
||||
{
|
||||
rmatch[rowindex]=colindex;
|
||||
rmatch[colindex]=rowindex;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
psb_l_t *d_CSRMatrixHMatch( psb_l_t nrows_B, psb_l_t ncols_B,
|
||||
psb_l_t nnz_B, psb_l_t *B_i,
|
||||
psb_l_t *B_j, psb_d_t *B_data)
|
||||
{
|
||||
|
||||
psb_l_t i, j, k, *rmatch;
|
||||
psb_d_t *c, alpha;
|
||||
psb_l_t jbp, nzrows_B;
|
||||
psb_d_t tmp=0.0;
|
||||
psb_l_t rno, cno, nzrows_cno, startj, ljrowindex, ljjrowindex;
|
||||
psb_l_t *jrowindex, *jjrowindex;
|
||||
|
||||
#if 0
|
||||
psb_l_t *B_i = bcm_CSRMatrixI(B);
|
||||
psb_l_t *B_j = bcm_CSRMatrixJ(B);
|
||||
psb_d_t *B_data = bcm_CSRMatrixData(B);
|
||||
psb_l_t nrows_B = bcm_CSRMatrixNumRows(B);
|
||||
psb_l_t ncols_B = bcm_CSRMatrixNumCols(B);
|
||||
psb_l_t nnz_B = bcm_CSRMatrixNumNonzeros(B);
|
||||
#endif
|
||||
// assert(nrows_B==ncols_B);
|
||||
|
||||
rmatch = (psb_l_t *) calloc(nrows_B, sizeof(psb_l_t));
|
||||
|
||||
for(i=0; i<nrows_B; ++i) rmatch[i]=-1;
|
||||
|
||||
jrowindex = (psb_l_t *) calloc(nrows_B, sizeof(psb_l_t));
|
||||
jjrowindex = (psb_l_t *) calloc(nrows_B, sizeof(psb_l_t));
|
||||
|
||||
jbp=0;
|
||||
for(i=0; i< nrows_B; ++i)
|
||||
{
|
||||
nzrows_B=B_i[i+1]-B_i[i];
|
||||
|
||||
for(j=0; j<nzrows_B; ++j) jrowindex[j]=B_j[jbp+j];
|
||||
for(j=0; j<nzrows_B; ++j)
|
||||
{
|
||||
rno=i;
|
||||
cno=B_j[jbp+j];
|
||||
|
||||
startj=B_i[cno];
|
||||
nzrows_cno=B_i[cno+1]-startj;
|
||||
|
||||
for(k=0; k<nzrows_cno; ++k) jjrowindex[k]=B_j[startj+k];
|
||||
|
||||
if(rmatch[rno] == -1 && rmatch[cno] == -1)
|
||||
d_trymatch(rno,cno,nrows_B,B_i,B_j,B_data,
|
||||
jrowindex,nzrows_B,jjrowindex,nzrows_cno,rmatch);
|
||||
|
||||
}
|
||||
|
||||
jbp=jbp+nzrows_B;
|
||||
}
|
||||
|
||||
free(jrowindex);
|
||||
free(jjrowindex);
|
||||
|
||||
return rmatch;
|
||||
}
|
||||
|
||||
|
||||
void dMatching(psb_l_t NLVer, psb_l_t NLEdge,
|
||||
psb_l_t *verLocPtr, psb_l_t *verLocInd, psb_d_t *edgeLocWeight,
|
||||
psb_l_t *verDistance, psb_l_t *Mate)
|
||||
{
|
||||
psb_l_t *lmate;
|
||||
lmate = d_CSRMatrixHMatch( NLVer, NLVer, NLEdge,
|
||||
verLocPtr, verLocInd,edgeLocWeight);
|
||||
for (psb_l_t i=0; i<NLVer; i++){
|
||||
Mate[i] = lmate[i];
|
||||
}
|
||||
free(lmate);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
psb_l_t s_trymatch(psb_l_t rowindex, psb_l_t colindex,
|
||||
psb_l_t nrows_W, psb_l_t *W_i, psb_l_t *W_j, psb_s_t *W_data,
|
||||
psb_l_t *jrowindex, psb_l_t ljrowindex,
|
||||
psb_l_t *jcolindex, psb_l_t ljcolindex, psb_l_t *rmatch)
|
||||
{
|
||||
|
||||
psb_l_t tryrowmatch, trycolmatch;
|
||||
psb_l_t i, j, k, nzrow_W, startj, kindex;
|
||||
psb_s_t cweight, nweight;
|
||||
|
||||
// psb_l_t *W_i = bcm_CSRMatrixI(W);
|
||||
// psb_l_t *W_j = bcm_CSRMatrixJ(W);
|
||||
// psb_l_t nrows_W = bcm_CSRMatrixNumRows(W);
|
||||
// psb_s_t *W_data=bcm_CSRMatrixData(W);
|
||||
|
||||
k=-1;
|
||||
i=0;
|
||||
while (i<ljrowindex && k ==-1)
|
||||
{
|
||||
if(jrowindex[i]==colindex) k=i;
|
||||
i++;
|
||||
}
|
||||
if(k >= 0)
|
||||
{
|
||||
ljrowindex=ljrowindex-1;
|
||||
for(i=k; i<ljrowindex; ++i) jrowindex[i]=jrowindex[i+1];
|
||||
}
|
||||
|
||||
k=-1;
|
||||
i=0;
|
||||
while(i<ljcolindex && k==-1)
|
||||
{
|
||||
if(jcolindex[i]==rowindex) k=i;
|
||||
i++;
|
||||
}
|
||||
if(k >= 0)
|
||||
{
|
||||
ljcolindex=ljcolindex-1;
|
||||
for(i=k; i<ljcolindex; ++i) jcolindex[i]=jcolindex[i+1];
|
||||
}
|
||||
|
||||
nzrow_W=W_i[rowindex+1]-W_i[rowindex];
|
||||
startj=W_i[rowindex];
|
||||
kindex=-1;
|
||||
k=0;
|
||||
while(k<nzrow_W && kindex==-1)
|
||||
{
|
||||
if(W_j[startj+k]==colindex) kindex=startj+k;
|
||||
k++;
|
||||
}
|
||||
cweight=W_data[kindex];
|
||||
|
||||
while((rmatch[rowindex]==-1 && rmatch[colindex]==-1)
|
||||
&& (ljrowindex !=0 || ljcolindex !=0))
|
||||
{
|
||||
|
||||
if (rmatch[rowindex] == -1 && ljrowindex !=0)
|
||||
{
|
||||
tryrowmatch=jrowindex[0];
|
||||
nzrow_W=W_i[rowindex+1]-W_i[rowindex];
|
||||
startj=W_i[rowindex];
|
||||
k=0;
|
||||
kindex=-1;
|
||||
while(k<nzrow_W && kindex==-1)
|
||||
{
|
||||
if(W_j[startj+k]==tryrowmatch) kindex=startj+k;
|
||||
k++;
|
||||
}
|
||||
nweight=W_data[kindex];
|
||||
|
||||
ljrowindex=ljrowindex-1;
|
||||
for(i=0; i<ljrowindex; ++i) jrowindex[i]=jrowindex[i+1];
|
||||
|
||||
if(nweight > cweight && rmatch[tryrowmatch]==-1)
|
||||
{
|
||||
|
||||
nzrow_W=W_i[tryrowmatch+1]-W_i[tryrowmatch];
|
||||
psb_l_t *trymatchindexrow;
|
||||
trymatchindexrow= (psb_l_t *) calloc(nzrow_W, sizeof(psb_l_t));
|
||||
|
||||
startj=W_i[tryrowmatch];
|
||||
for(k=0; k<nzrow_W; ++k) trymatchindexrow[k]=W_j[startj+k];
|
||||
|
||||
s_trymatch(rowindex,tryrowmatch,
|
||||
nrows_W, W_i, W_j, W_data,
|
||||
jrowindex,ljrowindex,
|
||||
trymatchindexrow,nzrow_W,rmatch);
|
||||
free(trymatchindexrow);
|
||||
}
|
||||
}
|
||||
|
||||
if(rmatch[colindex]==-1 && ljcolindex!=0)
|
||||
{
|
||||
trycolmatch=jcolindex[0];
|
||||
nzrow_W=W_i[colindex+1]-W_i[colindex];
|
||||
startj=W_i[colindex];
|
||||
k=0;
|
||||
kindex=-1;
|
||||
while(k<nzrow_W && kindex==-1)
|
||||
{
|
||||
if(W_j[startj+k]==trycolmatch) kindex=startj+k;
|
||||
k++;
|
||||
}
|
||||
nweight=W_data[kindex];
|
||||
|
||||
ljcolindex=ljcolindex-1;
|
||||
for(i=0; i<ljcolindex; ++i) jcolindex[i]=jcolindex[i+1];
|
||||
|
||||
if(nweight > cweight && rmatch[trycolmatch]==-1)
|
||||
{
|
||||
nzrow_W=W_i[trycolmatch+1]-W_i[trycolmatch];
|
||||
psb_l_t *trymatchindexcol;
|
||||
trymatchindexcol= (psb_l_t *) calloc(nzrow_W, sizeof(psb_l_t));
|
||||
|
||||
startj=W_i[trycolmatch];
|
||||
for(k=0; k<nzrow_W; ++k) trymatchindexcol[k]=W_j[startj+k];
|
||||
|
||||
s_trymatch(colindex,trycolmatch,
|
||||
nrows_W, W_i, W_j, W_data,
|
||||
jcolindex,ljcolindex,
|
||||
trymatchindexcol,nzrow_W,rmatch);
|
||||
free(trymatchindexcol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(rmatch[rowindex]==-1 & rmatch[colindex]==-1)
|
||||
{
|
||||
rmatch[rowindex]=colindex;
|
||||
rmatch[colindex]=rowindex;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
psb_l_t *s_CSRMatrixHMatch( psb_l_t nrows_B, psb_l_t ncols_B,
|
||||
psb_l_t nnz_B, psb_l_t *B_i,
|
||||
psb_l_t *B_j, psb_s_t *B_data)
|
||||
{
|
||||
|
||||
psb_l_t i, j, k, *rmatch;
|
||||
psb_s_t *c, alpha;
|
||||
psb_l_t jbp, nzrows_B;
|
||||
psb_s_t tmp=0.0;
|
||||
psb_l_t rno, cno, nzrows_cno, startj, ljrowindex, ljjrowindex;
|
||||
psb_l_t *jrowindex, *jjrowindex;
|
||||
|
||||
#if 0
|
||||
psb_l_t *B_i = bcm_CSRMatrixI(B);
|
||||
psb_l_t *B_j = bcm_CSRMatrixJ(B);
|
||||
psb_s_t *B_data = bcm_CSRMatrixData(B);
|
||||
psb_l_t nrows_B = bcm_CSRMatrixNumRows(B);
|
||||
psb_l_t ncols_B = bcm_CSRMatrixNumCols(B);
|
||||
psb_l_t nnz_B = bcm_CSRMatrixNumNonzeros(B);
|
||||
#endif
|
||||
// assert(nrows_B==ncols_B);
|
||||
|
||||
rmatch = (psb_l_t *) calloc(nrows_B, sizeof(psb_l_t));
|
||||
|
||||
for(i=0; i<nrows_B; ++i) rmatch[i]=-1;
|
||||
|
||||
jrowindex = (psb_l_t *) calloc(nrows_B, sizeof(psb_l_t));
|
||||
jjrowindex = (psb_l_t *) calloc(nrows_B, sizeof(psb_l_t));
|
||||
|
||||
jbp=0;
|
||||
for(i=0; i< nrows_B; ++i)
|
||||
{
|
||||
nzrows_B=B_i[i+1]-B_i[i];
|
||||
|
||||
for(j=0; j<nzrows_B; ++j) jrowindex[j]=B_j[jbp+j];
|
||||
for(j=0; j<nzrows_B; ++j)
|
||||
{
|
||||
rno=i;
|
||||
cno=B_j[jbp+j];
|
||||
|
||||
startj=B_i[cno];
|
||||
nzrows_cno=B_i[cno+1]-startj;
|
||||
|
||||
for(k=0; k<nzrows_cno; ++k) jjrowindex[k]=B_j[startj+k];
|
||||
|
||||
if(rmatch[rno] == -1 && rmatch[cno] == -1)
|
||||
s_trymatch(rno,cno,nrows_B,B_i,B_j,B_data,
|
||||
jrowindex,nzrows_B,jjrowindex,nzrows_cno,rmatch);
|
||||
|
||||
}
|
||||
|
||||
jbp=jbp+nzrows_B;
|
||||
}
|
||||
|
||||
free(jrowindex);
|
||||
free(jjrowindex);
|
||||
|
||||
return rmatch;
|
||||
}
|
||||
|
||||
|
||||
void sMatching(psb_l_t NLVer, psb_l_t NLEdge,
|
||||
psb_l_t *verLocPtr, psb_l_t *verLocInd, psb_s_t *edgeLocWeight,
|
||||
psb_l_t *verDistance, psb_l_t *Mate)
|
||||
{
|
||||
|
||||
psb_l_t *lmate;
|
||||
lmate = s_CSRMatrixHMatch( NLVer, NLVer, NLEdge,
|
||||
verLocPtr, verLocInd,edgeLocWeight);
|
||||
for (psb_l_t i=0; i<NLVer; i++){
|
||||
Mate[i] = lmate[i];
|
||||
}
|
||||
free(lmate);
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,81 @@
|
||||
/*
|
||||
AMG4PSBLAS version 1.2
|
||||
Algebraic Multigrid Package
|
||||
based on PSBLAS (Parallel Sparse BLAS version 3.9)
|
||||
|
||||
(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.
|
||||
|
||||
Includes material from BootCMatch, see copyright below.
|
||||
*/
|
||||
|
||||
/*
|
||||
BootCMatch
|
||||
Bootstrap AMG based on Compatible weighted Matching, version 0.9
|
||||
(C) Copyright 2017
|
||||
Pasqua D'Ambra IAC-CNR, IT
|
||||
Panayot S. Vassilevski Portland State University, OR USA
|
||||
|
||||
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 BootCMatch 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 BootCMatch 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.
|
||||
|
||||
*/
|
||||
#include "amg_config.h"
|
||||
|
||||
#if defined(PSB_SERIAL_MPI)
|
||||
#include "psb_types.h"
|
||||
void dMatching(psb_l_t NLVer, psb_l_t NLEdge,
|
||||
psb_l_t *verLocPtr, psb_l_t *verLocInd, psb_d_t *edgeLocWeight,
|
||||
psb_l_t *verDistance, psb_l_t *Mate);
|
||||
void sMatching(psb_l_t NLVer, psb_l_t NLEdge,
|
||||
psb_l_t *verLocPtr, psb_l_t *verLocInd, psb_s_t *edgeLocWeight,
|
||||
psb_l_t *verDistance, psb_l_t *Mate);
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue