From aaf623bfc2c1d30302fc8ef24e4b4de6516c8793 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Thu, 17 Jan 2019 21:05:39 +0000 Subject: [PATCH 1/4] Initialize alpha in CG. --- krylov/psb_ccg.F90 | 2 +- krylov/psb_dcg.F90 | 2 +- krylov/psb_scg.F90 | 2 +- krylov/psb_zcg.F90 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/krylov/psb_ccg.F90 b/krylov/psb_ccg.F90 index bd16e6571..aacac9e74 100644 --- a/krylov/psb_ccg.F90 +++ b/krylov/psb_ccg.F90 @@ -203,7 +203,7 @@ subroutine psb_ccg_vect(a,prec,b,x,eps,desc_a,info,& istebz = 0 end if itx=0 - + alpha = czero restart: do ! = diff --git a/krylov/psb_dcg.F90 b/krylov/psb_dcg.F90 index 74d41d69d..abb6e3e19 100644 --- a/krylov/psb_dcg.F90 +++ b/krylov/psb_dcg.F90 @@ -211,7 +211,7 @@ subroutine psb_dcg_vect(a,prec,b,x,eps,desc_a,info,& end if end if itx=0 - + alpha = dzero restart: do ! = diff --git a/krylov/psb_scg.F90 b/krylov/psb_scg.F90 index 92241791c..598a02828 100644 --- a/krylov/psb_scg.F90 +++ b/krylov/psb_scg.F90 @@ -211,7 +211,7 @@ subroutine psb_scg_vect(a,prec,b,x,eps,desc_a,info,& end if end if itx=0 - + alpha = szero restart: do ! = diff --git a/krylov/psb_zcg.F90 b/krylov/psb_zcg.F90 index 691a0f08e..5b4557eeb 100644 --- a/krylov/psb_zcg.F90 +++ b/krylov/psb_zcg.F90 @@ -203,7 +203,7 @@ subroutine psb_zcg_vect(a,prec,b,x,eps,desc_a,info,& istebz = 0 end if itx=0 - + alpha = zzero restart: do ! = From dbfedeebb540de49f2ded3793e60aa04d9733171 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Fri, 18 Jan 2019 09:02:07 +0000 Subject: [PATCH 2/4] Out from MMIO read in COO. --- util/psb_c_mmio_impl.f90 | 3 --- util/psb_d_mmio_impl.f90 | 1 - util/psb_s_mmio_impl.f90 | 2 -- util/psb_z_mmio_impl.f90 | 3 --- 4 files changed, 9 deletions(-) diff --git a/util/psb_c_mmio_impl.f90 b/util/psb_c_mmio_impl.f90 index e2f0ac60f..91bcd9475 100644 --- a/util/psb_c_mmio_impl.f90 +++ b/util/psb_c_mmio_impl.f90 @@ -346,7 +346,6 @@ subroutine cmm_mat_read(a, info, iunit, filename) call acoo%fix(info) call a%mv_from(acoo) - call a%cscnv(ircode,type='csr') else if ((psb_tolower(type) == 'complex').and.(psb_tolower(sym) == 'symmetric')) then ! we are generally working with non-symmetric matrices, so @@ -369,7 +368,6 @@ subroutine cmm_mat_read(a, info, iunit, filename) call acoo%fix(info) call a%mv_from(acoo) - call a%cscnv(ircode,type='csr') else if ((psb_tolower(type) == 'complex').and.(psb_tolower(sym) == 'hermitian')) then ! we are generally working with non-symmetric matrices, so @@ -392,7 +390,6 @@ subroutine cmm_mat_read(a, info, iunit, filename) call acoo%fix(info) call a%mv_from(acoo) - call a%cscnv(ircode,type='csr') else write(psb_err_unit,*) 'read_matrix: matrix type not yet supported' diff --git a/util/psb_d_mmio_impl.f90 b/util/psb_d_mmio_impl.f90 index 7026f68d0..d9ff57f59 100644 --- a/util/psb_d_mmio_impl.f90 +++ b/util/psb_d_mmio_impl.f90 @@ -386,7 +386,6 @@ subroutine dmm_mat_read(a, info, iunit, filename) if (info == 0) then call acoo%fix(info) call a%mv_from(acoo) - call a%cscnv(ircode,type='csr') end if if (infile /= 5) close(infile) diff --git a/util/psb_s_mmio_impl.f90 b/util/psb_s_mmio_impl.f90 index 7f049530b..ee79af770 100644 --- a/util/psb_s_mmio_impl.f90 +++ b/util/psb_s_mmio_impl.f90 @@ -341,7 +341,6 @@ subroutine smm_mat_read(a, info, iunit, filename) call acoo%fix(info) call a%mv_from(acoo) - call a%cscnv(ircode,type='csr') else if ((psb_tolower(type) == 'real').and.(psb_tolower(sym) == 'symmetric')) then ! we are generally working with non-symmetric matrices, so @@ -363,7 +362,6 @@ subroutine smm_mat_read(a, info, iunit, filename) call acoo%fix(info) call a%mv_from(acoo) - call a%cscnv(ircode,type='csr') else write(psb_err_unit,*) 'read_matrix: matrix type not yet supported' diff --git a/util/psb_z_mmio_impl.f90 b/util/psb_z_mmio_impl.f90 index 8475d2847..23ac322d0 100644 --- a/util/psb_z_mmio_impl.f90 +++ b/util/psb_z_mmio_impl.f90 @@ -346,7 +346,6 @@ subroutine zmm_mat_read(a, info, iunit, filename) call acoo%fix(info) call a%mv_from(acoo) - call a%cscnv(ircode,type='csr') else if ((psb_tolower(type) == 'complex').and.(psb_tolower(sym) == 'symmetric')) then ! we are generally working with non-symmetric matrices, so @@ -369,7 +368,6 @@ subroutine zmm_mat_read(a, info, iunit, filename) call acoo%fix(info) call a%mv_from(acoo) - call a%cscnv(ircode,type='csr') else if ((psb_tolower(type) == 'complex').and.(psb_tolower(sym) == 'hermitian')) then ! we are generally working with non-symmetric matrices, so @@ -392,7 +390,6 @@ subroutine zmm_mat_read(a, info, iunit, filename) call acoo%fix(info) call a%mv_from(acoo) - call a%cscnv(ircode,type='csr') else write(psb_err_unit,*) 'read_matrix: matrix type not yet supported' From 8bd2610b096a2caa00555a4a7faf90c4dfd71d0f Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Fri, 18 Jan 2019 16:20:15 +0000 Subject: [PATCH 3/4] Allow both METIS 4 and METIS 5 interfaces. --- config/pac.m4 | 4 ++-- configure | 6 +++--- configure.ac | 2 +- util/metis_int.c | 18 ++++++++++++++++++ util/psb_metispart_mod.F90 | 6 +++--- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/config/pac.m4 b/config/pac.m4 index 689efd6a8..57d769fea 100644 --- a/config/pac.m4 +++ b/config/pac.m4 @@ -1823,8 +1823,8 @@ fi if test "x$pac_metis_lib_ok" == "xyes" ; then AC_MSG_CHECKING([for METIS_SetDefaultOptions in $LIBS]) AC_TRY_LINK_FUNC(METIS_SetDefaultOptions, - [psblas_cv_have_metis=yes;pac_metis_lib_ok=yes; ], - [psblas_cv_have_metis=no;pac_metis_lib_ok="no. Unusable METIS version, sorry."; METIS_LIBS=""]) + [psblas_cv_metis_version="5"; ], + [psblas_cv_metis_version="4"; ]) AC_MSG_RESULT($pac_metis_lib_ok) fi diff --git a/configure b/configure index dd2094c84..94abe2c88 100755 --- a/configure +++ b/configure @@ -11378,12 +11378,12 @@ $as_echo "$ac_try_echo") >&5 test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then - psblas_cv_have_metis=yes;pac_metis_lib_ok=yes; + psblas_cv_metis_version="5"; else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - psblas_cv_have_metis=no;pac_metis_lib_ok="no. Unusable METIS version, sorry."; METIS_LIBS="" + psblas_cv_metis_version="4"; fi rm -rf conftest.dSYM @@ -11398,7 +11398,7 @@ CPPFLAGS="$SAVE_CPPFLAGS"; if test "x$psblas_cv_have_metis" == "xyes" ; then FDEFINES="$psblas_cv_define_prepend-DHAVE_METIS $FDEFINES" - CDEFINES="-DHAVE_METIS_ $psblas_cv_metis_includes $CDEFINES" + CDEFINES="-DHAVE_METIS_ -DMETIS_$psblas_cv_metis_version $psblas_cv_metis_includes $CDEFINES" fi diff --git a/configure.ac b/configure.ac index 4310397ae..7b4e1370a 100755 --- a/configure.ac +++ b/configure.ac @@ -677,7 +677,7 @@ dnl AC_CHECK_HEADERS([rsb.h], [ LIBS="${LIBS} $want_rsb_libs"], []) PAC_CHECK_METIS if test "x$psblas_cv_have_metis" == "xyes" ; then FDEFINES="$psblas_cv_define_prepend-DHAVE_METIS $FDEFINES" - CDEFINES="-DHAVE_METIS_ $psblas_cv_metis_includes $CDEFINES" + CDEFINES="-DHAVE_METIS_ -DMETIS_$psblas_cv_metis_version $psblas_cv_metis_includes $CDEFINES" fi PAC_CHECK_AMD diff --git a/util/metis_int.c b/util/metis_int.c index b9d258b4f..a293e0852 100644 --- a/util/metis_int.c +++ b/util/metis_int.c @@ -10,6 +10,7 @@ int metis_PartGraphKway_C(int *n, int *ixadj, int *iadj, int *ivwg, int *graphpart) { int res = -1; +#if defined(METIS_5) idx_t objval = 0; idx_t options[METIS_NOPTIONS]; //printf("Inside Metis/C interface\n"); @@ -35,6 +36,23 @@ int metis_PartGraphKway_C(int *n, int *ixadj, int *iadj, int *ivwg, } else { return res; } +#elif defined(METIS_4) + idxtype objval = 0; + int options[8]; + //printf("Inside Metis/C interface\n"); + idxtype ncon=1; + int wflag=0; + int numflag=1; + int ecut; + options[0]=0; + METIS_PartGraphKway((int *)n,(idxtype *)ixadj,(idxtype *)iadj, + NULL,NULL,&wflag,&numflag,nparts,options, + &ecut,(idxtype *)graphpart); + return(0); + +#elif + choke on me! +#endif } diff --git a/util/psb_metispart_mod.F90 b/util/psb_metispart_mod.F90 index 13a2292e8..57bf4efc2 100644 --- a/util/psb_metispart_mod.F90 +++ b/util/psb_metispart_mod.F90 @@ -365,9 +365,9 @@ contains !!$ write(*,*) 'Before allocation',nparts - irpl=irp - jal = ja - nl = n + irpl = irp + jal = ja + nl = n nptl = nparts wgh_ = -1.0 if(present(weights)) then From ba72faee7d06ec6a7de4d7c2b4b9646e0675de32 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Sat, 19 Jan 2019 14:56:01 +0000 Subject: [PATCH 4/4] In CSCNV we should call b%set_asb(), not b%asb() --- base/serial/impl/psb_c_mat_impl.F90 | 4 ++-- base/serial/impl/psb_d_mat_impl.F90 | 4 ++-- base/serial/impl/psb_s_mat_impl.F90 | 4 ++-- base/serial/impl/psb_z_mat_impl.F90 | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/base/serial/impl/psb_c_mat_impl.F90 b/base/serial/impl/psb_c_mat_impl.F90 index c48e796f6..7d50808fe 100644 --- a/base/serial/impl/psb_c_mat_impl.F90 +++ b/base/serial/impl/psb_c_mat_impl.F90 @@ -1201,7 +1201,7 @@ subroutine psb_c_cscnv(a,b,info,type,mold,upd,dupl) call move_alloc(altmp,b%a) call b%trim() - call b%asb() + call b%set_asb() call psb_erractionrestore(err_act) return @@ -1293,8 +1293,8 @@ subroutine psb_c_cscnv_ip(a,info,type,mold,dupl) end if call move_alloc(altmp,a%a) - call a%set_asb() call a%trim() + call a%set_asb() call psb_erractionrestore(err_act) return diff --git a/base/serial/impl/psb_d_mat_impl.F90 b/base/serial/impl/psb_d_mat_impl.F90 index 410fc5930..210315174 100644 --- a/base/serial/impl/psb_d_mat_impl.F90 +++ b/base/serial/impl/psb_d_mat_impl.F90 @@ -1201,7 +1201,7 @@ subroutine psb_d_cscnv(a,b,info,type,mold,upd,dupl) call move_alloc(altmp,b%a) call b%trim() - call b%asb() + call b%set_asb() call psb_erractionrestore(err_act) return @@ -1293,8 +1293,8 @@ subroutine psb_d_cscnv_ip(a,info,type,mold,dupl) end if call move_alloc(altmp,a%a) - call a%set_asb() call a%trim() + call a%set_asb() call psb_erractionrestore(err_act) return diff --git a/base/serial/impl/psb_s_mat_impl.F90 b/base/serial/impl/psb_s_mat_impl.F90 index a011aabfb..e14842c45 100644 --- a/base/serial/impl/psb_s_mat_impl.F90 +++ b/base/serial/impl/psb_s_mat_impl.F90 @@ -1201,7 +1201,7 @@ subroutine psb_s_cscnv(a,b,info,type,mold,upd,dupl) call move_alloc(altmp,b%a) call b%trim() - call b%asb() + call b%set_asb() call psb_erractionrestore(err_act) return @@ -1293,8 +1293,8 @@ subroutine psb_s_cscnv_ip(a,info,type,mold,dupl) end if call move_alloc(altmp,a%a) - call a%set_asb() call a%trim() + call a%set_asb() call psb_erractionrestore(err_act) return diff --git a/base/serial/impl/psb_z_mat_impl.F90 b/base/serial/impl/psb_z_mat_impl.F90 index d45ee93f9..616156916 100644 --- a/base/serial/impl/psb_z_mat_impl.F90 +++ b/base/serial/impl/psb_z_mat_impl.F90 @@ -1201,7 +1201,7 @@ subroutine psb_z_cscnv(a,b,info,type,mold,upd,dupl) call move_alloc(altmp,b%a) call b%trim() - call b%asb() + call b%set_asb() call psb_erractionrestore(err_act) return @@ -1293,8 +1293,8 @@ subroutine psb_z_cscnv_ip(a,info,type,mold,dupl) end if call move_alloc(altmp,a%a) - call a%set_asb() call a%trim() + call a%set_asb() call psb_erractionrestore(err_act) return