Make.inc.in
 base/modules/psb_const_mod.F90
 base/modules/psb_error_mod.F90
 config/pac.m4
 configure.ac
 configure
 util/psb_d_renum_impl.F90
 util/psb_renum_mod.f90

Added test and initial placeholder version of renumbering with AMD. 
Does not really work right now.
psblas3-type-indexed
Salvatore Filippone 13 years ago
parent 7fdd29afd1
commit e6828c8cca

@ -34,6 +34,7 @@ LIBS=@LIBS@
# BLAS, BLACS and METIS libraries.
BLAS=@BLAS_LIBS@
METIS_LIB=@METIS_LIBS@
AMD_LIB=@AMD_LIBS@
LAPACK=@LAPACK_LIBS@
EXTRA_COBJS=@FAKEMPI@

@ -194,6 +194,7 @@ module psb_const_mod
integer, parameter, public :: psb_err_ja_nix_ia_niy_unsupported_=3030
integer, parameter, public :: psb_err_ix_n1_iy_n1_unsupported_=3040
integer, parameter, public :: psb_err_input_matrix_unassembled_=3110
integer, parameter, public :: psb_err_missing_aux_lib_=3999
integer, parameter, public :: psb_err_alloc_dealloc_=4000
integer, parameter, public :: psb_err_internal_error_=4001
integer, parameter, public :: psb_err_from_subroutine_=4010

@ -561,8 +561,13 @@ contains
case(3112)
write(psb_err_unit,&
& '("Before you call this routine, you must build the preconditioner")')
case(3113:3999)
case(3113:3998)
write(psb_err_unit,'("miscellaneus error. code: ",i0)')err_c
case(psb_err_missing_aux_lib_)
write(psb_err_unit,&
&'("This method requires an external support library.")')
write(psb_err_unit,&
&'("Fix configure and rebuild the software.")')
case(psb_err_alloc_dealloc_)
write(psb_err_unit,'("Allocation/deallocation error")')
case(psb_err_internal_error_)

@ -1508,3 +1508,113 @@ fi
cd ..
rm -fr tmpdir_$i])
dnl @synopsis PAC_CHECK_AMD
dnl
dnl Will try to find the AMD library and headers.
dnl
dnl Will use $CC
dnl
dnl If the test passes, will execute ACTION-IF-FOUND. Otherwise, ACTION-IF-NOT-FOUND.
dnl Note : This file will be likely to induce the compiler to create a module file
dnl (for a module called conftest).
dnl Depending on the compiler flags, this could cause a conftest.mod file to appear
dnl in the present directory, or in another, or with another name. So be warned!
dnl
dnl @author Salvatore Filippone <salvatore.filippone@uniroma2.it>
dnl
AC_DEFUN(PAC_CHECK_AMD,
[AC_ARG_WITH(amd, AC_HELP_STRING([--with-amd=LIBNAME], [Specify the library name for AMD library.
Default: "-lamd"]),
[psblas_cv_amd=$withval],
[psblas_cv_amd='-lamd'])
AC_ARG_WITH(amddir, AC_HELP_STRING([--with-amddir=DIR], [Specify the directory for AMD library and includes.]),
[psblas_cv_amddir=$withval],
[psblas_cv_amddir=''])
AC_ARG_WITH(amdincdir, AC_HELP_STRING([--with-amdincdir=DIR], [Specify the directory for AMD includes.]),
[psblas_cv_amdincdir=$withval],
[psblas_cv_amdincdir=''])
AC_ARG_WITH(amdlibdir, AC_HELP_STRING([--with-amdlibdir=DIR], [Specify the directory for AMD library.]),
[psblas_cv_amdlibdir=$withval],
[psblas_cv_amdlibdir=''])
AC_LANG([C])
SAVE_LIBS="$LIBS"
SAVE_CPPFLAGS="$CPPFLAGS"
if test "x$psblas_cv_amddir" != "x"; then
AMD_LIBDIR="-L$psblas_cv_amddir"
LIBS="-L$psblas_cv_amddir $LIBS"
AMD_INCLUDES="-I$psblas_cv_amddir"
CPPFLAGS="$AMD_INCLUDES $CPPFLAGS"
fi
if test "x$psblas_cv_amdincdir" != "x"; then
AMD_INCLUDES="-I$psblas_cv_amdincdir"
CPPFLAGS="$AMD_INCLUDES $CPPFLAGS"
fi
if test "x$psblas_cv_amdlibdir" != "x"; then
LIBS="-L$psblas_cv_amdlibdir $LIBS"
AMD_LIBDIR="-L$psblas_cv_amdlibdir"
fi
AC_MSG_NOTICE([amd dir $psblas_cv_amddir])
AC_CHECK_HEADER([amd.h],
[pac_amd_header_ok=yes],
[pac_amd_header_ok=no; AMD_INCLUDES=""])
if test "x$pac_amd_header_ok" == "xno" ; then
dnl Maybe Include or include subdirs?
unset ac_cv_header_amd_h
AMD_INCLUDES="-I$psblas_cv_amddir/include -I$psblas_cv_amddir/Include "
CPPFLAGS="$AMD_INCLUDES $SAVE_CPPFLAGS"
AC_MSG_CHECKING([for amd_h in $AMD_INCLUDES])
AC_CHECK_HEADER([amd.h],
[pac_amd_header_ok=yes],
[pac_amd_header_ok=no; AMD_INCLUDES=""])
fi
if test "x$pac_amd_header_ok" == "xno" ; then
dnl Maybe new structure with AMD UFconfig AMD?
unset ac_cv_header_amd_h
AMD_INCLUDES="-I$psblas_cv_amddir/UFconfig -I$psblas_cv_amddir/AMD/Include -I$psblas_cv_amddir/AMD/Include"
CPPFLAGS="$AMD_INCLUDES $SAVE_CPPFLAGS"
AC_CHECK_HEADER([amd.h],
[pac_amd_header_ok=yes],
[pac_amd_header_ok=no; AMD_INCLUDES=""])
fi
if test "x$pac_amd_header_ok" == "xyes" ; then
AMD_LIBS="$psblas_cv_amd $AMD_LIBDIR"
LIBS="$AMD_LIBS -lm $LIBS";
AC_MSG_CHECKING([for amd_order in $AMD_LIBS])
AC_TRY_LINK_FUNC(amd_order,
[psblas_cv_have_amd=yes;pac_amd_lib_ok=yes; ],
[psblas_cv_have_amd=no;pac_amd_lib_ok=no; AMD_LIBS=""])
AC_MSG_RESULT($pac_amd_lib_ok)
if test "x$pac_amd_lib_ok" == "xno" ; then
dnl Maybe Lib or lib?
AMD_LIBDIR="-L$psblas_cv_amddir/Lib -L$psblas_cv_amddir/lib"
AMD_LIBS="$psblas_cv_amd $AMD_LIBDIR"
LIBS="$AMD_LIBS -lm $SAVE_LIBS"
AC_MSG_CHECKING([for amd_order in $AMD_LIBS])
AC_TRY_LINK_FUNC(amd_order,
[psblas_cv_have_amd=yes;pac_amd_lib_ok=yes; ],
[psblas_cv_have_amd=no;pac_amd_lib_ok=no; AMD_LIBS=""])
AC_MSG_RESULT($pac_amd_lib_ok)
fi
if test "x$pac_amd_lib_ok" == "xno" ; then
dnl Maybe AMD/Lib?
AMD_LIBDIR="-L$psblas_cv_amddir/AMD/Lib -L$psblas_cv_amddir/AMD/Lib"
AMD_LIBS="$psblas_cv_amd $AMD_LIBDIR"
LIBS="$AMD_LIBS -lm $SAVE_LIBS"
AC_MSG_CHECKING([for amd_order in $AMD_LIBS])
AC_TRY_LINK_FUNC(amd_order,
[psblas_cv_have_amd=yes;pac_amd_lib_ok=yes; ],
[psblas_cv_have_amd=no;pac_amd_lib_ok=no; AMD_LIBS=""])
AC_MSG_RESULT($pac_amd_lib_ok)
fi
fi
LIBS="$SAVE_LIBS";
CPPFLAGS="$SAVE_CPPFLAGS";
])dnl

337
configure vendored

@ -615,6 +615,7 @@ PSBLASRULES
FINCLUDES
CINCLUDES
METIS_LIBS
AMD_LIBS
INSTALL_DOCSDIR
INSTALL_INCLUDEDIR
INSTALL_LIBDIR
@ -751,6 +752,10 @@ with_blas
with_lapack
with_rsb
with_metis
with_amd
with_amddir
with_amdincdir
with_amdlibdir
'
ac_precious_vars='build_alias
host_alias
@ -1421,6 +1426,11 @@ Optional Packages:
configure script invoke librsb-config)
--with-metis=LIB Specify -lMETISLIBNAME or the absolute library
filename.
--with-amd=LIBNAME Specify the library name for AMD library. Default:
"-lamd"
--with-amddir=DIR Specify the directory for AMD library and includes.
--with-amdincdir=DIR Specify the directory for AMD includes.
--with-amdlibdir=DIR Specify the directory for AMD library.
Some influential environment variables:
FC Fortran compiler command
@ -2125,6 +2135,97 @@ $as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
# the include files in INCLUDES and setting the cache variable VAR
# accordingly.
ac_fn_c_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
else
# Is the header compilable?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
$as_echo_n "checking $2 usability... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_header_compiler=yes
else
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }
# Is the header present?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
$as_echo_n "checking $2 presence... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <$2>
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
ac_header_preproc=yes
else
ac_header_preproc=no
fi
rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
yes:no: )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
;;
no:yes:* )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
( $as_echo "## ---------------------------------------------- ##
## Report this to salvatore.filippone@uniroma2.it ##
## ---------------------------------------------- ##"
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_mongrel
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
@ -8954,6 +9055,236 @@ if test "x$psblas_cv_have_metis" == "xyes" ; then
fi
# Check whether --with-amd was given.
if test "${with_amd+set}" = set; then :
withval=$with_amd; psblas_cv_amd=$withval
else
psblas_cv_amd='-lamd'
fi
# Check whether --with-amddir was given.
if test "${with_amddir+set}" = set; then :
withval=$with_amddir; psblas_cv_amddir=$withval
else
psblas_cv_amddir=''
fi
# Check whether --with-amdincdir was given.
if test "${with_amdincdir+set}" = set; then :
withval=$with_amdincdir; psblas_cv_amdincdir=$withval
else
psblas_cv_amdincdir=''
fi
# Check whether --with-amdlibdir was given.
if test "${with_amdlibdir+set}" = set; then :
withval=$with_amdlibdir; psblas_cv_amdlibdir=$withval
else
psblas_cv_amdlibdir=''
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
SAVE_LIBS="$LIBS"
SAVE_CPPFLAGS="$CPPFLAGS"
if test "x$psblas_cv_amddir" != "x"; then
AMD_LIBDIR="-L$psblas_cv_amddir"
LIBS="-L$psblas_cv_amddir $LIBS"
AMD_INCLUDES="-I$psblas_cv_amddir"
CPPFLAGS="$AMD_INCLUDES $CPPFLAGS"
fi
if test "x$psblas_cv_amdincdir" != "x"; then
AMD_INCLUDES="-I$psblas_cv_amdincdir"
CPPFLAGS="$AMD_INCLUDES $CPPFLAGS"
fi
if test "x$psblas_cv_amdlibdir" != "x"; then
LIBS="-L$psblas_cv_amdlibdir $LIBS"
AMD_LIBDIR="-L$psblas_cv_amdlibdir"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: amd dir $psblas_cv_amddir" >&5
$as_echo "$as_me: amd dir $psblas_cv_amddir" >&6;}
ac_fn_c_check_header_mongrel "$LINENO" "amd.h" "ac_cv_header_amd_h" "$ac_includes_default"
if test "x$ac_cv_header_amd_h" = xyes; then :
pac_amd_header_ok=yes
else
pac_amd_header_ok=no; AMD_INCLUDES=""
fi
if test "x$pac_amd_header_ok" == "xno" ; then
unset ac_cv_header_amd_h
AMD_INCLUDES="-I$psblas_cv_amddir/include -I$psblas_cv_amddir/Include "
CPPFLAGS="$AMD_INCLUDES $SAVE_CPPFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for amd_h in $AMD_INCLUDES" >&5
$as_echo_n "checking for amd_h in $AMD_INCLUDES... " >&6; }
ac_fn_c_check_header_mongrel "$LINENO" "amd.h" "ac_cv_header_amd_h" "$ac_includes_default"
if test "x$ac_cv_header_amd_h" = xyes; then :
pac_amd_header_ok=yes
else
pac_amd_header_ok=no; AMD_INCLUDES=""
fi
fi
if test "x$pac_amd_header_ok" == "xno" ; then
unset ac_cv_header_amd_h
AMD_INCLUDES="-I$psblas_cv_amddir/UFconfig -I$psblas_cv_amddir/AMD/Include -I$psblas_cv_amddir/AMD/Include"
CPPFLAGS="$AMD_INCLUDES $SAVE_CPPFLAGS"
ac_fn_c_check_header_mongrel "$LINENO" "amd.h" "ac_cv_header_amd_h" "$ac_includes_default"
if test "x$ac_cv_header_amd_h" = xyes; then :
pac_amd_header_ok=yes
else
pac_amd_header_ok=no; AMD_INCLUDES=""
fi
fi
if test "x$pac_amd_header_ok" == "xyes" ; then
AMD_LIBS="$psblas_cv_amd $AMD_LIBDIR"
LIBS="$AMD_LIBS -lm $LIBS";
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for amd_order in $AMD_LIBS" >&5
$as_echo_n "checking for amd_order in $AMD_LIBS... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char amd_order ();
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
return amd_order ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
psblas_cv_have_amd=yes;pac_amd_lib_ok=yes;
else
psblas_cv_have_amd=no;pac_amd_lib_ok=no; AMD_LIBS=""
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_amd_lib_ok" >&5
$as_echo "$pac_amd_lib_ok" >&6; }
if test "x$pac_amd_lib_ok" == "xno" ; then
AMD_LIBDIR="-L$psblas_cv_amddir/Lib -L$psblas_cv_amddir/lib"
AMD_LIBS="$psblas_cv_amd $AMD_LIBDIR"
LIBS="$AMD_LIBS -lm $SAVE_LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for amd_order in $AMD_LIBS" >&5
$as_echo_n "checking for amd_order in $AMD_LIBS... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char amd_order ();
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
return amd_order ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
psblas_cv_have_amd=yes;pac_amd_lib_ok=yes;
else
psblas_cv_have_amd=no;pac_amd_lib_ok=no; AMD_LIBS=""
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_amd_lib_ok" >&5
$as_echo "$pac_amd_lib_ok" >&6; }
fi
if test "x$pac_amd_lib_ok" == "xno" ; then
AMD_LIBDIR="-L$psblas_cv_amddir/AMD/Lib -L$psblas_cv_amddir/AMD/Lib"
AMD_LIBS="$psblas_cv_amd $AMD_LIBDIR"
LIBS="$AMD_LIBS -lm $SAVE_LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for amd_order in $AMD_LIBS" >&5
$as_echo_n "checking for amd_order in $AMD_LIBS... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char amd_order ();
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
return amd_order ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
psblas_cv_have_amd=yes;pac_amd_lib_ok=yes;
else
psblas_cv_have_amd=no;pac_amd_lib_ok=no; AMD_LIBS=""
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_amd_lib_ok" >&5
$as_echo "$pac_amd_lib_ok" >&6; }
fi
fi
LIBS="$SAVE_LIBS";
CPPFLAGS="$SAVE_CPPFLAGS";
if test "x$psblas_cv_have_amd" == "xyes" ; then
FDEFINES="$mld_cv_define_prepend-DHAVE_AMD $FDEFINES"
fi
# Note : We would like to detect PSBLAS, but this is complicated by the
# module symbols mangling rules, which are compiler specific !
@ -9009,7 +9340,7 @@ UTILLIBNAME=libpsb_util.a
#AC_SUBST(BLACS_LIBS)
@ -9018,7 +9349,7 @@ UTILLIBNAME=libpsb_util.a
PSBLASRULES='
PSBLDLIBS=$(LAPACK) $(BLAS) $(METIS_LIB) $(LIBS)
PSBLDLIBS=$(LAPACK) $(BLAS) $(METIS_LIB) $(AMD_LIBS) $(LIBS)
CDEFINES=$(PSBCDEFINES)
FDEFINES=$(PSBFDEFINES)
@ -10381,6 +10712,7 @@ fi
BLAS : ${BLAS_LIBS}
METIS detected : ${psblas_cv_have_metis}
AMD detected : ${psblas_cv_have_amd}
LIBS : ${LIBS}
@ -10413,6 +10745,7 @@ $as_echo "$as_me:
BLAS : ${BLAS_LIBS}
METIS detected : ${psblas_cv_have_metis}
AMD detected : ${psblas_cv_have_amd}
LIBS : ${LIBS}

@ -681,6 +681,11 @@ if test "x$psblas_cv_have_metis" == "xyes" ; then
FDEFINES="$FDEFINES $psblas_cv_define_prepend-DHAVE_METIS"
fi
PAC_CHECK_AMD
if test "x$psblas_cv_have_amd" == "xyes" ; then
FDEFINES="$mld_cv_define_prepend-DHAVE_AMD $FDEFINES"
fi
# Note : We would like to detect PSBLAS, but this is complicated by the
@ -737,7 +742,7 @@ AC_SUBST(INSTALL_INCLUDEDIR)
AC_SUBST(INSTALL_DOCSDIR)
AC_SUBST(BLAS_LIBS)
#AC_SUBST(BLACS_LIBS)
AC_SUBST(AMD_LIBS)
AC_SUBST(METIS_LIBS)
AC_SUBST(LAPACK_LIBS)
@ -746,7 +751,7 @@ AC_SUBST(FINCLUDES)
PSBLASRULES='
PSBLDLIBS=$(LAPACK) $(BLAS) $(METIS_LIB) $(LIBS)
PSBLDLIBS=$(LAPACK) $(BLAS) $(METIS_LIB) $(AMD_LIBS) $(LIBS)
CDEFINES=$(PSBCDEFINES)
FDEFINES=$(PSBFDEFINES)
@ -807,6 +812,7 @@ dnl ESSL/PESSL : ${psblas_cv_have_essl} / ${psblas_cv_have_pessl}
dnl BLACS : ${BLACS_LIBS}
METIS detected : ${psblas_cv_have_metis}
AMD detected : ${psblas_cv_have_amd}
dnl SuperLU detected : ${psblas_cv_have_superlu}
dnl SuperLU_Dist detected : ${psblas_cv_have_superludist}
dnl UMFPack detected : ${psblas_cv_have_umfpack}

@ -21,6 +21,10 @@ subroutine psb_d_mat_renum(alg,mat,info,perm)
call psb_mat_renum_gps(mat,info,perm)
case(psb_mat_renum_amd_)
call psb_mat_renum_amd(mat,info,perm)
case default
info = psb_err_input_value_invalid_i_
call psb_errpush(info,name,i_err=(/1,alg,0,0,0/))
@ -65,7 +69,7 @@ contains
integer :: i, j, k, ideg, nr, ibw, ipf, idpth
info = psb_success_
name = 'mat_renum'
name = 'mat_renum_gps'
call psb_erractionsave(err_act)
info = psb_success_
@ -138,6 +142,110 @@ contains
return
end subroutine psb_mat_renum_gps
subroutine psb_mat_renum_amd(a,info,operm)
use psb_base_mod
implicit none
type(psb_dspmat_type), intent(inout) :: a
integer, intent(out) :: info
integer, allocatable, optional, intent(out) :: operm(:)
!
class(psb_d_base_sparse_mat), allocatable :: aa
type(psb_d_csr_sparse_mat) :: acsr
type(psb_d_coo_sparse_mat) :: acoo
integer :: err_act
character(len=20) :: name
integer, allocatable :: ndstk(:,:), iold(:), ndeg(:), perm(:)
integer :: i, j, k, ideg, nr, ibw, ipf, idpth
info = psb_success_
name = 'mat_renum_amd'
call psb_erractionsave(err_act)
#if defined(HAVE_AMD) && defined(HAVE_ISO_C_BINDING)
info = psb_success_
nr = a%get_nrows()
allocate(operm(nr))
do i=1, nr
operm(i) = i
end do
!!$ call a%mold(aa)
!!$ call a%mv_to(aa)
!!$ call aa%mv_to_fmt(acsr,info)
!!$ ! Insert call to gps_reduce
!!$ nr = acsr%get_nrows()
!!$ ideg = 0
!!$ do i=1, nr
!!$ ideg = max(ideg,acsr%irp(i+1)-acsr%irp(i))
!!$ end do
!!$ allocate(ndstk(nr,ideg), iold(nr), perm(nr+1), ndeg(nr),stat=info)
!!$ if (info /= 0) then
!!$ info = psb_err_alloc_dealloc_
!!$ call psb_errpush(info, name)
!!$ goto 9999
!!$ end if
!!$ do i=1, nr
!!$ iold(i) = i
!!$ ndstk(i,:) = 0
!!$ k = 0
!!$ do j=acsr%irp(i),acsr%irp(i+1)-1
!!$ k = k + 1
!!$ ndstk(i,k) = acsr%ja(j)
!!$ end do
!!$ end do
!!$ perm = 0
!!$
!!$ call psb_gps_reduce(ndstk,nr,ideg,iold,perm,ndeg,ibw,ipf,idpth)
!!$
!!$ if (.not.psb_isaperm(nr,perm)) then
!!$ write(0,*) 'Something wrong: bad perm from gps_reduce'
!!$ info = psb_err_from_subroutine_
!!$ call psb_errpush(info,name)
!!$ goto 9999
!!$ end if
!!$ ! Move to coordinate to apply renumbering
!!$ call acsr%mv_to_coo(acoo,info)
!!$ do i=1, acoo%get_nzeros()
!!$ acoo%ia(i) = perm(acoo%ia(i))
!!$ acoo%ja(i) = perm(acoo%ja(i))
!!$ end do
!!$ call acoo%fix(info)
!!$
!!$ ! Get back to where we started from
!!$ call aa%mv_from_coo(acoo,info)
!!$ call a%mv_from(aa)
!!$ if (present(operm)) then
!!$ call psb_realloc(nr,operm,info)
!!$ if (info /= psb_success_) then
!!$ info = psb_err_alloc_dealloc_
!!$ call psb_errpush(info,name)
!!$ goto 9999
!!$ end if
!!$ operm(1:nr) = perm(1:nr)
!!$ end if
!!$
!!$ deallocate(aa)
#else
info = psb_err_missing_aux_lib_
call psb_errpush(info, name)
goto 9999
#endif
call psb_erractionrestore(err_act)
return
9999 continue
call psb_erractionrestore(err_act)
if (err_act == psb_act_abort_) then
call psb_error()
return
end if
return
end subroutine psb_mat_renum_amd
end subroutine psb_d_mat_renum

@ -2,6 +2,7 @@ module psb_renum_mod
use psb_base_mod
integer, parameter :: psb_mat_renum_gps_ = 456
integer, parameter :: psb_mat_renum_amd_ = psb_mat_renum_gps_ + 1
interface psb_mat_renum

Loading…
Cancel
Save