Compare commits

..
372 changed files with 11824 additions and 255009 deletions
-3
View File
@@ -5,7 +5,6 @@
# header files generated
cbind/*.h
amgprec/amg_config.h
# Make.inc generated
/Make.inc
@@ -21,5 +20,3 @@ autom4te.cache
# the executable from tests
runs
# Documentation temporary files
docs/src/userguide.pdf
+165
View File
@@ -0,0 +1,165 @@
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.
+3 -3
View File
@@ -1,10 +1,10 @@
AMG4PSBLAS version 1.2
AMG4PSBLAS version 1.1
Algebraic Multigrid Package
based on PSBLAS (Parallel Sparse BLAS version 3.9)
based on PSBLAS (Parallel Sparse BLAS version 3.8)
(C) Copyright 2025
(C) Copyright 2022
Salvatore Filippone
Pasqua D'Ambra
+1 -1
View File
@@ -49,7 +49,7 @@ PSBLAS_INCLUDES=@PSBLAS_INCLUDES@
PSBLAS_LIBS=@PSBLAS_LIBS@
PSBBASEMODNAME=psb_base_mod
PSBPRECMODNAME=psb_prec_mod
PSBMETHDMODNAME=psb_linsolve_mod
PSBMETHDMODNAME=psb_krylov_mod
PSBUTILMODNAME=psb_util_mod
+4 -7
View File
@@ -44,10 +44,8 @@ cleanlib:
(cd include; /bin/rm -f *.a *$(.mod) *$(.fh))
(cd modules; /bin/rm -f *.a *$(.mod) *$(.fh))
distclean: clean samplesclean
/bin/rm -fr Make.inc amgprec/amg_config.h
samplesclean: clean
veryclean: cleanlib
(cd amgprec && $(MAKE) veryclean)
(cd samples/simple/fileread && $(MAKE) clean)
(cd samples/simple/pdegen && $(MAKE) clean)
(cd samples/advanced/fileread && $(MAKE) clean)
@@ -56,6 +54,5 @@ samplesclean: clean
check: all
make check -C samples/advanced/pdegen
clean: cleanlib
(cd amgprec && $(MAKE) veryclean)
(cd cbind && $(MAKE) veryclean)
clean:
(cd amgprec && $(MAKE) clean)
+35 -57
View File
@@ -1,76 +1,54 @@
# AMG4PSBLAS v1.2
Algebraic Multigrid Package based on [PSBLAS](https://github.com/sfilippone/psblas3) (Parallel Sparse BLAS version 3.9)
AMG4PSBLAS
Algebraic Multigrid Package based on PSBLAS (Parallel Sparse BLAS version 3.8)
Salvatore Filippone (University of Rome Tor Vergata and IAC-CNR)
Pasqua D'Ambra (IAC-CNR, Naples, IT)
Fabio Durastante (IAC-CNR, Naples, IT)
AMG4PSBLAS is a package of parallel algebraic multilevel preconditioners included in the PSCToolkit (Parallel Sparse Computation Toolkit) software framework.
---------------------------------------------------------------------
It is a progress of a software development project started in 2007, named MLD2P4, which originally implemented a multilevel version of some domain decomposition preconditioners of additive-Schwarz type and was based on a parallel decoupled version of the well known smoothed aggregation method to generate the multilevel hierarchy of coarser matrices.
AMG4PSBLAS is a package of Algebraic MultiGrid (AMG)
preconditioners for the iterative solution of large and sparse linear systems.
In the last years the package was extended for including new algorithms and functionalities for the setup and application new AMG preconditioners with the final aims of improving efficiency and scalability when tens of thousands cores are used and of boosting reliability in dealing with general symmetric positive definite linear systems.
It is an evolution of MLD2P4 (see LICENSE.MLD2P4), but it has been
thoroughly reworked, and it is sufficiently different to warrant a new
project name.
It is an evolution of MLD2P4 (see [LICENSE.MLD2P4](LICENSE.MLD2P4)), but due to the significant number of changes and the increase in scope, we decided to rename the package as AMG4PSBLAS.
AMG4PSBLAS has been designed to provide scalable and easy-to-use preconditioners in the context of the PSBLAS (Parallel Sparse Basic Linear Algebra Subprograms) computational framework and can be used in conjuction with the Krylov solvers available in this framework. Our package is based on a completely algebraic approach; therefore users level interfaces assume that the system matrix and preconditioners are represented as PSBLAS distributed sparse matrices.
MAIN REFERENCES:
AMG4PSBLAS enables the user to easily specify different features of an algebraic multilevel preconditioner, thus allowing to experiment with different preconditioners for the problem and parallel computers at hand.
The package employs object-oriented design techniques in Fortran 2008, with interfaces to additional third party libraries such as MUMPS, UMFPACK, SuperLU, and SuperLU_Dist, which can be exploited in building multilevel preconditioners. The parallel implementation is based on a Single Program Multiple Data (SPMD) paradigm; the inter-process communication is based on MPI and is managed mainly through PSBLAS.
P. D'Ambra, D. di Serafino, S. Filippone,
MLD2P4: a Package of Parallel Algebraic Multilevel Domain Decomposition
Preconditioners in Fortran 95,
ACM Transactions on Mathematical Software, 37 (3), 2010, art. 30,
doi: 10.1145/1824801.1824808.
## Main Refrerences:
The main reference for this project is
> D'Ambra, P., Durastante, F., & Filippone, S. (2021). AMG preconditioners for linear solvers towards extreme scale. SIAM Journal on Scientific Computing, 43(5), S679-S703.
AMG4PSBLAS is the suite of preconditioners for the Parallel Sparse Computation Toolkit ([PSCToolkit](https://psctoolkit.github.io/)) suite of libraries. See the paper:
> D’Ambra, P., Durastante, F., & Filippone, S. (2023). Parallel Sparse Computation Toolkit. Software Impacts, 15, 100463.
The main reference for features inherited from MLD2P4 is
> P. D'Ambra, D. di Serafino, S. Filippone,
> MLD2P4: a Package of Parallel Algebraic Multilevel Domain Decomposition
> Preconditioners in Fortran 95,
> ACM Transactions on Mathematical Software, 37 (3), 2010, art. 30,
> doi: 10.1145/1824801.1824808.
## Installing
Installation requires having a working version of the [PSBLAS](https://github.com/sfilippone/psblas3) library installed.
AMG4PSBLAS has several interfaces to third-party libraries that can be used in the construction and application phases of preconditioners.
In particular, it is possible to link AMG4PSBLAS with the libraries: MUMPS, SuperLU, SuperLU_Dist, UMFPACK. This is _not mandatory_ and the library can run
in isolation and without these features.
TO COMPILE
0. Unpack the tar file in a directory of your choice (preferrably
outside the main PSBLAS directory).
1. run configure `--with-psblas=<ABSOLUTE path of the PSBLAS install directory>`
1. run configure --with-psblas=<ABSOLUTE path of the PSBLAS install directory>
adding the options for MUMPS, SuperLU, SuperLU_Dist, UMFPACK as desired.
See [AMG4PSBLAS User's and Reference Guide](docs/amg4psblas_1.0-guide.pdf) (Section 3) for details.
2. Tweak `Make.inc` if you are not satisfied.
3. run `make`;
See MLD2P4 User's and Reference Guide (Section 3) for details.
2. Tweak Make.inc if you are not satisfied.
3. make;
4. Go into the test subdirectory and build the examples of your choice.
5. (if desired): `make install`
5. (if desired): make install
>[!CAUTION]
>The single precision version is supported only by MUMPS and SuperLU;
>thus, even if you specify at configure time to use UMFPACK or SuperLU_Dist,
>the corresponding preconditioner options will be available only from
>the double precision version.
### CUDA, OpeMP, OpenACC
NOTES
CUDA, OpenMP and OpenACC features are transparently inherited by PSBLAS installation. If PSBLAS has been configured (and installed) with these supports then AMG4PSBLAS will transparently inherit them. It will then be possible to move the computation to GPU accelerator simply by selecting the appropriate variable types. If these have not been activated or installed for PSBLAS then they will not be available for AMG4PSBLAS either and the operation will be purely on CPU/MPI. See also the samples/cuda folder.
- The single precision version is supported only by MUMPS and SuperLU;
thus, even if you specify at configure time to use UMFPACK or SuperLU_Dist,
the corresponding preconditioner options will be available only from
the double precision version.
### EoCoE - Software as service portal
In the European project “Energy oriented Center of Excellence: toward exascale for energy” we made available a software as service portal: [https://eocoe.psnc.pl/](https://eocoe.psnc.pl/). This permits to test several cutting-edge computational methods for accelerating the transition to the production, storage and management of clean, decarbonized energy. Among them you have the possibility of running PSBLAS+AMG4PSBLAS on some test problems to become familiar with using the software.
## TODO and bugs
- [X] Fix all reamining bugs. Bugs? We dont' have any ! 🤓
> [!NOTE]
> To report bugs 🐛 or issues ❓ please use the [GitHub issue system](https://github.com/sfilippone/amg4psblas/issues).
## The AMG4PSBLAS team.
- Pasqua D'Ambra (IAC-CNR, Naples, IT)
- Fabio Durastante (University of Pisa and IAC-CNR, IT)
- Salvatore Filippone (University of Rome Tor Vergata and IAC-CNR, IT)
The AMG4PSBLAS team.
---------------
Salvatore Filippone
Pasqua D'Ambra
Fabio Durastante
-14
View File
@@ -1,19 +1,5 @@
WHAT'S NEW
AMG4PSBLAS
Version 1.2
1. New polynomial smoothers.
2. Introduced L1-variants
3. Reorganization of sample programs.
Version 1.1
1. Reworked approximate inverse solvers.
Version 1.0
1. Transitioned from MLD2P4
MLD2P4
Version 2.1
1. The multigrid preconditioner now include fully general V- and
W-cycles. We also support K-cycles, both for symmetric and
+1 -1
View File
@@ -66,7 +66,7 @@ LIBNAME=libamg_prec.a
all: objs impld
objs: $(OBJS)
/bin/cp -p amg_const.h amg_config.h $(INCDIR)
/bin/cp -p amg_const.h $(INCDIR)
/bin/cp -p *$(.mod) $(MODDIR)
impld: objs
+4
View File
@@ -55,6 +55,10 @@ module amg_base_ainv_mod
integer, parameter :: amg_ainv_llk_noth_ = amg_ainv_s_ft_llk_ + 1
integer, parameter :: amg_ainv_mlk_ = amg_ainv_llk_noth_ + 1
integer, parameter :: amg_ainv_lmx_ = amg_ainv_mlk_
#if defined(HAVE_TUMA_SAINV)
integer, parameter :: amg_ainv_s_tuma_ = amg_ainv_lmx_ + 1
integer, parameter :: amg_ainv_l_tuma_ = amg_ainv_s_tuma_ + 1
#endif
end module amg_base_ainv_mod
+22 -29
View File
@@ -81,9 +81,9 @@ module amg_base_prec_type
!
! Version numbers
!
character(len=*), parameter :: amg_version_string_ = "1.2.0"
character(len=*), parameter :: amg_version_string_ = "1.1.0"
integer(psb_ipk_), parameter :: amg_version_major_ = 1
integer(psb_ipk_), parameter :: amg_version_minor_ = 2
integer(psb_ipk_), parameter :: amg_version_minor_ = 1
integer(psb_ipk_), parameter :: amg_patchlevel_ = 0
type amg_ml_parms
@@ -288,19 +288,17 @@ module amg_base_prec_type
!
! Legal values for entry: amg_aggr_prol_
!
integer(psb_ipk_), parameter :: amg_no_smooth_ = 0
integer(psb_ipk_), parameter :: amg_smooth_prol_ = 1
integer(psb_ipk_), parameter :: amg_l1_smooth_prol_ = 2
integer(psb_ipk_), parameter :: amg_min_energy_ = 3
integer(psb_ipk_), parameter :: amg_no_smooth_ = 0
integer(psb_ipk_), parameter :: amg_smooth_prol_ = 1
integer(psb_ipk_), parameter :: amg_min_energy_ = 2
! Disabling min_energy for the time being.
integer(psb_ipk_), parameter :: amg_max_aggr_prol_= amg_l1_smooth_prol_
integer(psb_ipk_), parameter :: amg_max_aggr_prol_=amg_smooth_prol_
!
! Legal values for entry: amg_aggr_filter_
!
integer(psb_ipk_), parameter :: amg_no_filter_mat_ = 0
integer(psb_ipk_), parameter :: amg_filter_mat_ = 1
integer(psb_ipk_), parameter :: amg_filter_prow_mat_ = 2
integer(psb_ipk_), parameter :: amg_max_filter_mat_ = amg_filter_prow_mat_
integer(psb_ipk_), parameter :: amg_no_filter_mat_ = 0
integer(psb_ipk_), parameter :: amg_filter_mat_ = 1
integer(psb_ipk_), parameter :: amg_max_filter_mat_ = amg_filter_mat_
!
! Legal values for entry: amg_aggr_ord_
!
@@ -325,10 +323,10 @@ module amg_base_prec_type
!
! Legal values for entry: amg_poly_variant_
!
integer(psb_ipk_), parameter :: amg_cheb_4_ = 0
integer(psb_ipk_), parameter :: amg_cheb_4_opt_ = 1
integer(psb_ipk_), parameter :: amg_cheb_1_opt_ = 2
integer(psb_ipk_), parameter :: amg_poly_dbg_ = 8
integer(psb_ipk_), parameter :: amg_poly_lottes_ = 0
integer(psb_ipk_), parameter :: amg_poly_lottes_beta_ = 1
integer(psb_ipk_), parameter :: amg_poly_new_ = 2
integer(psb_ipk_), parameter :: amg_poly_dbg_ = 8
integer(psb_ipk_), parameter :: amg_poly_rho_est_power_ = 0
@@ -378,11 +376,10 @@ module amg_base_prec_type
character(len=19), parameter, private :: &
& eigen_estimates(0:0)=(/'infinity norm '/)
character(len=15), parameter, private :: &
& aggr_prols(0:4)=(/'unsmoothed ','smoothed ',&
& 'l1-smoothed ','min energy ','bizr. smoothed'/)
& aggr_prols(0:3)=(/'unsmoothed ','smoothed ',&
& 'min energy ','bizr. smoothed'/)
character(len=15), parameter, private :: &
& aggr_filters(0:2)=(/'no filtering ','filtering ',&
& 'filtering rsum'/)
& aggr_filters(0:1)=(/'no filtering ','filtering '/)
character(len=15), parameter, private :: &
& matrix_names(0:1)=(/'distributed ','replicated '/)
character(len=18), parameter, private :: &
@@ -551,8 +548,6 @@ contains
val = amg_no_smooth_
case('SMOOTHED')
val = amg_smooth_prol_
case('L1-SMOOTHED','L1SMOOTHED')
val = amg_l1_smooth_prol_
case('MINENERGY')
val = amg_min_energy_
case('NOPREC')
@@ -575,12 +570,12 @@ contains
val = amg_as_
case('POLY')
val = amg_poly_
case('CHEB_4')
val = amg_cheb_4_
case('CHEB_4_OPT')
val = amg_cheb_4_opt_
case('CHEB_1_OPT')
val = amg_cheb_1_opt_
case('POLY_LOTTES')
val = amg_poly_lottes_
case('POLY_LOTTES_BETA')
val = amg_poly_lottes_beta_
case('POLY_NEW')
val = amg_poly_new_
case('POLY_DBG')
val = amg_poly_dbg_
case('POLY_RHO_EST_POWER')
@@ -593,8 +588,6 @@ contains
val = amg_eig_est_
case('FILTER')
val = amg_filter_mat_
case('FILTERROWSUM')
val = amg_filter_prow_mat_
case('NOFILTER','NO_FILTER')
val = amg_no_filter_mat_
case('OUTER_SWEEPS')
+6 -3
View File
@@ -62,6 +62,9 @@ module amg_c_ainv_solver
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
!!$ procedure, pass(sv) :: seti => amg_c_ainv_solver_seti
!!$ procedure, pass(sv) :: setc => amg_c_ainv_solver_setc
!!$ procedure, pass(sv) :: setr => amg_c_ainv_solver_setr
procedure, pass(sv) :: descr => amg_c_ainv_solver_descr
procedure, pass(sv) :: default => c_ainv_solver_default
procedure, nopass :: stringval => c_ainv_stringval
@@ -88,9 +91,9 @@ module amg_c_ainv_solver
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), intent(inout) :: svout
integer(psb_ipk_), intent(out) :: info
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
+1 -2
View File
@@ -302,7 +302,7 @@ contains
integer(psb_ipk_), intent(out) :: info
! Do nothing
info = psb_success_
return
end subroutine amg_c_base_aggregator_set_aggr_type
@@ -486,7 +486,6 @@ contains
integer(psb_ipk_) :: err_act
character(len=20) :: name='c_base_aggregator_bld_map'
info = psb_success_
call psb_erractionsave(err_act)
!
! Copy the prolongation/restriction matrices into the descriptor map.
+1 -2
View File
@@ -150,7 +150,7 @@ contains
class(amg_c_dec_aggregator_type), intent(inout) :: ag
type(amg_sml_parms), intent(in) :: parms
integer(psb_ipk_), intent(out) :: info
info = psb_success_
select case(parms%aggr_type)
case (amg_noalg_)
ag%soc_map_bld => null()
@@ -192,7 +192,6 @@ contains
integer(psb_ipk_), intent(out) :: info
character(len=*), intent(in), optional :: prefix
character(1024) :: prefix_
info = psb_success_
if (present(prefix)) then
prefix_ = prefix
else
+125
View File
@@ -0,0 +1,125 @@
!
!
! 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
+1 -2
View File
@@ -109,12 +109,11 @@ module amg_c_inner_mod
end interface amg_map_to_tprol
abstract interface
subroutine amg_caggrmat_var_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,parms,&
subroutine amg_caggrmat_var_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_, psb_lpk_, psb_lcspmat_type
import :: amg_c_onelev_type, amg_sml_parms
implicit none
integer(psb_ipk_), intent(in) :: dol1smoothing
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
+3 -3
View File
@@ -79,9 +79,9 @@ module amg_c_invk_solver
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), intent(inout) :: svout
integer(psb_ipk_), intent(out) :: info
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
+3 -3
View File
@@ -79,9 +79,9 @@ module amg_c_invt_solver
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), intent(inout) :: svout
integer(psb_ipk_), intent(out) :: info
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
+2 -2
View File
@@ -203,8 +203,8 @@ module amg_c_jac_smoother
subroutine amg_c_jac_smoother_clone_settings(sm,smout,info)
import :: amg_c_jac_smoother_type, psb_spk_, &
& amg_c_base_smoother_type, psb_ipk_
class(amg_c_jac_smoother_type), intent(inout) :: sm
class(amg_c_base_smoother_type), intent(inout) :: smout
class(amg_c_jac_smoother_type), intent(inout) :: sm
class(amg_c_base_smoother_type), allocatable, intent(inout) :: smout
integer(psb_ipk_), intent(out) :: info
end subroutine amg_c_jac_smoother_clone_settings
end interface
+11 -11
View File
@@ -52,10 +52,10 @@
!
module amg_c_mumps_solver
use amg_c_base_solver_mod
#if defined(AMG_HAVE_MUMPS) && defined(AMG_HAVE_MUMPS_MODULES)
#if defined(HAVE_MUMPS_) && defined(HAVE_MUMPS_MODULES_)
use cmumps_struc_def
#endif
#if defined(AMG_HAVE_MUMPS) && defined(AMG_HAVE_MUMPS_INCLUDES)
#if defined(HAVE_MUMPS_) && defined(HAVE_MUMPS_INCLUDES_)
include 'cmumps_struc.h'
#endif
@@ -68,7 +68,7 @@ module amg_c_mumps_solver
end type amg_c_mumps_rcntl_item
type, extends(amg_c_base_solver_type) :: amg_c_mumps_solver_type
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
type(cmumps_struc), allocatable :: id
#else
integer, allocatable :: id
@@ -189,7 +189,7 @@ contains
info = 0
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
call psb_erractionsave(err_act)
@@ -239,7 +239,7 @@ contains
character(len=20) :: name='c_mumps_solver_clear_data'
info = 0
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
call psb_erractionsave(err_act)
if (allocated(sv%id)) then
if (sv%built) then
@@ -279,7 +279,7 @@ contains
character(len=20) :: name='c_mumps_solver_free'
info = 0
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
call psb_erractionsave(err_act)
call sv%clear_data(info)
if ((info == 0).and.allocated(sv%icntl)) deallocate(sv%icntl,stat=info)
@@ -383,7 +383,7 @@ subroutine c_mumps_solver_csetc(sv,what,val,info,idx)
select case(psb_toupper(trim(what)))
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
case('MUMPS_LOC_GLOB')
sv%ipar(1) = sv%stringval(psb_toupper(trim(val)))
#endif
@@ -421,7 +421,7 @@ subroutine c_mumps_solver_cseti(sv,what,val,info,idx)
call psb_erractionsave(err_act)
select case(psb_toupper(what))
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
case('MUMPS_LOC_GLOB')
sv%ipar(1) = val
case('MUMPS_PRINT_ERR')
@@ -467,7 +467,7 @@ subroutine c_mumps_solver_csetr(sv,what,val,info,idx)
call psb_erractionsave(err_act)
select case(psb_toupper(what))
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
case('MUMPS_RPAR_ENTRY')
if(present(idx)) then
! Note: this will allocate %item
@@ -504,7 +504,7 @@ subroutine c_mumps_solver_default(sv)
info = psb_success_
call psb_erractionsave(err_act)
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
if (.not.allocated(sv%id)) then
allocate(sv%id,stat=info)
if (info /= psb_success_) then
@@ -561,7 +561,7 @@ function c_mumps_solver_sizeof(sv) result(val)
class(amg_c_mumps_solver_type), intent(in) :: sv
integer(psb_epk_) :: val
integer :: i
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
val = (sv%id%INFOG(22)+sv%id%INFOG(32))*1d+6
#else
val = 0
-1
View File
@@ -113,7 +113,6 @@ module amg_c_prec_type
procedure, pass(prec) :: free => amg_c_prec_free
procedure, pass(prec) :: allocate_wrk => amg_c_allocate_wrk
procedure, pass(prec) :: free_wrk => amg_c_free_wrk
procedure, pass(prec) :: deallocate_wrk => amg_c_free_wrk
procedure, pass(prec) :: is_allocated_wrk => amg_c_is_allocated_wrk
procedure, pass(prec) :: get_complexity => amg_c_get_compl
procedure, pass(prec) :: cmp_complexity => amg_c_cmp_compl
+1 -1
View File
@@ -51,7 +51,7 @@ module amg_c_slu_solver
use iso_c_binding
use amg_c_base_solver_mod
#if defined(PSB_IPK8)
#if defined(IPK8)
type, extends(amg_c_base_solver_type) :: amg_c_slu_solver_type
+1 -1
View File
@@ -97,7 +97,7 @@ contains
character(len=*), intent(in), optional :: prefix
character(1024) :: prefix_
info = psb_success_
if (present(prefix)) then
prefix_ = prefix
else
-17
View File
@@ -1,17 +0,0 @@
#ifndef AMG_CONFIG_H
#define AMG_CONFIG_H
#include "psb_config.h"
@CHAVEUMF@
@CHAVESLU@
@CSLUVERSION@
@CHAVESLUDIST@
@CSLUDISTVERSION@
@CHAVEMUMPS@
@CHAVEMUMPSMODULES@
@CHAVEMUMPSINCLUDES@
@CXXMATCHBOXBIT@
#endif
+6 -3
View File
@@ -62,6 +62,9 @@ module amg_d_ainv_solver
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
!!$ procedure, pass(sv) :: seti => amg_d_ainv_solver_seti
!!$ procedure, pass(sv) :: setc => amg_d_ainv_solver_setc
!!$ procedure, pass(sv) :: setr => amg_d_ainv_solver_setr
procedure, pass(sv) :: descr => amg_d_ainv_solver_descr
procedure, pass(sv) :: default => d_ainv_solver_default
procedure, nopass :: stringval => d_ainv_stringval
@@ -88,9 +91,9 @@ module amg_d_ainv_solver
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), intent(inout) :: svout
integer(psb_ipk_), intent(out) :: info
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
+1 -2
View File
@@ -302,7 +302,7 @@ contains
integer(psb_ipk_), intent(out) :: info
! Do nothing
info = psb_success_
return
end subroutine amg_d_base_aggregator_set_aggr_type
@@ -486,7 +486,6 @@ contains
integer(psb_ipk_) :: err_act
character(len=20) :: name='d_base_aggregator_bld_map'
info = psb_success_
call psb_erractionsave(err_act)
!
! Copy the prolongation/restriction matrices into the descriptor map.
+1 -2
View File
@@ -150,7 +150,7 @@ contains
class(amg_d_dec_aggregator_type), intent(inout) :: ag
type(amg_dml_parms), intent(in) :: parms
integer(psb_ipk_), intent(out) :: info
info = psb_success_
select case(parms%aggr_type)
case (amg_noalg_)
ag%soc_map_bld => null()
@@ -192,7 +192,6 @@ contains
integer(psb_ipk_), intent(out) :: info
character(len=*), intent(in), optional :: prefix
character(1024) :: prefix_
info = psb_success_
if (present(prefix)) then
prefix_ = prefix
else
+125
View File
@@ -0,0 +1,125 @@
!
!
! 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 -2
View File
@@ -109,12 +109,11 @@ module amg_d_inner_mod
end interface amg_map_to_tprol
abstract interface
subroutine amg_daggrmat_var_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,parms,&
subroutine amg_daggrmat_var_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_, psb_lpk_, psb_ldspmat_type
import :: amg_d_onelev_type, amg_dml_parms
implicit none
integer(psb_ipk_), intent(in) :: dol1smoothing
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
+3 -3
View File
@@ -79,9 +79,9 @@ module amg_d_invk_solver
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), intent(inout) :: svout
integer(psb_ipk_), intent(out) :: info
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
+3 -3
View File
@@ -79,9 +79,9 @@ module amg_d_invt_solver
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), intent(inout) :: svout
integer(psb_ipk_), intent(out) :: info
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
+2 -2
View File
@@ -203,8 +203,8 @@ module amg_d_jac_smoother
subroutine amg_d_jac_smoother_clone_settings(sm,smout,info)
import :: amg_d_jac_smoother_type, psb_dpk_, &
& amg_d_base_smoother_type, psb_ipk_
class(amg_d_jac_smoother_type), intent(inout) :: sm
class(amg_d_base_smoother_type), intent(inout) :: smout
class(amg_d_jac_smoother_type), intent(inout) :: sm
class(amg_d_base_smoother_type), allocatable, intent(inout) :: smout
integer(psb_ipk_), intent(out) :: info
end subroutine amg_d_jac_smoother_clone_settings
end interface
@@ -73,22 +73,6 @@ module amg_d_matchboxp_mod
use iso_c_binding
use psb_base_cbind_mod
#if defined(PSB_SERIAL_MPI)
interface MatchingC
subroutine dMatchingC(nlver,nledge,verlocptr,verlocind,edgelocweight,&
& verdistance, mate) bind(c,name='dMatching')
use iso_c_binding
import :: psb_c_ipk_, psb_c_lpk_
implicit none
integer(psb_c_lpk_), value :: nlver,nledge
integer(psb_c_lpk_) :: verlocptr(*),verlocind(*), verdistance(*)
integer(psb_c_lpk_) :: mate(*)
real(c_double) :: edgelocweight(*)
end subroutine dMatchingC
end interface MatchingC
#else
interface MatchBoxPC
subroutine dMatchBoxPC(nlver,nledge,verlocptr,verlocind,edgelocweight,&
& verdistance, mate, myrank, numprocs, icomm,&
@@ -109,7 +93,7 @@ module amg_d_matchboxp_mod
real(c_double) :: msgpercent(*)
end subroutine dMatchBoxPC
end interface MatchBoxPC
#endif
interface amg_i_aggr_assign
module procedure amg_i_d_aggr_assign
end interface amg_i_aggr_assign
@@ -1145,15 +1129,11 @@ contains
call psb_barrier(ictxt)
if (me == 0) write(0,*)' Calling MatchBoxP '
end if
#if defined(PSB_SERIAL_MPI)
call MatchingC(nlver,nledge,verlocptr,verlocind,edgelocweight,&
& verdistance, mate)
#else
call MatchBoxPC(nlver,nledge,verlocptr,verlocind,edgelocweight,&
& verdistance, mate, mrank, mnp, icomm,&
& msgindsent,msgactualsent,msgpercent,&
& ph0_time, ph1_time, ph2_time, ph1_card, ph2_card)
#endif
verlocptr(:) = verlocptr(:) + 1
verlocind(:) = verlocind(:) + 1
verdistance(:) = verdistance(:) + 1
+11 -11
View File
@@ -52,10 +52,10 @@
!
module amg_d_mumps_solver
use amg_d_base_solver_mod
#if defined(AMG_HAVE_MUMPS) && defined(AMG_HAVE_MUMPS_MODULES)
#if defined(HAVE_MUMPS_) && defined(HAVE_MUMPS_MODULES_)
use dmumps_struc_def
#endif
#if defined(AMG_HAVE_MUMPS) && defined(AMG_HAVE_MUMPS_INCLUDES)
#if defined(HAVE_MUMPS_) && defined(HAVE_MUMPS_INCLUDES_)
include 'dmumps_struc.h'
#endif
@@ -68,7 +68,7 @@ module amg_d_mumps_solver
end type amg_d_mumps_rcntl_item
type, extends(amg_d_base_solver_type) :: amg_d_mumps_solver_type
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
type(dmumps_struc), allocatable :: id
#else
integer, allocatable :: id
@@ -189,7 +189,7 @@ contains
info = 0
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
call psb_erractionsave(err_act)
@@ -239,7 +239,7 @@ contains
character(len=20) :: name='d_mumps_solver_clear_data'
info = 0
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
call psb_erractionsave(err_act)
if (allocated(sv%id)) then
if (sv%built) then
@@ -279,7 +279,7 @@ contains
character(len=20) :: name='d_mumps_solver_free'
info = 0
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
call psb_erractionsave(err_act)
call sv%clear_data(info)
if ((info == 0).and.allocated(sv%icntl)) deallocate(sv%icntl,stat=info)
@@ -383,7 +383,7 @@ subroutine d_mumps_solver_csetc(sv,what,val,info,idx)
select case(psb_toupper(trim(what)))
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
case('MUMPS_LOC_GLOB')
sv%ipar(1) = sv%stringval(psb_toupper(trim(val)))
#endif
@@ -421,7 +421,7 @@ subroutine d_mumps_solver_cseti(sv,what,val,info,idx)
call psb_erractionsave(err_act)
select case(psb_toupper(what))
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
case('MUMPS_LOC_GLOB')
sv%ipar(1) = val
case('MUMPS_PRINT_ERR')
@@ -467,7 +467,7 @@ subroutine d_mumps_solver_csetr(sv,what,val,info,idx)
call psb_erractionsave(err_act)
select case(psb_toupper(what))
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
case('MUMPS_RPAR_ENTRY')
if(present(idx)) then
! Note: this will allocate %item
@@ -504,7 +504,7 @@ subroutine d_mumps_solver_default(sv)
info = psb_success_
call psb_erractionsave(err_act)
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
if (.not.allocated(sv%id)) then
allocate(sv%id,stat=info)
if (info /= psb_success_) then
@@ -561,7 +561,7 @@ function d_mumps_solver_sizeof(sv) result(val)
class(amg_d_mumps_solver_type), intent(in) :: sv
integer(psb_epk_) :: val
integer :: i
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
val = (sv%id%INFOG(22)+sv%id%INFOG(32))*1d+6
#else
val = 0
+14 -9
View File
@@ -119,6 +119,10 @@
module amg_d_parmatch_aggregator_mod
use amg_d_base_aggregator_mod
use amg_d_matchboxp_mod
#if defined(SERIAL_MPI)
type, extends(amg_d_base_aggregator_type) :: amg_d_parmatch_aggregator_type
end type amg_d_parmatch_aggregator_type
#else
type, extends(amg_d_base_aggregator_type) :: amg_d_parmatch_aggregator_type
integer(psb_ipk_) :: matching_alg
integer(psb_ipk_) :: n_sweeps ! When n_sweeps >1 we need an auxiliary descriptor
@@ -240,12 +244,11 @@ module amg_d_parmatch_aggregator_mod
end interface
interface
subroutine amg_d_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,parms,&
subroutine amg_d_parmatch_unsmth_bld(ag,a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: amg_d_parmatch_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
integer(psb_ipk_), intent(in) :: dol1smoothing
class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
@@ -259,12 +262,11 @@ module amg_d_parmatch_aggregator_mod
end interface
interface
subroutine amg_d_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,parms,&
subroutine amg_d_parmatch_smth_bld(ag,a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: amg_d_parmatch_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
integer(psb_ipk_), intent(in) :: dol1smoothing
class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
@@ -396,7 +398,6 @@ contains
integer(psb_ipk_), intent(out) :: info
character(len=*), intent(in), optional :: prefix
character(1024) :: prefix_
info = psb_success_
if (present(prefix)) then
prefix_ = prefix
else
@@ -448,7 +449,6 @@ contains
class(amg_d_base_aggregator_type), target, intent(inout) :: agnext
integer(psb_ipk_), intent(out) :: info
info = psb_success_
!
!
select type(agnext)
@@ -588,7 +588,7 @@ contains
class(amg_d_parmatch_aggregator_type), intent(inout) :: ag
integer(psb_ipk_), intent(out) :: info
info = psb_success_
info = 0
if ((info == 0).and.allocated(ag%w)) deallocate(ag%w,stat=info)
if ((info == 0).and.allocated(ag%w_nxt)) deallocate(ag%w_nxt,stat=info)
if ((info == 0).and.allocated(ag%prol)) then
@@ -627,7 +627,7 @@ contains
class(amg_d_base_aggregator_type), allocatable, intent(inout) :: agnext
integer(psb_ipk_), intent(out) :: info
info = psb_success_
info = 0
if (allocated(agnext)) then
call agnext%free(info)
if (info == 0) deallocate(agnext,stat=info)
@@ -656,7 +656,6 @@ contains
integer(psb_ipk_) :: err_act
character(len=20) :: name='d_parmatch_aggregator_bld_map'
info = psb_success_
call psb_erractionsave(err_act)
!
! Copy the prolongation/restriction matrices into the descriptor map.
@@ -674,6 +673,11 @@ contains
map = psb_linmap(psb_map_gen_linear_,desc_a,&
& desc_ac,op_restr,op_prol,ilaggr,nlaggr)
end if
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_Free')
goto 9999
end if
call psb_erractionrestore(err_act)
return
@@ -681,4 +685,5 @@ contains
return
end subroutine amg_d_parmatch_aggregator_bld_map
#endif
end module amg_d_parmatch_aggregator_mod
+3 -3
View File
@@ -192,8 +192,8 @@ module amg_d_poly_smoother
subroutine amg_d_poly_smoother_clone_settings(sm,smout,info)
import :: amg_d_poly_smoother_type, psb_dpk_, &
& amg_d_base_smoother_type, psb_ipk_
class(amg_d_poly_smoother_type), intent(inout) :: sm
class(amg_d_base_smoother_type), intent(inout) :: smout
class(amg_d_poly_smoother_type), intent(inout) :: sm
class(amg_d_base_smoother_type), allocatable, intent(inout) :: smout
integer(psb_ipk_), intent(out) :: info
end subroutine amg_d_poly_smoother_clone_settings
end interface
@@ -322,7 +322,7 @@ contains
!
sm%pdegree = 1
sm%rho_ba = -done
sm%variant = amg_cheb_4_
sm%variant = amg_poly_lottes_
sm%rho_estimate = amg_poly_rho_est_power_
sm%rho_estimate_iterations = 20
if (allocated(sm%sv)) then
-1
View File
@@ -113,7 +113,6 @@ module amg_d_prec_type
procedure, pass(prec) :: free => amg_d_prec_free
procedure, pass(prec) :: allocate_wrk => amg_d_allocate_wrk
procedure, pass(prec) :: free_wrk => amg_d_free_wrk
procedure, pass(prec) :: deallocate_wrk => amg_d_free_wrk
procedure, pass(prec) :: is_allocated_wrk => amg_d_is_allocated_wrk
procedure, pass(prec) :: get_complexity => amg_d_get_compl
procedure, pass(prec) :: cmp_complexity => amg_d_cmp_compl
+1 -1
View File
@@ -51,7 +51,7 @@ module amg_d_slu_solver
use iso_c_binding
use amg_d_base_solver_mod
#if defined(PSB_IPK8)
#if defined(IPK8)
type, extends(amg_d_base_solver_type) :: amg_d_slu_solver_type
+1 -1
View File
@@ -52,7 +52,7 @@ module amg_d_sludist_solver
use iso_c_binding
use amg_d_base_solver_mod
#if (!defined(AMG_HAVE_SLUDIST)) || defined(PSB_IPK8)
#if (!defined(HAVE_SLUDIST_)) || defined(IPK8)
type, extends(amg_d_base_solver_type) :: amg_d_sludist_solver_type
+1 -1
View File
@@ -97,7 +97,7 @@ contains
character(len=*), intent(in), optional :: prefix
character(1024) :: prefix_
info = psb_success_
if (present(prefix)) then
prefix_ = prefix
else
+1 -1
View File
@@ -51,7 +51,7 @@ module amg_d_umf_solver
use iso_c_binding
use amg_d_base_solver_mod
#if defined(PSB_IPK8)
#if defined(IPK8)
type, extends(amg_d_base_solver_type) :: amg_d_umf_solver_type
end type amg_d_umf_solver_type
+6 -3
View File
@@ -62,6 +62,9 @@ module amg_s_ainv_solver
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
!!$ procedure, pass(sv) :: seti => amg_s_ainv_solver_seti
!!$ procedure, pass(sv) :: setc => amg_s_ainv_solver_setc
!!$ procedure, pass(sv) :: setr => amg_s_ainv_solver_setr
procedure, pass(sv) :: descr => amg_s_ainv_solver_descr
procedure, pass(sv) :: default => s_ainv_solver_default
procedure, nopass :: stringval => s_ainv_stringval
@@ -88,9 +91,9 @@ module amg_s_ainv_solver
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), intent(inout) :: svout
integer(psb_ipk_), intent(out) :: info
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
+1 -2
View File
@@ -302,7 +302,7 @@ contains
integer(psb_ipk_), intent(out) :: info
! Do nothing
info = psb_success_
return
end subroutine amg_s_base_aggregator_set_aggr_type
@@ -486,7 +486,6 @@ contains
integer(psb_ipk_) :: err_act
character(len=20) :: name='s_base_aggregator_bld_map'
info = psb_success_
call psb_erractionsave(err_act)
!
! Copy the prolongation/restriction matrices into the descriptor map.
+1 -2
View File
@@ -150,7 +150,7 @@ contains
class(amg_s_dec_aggregator_type), intent(inout) :: ag
type(amg_sml_parms), intent(in) :: parms
integer(psb_ipk_), intent(out) :: info
info = psb_success_
select case(parms%aggr_type)
case (amg_noalg_)
ag%soc_map_bld => null()
@@ -192,7 +192,6 @@ contains
integer(psb_ipk_), intent(out) :: info
character(len=*), intent(in), optional :: prefix
character(1024) :: prefix_
info = psb_success_
if (present(prefix)) then
prefix_ = prefix
else
+125
View File
@@ -0,0 +1,125 @@
!
!
! 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 -2
View File
@@ -109,12 +109,11 @@ module amg_s_inner_mod
end interface amg_map_to_tprol
abstract interface
subroutine amg_saggrmat_var_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,parms,&
subroutine amg_saggrmat_var_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_, psb_lpk_, psb_lsspmat_type
import :: amg_s_onelev_type, amg_sml_parms
implicit none
integer(psb_ipk_), intent(in) :: dol1smoothing
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
+3 -3
View File
@@ -79,9 +79,9 @@ module amg_s_invk_solver
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), intent(inout) :: svout
integer(psb_ipk_), intent(out) :: info
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
+3 -3
View File
@@ -79,9 +79,9 @@ module amg_s_invt_solver
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), intent(inout) :: svout
integer(psb_ipk_), intent(out) :: info
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
+2 -2
View File
@@ -203,8 +203,8 @@ module amg_s_jac_smoother
subroutine amg_s_jac_smoother_clone_settings(sm,smout,info)
import :: amg_s_jac_smoother_type, psb_spk_, &
& amg_s_base_smoother_type, psb_ipk_
class(amg_s_jac_smoother_type), intent(inout) :: sm
class(amg_s_base_smoother_type), intent(inout) :: smout
class(amg_s_jac_smoother_type), intent(inout) :: sm
class(amg_s_base_smoother_type), allocatable, intent(inout) :: smout
integer(psb_ipk_), intent(out) :: info
end subroutine amg_s_jac_smoother_clone_settings
end interface
@@ -73,22 +73,6 @@ module amg_s_matchboxp_mod
use iso_c_binding
use psb_base_cbind_mod
#if defined(PSB_SERIAL_MPI)
interface MatchingC
subroutine sMatchingC(nlver,nledge,verlocptr,verlocind,edgelocweight,&
& verdistance, mate) bind(c,name='sMatching')
use iso_c_binding
import :: psb_c_ipk_, psb_c_lpk_
implicit none
integer(psb_c_lpk_), value :: nlver,nledge
integer(psb_c_lpk_) :: verlocptr(*),verlocind(*), verdistance(*)
integer(psb_c_lpk_) :: mate(*)
real(c_float) :: edgelocweight(*)
end subroutine sMatchingC
end interface MatchingC
#else
interface MatchBoxPC
subroutine sMatchBoxPC(nlver,nledge,verlocptr,verlocind,edgelocweight,&
& verdistance, mate, myrank, numprocs, icomm,&
@@ -109,7 +93,7 @@ module amg_s_matchboxp_mod
real(c_double) :: msgpercent(*)
end subroutine sMatchBoxPC
end interface MatchBoxPC
#endif
interface amg_i_aggr_assign
module procedure amg_i_s_aggr_assign
end interface amg_i_aggr_assign
@@ -1145,15 +1129,11 @@ contains
call psb_barrier(ictxt)
if (me == 0) write(0,*)' Calling MatchBoxP '
end if
#if defined(PSB_SERIAL_MPI)
call MatchingC(nlver,nledge,verlocptr,verlocind,edgelocweight,&
& verdistance, mate)
#else
call MatchBoxPC(nlver,nledge,verlocptr,verlocind,edgelocweight,&
& verdistance, mate, mrank, mnp, icomm,&
& msgindsent,msgactualsent,msgpercent,&
& ph0_time, ph1_time, ph2_time, ph1_card, ph2_card)
#endif
verlocptr(:) = verlocptr(:) + 1
verlocind(:) = verlocind(:) + 1
verdistance(:) = verdistance(:) + 1
+11 -11
View File
@@ -52,10 +52,10 @@
!
module amg_s_mumps_solver
use amg_s_base_solver_mod
#if defined(AMG_HAVE_MUMPS) && defined(AMG_HAVE_MUMPS_MODULES)
#if defined(HAVE_MUMPS_) && defined(HAVE_MUMPS_MODULES_)
use smumps_struc_def
#endif
#if defined(AMG_HAVE_MUMPS) && defined(AMG_HAVE_MUMPS_INCLUDES)
#if defined(HAVE_MUMPS_) && defined(HAVE_MUMPS_INCLUDES_)
include 'smumps_struc.h'
#endif
@@ -68,7 +68,7 @@ module amg_s_mumps_solver
end type amg_s_mumps_rcntl_item
type, extends(amg_s_base_solver_type) :: amg_s_mumps_solver_type
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
type(smumps_struc), allocatable :: id
#else
integer, allocatable :: id
@@ -189,7 +189,7 @@ contains
info = 0
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
call psb_erractionsave(err_act)
@@ -239,7 +239,7 @@ contains
character(len=20) :: name='s_mumps_solver_clear_data'
info = 0
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
call psb_erractionsave(err_act)
if (allocated(sv%id)) then
if (sv%built) then
@@ -279,7 +279,7 @@ contains
character(len=20) :: name='s_mumps_solver_free'
info = 0
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
call psb_erractionsave(err_act)
call sv%clear_data(info)
if ((info == 0).and.allocated(sv%icntl)) deallocate(sv%icntl,stat=info)
@@ -383,7 +383,7 @@ subroutine s_mumps_solver_csetc(sv,what,val,info,idx)
select case(psb_toupper(trim(what)))
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
case('MUMPS_LOC_GLOB')
sv%ipar(1) = sv%stringval(psb_toupper(trim(val)))
#endif
@@ -421,7 +421,7 @@ subroutine s_mumps_solver_cseti(sv,what,val,info,idx)
call psb_erractionsave(err_act)
select case(psb_toupper(what))
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
case('MUMPS_LOC_GLOB')
sv%ipar(1) = val
case('MUMPS_PRINT_ERR')
@@ -467,7 +467,7 @@ subroutine s_mumps_solver_csetr(sv,what,val,info,idx)
call psb_erractionsave(err_act)
select case(psb_toupper(what))
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
case('MUMPS_RPAR_ENTRY')
if(present(idx)) then
! Note: this will allocate %item
@@ -504,7 +504,7 @@ subroutine s_mumps_solver_default(sv)
info = psb_success_
call psb_erractionsave(err_act)
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
if (.not.allocated(sv%id)) then
allocate(sv%id,stat=info)
if (info /= psb_success_) then
@@ -561,7 +561,7 @@ function s_mumps_solver_sizeof(sv) result(val)
class(amg_s_mumps_solver_type), intent(in) :: sv
integer(psb_epk_) :: val
integer :: i
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
val = (sv%id%INFOG(22)+sv%id%INFOG(32))*1d+6
#else
val = 0
+14 -9
View File
@@ -119,6 +119,10 @@
module amg_s_parmatch_aggregator_mod
use amg_s_base_aggregator_mod
use amg_s_matchboxp_mod
#if defined(SERIAL_MPI)
type, extends(amg_s_base_aggregator_type) :: amg_s_parmatch_aggregator_type
end type amg_s_parmatch_aggregator_type
#else
type, extends(amg_s_base_aggregator_type) :: amg_s_parmatch_aggregator_type
integer(psb_ipk_) :: matching_alg
integer(psb_ipk_) :: n_sweeps ! When n_sweeps >1 we need an auxiliary descriptor
@@ -240,12 +244,11 @@ module amg_s_parmatch_aggregator_mod
end interface
interface
subroutine amg_s_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,parms,&
subroutine amg_s_parmatch_unsmth_bld(ag,a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: amg_s_parmatch_aggregator_type, psb_desc_type, psb_sspmat_type,&
& psb_lsspmat_type, psb_dpk_, psb_ipk_, psb_lpk_, amg_sml_parms, amg_saggr_data
implicit none
integer(psb_ipk_), intent(in) :: dol1smoothing
class(amg_s_parmatch_aggregator_type), target, intent(inout) :: ag
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
@@ -259,12 +262,11 @@ module amg_s_parmatch_aggregator_mod
end interface
interface
subroutine amg_s_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,parms,&
subroutine amg_s_parmatch_smth_bld(ag,a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: amg_s_parmatch_aggregator_type, psb_desc_type, psb_sspmat_type,&
& psb_lsspmat_type, psb_dpk_, psb_ipk_, psb_lpk_, amg_sml_parms, amg_saggr_data
implicit none
integer(psb_ipk_), intent(in) :: dol1smoothing
class(amg_s_parmatch_aggregator_type), target, intent(inout) :: ag
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
@@ -396,7 +398,6 @@ contains
integer(psb_ipk_), intent(out) :: info
character(len=*), intent(in), optional :: prefix
character(1024) :: prefix_
info = psb_success_
if (present(prefix)) then
prefix_ = prefix
else
@@ -448,7 +449,6 @@ contains
class(amg_s_base_aggregator_type), target, intent(inout) :: agnext
integer(psb_ipk_), intent(out) :: info
info = psb_success_
!
!
select type(agnext)
@@ -588,7 +588,7 @@ contains
class(amg_s_parmatch_aggregator_type), intent(inout) :: ag
integer(psb_ipk_), intent(out) :: info
info = psb_success_
info = 0
if ((info == 0).and.allocated(ag%w)) deallocate(ag%w,stat=info)
if ((info == 0).and.allocated(ag%w_nxt)) deallocate(ag%w_nxt,stat=info)
if ((info == 0).and.allocated(ag%prol)) then
@@ -627,7 +627,7 @@ contains
class(amg_s_base_aggregator_type), allocatable, intent(inout) :: agnext
integer(psb_ipk_), intent(out) :: info
info = psb_success_
info = 0
if (allocated(agnext)) then
call agnext%free(info)
if (info == 0) deallocate(agnext,stat=info)
@@ -656,7 +656,6 @@ contains
integer(psb_ipk_) :: err_act
character(len=20) :: name='s_parmatch_aggregator_bld_map'
info = psb_success_
call psb_erractionsave(err_act)
!
! Copy the prolongation/restriction matrices into the descriptor map.
@@ -674,6 +673,11 @@ contains
map = psb_linmap(psb_map_gen_linear_,desc_a,&
& desc_ac,op_restr,op_prol,ilaggr,nlaggr)
end if
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_Free')
goto 9999
end if
call psb_erractionrestore(err_act)
return
@@ -681,4 +685,5 @@ contains
return
end subroutine amg_s_parmatch_aggregator_bld_map
#endif
end module amg_s_parmatch_aggregator_mod
+3 -3
View File
@@ -192,8 +192,8 @@ module amg_s_poly_smoother
subroutine amg_s_poly_smoother_clone_settings(sm,smout,info)
import :: amg_s_poly_smoother_type, psb_spk_, &
& amg_s_base_smoother_type, psb_ipk_
class(amg_s_poly_smoother_type), intent(inout) :: sm
class(amg_s_base_smoother_type), intent(inout) :: smout
class(amg_s_poly_smoother_type), intent(inout) :: sm
class(amg_s_base_smoother_type), allocatable, intent(inout) :: smout
integer(psb_ipk_), intent(out) :: info
end subroutine amg_s_poly_smoother_clone_settings
end interface
@@ -322,7 +322,7 @@ contains
!
sm%pdegree = 1
sm%rho_ba = -sone
sm%variant = amg_cheb_4_
sm%variant = amg_poly_lottes_
sm%rho_estimate = amg_poly_rho_est_power_
sm%rho_estimate_iterations = 20
if (allocated(sm%sv)) then
-1
View File
@@ -113,7 +113,6 @@ module amg_s_prec_type
procedure, pass(prec) :: free => amg_s_prec_free
procedure, pass(prec) :: allocate_wrk => amg_s_allocate_wrk
procedure, pass(prec) :: free_wrk => amg_s_free_wrk
procedure, pass(prec) :: deallocate_wrk => amg_s_free_wrk
procedure, pass(prec) :: is_allocated_wrk => amg_s_is_allocated_wrk
procedure, pass(prec) :: get_complexity => amg_s_get_compl
procedure, pass(prec) :: cmp_complexity => amg_s_cmp_compl
+1 -1
View File
@@ -51,7 +51,7 @@ module amg_s_slu_solver
use iso_c_binding
use amg_s_base_solver_mod
#if defined(PSB_IPK8)
#if defined(IPK8)
type, extends(amg_s_base_solver_type) :: amg_s_slu_solver_type
+1 -1
View File
@@ -97,7 +97,7 @@ contains
character(len=*), intent(in), optional :: prefix
character(1024) :: prefix_
info = psb_success_
if (present(prefix)) then
prefix_ = prefix
else
+6 -3
View File
@@ -62,6 +62,9 @@ module amg_z_ainv_solver
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
!!$ procedure, pass(sv) :: seti => amg_z_ainv_solver_seti
!!$ procedure, pass(sv) :: setc => amg_z_ainv_solver_setc
!!$ procedure, pass(sv) :: setr => amg_z_ainv_solver_setr
procedure, pass(sv) :: descr => amg_z_ainv_solver_descr
procedure, pass(sv) :: default => z_ainv_solver_default
procedure, nopass :: stringval => z_ainv_stringval
@@ -88,9 +91,9 @@ module amg_z_ainv_solver
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), intent(inout) :: svout
integer(psb_ipk_), intent(out) :: info
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
+1 -2
View File
@@ -302,7 +302,7 @@ contains
integer(psb_ipk_), intent(out) :: info
! Do nothing
info = psb_success_
return
end subroutine amg_z_base_aggregator_set_aggr_type
@@ -486,7 +486,6 @@ contains
integer(psb_ipk_) :: err_act
character(len=20) :: name='z_base_aggregator_bld_map'
info = psb_success_
call psb_erractionsave(err_act)
!
! Copy the prolongation/restriction matrices into the descriptor map.
+1 -2
View File
@@ -150,7 +150,7 @@ contains
class(amg_z_dec_aggregator_type), intent(inout) :: ag
type(amg_dml_parms), intent(in) :: parms
integer(psb_ipk_), intent(out) :: info
info = psb_success_
select case(parms%aggr_type)
case (amg_noalg_)
ag%soc_map_bld => null()
@@ -192,7 +192,6 @@ contains
integer(psb_ipk_), intent(out) :: info
character(len=*), intent(in), optional :: prefix
character(1024) :: prefix_
info = psb_success_
if (present(prefix)) then
prefix_ = prefix
else
+125
View File
@@ -0,0 +1,125 @@
!
!
! 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
+1 -2
View File
@@ -109,12 +109,11 @@ module amg_z_inner_mod
end interface amg_map_to_tprol
abstract interface
subroutine amg_zaggrmat_var_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,parms,&
subroutine amg_zaggrmat_var_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_, psb_lpk_, psb_lzspmat_type
import :: amg_z_onelev_type, amg_dml_parms
implicit none
integer(psb_ipk_), intent(in) :: dol1smoothing
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
+3 -3
View File
@@ -79,9 +79,9 @@ module amg_z_invk_solver
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), intent(inout) :: svout
integer(psb_ipk_), intent(out) :: info
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
+3 -3
View File
@@ -79,9 +79,9 @@ module amg_z_invt_solver
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), intent(inout) :: svout
integer(psb_ipk_), intent(out) :: info
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
+2 -2
View File
@@ -203,8 +203,8 @@ module amg_z_jac_smoother
subroutine amg_z_jac_smoother_clone_settings(sm,smout,info)
import :: amg_z_jac_smoother_type, psb_dpk_, &
& amg_z_base_smoother_type, psb_ipk_
class(amg_z_jac_smoother_type), intent(inout) :: sm
class(amg_z_base_smoother_type), intent(inout) :: smout
class(amg_z_jac_smoother_type), intent(inout) :: sm
class(amg_z_base_smoother_type), allocatable, intent(inout) :: smout
integer(psb_ipk_), intent(out) :: info
end subroutine amg_z_jac_smoother_clone_settings
end interface
+11 -11
View File
@@ -52,10 +52,10 @@
!
module amg_z_mumps_solver
use amg_z_base_solver_mod
#if defined(AMG_HAVE_MUMPS) && defined(AMG_HAVE_MUMPS_MODULES)
#if defined(HAVE_MUMPS_) && defined(HAVE_MUMPS_MODULES_)
use zmumps_struc_def
#endif
#if defined(AMG_HAVE_MUMPS) && defined(AMG_HAVE_MUMPS_INCLUDES)
#if defined(HAVE_MUMPS_) && defined(HAVE_MUMPS_INCLUDES_)
include 'zmumps_struc.h'
#endif
@@ -68,7 +68,7 @@ module amg_z_mumps_solver
end type amg_z_mumps_rcntl_item
type, extends(amg_z_base_solver_type) :: amg_z_mumps_solver_type
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
type(zmumps_struc), allocatable :: id
#else
integer, allocatable :: id
@@ -189,7 +189,7 @@ contains
info = 0
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
call psb_erractionsave(err_act)
@@ -239,7 +239,7 @@ contains
character(len=20) :: name='z_mumps_solver_clear_data'
info = 0
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
call psb_erractionsave(err_act)
if (allocated(sv%id)) then
if (sv%built) then
@@ -279,7 +279,7 @@ contains
character(len=20) :: name='z_mumps_solver_free'
info = 0
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
call psb_erractionsave(err_act)
call sv%clear_data(info)
if ((info == 0).and.allocated(sv%icntl)) deallocate(sv%icntl,stat=info)
@@ -383,7 +383,7 @@ subroutine z_mumps_solver_csetc(sv,what,val,info,idx)
select case(psb_toupper(trim(what)))
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
case('MUMPS_LOC_GLOB')
sv%ipar(1) = sv%stringval(psb_toupper(trim(val)))
#endif
@@ -421,7 +421,7 @@ subroutine z_mumps_solver_cseti(sv,what,val,info,idx)
call psb_erractionsave(err_act)
select case(psb_toupper(what))
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
case('MUMPS_LOC_GLOB')
sv%ipar(1) = val
case('MUMPS_PRINT_ERR')
@@ -467,7 +467,7 @@ subroutine z_mumps_solver_csetr(sv,what,val,info,idx)
call psb_erractionsave(err_act)
select case(psb_toupper(what))
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
case('MUMPS_RPAR_ENTRY')
if(present(idx)) then
! Note: this will allocate %item
@@ -504,7 +504,7 @@ subroutine z_mumps_solver_default(sv)
info = psb_success_
call psb_erractionsave(err_act)
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
if (.not.allocated(sv%id)) then
allocate(sv%id,stat=info)
if (info /= psb_success_) then
@@ -561,7 +561,7 @@ function z_mumps_solver_sizeof(sv) result(val)
class(amg_z_mumps_solver_type), intent(in) :: sv
integer(psb_epk_) :: val
integer :: i
#if defined(AMG_HAVE_MUMPS)
#if defined(HAVE_MUMPS_)
val = (sv%id%INFOG(22)+sv%id%INFOG(32))*1d+6
#else
val = 0
-1
View File
@@ -113,7 +113,6 @@ module amg_z_prec_type
procedure, pass(prec) :: free => amg_z_prec_free
procedure, pass(prec) :: allocate_wrk => amg_z_allocate_wrk
procedure, pass(prec) :: free_wrk => amg_z_free_wrk
procedure, pass(prec) :: deallocate_wrk => amg_z_free_wrk
procedure, pass(prec) :: is_allocated_wrk => amg_z_is_allocated_wrk
procedure, pass(prec) :: get_complexity => amg_z_get_compl
procedure, pass(prec) :: cmp_complexity => amg_z_cmp_compl
+1 -1
View File
@@ -51,7 +51,7 @@ module amg_z_slu_solver
use iso_c_binding
use amg_z_base_solver_mod
#if defined(PSB_IPK8)
#if defined(IPK8)
type, extends(amg_z_base_solver_type) :: amg_z_slu_solver_type
+1 -1
View File
@@ -52,7 +52,7 @@ module amg_z_sludist_solver
use iso_c_binding
use amg_z_base_solver_mod
#if (!defined(AMG_HAVE_SLUDIST)) || defined(PSB_IPK8)
#if (!defined(HAVE_SLUDIST_)) || defined(IPK8)
type, extends(amg_z_base_solver_type) :: amg_z_sludist_solver_type
+1 -1
View File
@@ -97,7 +97,7 @@ contains
character(len=*), intent(in), optional :: prefix
character(1024) :: prefix_
info = psb_success_
if (present(prefix)) then
prefix_ = prefix
else
+1 -1
View File
@@ -51,7 +51,7 @@ module amg_z_umf_solver
use iso_c_binding
use amg_z_base_solver_mod
#if defined(PSB_IPK8)
#if defined(IPK8)
type, extends(amg_z_base_solver_type) :: amg_z_umf_solver_type
end type amg_z_umf_solver_type
-1
View File
@@ -5,7 +5,6 @@ MODDIR=../../modules
HERE=..
FINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) $(PSBLAS_INCLUDES)
CINCLUDES=-I. -I.. -I$(PSBLAS_INCDIR)
+2 -4
View File
@@ -5,8 +5,7 @@ MODDIR=../../../modules
HERE=../..
FINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) $(PSBLAS_INCLUDES)
CXXINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(INCDIR) $(FMFLAG)/. -I$(PSBLAS_INCDIR)
CINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(INCDIR) $(FMFLAG)/. -I$(PSBLAS_INCDIR)
CXXINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(INCDIR) $(FMFLAG)/.
#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
@@ -62,8 +61,7 @@ amg_s_parmatch_unsmth_bld.o \
amg_s_parmatch_smth_bld.o \
amg_s_parmatch_spmm_bld_inner.o
MPCOBJS=Matching.o \
MatchBoxPC.o \
MPCOBJS=MatchBoxPC.o \
sendBundledMessages.o \
initialize.o \
extractUChunk.o \
+22 -33
View File
@@ -40,17 +40,14 @@
// ************************************************************************
#include <stdio.h>
#include <stdlib.h>
#include "amg_config.h"
#include "MatchBoxPC.h"
#if !defined(PSB_SERIAL_MPI)
#if !defined(SERIAL_MPI)
#include <mpi.h>
#endif
#include "MatchBoxPC.h"
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(PSB_SERIAL_MPI)
void dMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt* verLocPtr, MilanLongInt* verLocInd, MilanReal* edgeLocWeight,
@@ -60,6 +57,7 @@ void dMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt* msgIndSent, MilanLongInt* msgActualSent, MilanReal* msgPercent,
MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time,
MilanLongInt* ph1_card, MilanLongInt* ph2_card ) {
#if !defined(SERIAL_MPI)
MPI_Comm C_comm=MPI_Comm_f2c(icomm);
#ifdef DEBUG
@@ -68,13 +66,13 @@ void dMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
#endif
#undef TIME_TRACKER
#ifdef TIME_TRACKER
double tmr = MPI_Wtime();
#endif
#define TIME_TRACKER
#ifdef TIME_TRACKER
double tmr = MPI_Wtime();
#endif
#if defined(PSB_OPENMP)
//fprintf(stderr,"Warning: using buggy OpenMP matching!\n");
#define OMP
#ifdef OMP
dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(NLVer, NLEdge,
verLocPtr, verLocInd, edgeLocWeight,
verDistance, Mate,
@@ -93,11 +91,12 @@ void dMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
#endif
#ifdef TIME_TRACKER
tmr = MPI_Wtime() - tmr;
fprintf(stderr, "Elaboration time: %f for %ld nodes\n", tmr, NLVer);
#ifdef TIME_TRACKER
tmr = MPI_Wtime() - tmr;
fprintf(stderr, "Elaboration time: %f for %ld nodes\n", tmr, NLVer);
#endif
#endif
}
void sMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
@@ -108,33 +107,23 @@ void sMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt* msgIndSent, MilanLongInt* msgActualSent, MilanReal* msgPercent,
MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time,
MilanLongInt* ph1_card, MilanLongInt* ph2_card ) {
#if !defined(SERIAL_MPI)
MPI_Comm C_comm=MPI_Comm_f2c(icomm);
#ifdef DEBUG
fprintf(stderr,"MatchBoxPC: rank %d nlver %ld nledge %ld [ %ld %ld ]\n",
myRank,NLVer, NLEdge,verDistance[0],verDistance[1]);
#endif
#if defined(PSB_OPENMP)
//fprintf(stderr,"Warning: using buggy OpenMP matching!\n");
salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(NLVer, NLEdge,
verLocPtr, verLocInd, edgeLocWeight,
verDistance, Mate,
myRank, numProcs, C_comm,
msgIndSent, msgActualSent, msgPercent,
ph0_time, ph1_time, ph2_time,
ph1_card, ph2_card );
#else
salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(NLVer, NLEdge,
verLocPtr, verLocInd, edgeLocWeight,
verDistance, Mate,
myRank, numProcs, C_comm,
msgIndSent, msgActualSent, msgPercent,
ph0_time, ph1_time, ph2_time,
ph1_card, ph2_card );
verLocPtr, verLocInd, edgeLocWeight,
verDistance, Mate,
myRank, numProcs, C_comm,
msgIndSent, msgActualSent, msgPercent,
ph0_time, ph1_time, ph2_time,
ph1_card, ph2_card );
#endif
}
#endif
#ifdef __cplusplus
}
#endif
#endif
+245 -414
View File
@@ -59,14 +59,7 @@
#include <assert.h>
#include <map>
#include <vector>
#include "amg_config.h"
#if !defined(PSB_SERIAL_MPI)
#ifdef PSB_OPENMP
// OpenMP is included and used if and only if the OpenMP version of the matching
// is required
#include "omp.h"
#endif
#include "primitiveDataTypeDefinitions.h"
#include "dataStrStaticQueue.h"
@@ -85,6 +78,7 @@ const int BundleTag = 9; // Predefined tag
static vector<MilanLongInt> DEFAULT_VECTOR;
#if !defined(SERIAL_MPI)
// MPI type map
template <typename T>
@@ -97,12 +91,14 @@ template <>
inline MPI_Datatype TypeMap<double>() { return MPI_DOUBLE; }
template <>
inline MPI_Datatype TypeMap<float>() { return MPI_FLOAT; }
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#if !defined(SERIAL_MPI)
#define MilanMpiLongInt MPI_LONG_LONG
@@ -117,7 +113,7 @@ extern "C"
// Regular long integer:
#ifndef LONG_INT_H
#define LONG_INT_H
#ifdef AMG_MATCHBOXP_BIT64
#ifdef BIT64
typedef int64_t MilanLongInt;
typedef MPI_LONG MilanMpiLongInt;
#else
@@ -163,7 +159,7 @@ extern "C"
#define MilanIntMax INT32_MAX
#define MilanIntMin INT32_MIN
#ifdef AMG_MATCHBOXP_BIT64
#ifdef BIT64
#define MilanLongIntMax INT64_MAX
#define MilanLongIntMin -INT64_MAX
#else
@@ -181,416 +177,252 @@ extern "C"
#define MilanRealMin MINUS_INFINITY
#endif
/* These functions are only used in the experimental OMP implementation, if that
is disabled there is no reason to actually compile or reference them. */
// Function of find the owner of a ghost vertex using binary search:
MilanInt findOwnerOfGhost(MilanLongInt vtxIndex, MilanLongInt *mVerDistance,
MilanInt myRank, MilanInt numProcs);
// Function of find the owner of a ghost vertex using binary search:
MilanInt findOwnerOfGhost(MilanLongInt vtxIndex, MilanLongInt *mVerDistance,
MilanInt myRank, MilanInt numProcs);
MilanLongInt firstComputeCandidateMateD(MilanLongInt adj1,
MilanLongInt adj2,
MilanLongInt *verLocInd,
MilanReal *edgeLocWeight);
MilanLongInt firstComputeCandidateMate(MilanLongInt adj1,
MilanLongInt adj2,
MilanLongInt *verLocInd,
MilanReal *edgeLocWeight);
void queuesTransfer(vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
vector<MilanInt> &privateQOwner);
bool isAlreadyMatched(MilanLongInt node,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
vector<MilanLongInt> &GMate,
MilanLongInt *Mate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap);
MilanLongInt computeCandidateMateD(MilanLongInt adj1,
MilanLongInt adj2,
MilanReal *edgeLocWeight,
MilanLongInt k,
MilanLongInt *verLocInd,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
vector<MilanLongInt> &GMate,
MilanLongInt *Mate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap);
void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt StartIndex, MilanLongInt EndIndex,
MilanLongInt *numGhostEdgesPtr,
MilanLongInt *numGhostVerticesPtr,
MilanLongInt *S,
MilanLongInt *verLocInd,
MilanLongInt *verLocPtr,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
vector<MilanLongInt> &Counter,
vector<MilanLongInt> &verGhostPtr,
vector<MilanLongInt> &verGhostInd,
vector<MilanLongInt> &tempCounter,
vector<MilanLongInt> &GMate,
vector<MilanLongInt> &Message,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
MilanLongInt *&candidateMate,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
vector<MilanInt> &privateQOwner);
void clean(MilanLongInt NLVer,
MilanInt myRank,
MilanLongInt MessageIndex,
vector<MPI_Request> &SRequest,
vector<MPI_Status> &SStatus,
MilanInt BufferSize,
MilanLongInt *Buffer,
MilanLongInt msgActual,
MilanLongInt *msgActualSent,
MilanLongInt msgInd,
MilanLongInt *msgIndSent,
MilanLongInt NumMessagesBundled,
MilanReal *msgPercent);
void PARALLEL_COMPUTE_CANDIDATE_MATE_BD(MilanLongInt NLVer,
MilanLongInt *verLocPtr,
MilanLongInt *verLocInd,
MilanInt myRank,
MilanReal *edgeLocWeight,
MilanLongInt *candidateMate);
void PARALLEL_PROCESS_EXPOSED_VERTEX_BD(MilanLongInt NLVer,
MilanLongInt *candidateMate,
MilanLongInt *verLocInd,
MilanLongInt *verLocPtr,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *Mate,
vector<MilanLongInt> &GMate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
MilanReal *edgeLocWeight,
MilanLongInt *myCardPtr,
MilanLongInt *msgIndPtr,
MilanLongInt *NumMessagesBundledPtr,
MilanLongInt *SPtr,
MilanLongInt *verDistance,
MilanLongInt *PCounter,
vector<MilanLongInt> &Counter,
MilanInt myRank,
MilanInt numProcs,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
vector<MilanInt> &privateQOwner);
void PROCESS_CROSS_EDGE(MilanLongInt *edge,
MilanLongInt *SPtr);
void processMatchedVerticesD(
MilanLongInt NLVer,
vector<MilanLongInt> &UChunkBeingProcessed,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *myCardPtr,
MilanLongInt *msgIndPtr,
MilanLongInt *NumMessagesBundledPtr,
MilanLongInt *SPtr,
MilanLongInt *verLocPtr,
MilanLongInt *verLocInd,
MilanLongInt *verDistance,
MilanLongInt *PCounter,
vector<MilanLongInt> &Counter,
MilanInt myRank,
MilanInt numProcs,
MilanLongInt *candidateMate,
vector<MilanLongInt> &GMate,
MilanLongInt *Mate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
MilanReal *edgeLocWeight,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
vector<MilanInt> &privateQOwner);
void processMatchedVerticesAndSendMessagesD(
MilanLongInt NLVer,
vector<MilanLongInt> &UChunkBeingProcessed,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *myCardPtr,
MilanLongInt *msgIndPtr,
MilanLongInt *NumMessagesBundledPtr,
MilanLongInt *SPtr,
MilanLongInt *verLocPtr,
MilanLongInt *verLocInd,
MilanLongInt *verDistance,
MilanLongInt *PCounter,
vector<MilanLongInt> &Counter,
MilanInt myRank,
MilanInt numProcs,
MilanLongInt *candidateMate,
vector<MilanLongInt> &GMate,
MilanLongInt *Mate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
MilanReal *edgeLocWeight,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
vector<MilanInt> &privateQOwner,
MPI_Comm comm,
MilanLongInt *msgActual,
vector<MilanLongInt> &Message);
void sendBundledMessages(MilanLongInt *numGhostEdgesPtr,
MilanInt *BufferSizePtr,
MilanLongInt *Buffer,
vector<MilanLongInt> &PCumulative,
vector<MilanLongInt> &PMessageBundle,
vector<MilanLongInt> &PSizeInfoMessages,
MilanLongInt *PCounter,
MilanLongInt NumMessagesBundled,
MilanLongInt *msgActualPtr,
MilanLongInt *MessageIndexPtr,
MilanInt numProcs,
MilanInt myRank,
MPI_Comm comm,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
vector<MPI_Request> &SRequest,
vector<MPI_Status> &SStatus);
void processMessagesD(
MilanLongInt NLVer,
MilanLongInt *Mate,
MilanLongInt *candidateMate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
vector<MilanLongInt> &GMate,
vector<MilanLongInt> &Counter,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *myCardPtr,
MilanLongInt *msgIndPtr,
MilanLongInt *msgActualPtr,
MilanReal *edgeLocWeight,
MilanLongInt *verDistance,
MilanLongInt *verLocPtr,
MilanLongInt k,
MilanLongInt *verLocInd,
MilanInt numProcs,
MilanInt myRank,
MPI_Comm comm,
vector<MilanLongInt> &Message,
MilanLongInt numGhostEdges,
MilanLongInt u,
MilanLongInt v,
MilanLongInt *SPtr,
vector<MilanLongInt> &U);
void extractUChunk(
vector<MilanLongInt> &UChunkBeingProcessed,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU);
void queuesTransfer(vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
vector<MilanInt> &privateQOwner);
MilanLongInt firstComputeCandidateMateS(MilanLongInt adj1,
MilanLongInt adj2,
MilanLongInt *verLocInd,
MilanFloat *edgeLocWeight);
bool isAlreadyMatched(MilanLongInt node,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
vector<MilanLongInt> &GMate,
MilanLongInt *Mate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap);
MilanLongInt computeCandidateMateS(MilanLongInt adj1,
MilanLongInt adj2,
MilanFloat *edgeLocWeight,
MilanLongInt k,
MilanLongInt *verLocInd,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
vector<MilanLongInt> &GMate,
MilanLongInt *Mate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap);
void PARALLEL_COMPUTE_CANDIDATE_MATE_BS(MilanLongInt NLVer,
MilanLongInt *verLocPtr,
MilanLongInt *verLocInd,
MilanInt myRank,
MilanFloat *edgeLocWeight,
MilanLongInt *candidateMate);
void PARALLEL_PROCESS_EXPOSED_VERTEX_BS(MilanLongInt NLVer,
MilanLongInt *candidateMate,
MilanLongInt *verLocInd,
MilanLongInt *verLocPtr,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *Mate,
vector<MilanLongInt> &GMate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
MilanFloat *edgeLocWeight,
MilanLongInt *myCardPtr,
MilanLongInt *msgIndPtr,
MilanLongInt *NumMessagesBundledPtr,
MilanLongInt *SPtr,
MilanLongInt *verDistance,
MilanLongInt *PCounter,
vector<MilanLongInt> &Counter,
MilanInt myRank,
MilanInt numProcs,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
vector<MilanInt> &privateQOwner);
void processMatchedVerticesS(
MilanLongInt NLVer,
vector<MilanLongInt> &UChunkBeingProcessed,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *myCardPtr,
MilanLongInt *msgIndPtr,
MilanLongInt *NumMessagesBundledPtr,
MilanLongInt *SPtr,
MilanLongInt *verLocPtr,
MilanLongInt *verLocInd,
MilanLongInt *verDistance,
MilanLongInt *PCounter,
vector<MilanLongInt> &Counter,
MilanInt myRank,
MilanInt numProcs,
MilanLongInt *candidateMate,
vector<MilanLongInt> &GMate,
MilanLongInt *Mate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
MilanFloat *edgeLocWeight,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
vector<MilanInt> &privateQOwner);
void processMatchedVerticesAndSendMessagesS(
MilanLongInt NLVer,
vector<MilanLongInt> &UChunkBeingProcessed,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *myCardPtr,
MilanLongInt *msgIndPtr,
MilanLongInt *NumMessagesBundledPtr,
MilanLongInt *SPtr,
MilanLongInt *verLocPtr,
MilanLongInt *verLocInd,
MilanLongInt *verDistance,
MilanLongInt *PCounter,
vector<MilanLongInt> &Counter,
MilanInt myRank,
MilanInt numProcs,
MilanLongInt *candidateMate,
vector<MilanLongInt> &GMate,
MilanLongInt *Mate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
MilanFloat *edgeLocWeight,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
vector<MilanInt> &privateQOwner,
MPI_Comm comm,
MilanLongInt *msgActual,
vector<MilanLongInt> &Message);
void processMessagesS(
MilanLongInt NLVer,
MilanLongInt *Mate,
MilanLongInt *candidateMate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
vector<MilanLongInt> &GMate,
vector<MilanLongInt> &Counter,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *myCardPtr,
MilanLongInt *msgIndPtr,
MilanLongInt *msgActualPtr,
MilanFloat *edgeLocWeight,
MilanLongInt *verDistance,
MilanLongInt *verLocPtr,
MilanLongInt k,
MilanLongInt *verLocInd,
MilanInt numProcs,
MilanInt myRank,
MPI_Comm comm,
vector<MilanLongInt> &Message,
MilanLongInt numGhostEdges,
MilanLongInt u,
MilanLongInt v,
MilanLongInt *SPtr,
vector<MilanLongInt> &U);
void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt *verLocPtr, MilanLongInt *verLocInd, MilanReal *edgeLocWeight,
MilanLongInt *verDistance,
MilanLongInt *Mate,
MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
MilanLongInt *msgIndSent, MilanLongInt *msgActualSent, MilanReal *msgPercent,
MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
MilanLongInt *ph1_card, MilanLongInt *ph2_card);
MilanLongInt computeCandidateMate(MilanLongInt adj1,
MilanLongInt adj2,
MilanReal *edgeLocWeight,
MilanLongInt k,
MilanLongInt *verLocInd,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
vector<MilanLongInt> &GMate,
MilanLongInt *Mate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap);
void salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt *verLocPtr, MilanLongInt *verLocInd, MilanFloat *edgeLocWeight,
MilanLongInt *verDistance,
MilanLongInt *Mate,
MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
MilanLongInt *msgIndSent, MilanLongInt *msgActualSent, MilanReal *msgPercent,
MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
MilanLongInt *ph1_card, MilanLongInt *ph2_card);
void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt StartIndex, MilanLongInt EndIndex,
MilanLongInt *numGhostEdgesPtr,
MilanLongInt *numGhostVerticesPtr,
MilanLongInt *S,
MilanLongInt *verLocInd,
MilanLongInt *verLocPtr,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
vector<MilanLongInt> &Counter,
vector<MilanLongInt> &verGhostPtr,
vector<MilanLongInt> &verGhostInd,
vector<MilanLongInt> &tempCounter,
vector<MilanLongInt> &GMate,
vector<MilanLongInt> &Message,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
MilanLongInt *&candidateMate,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
vector<MilanInt> &privateQOwner);
void clean(MilanLongInt NLVer,
MilanInt myRank,
MilanLongInt MessageIndex,
vector<MPI_Request> &SRequest,
vector<MPI_Status> &SStatus,
MilanInt BufferSize,
MilanLongInt *Buffer,
MilanLongInt msgActual,
MilanLongInt *msgActualSent,
MilanLongInt msgInd,
MilanLongInt *msgIndSent,
MilanLongInt NumMessagesBundled,
MilanReal *msgPercent);
void PARALLEL_COMPUTE_CANDIDATE_MATE_B(MilanLongInt NLVer,
MilanLongInt *verLocPtr,
MilanLongInt *verLocInd,
MilanInt myRank,
MilanReal *edgeLocWeight,
MilanLongInt *candidateMate);
void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
MilanLongInt *candidateMate,
MilanLongInt *verLocInd,
MilanLongInt *verLocPtr,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *Mate,
vector<MilanLongInt> &GMate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
MilanReal *edgeLocWeight,
MilanLongInt *myCardPtr,
MilanLongInt *msgIndPtr,
MilanLongInt *NumMessagesBundledPtr,
MilanLongInt *SPtr,
MilanLongInt *verDistance,
MilanLongInt *PCounter,
vector<MilanLongInt> &Counter,
MilanInt myRank,
MilanInt numProcs,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
vector<MilanInt> &privateQOwner);
void PROCESS_CROSS_EDGE(MilanLongInt *edge,
MilanLongInt *SPtr);
void processMatchedVertices(
MilanLongInt NLVer,
vector<MilanLongInt> &UChunkBeingProcessed,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *myCardPtr,
MilanLongInt *msgIndPtr,
MilanLongInt *NumMessagesBundledPtr,
MilanLongInt *SPtr,
MilanLongInt *verLocPtr,
MilanLongInt *verLocInd,
MilanLongInt *verDistance,
MilanLongInt *PCounter,
vector<MilanLongInt> &Counter,
MilanInt myRank,
MilanInt numProcs,
MilanLongInt *candidateMate,
vector<MilanLongInt> &GMate,
MilanLongInt *Mate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
MilanReal *edgeLocWeight,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
vector<MilanInt> &privateQOwner);
void processMatchedVerticesAndSendMessages(
MilanLongInt NLVer,
vector<MilanLongInt> &UChunkBeingProcessed,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *myCardPtr,
MilanLongInt *msgIndPtr,
MilanLongInt *NumMessagesBundledPtr,
MilanLongInt *SPtr,
MilanLongInt *verLocPtr,
MilanLongInt *verLocInd,
MilanLongInt *verDistance,
MilanLongInt *PCounter,
vector<MilanLongInt> &Counter,
MilanInt myRank,
MilanInt numProcs,
MilanLongInt *candidateMate,
vector<MilanLongInt> &GMate,
MilanLongInt *Mate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
MilanReal *edgeLocWeight,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
vector<MilanInt> &privateQOwner,
MPI_Comm comm,
MilanLongInt *msgActual,
vector<MilanLongInt> &Message);
void sendBundledMessages(MilanLongInt *numGhostEdgesPtr,
MilanInt *BufferSizePtr,
MilanLongInt *Buffer,
vector<MilanLongInt> &PCumulative,
vector<MilanLongInt> &PMessageBundle,
vector<MilanLongInt> &PSizeInfoMessages,
MilanLongInt *PCounter,
MilanLongInt NumMessagesBundled,
MilanLongInt *msgActualPtr,
MilanLongInt *MessageIndexPtr,
MilanInt numProcs,
MilanInt myRank,
MPI_Comm comm,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
vector<MPI_Request> &SRequest,
vector<MPI_Status> &SStatus);
void processMessages(
MilanLongInt NLVer,
MilanLongInt *Mate,
MilanLongInt *candidateMate,
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
vector<MilanLongInt> &GMate,
vector<MilanLongInt> &Counter,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *myCardPtr,
MilanLongInt *msgIndPtr,
MilanLongInt *msgActualPtr,
MilanReal *edgeLocWeight,
MilanLongInt *verDistance,
MilanLongInt *verLocPtr,
MilanLongInt k,
MilanLongInt *verLocInd,
MilanInt numProcs,
MilanInt myRank,
MPI_Comm comm,
vector<MilanLongInt> &Message,
MilanLongInt numGhostEdges,
MilanLongInt u,
MilanLongInt v,
MilanLongInt *SPtr,
vector<MilanLongInt> &U);
void extractUChunk(
vector<MilanLongInt> &UChunkBeingProcessed,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU);
void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt *verLocPtr, MilanLongInt *verLocInd, MilanReal *edgeLocWeight,
MilanLongInt *verDistance,
MilanLongInt *Mate,
MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
MilanLongInt *msgIndSent, MilanLongInt *msgActualSent, MilanReal *msgPercent,
MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
MilanLongInt *ph1_card, MilanLongInt *ph2_card);
void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
MilanLongInt NLVer, MilanLongInt NLEdge,
@@ -630,9 +462,8 @@ is disabled there is no reason to actually compile or reference them. */
MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
MilanLongInt *ph1_card, MilanLongInt *ph2_card);
#endif
#ifdef __cplusplus
}
#endif
#endif
#endif
-504
View File
@@ -1,504 +0,0 @@
/*
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
-81
View File
@@ -1,81 +0,0 @@
/*
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
@@ -70,7 +70,7 @@
Statistics: ph1_card, ph2_card : Size: |P| number of processes in the comm-world (number of matched edges in Phase 1 and Phase 2)
*/
#ifdef PSB_SERIAL_MPI
#ifdef SERIAL_MPI
#else
// DOUBLE PRECISION VERSION
@@ -86,7 +86,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
MilanReal* msgPercent,
MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time,
MilanLongInt* ph1_card, MilanLongInt* ph2_card ) {
#if !defined(PSB_SERIAL_MPI)
#if !defined(SERIAL_MPI)
#ifdef PRINT_DEBUG_INFO_
cout<<"\n("<<myRank<<")Within algoEdgeApproxDominatingEdgesLinearSearchMessageBundling()"; fflush(stdout);
#endif
@@ -1303,17 +1303,17 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
// SINGLE PRECISION VERSION
void salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt* verLocPtr, MilanLongInt* verLocInd,
MilanFloat* edgeLocWeight,
MilanLongInt* verDistance,
MilanLongInt* Mate,
MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
MilanLongInt* msgIndSent, MilanLongInt* msgActualSent,
MilanReal* msgPercent,
MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time,
MilanLongInt* ph1_card, MilanLongInt* ph2_card ) {
#if !defined(PSB_SERIAL_MPI)
MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt* verLocPtr, MilanLongInt* verLocInd,
MilanFloat* edgeLocWeight,
MilanLongInt* verDistance,
MilanLongInt* Mate,
MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
MilanLongInt* msgIndSent, MilanLongInt* msgActualSent,
MilanReal* msgPercent,
MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time,
MilanLongInt* ph1_card, MilanLongInt* ph2_card ) {
#if !defined(SERIAL_MPI)
#ifdef PRINT_DEBUG_INFO_
cout<<"\n("<<myRank<<")Within algoEdgeApproxDominatingEdgesLinearSearchMessageBundling()"; fflush(stdout);
#endif
@@ -1,4 +1,5 @@
#include "MatchBoxPC.h"
// ***********************************************************************
//
// MatchboxP: A C++ library for approximate weighted matching
@@ -70,7 +71,7 @@
Statistics: ph1_card, ph2_card : Size: |P| number of processes in the comm-world (number of matched edges in Phase 1 and Phase 2)
*/
//#define DEBUG_HANG_
#ifdef PSB_SERIAL_MPI
#ifdef SERIAL_MPI
#else
// DOUBLE PRECISION VERSION
@@ -102,7 +103,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
* i+1-th value is the position of the first element on the i+1-th row
*/
#if !defined(PSB_SERIAL_MPI)
#if !defined(SERIAL_MPI)
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << ")Within algoEdgeApproxDominatingEdgesLinearSearchMessageBundling()";
fflush(stdout);
@@ -125,10 +126,8 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
fflush(stdout);
#endif
// The starting vertex owned by the current rank
MilanLongInt StartIndex = verDistance[myRank];
// The ending vertex owned by the current rank
MilanLongInt EndIndex = verDistance[myRank + 1] - 1;
MilanLongInt StartIndex = verDistance[myRank]; // The starting vertex owned by the current rank
MilanLongInt EndIndex = verDistance[myRank + 1] - 1; // The ending vertex owned by the current rank
MPI_Status computeStatus;
@@ -146,8 +145,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
// only one message will be sent in the initialization phase -
// one of: REQUEST/FAILURE/SUCCESS
vector<MilanLongInt> QLocalVtx, QGhostVtx, QMsgType;
// Changed by Fabio to be an integer, addresses needs to be integers!
vector<MilanInt> QOwner;
vector<MilanInt> QOwner; // Changed by Fabio to be an integer, addresses needs to be integers!
MilanLongInt *PCounter = new MilanLongInt[numProcs];
for (int i = 0; i < numProcs; i++)
@@ -155,8 +153,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
MilanLongInt NumMessagesBundled = 0;
// TODO when the last computational section will be refactored this could be eliminated
// Changed by Fabio to be an integer, addresses needs to be integers!
MilanInt ghostOwner = 0;
MilanInt ghostOwner = 0; // Changed by Fabio to be an integer, addresses needs to be integers!
MilanLongInt *candidateMate = nullptr;
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << ")NV: " << NLVer << " Edges: " << NLEdge;
@@ -171,12 +168,9 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
MilanLongInt myCard = 0;
// Build the Ghost Vertex Set: Vg
// Map each ghost vertex to a local vertex
map<MilanLongInt, MilanLongInt> Ghost2LocalMap;
// Store the edge count for each ghost vertex
vector<MilanLongInt> Counter;
// Number of Ghost vertices
MilanLongInt numGhostVertices = 0, numGhostEdges = 0;
map<MilanLongInt, MilanLongInt> Ghost2LocalMap; // Map each ghost vertex to a local vertex
vector<MilanLongInt> Counter; // Store the edge count for each ghost vertex
MilanLongInt numGhostVertices = 0, numGhostEdges = 0; // Number of Ghost vertices
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << ")About to compute Ghost Vertices...";
@@ -228,7 +222,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
cout << myRank << " Finished initialization" << endl;
fflush(stdout);
#endif
startTime = MPI_Wtime();
/////////////////////////////////////////////////////////////////////////////////////////
@@ -243,7 +237,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
* PARALLEL_COMPUTE_CANDIDATE_MATE_B is now totally parallel.
*/
PARALLEL_COMPUTE_CANDIDATE_MATE_BD(NLVer,
PARALLEL_COMPUTE_CANDIDATE_MATE_B(NLVer,
verLocPtr,
verLocInd,
myRank,
@@ -268,7 +262,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
* TODO: Test when it's actually more efficient to execute this code
* in parallel.
*/
PARALLEL_PROCESS_EXPOSED_VERTEX_BD(NLVer,
PARALLEL_PROCESS_EXPOSED_VERTEX_B(NLVer,
candidateMate,
verLocInd,
verLocPtr,
@@ -320,7 +314,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
vector<MilanLongInt> UChunkBeingProcessed;
UChunkBeingProcessed.reserve(UCHUNK);
processMatchedVerticesD(NLVer,
processMatchedVertices(NLVer,
UChunkBeingProcessed,
U,
privateU,
@@ -397,7 +391,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
cout << myRank << " Finished sendBundles" << endl;
fflush(stdout);
#endif
*ph1_card = myCard; // Cardinality at the end of Phase-1
startTime = MPI_Wtime();
/////////////////////////////////////////////////////////////////////////////////////////
@@ -428,8 +422,8 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////// PROCESS MATCHED VERTICES //////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
processMatchedVerticesAndSendMessagesD(NLVer,
processMatchedVerticesAndSendMessages(NLVer,
UChunkBeingProcessed,
U,
privateU,
@@ -462,7 +456,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
comm,
&msgActual,
Message);
///////////////////////// END OF PROCESS MATCHED VERTICES /////////////////////////
//// BREAK IF NO MESSAGES EXPECTED /////////
@@ -489,8 +483,8 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////// PROCESS MESSAGES //////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
//startTime = MPI_Wtime();
processMessagesD(NLVer,
processMessages(NLVer,
Mate,
candidateMate,
Ghost2LocalMap,
@@ -555,489 +549,6 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
*ph2_card = myCard; // Cardinality at the end of Phase-2
}
// End of algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMate
void salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt *verLocPtr, MilanLongInt *verLocInd,
MilanFloat *edgeLocWeight,
MilanLongInt *verDistance,
MilanLongInt *Mate,
MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
MilanLongInt *msgIndSent, MilanLongInt *msgActualSent,
MilanReal *msgPercent,
MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
MilanLongInt *ph1_card, MilanLongInt *ph2_card)
{
/*
* verDistance: it's a vector long as the number of processors.
* verDistance[i] contains the first node index of the i-th processor
* verDistance[i + 1] contains the last node index of the i-th processor
* NLVer: number of elements in the LocPtr
* NLEdge: number of edges assigned to the current processor
*
* Contains the portion of matrix assigned to the processor in
* Yale notation
* verLocInd: contains the positions on row of the matrix
* verLocPtr: i-th value is the position of the first element on the i-th row and
* i+1-th value is the position of the first element on the i+1-th row
*/
#if !defined(PSB_SERIAL_MPI)
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << ")Within algoEdgeApproxDominatingEdgesLinearSearchMessageBundling()";
fflush(stdout);
#endif
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << ") verDistance [" ;
for (int i = 0; i < numProcs; i++)
cout << verDistance[i] << "," << verDistance[i+1];
cout << "]\n";
fflush(stdout);
#endif
#ifdef DEBUG_HANG_
if (myRank == 0) {
cout << "\n(" << myRank << ") verDistance [" ;
for (int i = 0; i < numProcs; i++)
cout << verDistance[i] << "," ;
cout << verDistance[numProcs]<< "]\n";
}
fflush(stdout);
#endif
// The starting vertex owned by the current rank
MilanLongInt StartIndex = verDistance[myRank];
// The ending vertex owned by the current rank
MilanLongInt EndIndex = verDistance[myRank + 1] - 1;
MPI_Status computeStatus;
MilanLongInt msgActual = 0, msgInd = 0;
MilanFloat heaviestEdgeWt = 0.0f; // Assumes positive weight
MilanReal startTime, finishTime;
startTime = MPI_Wtime();
// Data structures for sending and receiving messages:
vector<MilanLongInt> Message; // [ u, v, message_type ]
Message.resize(3, -1);
// Data structures for Message Bundling:
// Although up to two messages can be sent along any cross edge,
// only one message will be sent in the initialization phase -
// one of: REQUEST/FAILURE/SUCCESS
vector<MilanLongInt> QLocalVtx, QGhostVtx, QMsgType;
// Changed by Fabio to be an integer, addresses needs to be integers!
vector<MilanInt> QOwner;
MilanLongInt *PCounter = new MilanLongInt[numProcs];
for (int i = 0; i < numProcs; i++)
PCounter[i] = 0;
MilanLongInt NumMessagesBundled = 0;
// TODO when the last computational section will be refactored this could be eliminated
// Changed by Fabio to be an integer, addresses needs to be integers!
MilanInt ghostOwner = 0;
MilanLongInt *candidateMate = nullptr;
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << ")NV: " << NLVer << " Edges: " << NLEdge;
fflush(stdout);
cout << "\n(" << myRank << ")StartIndex: " << StartIndex << " EndIndex: " << EndIndex;
fflush(stdout);
#endif
// Other Variables:
MilanLongInt u = -1, v = -1, w = -1, i = 0;
MilanLongInt k = -1, adj1 = -1, adj2 = -1;
MilanLongInt k1 = -1, adj11 = -1, adj12 = -1;
MilanLongInt myCard = 0;
// Build the Ghost Vertex Set: Vg
// Map each ghost vertex to a local vertex
map<MilanLongInt, MilanLongInt> Ghost2LocalMap;
// Store the edge count for each ghost vertex
vector<MilanLongInt> Counter;
// Number of Ghost vertices
MilanLongInt numGhostVertices = 0, numGhostEdges = 0;
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << ")About to compute Ghost Vertices...";
fflush(stdout);
#endif
#ifdef DEBUG_HANG_
if (myRank == 0)
cout << "\n(" << myRank << ")About to compute Ghost Vertices...";
fflush(stdout);
#endif
// Define Adjacency Lists for Ghost Vertices:
// cout<<"Building Ghost data structures ... \n\n";
vector<MilanLongInt> verGhostPtr, verGhostInd, tempCounter;
// Mate array for ghost vertices:
vector<MilanLongInt> GMate; // Proportional to the number of ghost vertices
MilanLongInt S;
MilanLongInt privateMyCard = 0;
vector<MilanLongInt> PCumulative, PMessageBundle, PSizeInfoMessages;
vector<MPI_Request> SRequest; // Requests that are used for each send message
vector<MPI_Status> SStatus; // Status of sent messages, used in MPI_Wait
MilanLongInt MessageIndex = 0; // Pointer for current message
MilanInt BufferSize;
MilanLongInt *Buffer;
vector<MilanLongInt> privateQLocalVtx, privateQGhostVtx, privateQMsgType;
vector<MilanInt> privateQOwner;
vector<MilanLongInt> U, privateU;
initialize(NLVer, NLEdge, StartIndex,
EndIndex, &numGhostEdges,
&numGhostVertices, &S,
verLocInd, verLocPtr,
Ghost2LocalMap, Counter,
verGhostPtr, verGhostInd,
tempCounter, GMate,
Message, QLocalVtx,
QGhostVtx, QMsgType, QOwner,
candidateMate, U,
privateU,
privateQLocalVtx,
privateQGhostVtx,
privateQMsgType,
privateQOwner);
finishTime = MPI_Wtime();
*ph0_time = finishTime - startTime; // Time taken for Phase-0: Initialization
#ifdef DEBUG_HANG_
cout << myRank << " Finished initialization" << endl;
fflush(stdout);
#endif
startTime = MPI_Wtime();
/////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////// INITIALIZATION /////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
// Compute the Initial Matching Set:
/*
* OMP PARALLEL_COMPUTE_CANDIDATE_MATE_B has been splitted from
* PARALLEL_PROCESS_EXPOSED_VERTEX_B in order to better parallelize
* the two.
* PARALLEL_COMPUTE_CANDIDATE_MATE_B is now totally parallel.
*/
PARALLEL_COMPUTE_CANDIDATE_MATE_BS(NLVer,
verLocPtr,
verLocInd,
myRank,
edgeLocWeight,
candidateMate);
#ifdef DEBUG_HANG_
cout << myRank << " Finished Exposed Vertex" << endl;
fflush(stdout);
#if 0
cout << myRank << " candidateMate after parallelCompute " <<endl;
for (int i=0; i<NLVer; i++) {
cout << candidateMate[i] << " " ;
}
cout << endl;
#endif
#endif
/*
* PARALLEL_PROCESS_EXPOSED_VERTEX_B
* TODO: write comment
*
* TODO: Test when it's actually more efficient to execute this code
* in parallel.
*/
PARALLEL_PROCESS_EXPOSED_VERTEX_BS(NLVer,
candidateMate,
verLocInd,
verLocPtr,
StartIndex,
EndIndex,
Mate,
GMate,
Ghost2LocalMap,
edgeLocWeight,
&myCard,
&msgInd,
&NumMessagesBundled,
&S,
verDistance,
PCounter,
Counter,
myRank,
numProcs,
U,
privateU,
QLocalVtx,
QGhostVtx,
QMsgType,
QOwner,
privateQLocalVtx,
privateQGhostVtx,
privateQMsgType,
privateQOwner);
tempCounter.clear(); // Do not need this any more
#ifdef DEBUG_HANG_
cout << myRank << " Finished Exposed Vertex" << endl;
fflush(stdout);
#if 0
cout << myRank << " Mate after Exposed Vertices " <<endl;
for (int i=0; i<NLVer; i++) {
cout << Mate[i] << " " ;
}
cout << endl;
#endif
#endif
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////// PROCESS MATCHED VERTICES //////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
// TODO what would be the optimal UCHUNK
vector<MilanLongInt> UChunkBeingProcessed;
UChunkBeingProcessed.reserve(UCHUNK);
processMatchedVerticesS(NLVer,
UChunkBeingProcessed,
U,
privateU,
StartIndex,
EndIndex,
&myCard,
&msgInd,
&NumMessagesBundled,
&S,
verLocPtr,
verLocInd,
verDistance,
PCounter,
Counter,
myRank,
numProcs,
candidateMate,
GMate,
Mate,
Ghost2LocalMap,
edgeLocWeight,
QLocalVtx,
QGhostVtx,
QMsgType,
QOwner,
privateQLocalVtx,
privateQGhostVtx,
privateQMsgType,
privateQOwner);
#ifdef DEBUG_HANG_
cout << myRank << " Finished Process Vertices" << endl;
fflush(stdout);
#if 0
cout << myRank << " Mate after Matched Vertices " <<endl;
for (int i=0; i<NLVer; i++) {
cout << Mate[i] << " " ;
}
cout << endl;
#endif
#endif
/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////// SEND BUNDLED MESSAGES /////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
sendBundledMessages(&numGhostEdges,
&BufferSize,
Buffer,
PCumulative,
PMessageBundle,
PSizeInfoMessages,
PCounter,
NumMessagesBundled,
&msgActual,
&MessageIndex,
numProcs,
myRank,
comm,
QLocalVtx,
QGhostVtx,
QMsgType,
QOwner,
SRequest,
SStatus);
///////////////////////// END OF SEND BUNDLED MESSAGES //////////////////////////////////
finishTime = MPI_Wtime();
*ph1_time = finishTime - startTime; // Time taken for Phase-1
#ifdef DEBUG_HANG_
cout << myRank << " Finished sendBundles" << endl;
fflush(stdout);
#endif
*ph1_card = myCard; // Cardinality at the end of Phase-1
startTime = MPI_Wtime();
/////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// MAIN LOOP //////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
// Main While Loop:
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << "=========================************===============================" << endl;
fflush(stdout);
fflush(stdout);
#endif
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << ")Entering While(true) loop..";
fflush(stdout);
#endif
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << "=========================************===============================" << endl;
fflush(stdout);
fflush(stdout);
#endif
while (true) {
#ifdef DEBUG_HANG_
//if (myRank == 0)
cout << "\n(" << myRank << ") Main loop" << endl;
fflush(stdout);
#endif
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////// PROCESS MATCHED VERTICES //////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
processMatchedVerticesAndSendMessagesS(NLVer,
UChunkBeingProcessed,
U,
privateU,
StartIndex,
EndIndex,
&myCard,
&msgInd,
&NumMessagesBundled,
&S,
verLocPtr,
verLocInd,
verDistance,
PCounter,
Counter,
myRank,
numProcs,
candidateMate,
GMate,
Mate,
Ghost2LocalMap,
edgeLocWeight,
QLocalVtx,
QGhostVtx,
QMsgType,
QOwner,
privateQLocalVtx,
privateQGhostVtx,
privateQMsgType,
privateQOwner,
comm,
&msgActual,
Message);
///////////////////////// END OF PROCESS MATCHED VERTICES /////////////////////////
//// BREAK IF NO MESSAGES EXPECTED /////////
#ifdef DEBUG_HANG_
#if 0
cout << myRank << " Mate after ProcessMatchedAndSend phase "<<S <<endl;
for (int i=0; i<NLVer; i++) {
cout << Mate[i] << " " ;
}
cout << endl;
#endif
#endif
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << ")Deciding whether to break: S= " << S << endl;
#endif
if (S == 0) {
#ifdef DEBUG_HANG_
cout << "\n(" << myRank << ") Breaking out" << endl;
fflush(stdout);
#endif
break;
}
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////// PROCESS MESSAGES //////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
processMessagesS(NLVer,
Mate,
candidateMate,
Ghost2LocalMap,
GMate,
Counter,
StartIndex,
EndIndex,
&myCard,
&msgInd,
&msgActual,
edgeLocWeight,
verDistance,
verLocPtr,
k,
verLocInd,
numProcs,
myRank,
comm,
Message,
numGhostEdges,
u,
v,
&S,
U);
///////////////////////// END OF PROCESS MESSAGES /////////////////////////////////
#ifdef DEBUG_HANG_
#if 0
cout << myRank << " Mate after ProcessMessages phase "<<S <<endl;
for (int i=0; i<NLVer; i++) {
cout << Mate[i] << " " ;
}
cout << endl;
#endif
#endif
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << ")Finished Message processing phase: S= " << S;
fflush(stdout);
cout << "\n(" << myRank << ")** SENT : ACTUAL= " << msgActual;
fflush(stdout);
cout << "\n(" << myRank << ")** SENT : INDIVIDUAL= " << msgInd << endl;
fflush(stdout);
#endif
} // End of while (true)
clean(NLVer,
myRank,
MessageIndex,
SRequest,
SStatus,
BufferSize,
Buffer,
msgActual,
msgActualSent,
msgInd,
msgIndSent,
NumMessagesBundled,
msgPercent);
finishTime = MPI_Wtime();
*ph2_time = finishTime - startTime; // Time taken for Phase-2
*ph2_card = myCard; // Cardinality at the end of Phase-2
}
#endif
#endif
#endif
@@ -177,24 +177,23 @@ subroutine amg_c_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
select case (parms%aggr_prol)
case (amg_no_smooth_)
call amg_caggrmat_nosmth_bld(parms%aggr_prol,a,desc_a,ilaggr,&
nlaggr,parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
call amg_caggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,&
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(amg_smooth_prol_,amg_l1_smooth_prol_)
case(amg_smooth_prol_)
call amg_caggrmat_smth_bld(parms%aggr_prol,a,desc_a,&
ilaggr,nlaggr,parms,ac,desc_ac,op_prol,&
op_restr,t_prol,info)
call amg_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr, &
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
!!$ case(amg_biz_prol_)
!!$
!!$ call amg_caggrmat_biz_bld(a,desc_a,ilaggr,nlaggr, &
!!$ & parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(amg_min_energy_)
call amg_caggrmat_minnrg_bld(parms%aggr_prol,a,desc_a,ilaggr,&
nlaggr,parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
call amg_caggrmat_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_
@@ -216,7 +216,6 @@ subroutine amg_c_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac_csr%clean_zeros(info)
call ac%mv_from(ac_csr)
call ac%set_asb()
@@ -421,7 +420,6 @@ subroutine amg_c_lc_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac_csr%clean_zeros(info)
call ac%mv_from(ac_csr)
call ac%set_asb()
@@ -631,7 +629,6 @@ subroutine amg_lc_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac_csr%clean_zeros(info)
call ac%mv_from(ac_csr)
call ac%set_asb()
-1
View File
@@ -142,7 +142,6 @@ subroutine amg_c_rap(a_csr,desc_a,nlaggr,parms,ac,&
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac_csr%clean_zeros(info)
call ac%mv_from(ac_csr)
call ac%set_asb()
@@ -72,7 +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(PSB_OPENMP)
#if defined(OPENMP)
use omp_lib
#endif
implicit none
@@ -172,7 +172,7 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
! Phase one: Start with disjoint groups.
!
naggr = 0
#if defined(PSB_OPENMP)
#if defined(OPENMP)
block
integer(psb_ipk_), allocatable :: bnds(:), locnaggr(:)
integer(psb_ipk_) :: myth,nths, kk
@@ -250,7 +250,7 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
! 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)))).and.(diag(i).ne.czero)) then
if (abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))) then
ip = ip + 1
icol(ip) = icol(k)
end if
@@ -357,7 +357,7 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
do k=1, nz
j = icol(k)
if ((1<=j).and.(j<=nr)) then
if ((abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))).and.(diag(i).ne.czero)) then
if (abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))) then
ip = ip + 1
icol(ip) = icol(k)
end if
@@ -545,3 +545,4 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
return
end subroutine amg_c_soc1_map_bld
@@ -71,7 +71,7 @@ subroutine amg_c_soc2_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(PSB_OPENMP)
#if defined(OPENMP)
use omp_lib
#endif
@@ -211,7 +211,7 @@ subroutine amg_c_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
! Phase one: Start with disjoint groups.
!
naggr = 0
#if defined(PSB_OPENMP)
#if defined(OPENMP)
block
integer(psb_ipk_), allocatable :: bnds(:), locnaggr(:)
integer(psb_ipk_) :: myth,nths, kk
@@ -69,7 +69,6 @@
!
!
! Arguments:
! dol1smoothing - fictitious integer argument, it is not used inside
! a - type(psb_cspmat_type), input.
! The sparse matrix structure containing the local part of
! the fine-level matrix.
@@ -105,8 +104,8 @@
! Error code.
!
!
subroutine amg_caggrmat_minnrg_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
subroutine amg_caggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use amg_base_prec_type
use amg_c_inner_mod, amg_protect_name => amg_caggrmat_minnrg_bld
@@ -114,7 +113,6 @@ subroutine amg_caggrmat_minnrg_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
implicit none
! Arguments
integer(psb_ipk_), intent(in) :: dol1smoothing
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
@@ -173,13 +171,6 @@ subroutine amg_caggrmat_minnrg_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
filter_mat = (parms%aggr_filter == amg_filter_mat_)
if (dol1smoothing.ne.amg_no_smooth_) then
info=psb_err_fatal_;
call psb_errpush(info,name,a_err='Are you trying to smooth an unsmoothed aggregation?')
goto 9999
end if
!NEEDS TO BE REWORKED !!
! naggr: number of local aggregates
@@ -309,7 +300,7 @@ subroutine amg_caggrmat_minnrg_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
!!$ endif
!!$ enddo
!!$ if (jd == -1) then
!!$ write(0,*) name,': Warning: there is no diagonal element', i
!!$ write(0,*) 'Wrong input: we need the diagonal!!!!', i
!!$ else
!!$ acsrf%val(jd)=acsrf%val(jd)-tmp
!!$ end if
@@ -94,11 +94,10 @@
!
! info - integer, output.
! Error code.
! dol1smoothing - optional, this is here just for interfacing reasons. It is not used by the
! code
!
subroutine amg_caggrmat_nosmth_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
!
subroutine amg_caggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use amg_base_prec_type
use amg_c_inner_mod, amg_protect_name => amg_caggrmat_nosmth_bld
@@ -106,7 +105,6 @@ subroutine amg_caggrmat_nosmth_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
implicit none
! Arguments
integer(psb_ipk_), intent(in) :: dol1smoothing
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
@@ -139,12 +137,6 @@ subroutine amg_caggrmat_nosmth_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
ctxt = desc_a%get_context()
call psb_info(ctxt, me, np)
if (dol1smoothing.ne.amg_no_smooth_) then
info=psb_err_fatal_;
call psb_errpush(info,name,a_err='Are you trying to smooth an unsmoothed aggregation?')
goto 9999
end if
nglob = desc_a%get_global_rows()
nrow = desc_a%get_local_rows()
ncol = desc_a%get_local_cols()
@@ -69,8 +69,6 @@
!
!
! Arguments:
! dol1smooth - Integer taking the type of smoother that has to be used
! on the tentative prolongator
! a - type(psb_cspmat_type), input.
! The sparse matrix structure containing the local part of
! the fine-level matrix.
@@ -104,18 +102,16 @@
! info - integer, output.
! Error code.
!
subroutine amg_caggrmat_smth_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
subroutine amg_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use amg_base_prec_type
use amg_c_inner_mod, amg_protect_name => amg_caggrmat_smth_bld
use amg_c_base_aggregator_mod
! use, intrinsic :: ieee_arithmetic
implicit none
! Arguments
integer(psb_ipk_), intent(in) :: dol1smoothing
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
@@ -136,7 +132,7 @@ subroutine amg_caggrmat_smth_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
type(psb_c_coo_sparse_mat) :: coo_prol, coo_restr
type(psb_c_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
complex(psb_spk_), allocatable :: adiag(:)
real(psb_spk_), allocatable :: arwsum(:),l1rwsum(:)
real(psb_spk_), allocatable :: arwsum(:)
integer(psb_ipk_) :: ierr(5)
logical :: filter_mat
integer(psb_ipk_) :: debug_level, debug_unit, err_act
@@ -145,7 +141,6 @@ subroutine amg_caggrmat_smth_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
logical, parameter :: debug_new=.false.
character(len=80) :: filename
logical, parameter :: do_timings=.false.
logical :: do_l1correction=.false.
integer(psb_ipk_), save :: idx_spspmm=-1, idx_phase1=-1, idx_gtrans=-1, idx_phase2=-1, idx_refine=-1
integer(psb_ipk_), save :: idx_phase3=-1, idx_cdasb=-1, idx_ptap=-1
@@ -178,9 +173,6 @@ subroutine amg_caggrmat_smth_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
if ((do_timings).and.(idx_ptap==-1)) &
& idx_ptap = psb_get_timer_idx("DEC_SMTH_BLD: ptap_bld ")
! check if we have to use Jacobi or l1-Jacobi to smooth the tentative prolongator
if (dol1smoothing.eq.amg_l1_smooth_prol_) do_l1correction=.true.
nglob = desc_a%get_global_rows()
nrow = desc_a%get_local_rows()
@@ -193,7 +185,7 @@ subroutine amg_caggrmat_smth_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
naggrm1 = sum(nlaggr(1:me))
naggrp1 = sum(nlaggr(1:me+1))
filter_mat = (parms%aggr_filter == amg_filter_mat_).or.(parms%aggr_filter == amg_filter_prow_mat_)
filter_mat = (parms%aggr_filter == amg_filter_mat_)
!
! naggr: number of local aggregates
@@ -208,24 +200,6 @@ subroutine amg_caggrmat_smth_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%cp_to(acsr)
!
! Do the l1-correction on the diagonal if it is requested
!
if (do_l1correction) then
allocate(l1rwsum(nrow))
call acsr%arwsum(l1rwsum)
if (info == psb_success_) &
& call psb_realloc(ncol,l1rwsum,info)
if (info == psb_success_) &
& call psb_halo(l1rwsum,desc_a,info)
! \tilde{D}_{i,i} = \sum_{j \ne i} |a_{i,j}|
!$OMP parallel do private(i) schedule(static)
do i=1,size(adiag)
adiag(i) = adiag(i) + l1rwsum(i) - abs(adiag(i))
end do
!$OMP end parallel do
end if
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
@@ -256,15 +230,9 @@ subroutine amg_caggrmat_smth_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
enddo
if (jd == -1) then
! if (.not.do_l1correction)
write(0,*) 'Wrong input: we need the diagonal!!!!', i
else if (parms%aggr_filter == amg_filter_mat_) then
! We perform filtering in the standard way assuming that A is an M-matrix
else
acsrf%val(jd)=acsrf%val(jd)-tmp
else if (parms%aggr_filter == amg_filter_prow_mat_) then
! We are probably doing l1-correction, hence we want to preserve the
! row sum of the matrix: note the change in sign
acsrf%val(jd)=acsrf%val(jd)+tmp
end if
enddo
!$OMP end parallel do
@@ -272,6 +240,7 @@ subroutine amg_caggrmat_smth_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
call acsrf%clean_zeros(info)
end if
!$OMP parallel do private(i) schedule(static)
do i=1,size(adiag)
if (adiag(i) /= czero) then
@@ -283,17 +252,14 @@ subroutine amg_caggrmat_smth_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
!$OMP end parallel do
if (parms%aggr_omega_alg == amg_eig_est_) then
if ( (parms%aggr_filter == amg_filter_prow_mat_).and.(do_l1correction) ) then
! For l1-Jacobi this can be estimated with 1:
! this makes sense only if we are preserving the row-sum!
parms%aggr_omega_val = done
else if (parms%aggr_eig == amg_max_norm_) then
if (parms%aggr_eig == amg_max_norm_) then
allocate(arwsum(nrow))
call acsr%arwsum(arwsum)
anorm = maxval(abs(adiag(1:nrow)*arwsum(1:nrow)))
call psb_amx(ctxt,anorm)
omega = 4.d0/(3.d0*anorm)
parms%aggr_omega_val = omega
else
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='invalid amg_aggr_eig_')
@@ -356,7 +322,6 @@ subroutine amg_caggrmat_smth_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done smooth_aggregate '
if (allocated(l1rwsum)) deallocate(l1rwsum)
call psb_erractionrestore(err_act)
return
@@ -177,24 +177,23 @@ subroutine amg_d_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
select case (parms%aggr_prol)
case (amg_no_smooth_)
call amg_daggrmat_nosmth_bld(parms%aggr_prol,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_,amg_l1_smooth_prol_)
case(amg_smooth_prol_)
call amg_daggrmat_smth_bld(parms%aggr_prol,a,desc_a,&
ilaggr,nlaggr,parms,ac,desc_ac,op_prol,&
op_restr,t_prol,info)
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,t_prol,info)
case(amg_min_energy_)
call amg_daggrmat_minnrg_bld(parms%aggr_prol,a,desc_a,ilaggr,&
nlaggr,parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
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_
@@ -98,7 +98,11 @@ subroutine amg_d_parmatch_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_parmatch_aggregator_mod
#else
use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_aggregator_inner_mat_asb
#endif
implicit none
class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag
type(amg_dml_parms), intent(inout) :: parms
@@ -129,6 +133,8 @@ subroutine amg_d_parmatch_aggregator_inner_mat_asb(ag,parms,a,desc_a,&
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)
@@ -140,17 +146,16 @@ subroutine amg_d_parmatch_aggregator_inner_mat_asb(ag,parms,a,desc_a,&
case(amg_repl_mat_)
!
!
if (np>1) then
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='no repl coarse_mat_ here')
goto 9999
end if
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
@@ -98,7 +98,11 @@ subroutine amg_d_parmatch_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
#if defined(SERIAL_MPI)
use amg_d_parmatch_aggregator_mod
#else
use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_aggregator_mat_asb
#endif
implicit none
class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag
type(amg_dml_parms), intent(inout) :: parms
@@ -131,6 +135,8 @@ subroutine amg_d_parmatch_aggregator_mat_asb(ag,parms,a,desc_a,&
return
end if
#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)
@@ -193,7 +199,7 @@ subroutine amg_d_parmatch_aggregator_mat_asb(ag,parms,a,desc_a,&
call psb_errpush(info,name,a_err='invalid amg_coarse_mat_')
goto 9999
end select
#endif
call psb_erractionrestore(err_act)
return
@@ -135,7 +135,11 @@ subroutine amg_d_parmatch_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
use psb_base_mod
use amg_d_inner_mod
use amg_base_prec_type
#if defined(SERIAL_MPI)
use amg_d_parmatch_aggregator_mod
#else
use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_aggregator_mat_bld
#endif
implicit none
class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag
@@ -172,6 +176,7 @@ subroutine amg_d_parmatch_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
! algorithm specified by
!
#if !defined(SERIAL_MPI)
call clean_shortcuts(ag)
!
! When requesting smoothed aggregation we cannot use the
@@ -179,23 +184,20 @@ subroutine amg_d_parmatch_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
!
select case (parms%aggr_prol)
case (amg_no_smooth_)
call amg_d_parmatch_unsmth_bld(parms%aggr_prol,ag,a,desc_a,&
ilaggr,nlaggr,parms,ac,desc_ac,op_prol,op_restr,&
t_prol,info)
call amg_d_parmatch_unsmth_bld(ag,a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
case(amg_smooth_prol_,amg_l1_smooth_prol_)
call amg_d_parmatch_smth_bld(parms%aggr_prol,ag,a,desc_a,&
ilaggr,nlaggr,parms,ac,desc_ac,op_prol,op_restr,&
t_prol,info)
case(amg_smooth_prol_)
call amg_d_parmatch_smth_bld(ag,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(parms%aggr_prol,a,desc_a,&
ilaggr,nlaggr,parms,ac,desc_ac,op_prol,op_restr,&
t_prol,info)
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_
@@ -207,12 +209,14 @@ subroutine amg_d_parmatch_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
call psb_errpush(psb_err_from_subroutine_,name,a_err='Inner aggrmat asb')
goto 9999
end if
#endif
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
#if !defined(SERIAL_MPI)
contains
subroutine clean_shortcuts(ag)
@@ -241,4 +245,5 @@ contains
end if
end if
end subroutine clean_shortcuts
#endif
end subroutine amg_d_parmatch_aggregator_mat_bld
@@ -47,7 +47,11 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
use psb_base_mod
use amg_base_prec_type
use amg_d_inner_mod
#if defined(SERIAL_MPI)
use amg_d_parmatch_aggregator_mod
#else
use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_aggregator_build_tprol
#endif
use iso_c_binding
implicit none
class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag
@@ -116,6 +120,8 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
& 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
@@ -460,7 +466,7 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,&
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_bootCMatch_if')
goto 9999
end if
#endif
call psb_erractionrestore(err_act)
return
@@ -69,8 +69,6 @@
!
!
! Arguments:
! dol1smoothing - Select between l1-Jacobi and Jacobi as smoother for the
! tentative prolongator
! a - type(psb_dspmat_type), input.
! The sparse matrix structure containing the local part of
! the fine-level matrix.
@@ -104,17 +102,20 @@
! info - integer, output.
! Error code.
!
subroutine amg_d_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,&
parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
subroutine amg_d_parmatch_smth_bld(ag,a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use amg_base_prec_type
use amg_d_inner_mod
use amg_d_base_aggregator_mod
#if defined(SERIAL_MPI)
use amg_d_parmatch_aggregator_mod
#else
use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_smth_bld
#endif
implicit none
! Arguments
integer(psb_ipk_), intent(in) :: dol1smoothing
class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
@@ -136,7 +137,7 @@ subroutine amg_d_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,&
type(psb_d_coo_sparse_mat) :: coo_prol, coo_restr
type(psb_d_csr_sparse_mat) :: acsrf, csr_prol, acsr, tcsr
real(psb_dpk_), allocatable :: adiag(:)
real(psb_dpk_), allocatable :: arwsum(:),l1rwsum(:)
real(psb_dpk_), allocatable :: arwsum(:)
logical :: filter_mat
integer(psb_ipk_) :: debug_level, debug_unit, err_act
integer(psb_ipk_), parameter :: ncmax=16
@@ -144,7 +145,6 @@ subroutine amg_d_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,&
logical, parameter :: debug_new=.false., dump_r=.false., dump_p=.false., debug=.false.
character(len=80) :: filename
logical, parameter :: do_timings=.false.
logical :: do_l1correction=.false.
integer(psb_ipk_), save :: idx_spspmm=-1, idx_phase1=-1, idx_gtrans=-1, idx_phase2=-1, idx_refine=-1, idx_phase3=-1
integer(psb_ipk_), save :: idx_cdasb=-1, idx_ptap=-1
@@ -166,10 +166,6 @@ subroutine amg_d_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,&
ncol = desc_a%get_local_cols()
theta = parms%aggr_thresh
! Check if we have to perform l1-Jacobi or Jacobi as smoother
if(dol1smoothing.eq.amg_l1_smooth_prol_) do_l1correction=.true.
!write(0,*) me,' ',trim(name),' Start ',idx_spspmm
if ((do_timings).and.(idx_spspmm==-1)) &
& idx_spspmm = psb_get_timer_idx("PMC_SMTH_BLD: par_spspmm")
@@ -190,6 +186,8 @@ subroutine amg_d_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,&
if (do_timings) call psb_tic(idx_phase1)
#if !defined(SERIAL_MPI)
naggr = nlaggr(me+1)
ntaggr = sum(nlaggr)
naggrm1 = sum(nlaggr(1:me))
@@ -219,19 +217,6 @@ subroutine amg_d_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,&
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%cp_to(acsr)
! Get the l1-diagonal of D
if (do_l1correction) then
allocate(l1rwsum(nrow))
call acsr%arwsum(l1rwsum)
if (info == psb_success_) &
& call psb_realloc(ncol,l1rwsum,info)
if (info == psb_success_) &
& call psb_halo(l1rwsum,desc_a,info)
! \tilde{D}_{i,i} = \sum_{j \ne i} |a_{i,j}|
do i=1,size(adiag)
adiag(i) = adiag(i) + l1rwsum(i) - abs(adiag(i))
end do
end if
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
@@ -261,7 +246,7 @@ subroutine amg_d_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,&
enddo
if (jd == -1) then
write(0,*) name,': Warning: there is no diagonal element', i
write(0,*) 'Wrong input: we need the diagonal!!!!', i
else
acsrf%val(jd)=acsrf%val(jd)-tmp
end if
@@ -282,10 +267,7 @@ subroutine amg_d_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,&
if (parms%aggr_omega_alg == amg_eig_est_) then
if (do_l1correction) then
! For l1-Jacobi this can be estimated with 1
parms%aggr_omega_val = done
else if (parms%aggr_eig == amg_max_norm_) then
if (parms%aggr_eig == amg_max_norm_) then
allocate(arwsum(nrow))
call acsr%arwsum(arwsum)
anorm = maxval(abs(adiag(1:nrow)*arwsum(1:nrow)))
@@ -391,13 +373,12 @@ subroutine amg_d_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,&
end block
end if
if (allocated(l1rwsum)) deallocate(l1rwsum)
if (do_timings) call psb_toc(idx_phase2)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done smooth_aggregate '
#endif
call psb_erractionrestore(err_act)
return
@@ -99,7 +99,11 @@ subroutine amg_d_parmatch_spmm_bld(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_parmatch_aggregator_mod
#else
use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_spmm_bld
#endif
implicit none
! Arguments
@@ -136,6 +140,7 @@ subroutine amg_d_parmatch_spmm_bld(a,desc_a,ilaggr,nlaggr,parms,&
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
#if !defined(SERIAL_MPI)
call a%cp_to(acsr)
call amg_d_parmatch_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,&
@@ -149,7 +154,7 @@ subroutine amg_d_parmatch_spmm_bld(a,desc_a,ilaggr,nlaggr,parms,&
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done spmm_bld '
#endif
call psb_erractionrestore(err_act)
return
@@ -99,7 +99,11 @@ subroutine amg_d_parmatch_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_parmatch_aggregator_mod
#else
use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_spmm_bld_inner
#endif
implicit none
! Arguments
@@ -135,6 +139,7 @@ subroutine amg_d_parmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,&
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()
@@ -158,6 +163,7 @@ subroutine amg_d_parmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,&
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.
@@ -197,10 +203,11 @@ subroutine amg_d_parmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,&
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
@@ -99,7 +99,11 @@ subroutine amg_d_parmatch_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_parmatch_aggregator_mod
#else
use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_spmm_bld_ov
#endif
implicit none
! Arguments
@@ -137,6 +141,8 @@ subroutine amg_d_parmatch_spmm_bld_ov(a,desc_a,ilaggr,nlaggr,parms,&
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
#if !defined(SERIAL_MPI)
call a%mv_to(acsr)
call amg_d_parmatch_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,&
@@ -152,6 +158,7 @@ subroutine amg_d_parmatch_spmm_bld_ov(a,desc_a,ilaggr,nlaggr,parms,&
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done spmm_bld '
#endif
call psb_erractionrestore(err_act)
return
@@ -68,8 +68,6 @@
!
!
! Arguments:
! dol1smoothing - this not actually used inside unsmoothed aggregation, it
! is used just to perform a check
! a - type(psb_dspmat_type), input.
! The sparse matrix structure containing the local part of
! the fine-level matrix.
@@ -103,17 +101,20 @@
! info - integer, output.
! Error code.
!
subroutine amg_d_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,&
parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
subroutine amg_d_parmatch_unsmth_bld(ag,a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use amg_base_prec_type
use amg_d_inner_mod
use amg_d_base_aggregator_mod
#if defined(SERIAL_MPI)
use amg_d_parmatch_aggregator_mod
#else
use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_unsmth_bld
#endif
implicit none
! Arguments
integer(psb_ipk_), intent(in) :: dol1smoothing
class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
@@ -158,12 +159,8 @@ subroutine amg_d_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,&
ictxt = desc_a%get_context()
call psb_info(ictxt, me, np)
if (dol1smoothing.ne.amg_no_smooth_) then
info=psb_err_fatal_;
call psb_errpush(info,name,a_err='Are you trying to smooth an unsmoothed aggregation?')
goto 9999
end if
#if !defined(SERIAL_MPI)
nglob = desc_a%get_global_rows()
nrow = desc_a%get_local_rows()
ncol = desc_a%get_local_cols()
@@ -204,8 +201,7 @@ subroutine amg_d_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,&
call op_prol%mv_from(coo_prol)
if (debug) write(0,*) me,' ',trim(name),' After mv_from',psb_get_errstatus()
if (debug) write(0,*) me,' ',trim(name),' ',ac%get_fmt(),ac%get_nrows(),&
& ac%get_ncols(),ac%get_nzeros(),naggr,ntaggr
if (debug) write(0,*) me,' ',trim(name),' ',ac%get_fmt(),ac%get_nrows(),ac%get_ncols(),ac%get_nzeros(),naggr,ntaggr
! write(0,*) me,' ',trim(name),' Final AC newstyle ',ac%get_fmt(),ac%get_nrows(),ac%get_ncols(),ac%get_nzeros()
if (debug) then
@@ -232,6 +228,7 @@ subroutine amg_d_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,&
goto 9999
end if
#endif
call psb_erractionrestore(err_act)
return
@@ -216,7 +216,6 @@ subroutine amg_d_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac_csr%clean_zeros(info)
call ac%mv_from(ac_csr)
call ac%set_asb()
@@ -421,7 +420,6 @@ subroutine amg_d_ld_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac_csr%clean_zeros(info)
call ac%mv_from(ac_csr)
call ac%set_asb()
@@ -631,7 +629,6 @@ subroutine amg_ld_ptap_bld(a_csr,desc_a,nlaggr,parms,ac,&
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac_csr%clean_zeros(info)
call ac%mv_from(ac_csr)
call ac%set_asb()
-1
View File
@@ -142,7 +142,6 @@ subroutine amg_d_rap(a_csr,desc_a,nlaggr,parms,ac,&
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac_csr%clean_zeros(info)
call ac%mv_from(ac_csr)
call ac%set_asb()
@@ -72,7 +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(PSB_OPENMP)
#if defined(OPENMP)
use omp_lib
#endif
implicit none
@@ -172,7 +172,7 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
! Phase one: Start with disjoint groups.
!
naggr = 0
#if defined(PSB_OPENMP)
#if defined(OPENMP)
block
integer(psb_ipk_), allocatable :: bnds(:), locnaggr(:)
integer(psb_ipk_) :: myth,nths, kk
@@ -250,7 +250,7 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
! 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)))).and.(diag(i).ne.dzero)) then
if (abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))) then
ip = ip + 1
icol(ip) = icol(k)
end if
@@ -357,7 +357,7 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
do k=1, nz
j = icol(k)
if ((1<=j).and.(j<=nr)) then
if ((abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))).and.(diag(i).ne.dzero)) then
if (abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))) then
ip = ip + 1
icol(ip) = icol(k)
end if
@@ -545,3 +545,4 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
return
end subroutine amg_d_soc1_map_bld
@@ -71,7 +71,7 @@ subroutine amg_d_soc2_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(PSB_OPENMP)
#if defined(OPENMP)
use omp_lib
#endif
@@ -211,7 +211,7 @@ subroutine amg_d_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
! Phase one: Start with disjoint groups.
!
naggr = 0
#if defined(PSB_OPENMP)
#if defined(OPENMP)
block
integer(psb_ipk_), allocatable :: bnds(:), locnaggr(:)
integer(psb_ipk_) :: myth,nths, kk
@@ -69,7 +69,6 @@
!
!
! Arguments:
! dol1smoothing - fictitious integer argument, it is not used inside
! a - type(psb_dspmat_type), input.
! The sparse matrix structure containing the local part of
! the fine-level matrix.
@@ -105,8 +104,8 @@
! Error code.
!
!
subroutine amg_daggrmat_minnrg_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
subroutine amg_daggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use amg_base_prec_type
use amg_d_inner_mod, amg_protect_name => amg_daggrmat_minnrg_bld
@@ -114,7 +113,6 @@ subroutine amg_daggrmat_minnrg_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
implicit none
! Arguments
integer(psb_ipk_), intent(in) :: dol1smoothing
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
@@ -173,13 +171,6 @@ subroutine amg_daggrmat_minnrg_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
filter_mat = (parms%aggr_filter == amg_filter_mat_)
if (dol1smoothing.ne.amg_no_smooth_) then
info=psb_err_fatal_;
call psb_errpush(info,name,a_err='Are you trying to smooth an unsmoothed aggregation?')
goto 9999
end if
!NEEDS TO BE REWORKED !!
! naggr: number of local aggregates
@@ -309,7 +300,7 @@ subroutine amg_daggrmat_minnrg_bld(dol1smoothing,a,desc_a,ilaggr,nlaggr,&
!!$ endif
!!$ enddo
!!$ if (jd == -1) then
!!$ write(0,*) name,': Warning: there is no diagonal element', i
!!$ write(0,*) 'Wrong input: we need the diagonal!!!!', i
!!$ else
!!$ acsrf%val(jd)=acsrf%val(jd)-tmp
!!$ end if

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