mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-06 22:55:08 +00:00
Check METIS real size, use it where appropriate
This commit is contained in:
+5
-5
@@ -1850,17 +1850,17 @@ fi
|
||||
|
||||
if test "x$pac_metis_header_ok" == "xyes" ; then
|
||||
AC_LANG_PUSH([C])
|
||||
AC_MSG_CHECKING([for METIS idx size])
|
||||
AC_MSG_CHECKING([for METIS real size])
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE(
|
||||
#include <stdio.h>
|
||||
#include "$psblas_cv_metisincfile"
|
||||
void main(){
|
||||
printf("%d\n",IDXTYPEWIDTH);
|
||||
printf("%d\n",REALTYPEWIDTH);
|
||||
}
|
||||
)],
|
||||
[pac_cv_metis_idx=`./conftest${ac_exeext} | sed 's/^ *//'`],
|
||||
[pac_cv_metis_idx="unknown"])
|
||||
AC_MSG_RESULT($pac_cv_metis_idx)
|
||||
[pac_cv_metis_real=`./conftest${ac_exeext} | sed 's/^ *//'`],
|
||||
[pac_cv_metis_real="unknown"])
|
||||
AC_MSG_RESULT($pac_cv_metis_real)
|
||||
|
||||
AC_LANG_POP()
|
||||
fi
|
||||
|
||||
@@ -8988,26 +8988,26 @@ 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
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for METIS idx size" >&5
|
||||
$as_echo_n "checking for METIS idx size... " >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for METIS real size" >&5
|
||||
$as_echo_n "checking for METIS real size... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <stdio.h>
|
||||
#include "$psblas_cv_metisincfile"
|
||||
void main(){
|
||||
printf("%d\n",IDXTYPEWIDTH);
|
||||
printf("%d\n",REALTYPEWIDTH);
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
pac_cv_metis_idx=`./conftest${ac_exeext} | sed 's/^ *//'`
|
||||
pac_cv_metis_real=`./conftest${ac_exeext} | sed 's/^ *//'`
|
||||
else
|
||||
pac_cv_metis_idx="unknown"
|
||||
pac_cv_metis_real="unknown"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_cv_metis_idx" >&5
|
||||
$as_echo "$pac_cv_metis_idx" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_cv_metis_real" >&5
|
||||
$as_echo "$pac_cv_metis_real" >&6; }
|
||||
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
@@ -9180,9 +9180,14 @@ if test "x$pac_cv_metis_idx" == "xunknown" ; then
|
||||
$as_echo "$as_me: Unknown METIS bitsize." >&6;}
|
||||
$psblas_cv_have_metis = "no";
|
||||
fi
|
||||
if test "x$pac_cv_metis_real" == "xunknown" ; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Unknown METIS REAL bitsize." >&5
|
||||
$as_echo "$as_me: Unknown METIS REAL bitsize." >&6;}
|
||||
$psblas_cv_have_metis = "no";
|
||||
fi
|
||||
if test "x$psblas_cv_have_metis" == "xyes" ; then
|
||||
FDEFINES="$psblas_cv_define_prepend-DHAVE_METIS $psblas_cv_define_prepend-DMETIS_$pac_cv_metis_idx $FDEFINES"
|
||||
CDEFINES="-DHAVE_METIS_ $psblas_cv_metis_includes $CDEFINES -DMETIS_$pac_cv_metis_idx"
|
||||
FDEFINES="$psblas_cv_define_prepend-DHAVE_METIS $psblas_cv_define_prepend-DMETIS_$pac_cv_metis_idx $psblas_cv_define_prepend-DMETIS_REAL_$pac_cv_metis_real $FDEFINES"
|
||||
CDEFINES="-DHAVE_METIS_ $psblas_cv_metis_includes $CDEFINES -DMETIS_$pac_cv_metis_idx -DMETIS_REAL_$pac_cv_metis_real"
|
||||
METISINCFILE=$psblas_cv_metisincfile
|
||||
fi
|
||||
|
||||
|
||||
+7
-2
@@ -716,9 +716,14 @@ if test "x$pac_cv_metis_idx" == "xunknown" ; then
|
||||
AC_MSG_NOTICE([Unknown METIS bitsize.])
|
||||
$psblas_cv_have_metis = "no";
|
||||
fi
|
||||
if test "x$pac_cv_metis_real" == "xunknown" ; then
|
||||
dnl mismatch between metis size and PSBLAS LPK
|
||||
AC_MSG_NOTICE([Unknown METIS REAL bitsize.])
|
||||
$psblas_cv_have_metis = "no";
|
||||
fi
|
||||
if test "x$psblas_cv_have_metis" == "xyes" ; then
|
||||
FDEFINES="$psblas_cv_define_prepend-DHAVE_METIS $psblas_cv_define_prepend-DMETIS_$pac_cv_metis_idx $FDEFINES"
|
||||
CDEFINES="-DHAVE_METIS_ $psblas_cv_metis_includes $CDEFINES -DMETIS_$pac_cv_metis_idx"
|
||||
FDEFINES="$psblas_cv_define_prepend-DHAVE_METIS $psblas_cv_define_prepend-DMETIS_$pac_cv_metis_idx $psblas_cv_define_prepend-DMETIS_REAL_$pac_cv_metis_real $FDEFINES"
|
||||
CDEFINES="-DHAVE_METIS_ $psblas_cv_metis_includes $CDEFINES -DMETIS_$pac_cv_metis_idx -DMETIS_REAL_$pac_cv_metis_real"
|
||||
METISINCFILE=$psblas_cv_metisincfile
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#if defined(HAVE_METIS_)
|
||||
#include "psb_metis_int.h"
|
||||
|
||||
#if defined(METIS_REAL_32)
|
||||
int metis_PartGraphKway_C(idx_t *n, idx_t *ixadj, idx_t *iadj, idx_t *ivwg,
|
||||
idx_t *iajw, idx_t *nparts, float *weights,
|
||||
idx_t *graphpart)
|
||||
@@ -34,6 +35,38 @@ int metis_PartGraphKway_C(idx_t *n, idx_t *ixadj, idx_t *iadj, idx_t *ivwg,
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(METIS_REAL_64)
|
||||
int metis_PartGraphKway_C(idx_t *n, idx_t *ixadj, idx_t *iadj, idx_t *ivwg,
|
||||
idx_t *iajw, idx_t *nparts, double *weights,
|
||||
idx_t *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_PartGraphKway((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_PartGraphKway((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_PartGraphKway((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
|
||||
|
||||
|
||||
@@ -77,8 +77,13 @@ module psb_metispart_mod
|
||||
integer(psb_lpk_), intent(in) :: n, nparts
|
||||
integer(psb_lpk_), intent(in) :: ja(:), irp(:)
|
||||
integer(psb_lpk_), allocatable, intent(inout) :: vect(:)
|
||||
#if defined(METIS_REAL_32)
|
||||
real(psb_spk_),optional, intent(in) :: weights(:)
|
||||
|
||||
#elif defined(METIS_REAL_64)
|
||||
real(psb_dpk_),optional, intent(in) :: weights(:)
|
||||
#else
|
||||
choke on me;
|
||||
#endif
|
||||
end subroutine psi_l_build_mtpart
|
||||
end interface
|
||||
|
||||
@@ -181,8 +186,13 @@ contains
|
||||
type(psb_ld_csr_sparse_mat), intent(in) :: a
|
||||
integer(psb_lpk_) :: nparts
|
||||
real(psb_dpk_), optional :: weights(:)
|
||||
#if defined(METIS_REAL_32)
|
||||
real(psb_spk_), allocatable :: wgh_(:)
|
||||
|
||||
#elif defined(METIS_REAL_64)
|
||||
real(psb_dpk_), allocatable :: wgh_(:)
|
||||
#else
|
||||
choke on me;
|
||||
#endif
|
||||
|
||||
if (present(weights)) then
|
||||
if (size(weights)==nparts) then
|
||||
@@ -220,8 +230,13 @@ contains
|
||||
type(psb_lz_csr_sparse_mat), intent(in) :: a
|
||||
integer(psb_lpk_) :: nparts
|
||||
real(psb_dpk_), optional :: weights(:)
|
||||
#if defined(METIS_REAL_32)
|
||||
real(psb_spk_), allocatable :: wgh_(:)
|
||||
|
||||
#elif defined(METIS_REAL_64)
|
||||
real(psb_dpk_), allocatable :: wgh_(:)
|
||||
#else
|
||||
choke on me;
|
||||
#endif
|
||||
|
||||
if (present(weights)) then
|
||||
if (size(weights)==nparts) then
|
||||
@@ -276,9 +291,25 @@ contains
|
||||
type(psb_lc_csr_sparse_mat), intent(in) :: a
|
||||
integer(psb_lpk_) :: nparts
|
||||
real(psb_spk_), optional :: weights(:)
|
||||
|
||||
|
||||
call psi_build_mtpart(a%get_nrows(),a%ja,a%irp,nparts,graph_vect,weights)
|
||||
#if defined(METIS_REAL_32)
|
||||
real(psb_spk_), allocatable :: wgh_(:)
|
||||
#elif defined(METIS_REAL_64)
|
||||
real(psb_dpk_), allocatable :: wgh_(:)
|
||||
#else
|
||||
choke on me;
|
||||
#endif
|
||||
|
||||
|
||||
if (present(weights)) then
|
||||
if (size(weights)==nparts) then
|
||||
wgh_ = weights
|
||||
end if
|
||||
end if
|
||||
if (allocated(wgh_)) then
|
||||
call psi_build_mtpart(a%get_nrows(),a%ja,a%irp,nparts,graph_vect,wgh_)
|
||||
else
|
||||
call psi_build_mtpart(a%get_nrows(),a%ja,a%irp,nparts,graph_vect)
|
||||
end if
|
||||
|
||||
end subroutine lc_csr_build_mtpart
|
||||
|
||||
@@ -288,10 +319,26 @@ contains
|
||||
type(psb_ls_csr_sparse_mat), intent(in) :: a
|
||||
integer(psb_lpk_) :: nparts
|
||||
real(psb_spk_), optional :: weights(:)
|
||||
|
||||
|
||||
call psi_build_mtpart(a%get_nrows(),a%ja,a%irp,nparts,graph_vect,weights)
|
||||
#if defined(METIS_REAL_32)
|
||||
real(psb_spk_), allocatable :: wgh_(:)
|
||||
#elif defined(METIS_REAL_64)
|
||||
real(psb_dpk_), allocatable :: wgh_(:)
|
||||
#else
|
||||
choke on me;
|
||||
#endif
|
||||
|
||||
|
||||
if (present(weights)) then
|
||||
if (size(weights)==nparts) then
|
||||
wgh_ = weights
|
||||
end if
|
||||
end if
|
||||
if (allocated(wgh_)) then
|
||||
call psi_build_mtpart(a%get_nrows(),a%ja,a%irp,nparts,graph_vect,wgh_)
|
||||
else
|
||||
call psi_build_mtpart(a%get_nrows(),a%ja,a%irp,nparts,graph_vect)
|
||||
end if
|
||||
|
||||
end subroutine ls_csr_build_mtpart
|
||||
|
||||
!
|
||||
|
||||
Reference in New Issue
Block a user