METIS fixes.

psblas-3.1-maint
Salvatore Filippone 11 years ago
parent 00143bb08b
commit 86888b58ef

@ -10,7 +10,7 @@ kryld: precd based
libd:
(if test ! -d lib ; then mkdir lib; fi)
(if test ! -d include ; then mkdir include; $(INSTALL_DATA) Make.inc include/Make.inc.psblas; fi)
(if test ! -d include ; then mkdir include; fi; $(INSTALL_DATA) Make.inc include/Make.inc.psblas;)
based:
cd base && $(MAKE) lib
precd:
@ -26,7 +26,7 @@ install: all
(./mkdir.sh $(INSTALL_LIBDIR) &&\
$(INSTALL_DATA) lib/*.a $(INSTALL_LIBDIR))
(./mkdir.sh $(INSTALL_INCLUDEDIR) && \
$(INSTALL_DATA) lib/*$(.mod) $(INSTALL_INCLUDEDIR))
$(INSTALL_DATA) include/*$(.mod) $(INSTALL_INCLUDEDIR))
(./mkdir.sh $(INSTALL_DOCSDIR) && \
/bin/cp -fr docs/*pdf docs/html $(INSTALL_DOCSDIR))
(./mkdir.sh $(INSTALL_DOCSDIR) && \
@ -40,16 +40,10 @@ clean:
check: all
make check -C test/serial
cleanlib:
(cd lib; /bin/rm -f *.a *$(.mod) *$(.fh))
(cd include; /bin/rm -f *.a *$(.mod) *$(.fh))
veryclean: cleanlib
cd base && $(MAKE) veryclean
cd prec && $(MAKE) veryclean
cd krylov && $(MAKE) veryclean
cd util && $(MAKE) veryclean
veryclean: clean
cd test/fileread && $(MAKE) clean
cd test/pargen && $(MAKE) clean
cd test/util && $(MAKE) clean
(cd lib; /bin/rm -f *.a *$(.mod) *$(.fh))
(cd include; /bin/rm -f *.a *$(.mod) *$(.fh))

@ -67,7 +67,7 @@ prerequisites (see also SERIAL below):
your platform you may try ATLAS available from
http://math-atlas.sourceforge.net/
3. We have had good results with the METIS library, from
3. We have had good results with the METIS library, version 5, from
http://www-users.cs.umn.edu/~karypis/metis/metis/main.html
This is optional; it is used in the util and test/fileread
directories but only if you specify --with-metis.

@ -1688,3 +1688,115 @@ LIBS="$SAVE_LIBS";
CPPFLAGS="$SAVE_CPPFLAGS";
])dnl
dnl @synopsis PAC_CHECK_METIS
dnl
dnl Will try to find the METIS 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_METIS,
[AC_ARG_WITH(metis, AC_HELP_STRING([--with-metis=LIBNAME], [Specify the library name for METIS library.
Default: "-lmetis"]),
[psblas_cv_metis=$withval],
[psblas_cv_metis='-lmetis'])
AC_ARG_WITH(metisdir, AC_HELP_STRING([--with-metisdir=DIR], [Specify the directory for METIS library and includes.]),
[psblas_cv_metisdir=$withval],
[psblas_cv_metisdir=''])
AC_ARG_WITH(metisincdir, AC_HELP_STRING([--with-metisincdir=DIR], [Specify the directory for METIS includes.]),
[psblas_cv_metisincdir=$withval],
[psblas_cv_metisincdir=''])
AC_ARG_WITH(metislibdir, AC_HELP_STRING([--with-metislibdir=DIR], [Specify the directory for METIS library.]),
[psblas_cv_metislibdir=$withval],
[psblas_cv_metislibdir=''])
AC_LANG([C])
SAVE_LIBS="$LIBS"
SAVE_CPPFLAGS="$CPPFLAGS"
if test "x$psblas_cv_metisdir" != "x"; then
METIS_LIBDIR="-L$psblas_cv_metisdir"
LIBS="-L$psblas_cv_metisdir $LIBS"
METIS_INCLUDES="-I$psblas_cv_metisdir"
CPPFLAGS="$METIS_INCLUDES $CPPFLAGS"
fi
if test "x$psblas_cv_metisincdir" != "x"; then
METIS_INCLUDES="-I$psblas_cv_metisincdir"
CPPFLAGS="$METIS_INCLUDES $CPPFLAGS"
fi
if test "x$psblas_cv_metislibdir" != "x"; then
LIBS="-L$psblas_cv_metislibdir $LIBS"
METIS_LIBDIR="-L$psblas_cv_metislibdir"
fi
AC_MSG_NOTICE([metis dir $psblas_cv_metisdir])
AC_CHECK_HEADER([metis.h],
[pac_metis_header_ok=yes],
[pac_metis_header_ok=no; METIS_INCLUDES=""])
if test "x$pac_metis_header_ok" == "xno" ; then
dnl Maybe Include or include subdirs?
unset ac_cv_header_metis_h
METIS_INCLUDES="-I$psblas_cv_metisdir/include -I$psblas_cv_metisdir/Include "
CPPFLAGS="$METIS_INCLUDES $SAVE_CPPFLAGS"
AC_MSG_CHECKING([for metis_h in $METIS_INCLUDES])
AC_CHECK_HEADER([metis.h],
[pac_metis_header_ok=yes],
[pac_metis_header_ok=no; METIS_INCLUDES=""])
fi
if test "x$pac_metis_header_ok" == "xno" ; then
dnl Maybe new structure with METIS UFconfig METIS?
unset ac_cv_header_metis_h
METIS_INCLUDES="-I$psblas_cv_metisdir/UFconfig -I$psblas_cv_metisdir/METIS/Include -I$psblas_cv_metisdir/METIS/Include"
CPPFLAGS="$METIS_INCLUDES $SAVE_CPPFLAGS"
AC_CHECK_HEADER([metis.h],
[pac_metis_header_ok=yes],
[pac_metis_header_ok=no; METIS_INCLUDES=""])
fi
if test "x$pac_metis_header_ok" == "xyes" ; then
psblas_cv_metis_includes="$METIS_INCLUDES"
METIS_LIBS="$psblas_cv_metis $METIS_LIBDIR"
LIBS="$METIS_LIBS -lm $LIBS";
AC_MSG_CHECKING([for METIS_PartGraphRecursive in $METIS_LIBS])
AC_TRY_LINK_FUNC(METIS_PartGraphRecursive,
[psblas_cv_have_metis=yes;pac_metis_lib_ok=yes; ],
[psblas_cv_have_metis=no;pac_metis_lib_ok=no; METIS_LIBS=""])
AC_MSG_RESULT($pac_metis_lib_ok)
if test "x$pac_metis_lib_ok" == "xno" ; then
dnl Maybe Lib or lib?
METIS_LIBDIR="-L$psblas_cv_metisdir/Lib -L$psblas_cv_metisdir/lib"
METIS_LIBS="$psblas_cv_metis $METIS_LIBDIR"
LIBS="$METIS_LIBS -lm $SAVE_LIBS"
AC_MSG_CHECKING([for METIS_PartGraphRecursive in $METIS_LIBS])
AC_TRY_LINK_FUNC(METIS_PartGraphRecursive,
[psblas_cv_have_metis=yes;pac_metis_lib_ok=yes; ],
[psblas_cv_have_metis=no;pac_metis_lib_ok=no; METIS_LIBS=""])
AC_MSG_RESULT($pac_metis_lib_ok)
fi
if test "x$pac_metis_lib_ok" == "xno" ; then
dnl Maybe METIS/Lib?
METIS_LIBDIR="-L$psblas_cv_metisdir/METIS/Lib -L$psblas_cv_metisdir/METIS/Lib"
METIS_LIBS="$psblas_cv_metis $METIS_LIBDIR"
LIBS="$METIS_LIBS -lm $SAVE_LIBS"
AC_MSG_CHECKING([for METIS_PartGraphRecursive in $METIS_LIBS])
AC_TRY_LINK_FUNC(METIS_PartGraphRecursive,
[psblas_cv_have_metis=yes;pac_metis_lib_ok=yes; ],
[psblas_cv_have_metis=no;pac_metis_lib_ok=no; METIS_LIBS=""])
AC_MSG_RESULT($pac_metis_lib_ok)
fi
fi
LIBS="$SAVE_LIBS";
CPPFLAGS="$SAVE_CPPFLAGS";
])dnl

623
configure vendored

@ -791,6 +791,9 @@ with_blas
with_lapack
with_rsb
with_metis
with_metisdir
with_metisincdir
with_metislibdir
with_amd
with_amddir
with_amdincdir
@ -1474,8 +1477,12 @@ Optional Packages:
bin/include/lib subdirs with a regular RSB
installation resides, or nothing to make the
configure script invoke librsb-config)
--with-metis=LIB Specify -lMETISLIBNAME or the absolute library
filename.
--with-metis=LIBNAME Specify the library name for METIS library. Default:
"-lmetis"
--with-metisdir=DIR Specify the directory for METIS library and
includes.
--with-metisincdir=DIR Specify the directory for METIS includes.
--with-metislibdir=DIR Specify the directory for METIS library.
--with-amd=LIBNAME Specify the library name for AMD library. Default:
"-lamd"
--with-amddir=DIR Specify the directory for AMD library and includes.
@ -9398,29 +9405,508 @@ RSB_LIBS="$want_rsb_libs"
LIBS="$RSB_LIBS ${LIBS}"
# Check whether --with-metis was given.
if test "${with_metis+set}" = set; then
withval=$with_metis; psblas_cv_metis="$withval"
withval=$with_metis; psblas_cv_metis=$withval
else
psblas_cv_metis=''
psblas_cv_metis='-lmetis'
fi
# Check whether --with-metisdir was given.
if test "${with_metisdir+set}" = set; then
withval=$with_metisdir; psblas_cv_metisdir=$withval
else
psblas_cv_metisdir=''
fi
# Check whether --with-metisincdir was given.
if test "${with_metisincdir+set}" = set; then
withval=$with_metisincdir; psblas_cv_metisincdir=$withval
else
psblas_cv_metisincdir=''
fi
if test "x$psblas_cv_metis" != "x" ; then
{ $as_echo "$as_me:$LINENO: checking for METIS_PartGraphRecursive in -l\"m\"" >&5
$as_echo_n "checking for METIS_PartGraphRecursive in -l\"m\"... " >&6; }
if test "${ac_cv_lib__m__METIS_PartGraphRecursive+set}" = set; then
# Check whether --with-metislibdir was given.
if test "${with_metislibdir+set}" = set; then
withval=$with_metislibdir; psblas_cv_metislibdir=$withval
else
psblas_cv_metislibdir=''
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_metisdir" != "x"; then
METIS_LIBDIR="-L$psblas_cv_metisdir"
LIBS="-L$psblas_cv_metisdir $LIBS"
METIS_INCLUDES="-I$psblas_cv_metisdir"
CPPFLAGS="$METIS_INCLUDES $CPPFLAGS"
fi
if test "x$psblas_cv_metisincdir" != "x"; then
METIS_INCLUDES="-I$psblas_cv_metisincdir"
CPPFLAGS="$METIS_INCLUDES $CPPFLAGS"
fi
if test "x$psblas_cv_metislibdir" != "x"; then
LIBS="-L$psblas_cv_metislibdir $LIBS"
METIS_LIBDIR="-L$psblas_cv_metislibdir"
fi
{ $as_echo "$as_me:$LINENO: metis dir $psblas_cv_metisdir" >&5
$as_echo "$as_me: metis dir $psblas_cv_metisdir" >&6;}
if test "${ac_cv_header_metis_h+set}" = set; then
{ $as_echo "$as_me:$LINENO: checking for metis.h" >&5
$as_echo_n "checking for metis.h... " >&6; }
if test "${ac_cv_header_metis_h+set}" = set; then
$as_echo_n "(cached) " >&6
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_metis_h" >&5
$as_echo "$ac_cv_header_metis_h" >&6; }
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-l"m" "$psblas_cv_metis" $LIBS"
# Is the header compilable?
{ $as_echo "$as_me:$LINENO: checking metis.h usability" >&5
$as_echo_n "checking metis.h usability... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <metis.h>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_header_compiler=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }
# Is the header present?
{ $as_echo "$as_me:$LINENO: checking metis.h presence" >&5
$as_echo_n "checking metis.h presence... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <metis.h>
_ACEOF
if { (ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then
ac_header_preproc=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
{ $as_echo "$as_me:$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:$LINENO: WARNING: metis.h: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: metis.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: metis.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: metis.h: present but cannot be compiled" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: metis.h: check for missing prerequisite headers?" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: metis.h: see the Autoconf documentation" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: metis.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: proceeding with the preprocessor's result" >&5
$as_echo "$as_me: WARNING: metis.h: proceeding with the preprocessor's result" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: metis.h: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
## ---------------------------------------------- ##
## Report this to salvatore.filippone@uniroma2.it ##
## ---------------------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ $as_echo "$as_me:$LINENO: checking for metis.h" >&5
$as_echo_n "checking for metis.h... " >&6; }
if test "${ac_cv_header_metis_h+set}" = set; then
$as_echo_n "(cached) " >&6
else
ac_cv_header_metis_h=$ac_header_preproc
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_metis_h" >&5
$as_echo "$ac_cv_header_metis_h" >&6; }
fi
if test "x$ac_cv_header_metis_h" = x""yes; then
pac_metis_header_ok=yes
else
pac_metis_header_ok=no; METIS_INCLUDES=""
fi
if test "x$pac_metis_header_ok" == "xno" ; then
unset ac_cv_header_metis_h
METIS_INCLUDES="-I$psblas_cv_metisdir/include -I$psblas_cv_metisdir/Include "
CPPFLAGS="$METIS_INCLUDES $SAVE_CPPFLAGS"
{ $as_echo "$as_me:$LINENO: checking for metis_h in $METIS_INCLUDES" >&5
$as_echo_n "checking for metis_h in $METIS_INCLUDES... " >&6; }
if test "${ac_cv_header_metis_h+set}" = set; then
{ $as_echo "$as_me:$LINENO: checking for metis.h" >&5
$as_echo_n "checking for metis.h... " >&6; }
if test "${ac_cv_header_metis_h+set}" = set; then
$as_echo_n "(cached) " >&6
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_metis_h" >&5
$as_echo "$ac_cv_header_metis_h" >&6; }
else
# Is the header compilable?
{ $as_echo "$as_me:$LINENO: checking metis.h usability" >&5
$as_echo_n "checking metis.h usability... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <metis.h>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_header_compiler=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }
# Is the header present?
{ $as_echo "$as_me:$LINENO: checking metis.h presence" >&5
$as_echo_n "checking metis.h presence... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <metis.h>
_ACEOF
if { (ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then
ac_header_preproc=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
{ $as_echo "$as_me:$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:$LINENO: WARNING: metis.h: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: metis.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: metis.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: metis.h: present but cannot be compiled" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: metis.h: check for missing prerequisite headers?" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: metis.h: see the Autoconf documentation" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: metis.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: proceeding with the preprocessor's result" >&5
$as_echo "$as_me: WARNING: metis.h: proceeding with the preprocessor's result" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: metis.h: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
## ---------------------------------------------- ##
## Report this to salvatore.filippone@uniroma2.it ##
## ---------------------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ $as_echo "$as_me:$LINENO: checking for metis.h" >&5
$as_echo_n "checking for metis.h... " >&6; }
if test "${ac_cv_header_metis_h+set}" = set; then
$as_echo_n "(cached) " >&6
else
ac_cv_header_metis_h=$ac_header_preproc
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_metis_h" >&5
$as_echo "$ac_cv_header_metis_h" >&6; }
fi
if test "x$ac_cv_header_metis_h" = x""yes; then
pac_metis_header_ok=yes
else
pac_metis_header_ok=no; METIS_INCLUDES=""
fi
fi
if test "x$pac_metis_header_ok" == "xno" ; then
unset ac_cv_header_metis_h
METIS_INCLUDES="-I$psblas_cv_metisdir/UFconfig -I$psblas_cv_metisdir/METIS/Include -I$psblas_cv_metisdir/METIS/Include"
CPPFLAGS="$METIS_INCLUDES $SAVE_CPPFLAGS"
if test "${ac_cv_header_metis_h+set}" = set; then
{ $as_echo "$as_me:$LINENO: checking for metis.h" >&5
$as_echo_n "checking for metis.h... " >&6; }
if test "${ac_cv_header_metis_h+set}" = set; then
$as_echo_n "(cached) " >&6
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_metis_h" >&5
$as_echo "$ac_cv_header_metis_h" >&6; }
else
# Is the header compilable?
{ $as_echo "$as_me:$LINENO: checking metis.h usability" >&5
$as_echo_n "checking metis.h usability... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <metis.h>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_header_compiler=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }
# Is the header present?
{ $as_echo "$as_me:$LINENO: checking metis.h presence" >&5
$as_echo_n "checking metis.h presence... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <metis.h>
_ACEOF
if { (ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then
ac_header_preproc=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
{ $as_echo "$as_me:$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:$LINENO: WARNING: metis.h: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: metis.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: metis.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: metis.h: present but cannot be compiled" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: metis.h: check for missing prerequisite headers?" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: metis.h: see the Autoconf documentation" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: metis.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: proceeding with the preprocessor's result" >&5
$as_echo "$as_me: WARNING: metis.h: proceeding with the preprocessor's result" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: metis.h: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: metis.h: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
## ---------------------------------------------- ##
## Report this to salvatore.filippone@uniroma2.it ##
## ---------------------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ $as_echo "$as_me:$LINENO: checking for metis.h" >&5
$as_echo_n "checking for metis.h... " >&6; }
if test "${ac_cv_header_metis_h+set}" = set; then
$as_echo_n "(cached) " >&6
else
ac_cv_header_metis_h=$ac_header_preproc
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_metis_h" >&5
$as_echo "$ac_cv_header_metis_h" >&6; }
fi
if test "x$ac_cv_header_metis_h" = x""yes; then
pac_metis_header_ok=yes
else
pac_metis_header_ok=no; METIS_INCLUDES=""
fi
fi
if test "x$pac_metis_header_ok" == "xyes" ; then
psblas_cv_metis_includes="$METIS_INCLUDES"
METIS_LIBS="$psblas_cv_metis $METIS_LIBDIR"
LIBS="$METIS_LIBS -lm $LIBS";
{ $as_echo "$as_me:$LINENO: checking for METIS_PartGraphRecursive in $METIS_LIBS" >&5
$as_echo_n "checking for METIS_PartGraphRecursive in $METIS_LIBS... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
@ -9458,38 +9944,90 @@ $as_echo "$ac_try_echo") >&5
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
ac_cv_lib__m__METIS_PartGraphRecursive=yes
psblas_cv_have_metis=yes;pac_metis_lib_ok=yes;
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib__m__METIS_PartGraphRecursive=no
psblas_cv_have_metis=no;pac_metis_lib_ok=no; METIS_LIBS=""
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib__m__METIS_PartGraphRecursive" >&5
$as_echo "$ac_cv_lib__m__METIS_PartGraphRecursive" >&6; }
if test "x$ac_cv_lib__m__METIS_PartGraphRecursive" = x""yes; then
psblas_cv_have_metis=yes; METIS_LIBS="$psblas_cv_metis"
{ $as_echo "$as_me:$LINENO: result: $pac_metis_lib_ok" >&5
$as_echo "$pac_metis_lib_ok" >&6; }
if test "x$pac_metis_lib_ok" == "xno" ; then
METIS_LIBDIR="-L$psblas_cv_metisdir/Lib -L$psblas_cv_metisdir/lib"
METIS_LIBS="$psblas_cv_metis $METIS_LIBDIR"
LIBS="$METIS_LIBS -lm $SAVE_LIBS"
{ $as_echo "$as_me:$LINENO: checking for METIS_PartGraphRecursive in $METIS_LIBS" >&5
$as_echo_n "checking for METIS_PartGraphRecursive in $METIS_LIBS... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* 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 METIS_PartGraphRecursive ();
int
main ()
{
return METIS_PartGraphRecursive ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
psblas_cv_have_metis=yes;pac_metis_lib_ok=yes;
else
psblas_cv_have_metis=no
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
psblas_cv_have_metis=no;pac_metis_lib_ok=no; METIS_LIBS=""
fi
else
save_LIBS="$LIBS";
LIBS="-lm $LIBS";
{ $as_echo "$as_me:$LINENO: checking for METIS_PartGraphRecursive in -lmetis" >&5
$as_echo_n "checking for METIS_PartGraphRecursive in -lmetis... " >&6; }
if test "${ac_cv_lib_metis_METIS_PartGraphRecursive+set}" = set; then
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lmetis $LIBS"
cat >conftest.$ac_ext <<_ACEOF
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:$LINENO: result: $pac_metis_lib_ok" >&5
$as_echo "$pac_metis_lib_ok" >&6; }
fi
if test "x$pac_metis_lib_ok" == "xno" ; then
METIS_LIBDIR="-L$psblas_cv_metisdir/METIS/Lib -L$psblas_cv_metisdir/METIS/Lib"
METIS_LIBS="$psblas_cv_metis $METIS_LIBDIR"
LIBS="$METIS_LIBS -lm $SAVE_LIBS"
{ $as_echo "$as_me:$LINENO: checking for METIS_PartGraphRecursive in $METIS_LIBS" >&5
$as_echo_n "checking for METIS_PartGraphRecursive in $METIS_LIBS... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@ -9532,34 +10070,31 @@ $as_echo "$ac_try_echo") >&5
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
ac_cv_lib_metis_METIS_PartGraphRecursive=yes
psblas_cv_have_metis=yes;pac_metis_lib_ok=yes;
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_metis_METIS_PartGraphRecursive=no
psblas_cv_have_metis=no;pac_metis_lib_ok=no; METIS_LIBS=""
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_metis_METIS_PartGraphRecursive" >&5
$as_echo "$ac_cv_lib_metis_METIS_PartGraphRecursive" >&6; }
if test "x$ac_cv_lib_metis_METIS_PartGraphRecursive" = x""yes; then
psblas_cv_have_metis=yes;METIS_LIBS="-lmetis"
else
psblas_cv_have_metis=no
{ $as_echo "$as_me:$LINENO: result: $pac_metis_lib_ok" >&5
$as_echo "$pac_metis_lib_ok" >&6; }
fi
fi
LIBS="$SAVE_LIBS";
CPPFLAGS="$SAVE_CPPFLAGS";
LIBS="$save_LIBS";
fi
if test "x$psblas_cv_have_metis" == "xyes" ; then
FDEFINES="$FDEFINES $psblas_cv_define_prepend-DHAVE_METIS"
FDEFINES="$psblas_cv_define_prepend-DHAVE_METIS $FDEFINES"
CDEFINES="-DHAVE_METIS_ $psblas_cv_metis_includes $CDEFINES"
fi
# Check whether --with-amd was given.
if test "${with_amd+set}" = set; then
withval=$with_amd; psblas_cv_amd=$withval
@ -10243,7 +10778,7 @@ LIBS="$SAVE_LIBS";
CPPFLAGS="$SAVE_CPPFLAGS";
if test "x$psblas_cv_have_amd" == "xyes" ; then
FDEFINES="$mld_cv_define_prepend-DHAVE_AMD $FDEFINES"
FDEFINES="$psblas_cv_define_prepend-DHAVE_AMD $FDEFINES"
CDEFINES="-DHAVE_AMD_ $psblas_cv_amd_includes $CDEFINES"
fi

@ -703,26 +703,17 @@ RSB_LIBS="$want_rsb_libs"
LIBS="$RSB_LIBS ${LIBS}"
dnl AC_CHECK_HEADERS([rsb.h], [ LIBS="${LIBS} $want_rsb_libs"], [])
AC_ARG_WITH(metis, AC_HELP_STRING([--with-metis=LIB], [Specify -lMETISLIBNAME or the absolute library filename.]),
[psblas_cv_metis="$withval"],
[psblas_cv_metis=''])
if test "x$psblas_cv_metis" != "x" ; then
AC_CHECK_LIB("m",METIS_PartGraphRecursive, psblas_cv_have_metis=yes; METIS_LIBS="$psblas_cv_metis", psblas_cv_have_metis=no,["$psblas_cv_metis"])
else
save_LIBS="$LIBS";
LIBS="-lm $LIBS";
AC_CHECK_LIB(metis,METIS_PartGraphRecursive,psblas_cv_have_metis=yes;METIS_LIBS="-lmetis", psblas_cv_have_metis=no)
LIBS="$save_LIBS";
fi
if test "x$psblas_cv_have_metis" == "xyes" ; then
FDEFINES="$FDEFINES $psblas_cv_define_prepend-DHAVE_METIS"
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"
fi
PAC_CHECK_AMD
if test "x$psblas_cv_have_amd" == "xyes" ; then
FDEFINES="$mld_cv_define_prepend-DHAVE_AMD $FDEFINES"
FDEFINES="$psblas_cv_define_prepend-DHAVE_AMD $FDEFINES"
CDEFINES="-DHAVE_AMD_ $psblas_cv_amd_includes $CDEFINES"
fi

@ -19,8 +19,8 @@ IMPLOBJS= psb_s_hbio_impl.o psb_d_hbio_impl.o \
psb_c_renum_impl.o psb_z_renum_impl.o \
psb_d_genpde_impl.o psb_s_genpde_impl.o
MODOBJS=psb_util_mod.o $(BASEOBJS)
COBJS=psb_amd_order.o
OBJS=$(MODOBJS) $(IMPLOBJS) $(COBJS)
COBJS=metis_int.o psb_amd_order.o
OBJS=$(COBJS) $(MODOBJS) $(IMPLOBJS)
LOCAL_MODS=$(MODOBJS:.o=$(.mod))
LIBNAME=$(UTILLIBNAME)
FINCLUDES=$(FMFLAG). $(FMFLAG)$(INCDIR)
@ -36,6 +36,7 @@ $(HERE)/$(LIBNAME): $(OBJS)
$(OBJS): $(INCDIR)/$(BASEMODNAME)$(.mod)
psb_util_mod.o: $(BASEOBJS)
psb_metispart_mod.o: metis_int.o
$(IMPLOBJS): $(BASEOBJS)

@ -0,0 +1,49 @@
#include <stdio.h>
#if defined(HAVE_METIS_)
#include "metis.h"
/* extern int METIS_PartGraphRecursive(int *, int *, int *, int *, int *, int *, int *, int *, float *, float, int *, int *, int *); */
int metis_PartGraphRecursive_C(int *n, int *ixadj, int *iadj, int *ivwg,
int *iajw, int *nparts, float *weights,
int *graphpart)
{
int res = -1;
idx_t objval = 0;
idx_t options[METIS_NOPTIONS];
//printf("Inside Metis/C interface\n");
idx_t ncon=1;
METIS_SetDefaultOptions(options);
options[METIS_OPTION_NUMBERING] = 1;
//printf("n:%p ncon:%p ixadj:%p iadj:%p npart:%p weights:%p options:%p objval:%p graphpart: %p\n",n,&ncon,ixadj,iadj,nparts,NULL,options,&objval,graphpart);
/* fprintf(stderr,"From metis_int: %f\n",weights[0]); */
if (weights[0] == -1.0) {
res = METIS_PartGraphRecursive((idx_t*)n,(idx_t *)&ncon,(idx_t *)ixadj,(idx_t *)iadj,
NULL,NULL,NULL,(idx_t *)nparts,NULL,NULL,options,
&objval,(idx_t *)graphpart);
} else {
/* res = METIS_PartGraphRecursive((idx_t*)n,(idx_t *)&ncon,(idx_t *)ixadj,(idx_t *)iadj, */
/* NULL,NULL,NULL,(idx_t *)nparts,NULL,NULL,NULL, */
/* &objval,(idx_t *)graphpart); */
res = METIS_PartGraphRecursive((idx_t*)n,(idx_t *)&ncon,(idx_t *)ixadj,(idx_t *)iadj,
NULL,NULL,NULL,(idx_t *)nparts,weights,NULL,options,
&objval,(idx_t *)graphpart);
}
if (res == METIS_OK) {
return(0);
} else {
return res;
}
}
#else
int metis_PartGraphRecursive_C(int *n, int *ixadj, int *iadj, int *ivwg,
int *iajw, int *nparts, float *weights,
int *graphpart)
{
return(-1);
}
#endif

@ -136,15 +136,26 @@ contains
end if
end subroutine getv_mtpart
subroutine d_mat_build_mtpart(a,nparts)
subroutine d_mat_build_mtpart(a,nparts,weights)
use psb_base_mod
type(psb_dspmat_type), intent(in) :: a
integer(psb_ipk_) :: nparts
real(psb_dpk_), optional :: weights(:)
real(psb_spk_), allocatable :: wgh_(:)
select type (aa=>a%a)
type is (psb_d_csr_sparse_mat)
call build_mtpart(aa%get_nrows(),aa%get_fmt(),aa%ja,aa%irp,nparts)
if (present(weights)) then
if (size(weights)==nparts) then
wgh_ = weights
end if
end if
if (allocated(wgh_)) then
call build_mtpart(aa%get_nrows(),aa%get_fmt(),aa%ja,aa%irp,nparts,wgh_)
else
call build_mtpart(aa%get_nrows(),aa%get_fmt(),aa%ja,aa%irp,nparts,wgh_)
end if
class default
write(psb_err_unit,*) 'Sorry, right now we only take CSR input!'
call psb_abort(ictxt)
@ -153,49 +164,62 @@ contains
end subroutine d_mat_build_mtpart
subroutine s_mat_build_mtpart(a,nparts)
subroutine z_mat_build_mtpart(a,nparts,weights)
use psb_base_mod
type(psb_sspmat_type), intent(in) :: a
type(psb_zspmat_type), intent(in) :: a
integer(psb_ipk_) :: nparts
real(psb_dpk_), optional :: weights(:)
real(psb_spk_), allocatable :: wgh_(:)
select type (aa=>a%a)
type is (psb_s_csr_sparse_mat)
call build_mtpart(aa%get_nrows(),aa%get_fmt(),aa%ja,aa%irp,nparts)
type is (psb_z_csr_sparse_mat)
if (present(weights)) then
if (size(weights)==nparts) then
wgh_ = weights
end if
end if
if (allocated(wgh_)) then
call build_mtpart(aa%get_nrows(),aa%get_fmt(),aa%ja,aa%irp,nparts,wgh_)
else
call build_mtpart(aa%get_nrows(),aa%get_fmt(),aa%ja,aa%irp,nparts,wgh_)
end if
class default
write(psb_err_unit,*) 'Sorry, right now we only take CSR input!'
call psb_abort(ictxt)
end select
end subroutine s_mat_build_mtpart
end subroutine z_mat_build_mtpart
subroutine z_mat_build_mtpart(a,nparts)
subroutine s_mat_build_mtpart(a,nparts,weights)
use psb_base_mod
type(psb_zspmat_type), intent(in) :: a
type(psb_sspmat_type), intent(in) :: a
integer(psb_ipk_) :: nparts
real(psb_spk_), optional :: weights(:)
select type (aa=>a%a)
type is (psb_z_csr_sparse_mat)
call build_mtpart(aa%get_nrows(),aa%get_fmt(),aa%ja,aa%irp,nparts)
type is (psb_s_csr_sparse_mat)
call build_mtpart(aa%get_nrows(),aa%get_fmt(),aa%ja,aa%irp,nparts,weights)
class default
write(psb_err_unit,*) 'Sorry, right now we only take CSR input!'
call psb_abort(ictxt)
end select
end subroutine z_mat_build_mtpart
end subroutine s_mat_build_mtpart
subroutine c_mat_build_mtpart(a,nparts)
subroutine c_mat_build_mtpart(a,nparts,weights)
use psb_base_mod
type(psb_cspmat_type), intent(in) :: a
integer(psb_ipk_) :: nparts
real(psb_spk_), optional :: weights(:)
select type (aa=>a%a)
type is (psb_c_csr_sparse_mat)
call build_mtpart(aa%get_nrows(),aa%get_fmt(),aa%ja,aa%irp,nparts)
call build_mtpart(aa%get_nrows(),aa%get_fmt(),aa%ja,aa%irp,nparts,weights)
class default
write(psb_err_unit,*) 'Sorry, right now we only take CSR input!'
call psb_abort(ictxt)
@ -203,33 +227,52 @@ contains
end subroutine c_mat_build_mtpart
subroutine build_mtpart(n,fida,ia1,ia2,nparts)
subroutine build_mtpart(n,fida,ja,irp,nparts,weights)
use psb_base_mod
implicit none
integer(psb_ipk_) :: nparts
integer(psb_ipk_) :: ia1(:), ia2(:)
integer(psb_ipk_) :: ja(:), irp(:)
integer(psb_ipk_) :: n, i,numflag,nedc,wgflag
character(len=5) :: fida
integer(psb_ipk_), parameter :: nb=512
real(psb_dpk_), parameter :: seed=12345.d0
integer(psb_ipk_) :: iopt(10),idummy(2),jdummy(2)
integer(psb_ipk_) :: iopt(10),idummy(2),jdummy(2), info
real(psb_spk_),optional :: weights(:)
integer(psb_ipk_) :: nl,nptl
integer(psb_ipk_), allocatable :: irpl(:),jal(:),gvl(:)
real(psb_spk_),allocatable :: wgh_(:)
#if defined(HAVE_METIS)
interface
subroutine METIS_PartGraphRecursive(n,ixadj,iadj,ivwg,iajw,&
& wgflag,numflag,nparts,iopt,nedc,part)
import :: psb_ipk_
integer(psb_ipk_) :: n,wgflag,numflag,nparts,nedc
integer(psb_ipk_) :: ixadj(*),iadj(*),ivwg(*),iajw(*),iopt(*),part(*)
end subroutine METIS_PartGraphRecursive
end interface
allocate(graph_vect(n),stat=info)
! subroutine METIS_PartGraphRecursive(n,ixadj,iadj,ivwg,iajw,&
! & wgflag,numflag,nparts,weights,iopt,nedc,part) bind(c)
! use iso_c_binding
! integer(c_int) :: n,wgflag,numflag,nparts,nedc
! integer(c_int) :: ixadj(*),iadj(*),ivwg(*),iajw(*),iopt(*),part(*)
! real(c_float) :: weights(*)
! !integer(psb_ipk_) :: n,wgflag,numflag,nparts,nedc
! !integer(psb_ipk_) :: ixadj(*),iadj(*),ivwg(*),iajw(*),iopt(*),part(*)
! end subroutine METIS_PartGraphRecursive
function METIS_PartGraphRecursive(n,ixadj,iadj,ivwg,iajw,&
& nparts,weights,part) bind(c,name="metis_PartGraphRecursive_C") result(res)
use iso_c_binding
integer(c_int) :: res
integer(c_int) :: n,nparts
integer(c_int) :: ixadj(*),iadj(*),ivwg(*),iajw(*),part(*)
real(c_float) :: weights(*)
!integer(psb_ipk_) :: n,wgflag,numflag,nparts,nedc
!integer(psb_ipk_) :: ixadj(*),iadj(*),ivwg(*),iajw(*),iopt(*),part(*)
end function METIS_PartGraphRecursive
end interface
call psb_realloc(n,graph_vect,info)
if (info == psb_success_) allocate(gvl(n),wgh_(nparts),stat=info)
if (info /= psb_success_) then
write(psb_err_unit,*) 'Fatal error in BUILD_MTPART: memory allocation ',&
& ' failure.'
return
write(psb_err_unit,*) 'Fatal error in BUILD_MTPART: memory allocation ',&
& ' failure.'
return
endif
if (nparts > 1) then
if (psb_toupper(fida) == 'CSR') then
@ -237,11 +280,35 @@ contains
numflag = 1
wgflag = 0
call METIS_PartGraphRecursive(n,ia2,ia1,idummy,jdummy,&
& wgflag,numflag,nparts,iopt,nedc,graph_vect)
write(*,*) 'Before allocation',nparts
irpl=irp
jal = ja
nl = n
nptl = nparts
wgh_ = -1.0
if(present(weights)) then
if (size(weights) == nptl) then
write(*,*) 'weights present',weights
! call METIS_PartGraphRecursive(n,irp,ja,idummy,jdummy,&
! & wgflag,numflag,nparts,weights,iopt,nedc,graph_vect)
info = METIS_PartGraphRecursive(nl,irpl,jal,idummy,jdummy,&
& nptl,weights,gvl)
else
write(*,*) 'weights absent',wgh_
info = METIS_PartGraphRecursive(nl,irpl,jal,idummy,jdummy,&
& nptl,wgh_,gvl)
end if
else
write(*,*) 'weights absent',wgh_
info = METIS_PartGraphRecursive(nl,irpl,jal,idummy,jdummy,&
& nptl,wgh_,gvl)
endif
write(*,*) 'after allocation',info
do i=1, n
graph_vect(i) = graph_vect(i) - 1
graph_vect(i) = gvl(i) - 1
enddo
else
write(psb_err_unit,*) 'Fatal error in BUILD_MTPART: matrix format ',&
@ -259,7 +326,7 @@ contains
return
end subroutine build_mtpart
end subroutine build_mtpart
subroutine free_part(info)

Loading…
Cancel
Save