diff --git a/AUTOTEST/check-license.sh b/AUTOTEST/check-license.sh index 1483729987..d285dfd80e 100755 --- a/AUTOTEST/check-license.sh +++ b/AUTOTEST/check-license.sh @@ -67,6 +67,7 @@ cat > check-license.remove < header file. */ +#undef HAVE_INTTYPES_H -/* Define to 1 for Solaris. */ -#undef HYPRE_SOLARIS +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H -/* Define to 1 for Linux on platforms running any version of CHAOS */ -#undef HYPRE_LINUX_CHAOS +/* Define to 1 if using MLI */ +#undef HAVE_MLI -/* Define to 1 for Linux platforms */ -#undef HYPRE_LINUX +/* Define to 1 if you have the `MPI_Comm_f2c' function. */ +#undef HAVE_MPI_COMM_F2C -/* Define to 1 for Alpha platforms */ -#undef HYPRE_ALPHA +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H -/* Define to 1 for RS6000 platforms */ -#undef HYPRE_RS6000 +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H -/* Define to 1 for IRIX64 platforms */ -#undef HYPRE_IRIX64 +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H -/* Define to 1 if using long long int for HYPRE_BigInt */ -#undef HYPRE_MIXEDINT +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H -/* Define to 1 if using long long int for HYPRE_Int and HYPRE_BigInt */ -#undef HYPRE_BIGINT +/* Define to 1 if using SuperLU */ +#undef HAVE_SUPERLU -/* Define to 1 if using single precision values for HYPRE_Real */ -#undef HYPRE_SINGLE +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H -/* Define to 1 if using quad precision values for HYPRE_Real */ -#undef HYPRE_LONG_DOUBLE +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 for Alpha platforms */ +#undef HYPRE_ALPHA + +/* Define to 1 if using long long int for HYPRE_Int and HYPRE_BigInt */ +#undef HYPRE_BIGINT /* Define to 1 if using complex values */ #undef HYPRE_COMPLEX -/* Define to be the max dimension size (must be at least 3) */ -#undef HYPRE_MAXDIM +/* Define to 1 if in debug mode */ +#undef HYPRE_DEBUG -/* Define to 1 if using persistent communication */ -#undef HYPRE_USING_PERSISTENT_COMM +/* Define to 1 if using OpenMP on device [target alloc version] */ +#undef HYPRE_DEVICE_OPENMP_ALLOC -/* Define to 1 if hopscotch hashing */ -#undef HYPRE_HOPSCOTCH +/* Define to 1 if strictly checking OpenMP offload directives */ +#undef HYPRE_DEVICE_OPENMP_CHECK + +/* Define as follows to set the Fortran name mangling scheme: 0 = unspecified; + 1 = no underscores; 2 = one underscore; 3 = two underscores; 4 = caps, no + underscores; 5 = one underscore before and after */ +#undef HYPRE_FMANGLE + +/* BLAS mangling */ +#undef HYPRE_FMANGLE_BLAS + +/* LAPACK mangling */ +#undef HYPRE_FMANGLE_LAPACK /* Define to 1 if an MPI library is found */ #undef HYPRE_HAVE_MPI -/* Define to 1 if Node Aware MPI library is used */ -#undef HYPRE_USING_NODE_AWARE_MPI - /* Define to 1 if the routine MPI_Comm_f2c is found */ #undef HYPRE_HAVE_MPI_COMM_F2C -/* Disable MPI, enable serial codes */ -#undef HYPRE_SEQUENTIAL +/* Define to 1 if hopscotch hashing */ +#undef HYPRE_HOPSCOTCH -/* Using HYPRE timing routines */ -#undef HYPRE_TIMING +/* Define to 1 for HP platforms */ +#undef HYPRE_HPPA -/* Using dxml for BLAS */ -#undef HYPRE_USING_DXML +/* Define to 1 for IRIX64 platforms */ +#undef HYPRE_IRIX64 -/* Using essl for BLAS */ -#undef HYPRE_USING_ESSL +/* Define to 1 for Linux platform */ +#undef HYPRE_LINUX -/* Using internal Hypre routines */ -#undef HYPRE_USING_HYPRE_BLAS +/* Define to 1 for Linux on platforms running any version of CHAOS */ +#undef HYPRE_LINUX_CHAOS -/* Using internal Hypre routines */ -#undef HYPRE_USING_HYPRE_LAPACK +/* Define to 1 if using quad precision values for HYPRE_Real */ +#undef HYPRE_LONG_DOUBLE + +/* Define to be the max dimension size (must be at least 3) */ +#undef HYPRE_MAXDIM + +/* Define to 1 if using long long int for HYPRE_BigInt */ +#undef HYPRE_MIXEDINT /* No global partitioning being used */ #undef HYPRE_NO_GLOBAL_PARTITION @@ -97,107 +115,122 @@ /* Print HYPRE errors */ #undef HYPRE_PRINT_ERRORS -/* Enable OpenMP support */ -#undef HYPRE_USING_OPENMP +/* Bug reports */ +#undef HYPRE_RELEASE_BUGS -/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * MEMORY - *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +/* Date of release */ +#undef HYPRE_RELEASE_DATE -/* Define to 1 if using host memory only */ -#undef HYPRE_USING_HOST_MEMORY +/* Release name */ +#undef HYPRE_RELEASE_NAME -/* Define to 1 if using device memory without UM */ -#undef HYPRE_USING_DEVICE_MEMORY +/* Time of release */ +#undef HYPRE_RELEASE_TIME -/* Define to 1 if using unified memory */ -#undef HYPRE_USING_UNIFIED_MEMORY +/* Version number */ +#undef HYPRE_RELEASE_VERSION + +/* Define to 1 for RS6000 platforms */ +#undef HYPRE_RS6000 + +/* Disable MPI, enable serial codes. */ +#undef HYPRE_SEQUENTIAL + +/* Define to 1 if using single precision values for HYPRE_Real */ +#undef HYPRE_SINGLE + +/* Define to 1 for Solaris. */ +#undef HYPRE_SOLARIS + +/* Using HYPRE timing routines */ +#undef HYPRE_TIMING + +/* Define to 1 if Caliper instrumentation is enabled */ +#undef HYPRE_USING_CALIPER + +/* Define to 1 if using cuBLAS */ +#undef HYPRE_USING_CUBLAS + +/* Define to 1 if using CUB */ +#undef HYPRE_USING_CUB_ALLOCATOR -/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * EXECUTION - *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ /* Define to 1 if executing on device with CUDA */ #undef HYPRE_USING_CUDA -/* Define to 1 if executing on device with OpenMP */ +/* Define to 1 if using CUDA streams */ +#undef HYPRE_USING_CUDA_STREAMS + +/* Define to 1 if using cuRAND */ +#undef HYPRE_USING_CURAND + +/* Define to 1 if using cuSPARSE */ +#undef HYPRE_USING_CUSPARSE + +/* Define to 1 if using device memory without UM */ +#undef HYPRE_USING_DEVICE_MEMORY + +/* Define to 1 if executing on device with OpenMP */ #undef HYPRE_USING_DEVICE_OPENMP -/* Define to 1 if using OpenMP on device [target alloc version] */ -#undef HYPRE_DEVICE_OPENMP_ALLOC +/* Define to 1 if using DSuperLU */ +#undef HYPRE_USING_DSUPERLU -/* Define to 1 if using OpenMP on device [target mapped version] */ -#undef HYPRE_DEVICE_OPENMP_MAPPED +/* Using dxml for Blas */ +#undef HYPRE_USING_DXML -/* Define to 1 if strictly checking OpenMP offload directives */ -#undef HYPRE_DEVICE_OPENMP_CHECK +/* Using ESSL for Lapack */ +#undef HYPRE_USING_ESSL -/* Define to 1 if executing on host/device with RAJA */ -#undef HYPRE_USING_RAJA +/* Define to 1 if using host memory only */ +#undef HYPRE_USING_HOST_MEMORY + +/* Using internal HYPRE routines */ +#undef HYPRE_USING_HYPRE_BLAS + +/* Using internal HYPRE routines */ +#undef HYPRE_USING_HYPRE_LAPACK /* Define to 1 if executing on host/device with KOKKOS */ #undef HYPRE_USING_KOKKOS -/* Define to 1 if using NVIDIA Tools Extension (NVTX) */ +/* Define to 1 if Node Aware MPI library is used */ +#undef HYPRE_USING_NODE_AWARE_MPI + +/* NVTX being used */ #undef HYPRE_USING_NVTX -/* Define to 1 if using cuSPARSE */ -#undef HYPRE_USING_CUSPARSE +/* Enable OpenMP support */ +#undef HYPRE_USING_OPENMP -/* Define to 1 if using CUB */ -#undef HYPRE_USING_CUB_ALLOCATOR +/* Define to 1 if using persistent communication */ +#undef HYPRE_USING_PERSISTENT_COMM -/* Define to 1 if using cuBLAS */ -#undef HYPRE_USING_CUBLAS +/* Define to 1 if executing on host/device with RAJA */ +#undef HYPRE_USING_RAJA -/* Define to 1 if using cuRAND */ -#undef HYPRE_USING_CURAND +/* Define to 1 if using unified memory */ +#undef HYPRE_USING_UNIFIED_MEMORY /* Define to 1 if using GPU aware MPI */ #undef HYPRE_WITH_GPU_AWARE_MPI -/* Define to 1 if using CUDA streams */ -#undef HYPRE_USING_CUDA_STREAMS - -/* Define as follows to set the Fortran name mangling scheme: - * 0 = unspecified - * 1 = no underscores - * 2 = one underscore - * 3 = two underscores - * 4 = caps, no underscores - * 5 = one underscore before and after */ -#undef HYPRE_FMANGLE - -/* Define as in HYPRE_FMANGLE to set the BLAS name mangling scheme */ -#undef HYPRE_FMANGLE_BLAS - -/* Define as in HYPRE_FMANGLE to set the LAPACK name mangling scheme */ -#undef HYPRE_FMANGLE_LAPACK - -/* Define to a macro mangling the given C identifier (in lower and upper - * case), which must not contain underscores, for linking with Fortran. */ -#undef FC_FUNC - -/* As HYPRE_FC_FUNC, but for C identifiers containing underscores. */ -#undef FC_FUNC_ +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT -/* Define to 1 if Caliper instrumentation is enabled */ -#undef HYPRE_USING_CALIPER +/* Define to the full name of this package. */ +#undef PACKAGE_NAME -/* Define to 1 if using SuperLU */ -#undef HAVE_SUPERLU +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING -/* Define to 1 if using DSuperLU */ -#undef HYPRE_USING_DSUPERLU +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME -/* Define to 1 if using MLI */ -#undef HAVE_MLI +/* Define to the home page for this package. */ +#undef PACKAGE_URL -/* Define to 1 if in debug mode */ -#undef HYPRE_DEBUG +/* Define to the version of this package. */ +#undef PACKAGE_VERSION -/* if not in debug mode, define NDEBUG */ -#ifndef HYPRE_DEBUG -#ifndef NDEBUG -#define NDEBUG -#endif -#endif +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS diff --git a/src/config/bootstrap b/src/config/bootstrap index 6a63facb65..dc114da76f 100755 --- a/src/config/bootstrap +++ b/src/config/bootstrap @@ -15,6 +15,7 @@ ln -s config/configure.in . rm -rf aclocal.m4 configure autom4te.cache autoconf --include=config +autoheader configure.in rm configure.in cat >> configure <=4.5) device directives]) - AC_DEFINE(HYPRE_DEVICE_OPENMP_ALLOC, 1, [Enable device OpenMP target alloc version]) + AC_DEFINE(HYPRE_USING_DEVICE_OPENMP, 1, [Define to 1 if executing on device with OpenMP]) + AC_DEFINE(HYPRE_DEVICE_OPENMP_ALLOC, 1, [Define to 1 if using OpenMP on device [target alloc version]]) - dnl AC_DEFINE(HYPRE_DEVICE_OPENMP_MAPPED, 1, [Enable device OpenMP target mapped version]) + dnl AC_DEFINE(HYPRE_DEVICE_OPENMP_MAPPED, 1, [Define to 1 if using OpenMP on device [target mapped version]]) dnl AC_CHECK_PROGS(CUCC, nvcc) @@ -1852,7 +1860,7 @@ then fi if test "$hypre_using_debug" = "yes" then - AC_DEFINE(HYPRE_DEVICE_OPENMP_CHECK, 1, [Strictly checking OpenMP offload directives]) + AC_DEFINE(HYPRE_DEVICE_OPENMP_CHECK, 1, [Define to 1 if strictly checking OpenMP offload directives]) fi HYPRE_CUDA_INCL="-I${HYPRE_CUDA_PATH}/include" @@ -1921,7 +1929,7 @@ fi if test "x$hypre_using_cuda_streams" = "xyes" then - AC_DEFINE([HYPRE_USING_CUDA_STREAMS],1,[HYPRE WITH CUDA STREAMS]) + AC_DEFINE([HYPRE_USING_CUDA_STREAMS],1,[Define to 1 if using CUDA streams]) fi dnl ********************************************************************* @@ -1929,19 +1937,19 @@ dnl * Set memory env dnl ********************************************************************* if test "x$hypre_using_um" = "xyes" then - AC_DEFINE([HYPRE_USING_UNIFIED_MEMORY],1,[HYPRE WITH UNIFIED MEMORY]) + AC_DEFINE([HYPRE_USING_UNIFIED_MEMORY],1,[Define to 1 if using unified memory]) else if [test "x$hypre_user_chose_cuda" = "xyes" || test "x$hypre_using_device_openmp" = "xyes"] then - AC_DEFINE([HYPRE_USING_DEVICE_MEMORY],1,[HYPRE WITH DEVICE MEMORY]) + AC_DEFINE([HYPRE_USING_DEVICE_MEMORY],1,[Define to 1 if using device memory without UM]) else - AC_DEFINE([HYPRE_USING_HOST_MEMORY],1,[HYPRE WITH HOST MEMORY]) + AC_DEFINE([HYPRE_USING_HOST_MEMORY],1,[Define to 1 if using host memory only]) fi fi if test "$hypre_gpu_mpi" = "yes" then - AC_DEFINE([HYPRE_WITH_GPU_AWARE_MPI],1,[HYPRE WITH GPU AWARE MPI]) + AC_DEFINE([HYPRE_WITH_GPU_AWARE_MPI],1,[Define to 1 if using GPU aware MPI]) fi dnl ********************************************************************* @@ -2107,4 +2115,4 @@ dnl * Define the files to be configured and made dnl ********************************************************************* AC_CONFIG_FILES([config/Makefile.config]) -AC_OUTPUT +AC_OUTPUT() diff --git a/src/config/hypre_blas_macros.m4 b/src/config/hypre_blas_macros.m4 index ac691e69aa..8335f21e84 100644 --- a/src/config/hypre_blas_macros.m4 +++ b/src/config/hypre_blas_macros.m4 @@ -297,7 +297,7 @@ dnl ************************************************************** else hypre_fmangle_blas=4 fi - AC_DEFINE_UNQUOTED(HYPRE_FMANGLE_BLAS, [$hypre_fmangle_blas], [BLAS mangling]) + AC_DEFINE_UNQUOTED(HYPRE_FMANGLE_BLAS, [$hypre_fmangle_blas], [Define as in HYPRE_FMANGLE to set the BLAS name mangling scheme]) fi dnl ************************************************************** dnl Restore LIBS and LDFLAGS diff --git a/src/config/hypre_lapack_macros.m4 b/src/config/hypre_lapack_macros.m4 index 03d64fed2a..501cb0c2ad 100644 --- a/src/config/hypre_lapack_macros.m4 +++ b/src/config/hypre_lapack_macros.m4 @@ -272,7 +272,7 @@ dnl ************************************************************** else hypre_fmangle_lapack=4 fi - AC_DEFINE_UNQUOTED(HYPRE_FMANGLE_LAPACK, [$hypre_fmangle_lapack], [LAPACK mangling]) + AC_DEFINE_UNQUOTED(HYPRE_FMANGLE_LAPACK, [$hypre_fmangle_lapack], [Define as in HYPRE_FMANGLE to set the LAPACK name mangling scheme]) fi dnl ************************************************************** diff --git a/src/config/hypre_macros_misc.m4 b/src/config/hypre_macros_misc.m4 index 758340239e..2b9b19c928 100644 --- a/src/config/hypre_macros_misc.m4 +++ b/src/config/hypre_macros_misc.m4 @@ -54,7 +54,7 @@ if test x = x"$MPILIBS"; then $2 : else - AC_DEFINE(HYPRE_HAVE_MPI,1,[Found the MPI library.]) + AC_DEFINE(HYPRE_HAVE_MPI,1,[Define to 1 if an MPI library is found]) $1 : fi @@ -415,19 +415,19 @@ dnl * dnl * define type of architecture case $HYPRE_ARCH in alpha) - AC_DEFINE(HYPRE_ALPHA) + AC_DEFINE(HYPRE_ALPHA,1,[Define to 1 for Alpha platforms]) ;; sun* | solaris*) - AC_DEFINE(HYPRE_SOLARIS) + AC_DEFINE(HYPRE_SOLARIS,1,[Define to 1 for Solaris.]) ;; hp* | HP*) - AC_DEFINE(HYPRE_HPPA) + AC_DEFINE(HYPRE_HPPA,1,[Define to 1 for HP platforms]) ;; rs6000 | RS6000 | *bgl* | *BGL* | ppc64*) - AC_DEFINE(HYPRE_RS6000) + AC_DEFINE(HYPRE_RS6000,1,[Define to 1 for RS6000 platforms]) ;; IRIX64) - AC_DEFINE(HYPRE_IRIX64) + AC_DEFINE(HYPRE_IRIX64,1,[Define to 1 for IRIX64 platforms]) ;; Linux | linux | LINUX) if test -r /etc/home.config @@ -435,14 +435,14 @@ dnl * define type of architecture systemtype=`grep ^SYS_TYPE /etc/home.config | cut -d" " -f2` case $systemtype in chaos*) - AC_DEFINE(HYPRE_LINUX_CHAOS) + AC_DEFINE(HYPRE_LINUX_CHAOS,1,[Define to 1 for Linux on platforms running any version of CHAOS]) ;; *) - AC_DEFINE(HYPRE_LINUX) + AC_DEFINE(HYPRE_LINUX,1,[Define to 1 for Linux platform]) ;; esac else - AC_DEFINE(HYPRE_LINUX) + AC_DEFINE(HYPRE_LINUX,1,[Define to 1 for Linux platform]) fi ;; esac diff --git a/src/configure b/src/configure index 069314947b..dc807076f5 100755 --- a/src/configure +++ b/src/configure @@ -738,6 +738,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -887,6 +888,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1139,6 +1141,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1276,7 +1287,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1429,6 +1440,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1575,7 +1587,7 @@ Optional Packages: name mangling to use when calling hypre from Fortran. It can be set to: "no-underscores", "one-underscore", "two-underscores", - "caps-no-underscores, and "one-before-after". + "caps-no-underscores", and "one-before-after". --with-fmangle-blas=FMANGLE Name mangling for BLAS. See --with-fmangle. --with-fmangle-lapack=FMANGLE @@ -2793,7 +2805,8 @@ fi if test "$hypre_using_mixedint" = "yes" then - $as_echo "#define HYPRE_MIXEDINT 1" >>confdefs.h + +$as_echo "#define HYPRE_MIXEDINT 1" >>confdefs.h fi @@ -2812,7 +2825,8 @@ fi if test "$hypre_using_bigint" = "yes" then - $as_echo "#define HYPRE_BIGINT 1" >>confdefs.h + +$as_echo "#define HYPRE_BIGINT 1" >>confdefs.h fi @@ -2831,7 +2845,8 @@ fi if test "$hypre_using_single" = "yes" then - $as_echo "#define HYPRE_SINGLE 1" >>confdefs.h + +$as_echo "#define HYPRE_SINGLE 1" >>confdefs.h fi @@ -2850,7 +2865,8 @@ fi if test "$hypre_using_longdouble" = "yes" then - $as_echo "#define HYPRE_LONG_DOUBLE 1" >>confdefs.h + +$as_echo "#define HYPRE_LONG_DOUBLE 1" >>confdefs.h fi @@ -2869,7 +2885,8 @@ fi if test "$hypre_using_complex" = "yes" then - $as_echo "#define HYPRE_COMPLEX 1" >>confdefs.h + +$as_echo "#define HYPRE_COMPLEX 1" >>confdefs.h fi @@ -2901,7 +2918,8 @@ fi if test "$hypre_using_persistent" = "yes" then - $as_echo "#define HYPRE_USING_PERSISTENT_COMM 1" >>confdefs.h + +$as_echo "#define HYPRE_USING_PERSISTENT_COMM 1" >>confdefs.h fi @@ -2919,7 +2937,8 @@ fi if test "$hypre_using_hopscotch" = "yes" then - $as_echo "#define HYPRE_HOPSCOTCH 1" >>confdefs.h + +$as_echo "#define HYPRE_HOPSCOTCH 1" >>confdefs.h fi @@ -7240,20 +7259,23 @@ fi $as_echo "$hypre_cv_func_MPI_Comm_f2c_macro" >&6; } if test $ac_cv_func_MPI_Comm_f2c = yes \ || test $hypre_cv_func_MPI_Comm_f2c_macro = yes; then - $as_echo "#define HYPRE_HAVE_MPI_COMM_F2C 1" >>confdefs.h + +$as_echo "#define HYPRE_HAVE_MPI_COMM_F2C 1" >>confdefs.h fi fi if test "$hypre_using_global_partition" = "no" then - $as_echo "#define HYPRE_NO_GLOBAL_PARTITION 1" >>confdefs.h + +$as_echo "#define HYPRE_NO_GLOBAL_PARTITION 1" >>confdefs.h fi if test "$hypre_using_node_aware_mpi" = "yes" then - $as_echo "#define HYPRE_USING_NODE_AWARE_MPI 1" >>confdefs.h + +$as_echo "#define HYPRE_USING_NODE_AWARE_MPI 1" >>confdefs.h fi @@ -8742,23 +8764,28 @@ $as_echo "$HYPRE_ARCH" >&6; } fi case $HYPRE_ARCH in alpha) - $as_echo "#define HYPRE_ALPHA 1" >>confdefs.h + +$as_echo "#define HYPRE_ALPHA 1" >>confdefs.h ;; sun* | solaris*) - $as_echo "#define HYPRE_SOLARIS 1" >>confdefs.h + +$as_echo "#define HYPRE_SOLARIS 1" >>confdefs.h ;; hp* | HP*) - $as_echo "#define HYPRE_HPPA 1" >>confdefs.h + +$as_echo "#define HYPRE_HPPA 1" >>confdefs.h ;; rs6000 | RS6000 | *bgl* | *BGL* | ppc64*) - $as_echo "#define HYPRE_RS6000 1" >>confdefs.h + +$as_echo "#define HYPRE_RS6000 1" >>confdefs.h ;; IRIX64) - $as_echo "#define HYPRE_IRIX64 1" >>confdefs.h + +$as_echo "#define HYPRE_IRIX64 1" >>confdefs.h ;; Linux | linux | LINUX) @@ -8767,16 +8794,19 @@ $as_echo "$HYPRE_ARCH" >&6; } systemtype=`grep ^SYS_TYPE /etc/home.config | cut -d" " -f2` case $systemtype in chaos*) - $as_echo "#define HYPRE_LINUX_CHAOS 1" >>confdefs.h + +$as_echo "#define HYPRE_LINUX_CHAOS 1" >>confdefs.h ;; *) - $as_echo "#define HYPRE_LINUX 1" >>confdefs.h + +$as_echo "#define HYPRE_LINUX 1" >>confdefs.h ;; esac else - $as_echo "#define HYPRE_LINUX 1" >>confdefs.h + +$as_echo "#define HYPRE_LINUX 1" >>confdefs.h fi ;; diff --git a/src/distributed_ls/Euclid/Euclid_dh.c b/src/distributed_ls/Euclid/Euclid_dh.c index 77975de8d3..05d04cd13e 100644 --- a/src/distributed_ls/Euclid/Euclid_dh.c +++ b/src/distributed_ls/Euclid/Euclid_dh.c @@ -70,7 +70,7 @@ void Euclid_dhCreate(Euclid_dh *ctxOUT) strcpy(ctx->krylovMethod, "bicgstab"); ctx->maxIts = 200; ctx->rtol = 1e-5; - ctx->atol = 1.0e-50; + ctx->atol = HYPRE_REAL_MIN; ctx->its = 0; ctx->itsTotal = 0; ctx->setupCount = 0; diff --git a/src/distributed_ls/Euclid/_hypre_Euclid.h b/src/distributed_ls/Euclid/_hypre_Euclid.h index 217fd5d837..3ca87f5601 100644 --- a/src/distributed_ls/Euclid/_hypre_Euclid.h +++ b/src/distributed_ls/Euclid/_hypre_Euclid.h @@ -1,4 +1,6 @@ +/*** DO NOT EDIT THIS FILE DIRECTLY (use 'headers' to generate) ***/ + #ifndef hypre_EUCLID_HEADER #define hypre_EUCLID_HEADER @@ -7,6 +9,16 @@ #define HYPRE_MODE #define OPTIMIZED_DH +#if defined(HYPRE_MODE) +#include "HYPRE_parcsr_mv.h" +#include "HYPRE_config.h" +#include "HYPRE_distributed_matrix_mv.h" +#include "_hypre_utilities.h" + +#elif defined(PETSC_MODE) +#include "petsc_config.h" +#endif + #ifdef __cplusplus extern "C" { #endif @@ -51,7 +63,7 @@ extern "C" { #define EXIT_NOW(msg) \ { setError_dh(msg, __FUNC__, __FILE__, __LINE__); \ ERRCHKA; \ - } + } #define ERRCHKA \ if (errFlag_dh) { \ @@ -65,7 +77,7 @@ extern "C" { Mem_dhPrint(mem_dh, stderr, false); \ } \ EUCLID_EXIT; \ - } + } /* let Euclid do its thing, before handing off to PETSc; @@ -83,10 +95,10 @@ extern "C" { printErrorMsg(stderr); \ hypre_fprintf(stderr, "\n[%i] ierr = %i, errFlag_dh = %i\n", myid_dh, ierr, errFlag_dh); \ CHKERRA(ierr); \ - } + } -#define MAX_SUBDOMAINS 20 +#define MAX_SUBDOMAINS 20 /* The maximum number of subdomains into which the matrix may be partitioned. Rule of thumb: MAX_SUBDOMAINS >= number of threads. @@ -99,7 +111,7 @@ extern "C" { /*--------------------------------------------------------------------- * Memory management. These macros work with functions in Mem_dh.c; - * Change if you want to use some memory management and reporting schemes + * Change if you want to use some memory management and reporting schemes * other than that supplied with Euclid. These depend on the global * object "Mem_dh mem_dh" which is defined in globalObjects.c (yuck!) ---------------------------------------------------------------------*/ @@ -116,7 +128,7 @@ extern "C" { #endif - /* The actual calls used by Mem_dh objects to allocate/free memory + /* The actual calls used by Mem_dh objects to allocate/free memory * from the heap. */ #define PRIVATE_MALLOC malloc @@ -175,7 +187,7 @@ you need to write EUCLID_GET_ROW() functions: see src/getRow.c #endif -/*---------------------------------------------------------------------- +/*---------------------------------------------------------------------- * macros for error handling everyplace except in main. *---------------------------------------------------------------------- */ @@ -251,13 +263,13 @@ you need to write EUCLID_GET_ROW() functions: see src/getRow.c return (retval); \ } -/*---------------------------------------------------------------------- +/*---------------------------------------------------------------------- * informational macros *---------------------------------------------------------------------- */ #define SET_INFO(msg) setInfo_dh(msg, __FUNC__, __FILE__, __LINE__); -/*---------------------------------------------------------------------- +/*---------------------------------------------------------------------- * macros for tracking the function call stack *---------------------------------------------------------------------- */ #ifdef OPTIMIZED_DH @@ -323,7 +335,7 @@ you need to write EUCLID_GET_ROW() functions: see src/getRow.c } \ -#endif +#endif #endif /* #ifndef MACROS_DH */ /****************************************************************************** @@ -352,16 +364,6 @@ you need to write EUCLID_GET_ROW() functions: see src/getRow.c * files are included. *-----------------------------------------------------------------------*/ -#if defined(HYPRE_MODE) -#include "HYPRE_parcsr_mv.h" -#include "HYPRE_config.h" -#include "HYPRE_distributed_matrix_mv.h" -#include "_hypre_utilities.h" - -#elif defined(PETSC_MODE) -#include "petsc_config.h" -#endif - #if ( !defined(FAKE_MPI) && defined(USING_MPI) && \ !defined(HYPRE_MODE) && !defined(PETSC_MODE) ) #include @@ -507,16 +509,16 @@ struct _extrows_dh { Factor_dh F; /* not owned! */ hypre_MPI_Status status[MAX_MPI_TASKS]; - hypre_MPI_Request req1[MAX_MPI_TASKS]; + hypre_MPI_Request req1[MAX_MPI_TASKS]; hypre_MPI_Request req2[MAX_MPI_TASKS]; - hypre_MPI_Request req3[MAX_MPI_TASKS]; + hypre_MPI_Request req3[MAX_MPI_TASKS]; hypre_MPI_Request req4[MAX_MPI_TASKS]; hypre_MPI_Request cval_req[MAX_MPI_TASKS]; hypre_MPI_Request fill_req[MAX_MPI_TASKS]; hypre_MPI_Request aval_req[MAX_MPI_TASKS]; /*------------------------------------------------------------------------ - * data structures for receiving, storing, and accessing external rows + * data structures for receiving, storing, and accessing external rows * from lower-ordered nabors *------------------------------------------------------------------------*/ /* for reception of row counts, row numbers, and row lengths: */ @@ -564,7 +566,7 @@ struct _extrows_dh { struct _factor_dh { /* dimensions of local rectangular submatrix; global matrix is n*n */ - HYPRE_Int m, n; + HYPRE_Int m, n; HYPRE_Int id; /* this subdomain's id after reordering */ HYPRE_Int beg_row; /* global number of 1st locally owned row */ @@ -577,7 +579,7 @@ struct _factor_dh { bool blockJacobi; /* sparse row-oriented storage for locally owned submatrix */ - HYPRE_Int *rp; + HYPRE_Int *rp; HYPRE_Int *cval; REAL_DH *aval; HYPRE_Int *fill; @@ -602,7 +604,7 @@ struct _factor_dh { hypre_MPI_Request recv_reqLo[MAX_MPI_TASKS], recv_reqHi[MAX_MPI_TASKS]; /* used for persistent comms */ hypre_MPI_Request send_reqLo[MAX_MPI_TASKS], send_reqHi[MAX_MPI_TASKS]; /* used for persistent comms */ hypre_MPI_Request requests[MAX_MPI_TASKS]; - hypre_MPI_Status status[MAX_MPI_TASKS]; + hypre_MPI_Status status[MAX_MPI_TASKS]; bool debug; }; @@ -668,7 +670,7 @@ extern void Vec_dhInit(Vec_dh v, HYPRE_Int size); extern void Vec_dhDuplicate(Vec_dh v, Vec_dh *out); /* creates vec and allocates storage, but neither - * initializes nor copies values + * initializes nor copies values */ extern void Vec_dhCopy(Vec_dh x, Vec_dh y); @@ -684,7 +686,7 @@ extern void Vec_dhSetRand(Vec_dh v); extern void Vec_dhRead(Vec_dh *v, HYPRE_Int ignore, char *filename); extern void Vec_dhReadBIN(Vec_dh *v, char *filename); extern void Vec_dhPrint(Vec_dh v, SubdomainGraph_dh sg, char *filename); -extern void Vec_dhPrintBIN(Vec_dh v, SubdomainGraph_dh sg, char *filename); +extern void Vec_dhPrintBIN(Vec_dh v, SubdomainGraph_dh sg, char *filename); #endif /****************************************************************************** * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other @@ -739,15 +741,15 @@ Misc. /* #include "euclid_common.h" */ struct _matgenfd { - bool allocateMem; + bool allocateMem; /* If true, memory is allocated when run() is called, in which case * the caller is responsible for calling FREE_DH for the rp, cval, * aval, and rhs arrays. If false, caller is assumed to have - * allocated memory when run is called. + * allocated memory when run is called. * Default is "true" */ HYPRE_Int px, py, pz; /* Processor graph dimensions */ - bool threeD; + bool threeD; HYPRE_Int m; /* number of matrix rows in local matrix */ HYPRE_Int cc; /* Dimension of each processor's subgrid */ HYPRE_Real hh; /* Grid spacing; this is constant, equal to 1.0/(px*cc-1) */ @@ -756,7 +758,7 @@ struct _matgenfd { HYPRE_Real stencil[8]; - /* derivative coefficients; a,b,c are 2nd derivatives, + /* derivative coefficients; a,b,c are 2nd derivatives, * c,d,e are 1st derivatives; f,g,h not currently used. */ HYPRE_Real a, b, c, d, e, f, g, h; @@ -768,7 +770,7 @@ struct _matgenfd { HYPRE_Real bcX1, bcX2; HYPRE_Real bcY1, bcY2; HYPRE_Real bcZ1, bcZ2; - + /* The following return coefficients; default is konstant() */ HYPRE_Real (*A)(HYPRE_Real coeff, HYPRE_Real x, HYPRE_Real y, HYPRE_Real z); HYPRE_Real (*B)(HYPRE_Real coeff, HYPRE_Real x, HYPRE_Real y, HYPRE_Real z); @@ -818,7 +820,7 @@ extern HYPRE_Real box_1(HYPRE_Real coeff, HYPRE_Real x, HYPRE_Real y, HYPRE_Real /* -bd2 is diffusion coeff outside box; -bd1 is diffusion coeff inside box. */ - + extern HYPRE_Real box_2(HYPRE_Real coeff, HYPRE_Real x, HYPRE_Real y, HYPRE_Real z); @@ -853,7 +855,7 @@ struct _mat_dh { HYPRE_Int bs; /* block size */ /* sparse row-oriented storage for locally owned submatrix */ - HYPRE_Int *rp; + HYPRE_Int *rp; HYPRE_Int *len; /* length of each row; only used for MPI triangular solves */ HYPRE_Int *cval; HYPRE_Int *fill; @@ -877,17 +879,17 @@ struct _mat_dh { bool matvec_timing; /* used for MatVecs */ - HYPRE_Int num_recv; + HYPRE_Int num_recv; HYPRE_Int num_send; /* used in destructor */ hypre_MPI_Request *recv_req; - hypre_MPI_Request *send_req; - HYPRE_Real *recvbuf, *sendbuf; + hypre_MPI_Request *send_req; + HYPRE_Real *recvbuf, *sendbuf; HYPRE_Int *sendind; - HYPRE_Int sendlen; - HYPRE_Int recvlen; + HYPRE_Int sendlen; + HYPRE_Int recvlen; bool matvecIsSetup; Numbering_dh numb; - hypre_MPI_Status *status; + hypre_MPI_Status *status; bool debug; }; @@ -959,7 +961,7 @@ extern void Mat_dhGetRow(Mat_dh B, HYPRE_Int globalRow, HYPRE_Int *len, HYPRE_In extern void Mat_dhRestoreRow(Mat_dh B, HYPRE_Int row, HYPRE_Int *len, HYPRE_Int **ind, HYPRE_Real **val); /* partition matrix into "k" blocks. User must free storage. */ -extern void Mat_dhPartition(Mat_dh mat, HYPRE_Int k, HYPRE_Int **beg_rowOUT, +extern void Mat_dhPartition(Mat_dh mat, HYPRE_Int k, HYPRE_Int **beg_rowOUT, HYPRE_Int **row_countOUT, HYPRE_Int **n2oOUT, HYPRE_Int **o2nOUT); @@ -1015,7 +1017,7 @@ struct _subdomain_dh { HYPRE_Int *beg_row; /* global ordering of first local row owned by P_i */ HYPRE_Int *beg_rowP; /* global ordering of first local row owned by P_i after - subdomain reordering + subdomain reordering */ HYPRE_Int *row_count; /* P_i owns row_count[i] local rows */ HYPRE_Int *bdry_count; /* bdry_count[i] of P_i's rows are boundary rows */ @@ -1045,7 +1047,7 @@ extern void SubdomainGraph_dhDestroy(SubdomainGraph_dh s); extern void SubdomainGraph_dhInit(SubdomainGraph_dh s, HYPRE_Int blocks, bool bj, void *A); /* Partitions matrix A into the specified number of blocks, - if there is a single MPI task; for mpi use, "blocks" must be the same + if there is a single MPI task; for mpi use, "blocks" must be the same as the number of mpi tasks; for sequential, it may vary. On completion, the subdomain graph will be fully formed, (all fields valid); o2n_row[] and n2o_col[] will be permutations @@ -1102,11 +1104,11 @@ extern void SubdomainGraph_dhPrintStats(SubdomainGraph_dh sg, FILE *fp); ******************************************************************************/ /* - Euclid employs a global object: + Euclid employs a global object: TimeLog_dh timlog_dh; - for recording timing information. + for recording timing information. */ #ifndef TIMELOG_DH_DH @@ -1215,7 +1217,7 @@ extern void shellSort_int_int_float(HYPRE_Int n, HYPRE_Int *x, HYPRE_Int *y, HYP struct _numbering_dh { HYPRE_Int size; /* max number of indices that can be stored; - (length of idx_ext[]) + (length of idx_ext[]) */ HYPRE_Int first; /* global number of 1st local index (row) */ HYPRE_Int m; /* number of local indices (number of local rows in mat) */ @@ -1243,7 +1245,7 @@ extern void Numbering_dhSetup(Numbering_dh numb, Mat_dh mat); output: local_out[len], containing corresponding local numbers. note: global_in[] and local_out[] may be identical. */ -extern void Numbering_dhGlobalToLocal(Numbering_dh numb, HYPRE_Int len, +extern void Numbering_dhGlobalToLocal(Numbering_dh numb, HYPRE_Int len, HYPRE_Int *global_in, HYPRE_Int *local_out); #endif @@ -1263,10 +1265,10 @@ extern void Numbering_dhGlobalToLocal(Numbering_dh numb, HYPRE_Int len, #define HASH_I_DH /* #include "euclid_common.h" */ - + /* - class methods - note: all parameters are inputs; the only output + class methods + note: all parameters are inputs; the only output is the "HYPRE_Int" returned by Hash_i_dhLookup. */ extern void Hash_i_dhCreate(Hash_i_dh *h, HYPRE_Int size); @@ -1312,7 +1314,7 @@ extern HYPRE_Int Hash_i_dhLookup(Hash_i_dh h, HYPRE_Int key); * You may need to fiddle with some of these includes, depending * on your system. Make sure and check the logFile to ensure * that CLK_TCK was properly defined. See Timer_dhCreate() - * for additional details. + * for additional details. * * if "JUNK_TIMING" is defined during compilation, timing functions * either do nothing, or return -1.0; this is primarily for debugging. @@ -1333,7 +1335,7 @@ extern HYPRE_Int Hash_i_dhLookup(Hash_i_dh h, HYPRE_Int key); #endif -/* +/* ??? may be needed for some compilers/platforms? #include #include @@ -1346,14 +1348,14 @@ extern HYPRE_Int Hash_i_dhLookup(Hash_i_dh h, HYPRE_Int key); struct _timer_dh { bool isRunning; hypre_longint sc_clk_tck; - HYPRE_Real begin_wall; + HYPRE_Real begin_wall; HYPRE_Real end_wall; #ifdef EUCLID_TIMING struct tms begin_cpu; struct tms end_cpu; #endif - + }; extern void Timer_dhCreate(Timer_dh *t); @@ -1365,7 +1367,7 @@ extern HYPRE_Real Timer_dhReadWall(Timer_dh t); extern HYPRE_Real Timer_dhReadUsage(Timer_dh t); /* notes: - (1) unless compiled with EUCLID_TIMING defined, readCPU + (1) unless compiled with EUCLID_TIMING defined, readCPU and readUseage return -1.0. (2) whenever start() is called, the timer is reset; you don't need to call stop() first. @@ -1491,7 +1493,7 @@ extern SRecord * SortedList_dhGetSmallest(SortedList_dh sList); extern SRecord * SortedList_dhGetSmallestLowerTri(SortedList_dh sList); /* returns record with smallest column value that hasn't been - retrieved via this method since last call to reset. + retrieved via this method since last call to reset. Only returns records where SRecord sr.col < row (per Init). If all records have been retrieved, returns NULL. */ @@ -1504,14 +1506,14 @@ extern void SortedList_dhInsert(SortedList_dh sList, SRecord *sr); extern void SortedList_dhInsertOrUpdateVal(SortedList_dh sList, SRecord *sr); /* unilateral insert: does not check to see if already - inserted; does not permute sr->col; used in numeric + inserted; does not permute sr->col; used in numeric factorization routines. */ extern bool SortedList_dhPermuteAndInsert(SortedList_dh sList, SRecord *sr, HYPRE_Real thresh); /* permutes sr->col, and inserts record in sorted list. Note: the contents of the passed variable "sr" may be changed. - Note: this performs sparsification + Note: this performs sparsification */ @@ -1525,7 +1527,7 @@ extern void SortedList_dhInsertOrUpdate(SortedList_dh sList, SRecord *sr); */ extern SRecord * SortedList_dhFind(SortedList_dh sList, SRecord *sr); - /* returns NULL if no record is found containing sr->col + /* returns NULL if no record is found containing sr->col */ extern void SortedList_dhUpdateVal(SortedList_dh sList, SRecord *sr); @@ -1606,7 +1608,7 @@ extern void Hash_dhPrint(Hash_dh h, FILE *fp); /* Functions called by Mat_dh, Factor_dh, and possibly others. Also, a few handy functions for dealing with permutations, etc. - + */ /* #include "euclid_common.h" */ @@ -1618,7 +1620,7 @@ extern void mat_dh_transpose_private(HYPRE_Int m, HYPRE_Int *rpIN, HYPRE_Int **r HYPRE_Real *avalIN, HYPRE_Real **avalOUT); /* same as above, but memory for output was already allocated */ -extern void mat_dh_transpose_reuse_private(HYPRE_Int m, +extern void mat_dh_transpose_reuse_private(HYPRE_Int m, HYPRE_Int *rpIN, HYPRE_Int *cvalIN, HYPRE_Real *avalIN, HYPRE_Int *rpOUT, HYPRE_Int *cvalOUT, HYPRE_Real *avalOUT); @@ -1631,7 +1633,7 @@ extern void mat_dh_transpose_reuse_private(HYPRE_Int m, * the "ignore" parameter is only used for the matrix "trip" format, * and the vector "csr" and "trip" formats (which are misnamed, and identical); * the intention is to skip over the first "ignore" lines of the file; - * this is a hack to enable reading of Matrix Market, etc, formats. + * this is a hack to enable reading of Matrix Market, etc, formats. *-------------------------------------------------------------------------*/ extern void readMat(Mat_dh *Aout, char *fileType, char *fileName, HYPRE_Int ignore); extern void readVec(Vec_dh *bout, char *fileType, char *fileName, HYPRE_Int ignore); @@ -1639,7 +1641,7 @@ extern void writeMat(Mat_dh Ain, char *fileType, char *fileName); extern void writeVec(Vec_dh b, char *fileType, char *fileName); /* Next function is primarily (?) for testing/development/debugging. - P_0 reads and partitions the matrix, then distributes + P_0 reads and partitions the matrix, then distributes amongst the other processors. */ extern void readMat_par(Mat_dh *Aout, char *fileType, char *fileName, HYPRE_Int ignore); @@ -1660,7 +1662,7 @@ extern void profileMat(Mat_dh A); * beg_row is global number of 1st locally owned row; * m, beg_row, rp, cval may not be null (caller's responsiblity); * if n2o is NULL, it's assumed that o2n is NULL; - * if + * if * * error thrown: * if a nonlocal column (a column index that is less than beg_row, @@ -1671,30 +1673,30 @@ extern void profileMat(Mat_dh A); *-------------------------------------------------------------------------*/ /* seq or mpi */ -extern void mat_dh_print_graph_private(HYPRE_Int m, HYPRE_Int beg_row, HYPRE_Int *rp, HYPRE_Int *cval, +extern void mat_dh_print_graph_private(HYPRE_Int m, HYPRE_Int beg_row, HYPRE_Int *rp, HYPRE_Int *cval, HYPRE_Real *aval, HYPRE_Int *n2o, HYPRE_Int *o2n, Hash_i_dh hash, FILE* fp); /* seq; reordering not implemented */ /* see io_dh.h - HYPRE_Int *rp, HYPRE_Int *cval, HYPRE_Real *aval, + HYPRE_Int *rp, HYPRE_Int *cval, HYPRE_Real *aval, HYPRE_Int *n2o, HYPRE_Int *o2n, Hash_i_dh hash, char *filename); */ /* seq only */ extern void mat_dh_print_csr_private(HYPRE_Int m, HYPRE_Int *rp, HYPRE_Int *cval, HYPRE_Real *aval, - FILE* fp); + FILE* fp); /* seq only */ extern void mat_dh_read_csr_private(HYPRE_Int *m, HYPRE_Int **rp, HYPRE_Int **cval, HYPRE_Real **aval, - FILE* fp); + FILE* fp); /* seq only */ -extern void mat_dh_read_triples_private(HYPRE_Int ignore, HYPRE_Int *m, HYPRE_Int **rp, - HYPRE_Int **cval, HYPRE_Real **aval, FILE* fp); +extern void mat_dh_read_triples_private(HYPRE_Int ignore, HYPRE_Int *m, HYPRE_Int **rp, + HYPRE_Int **cval, HYPRE_Real **aval, FILE* fp); -/* seq or mpi */ +/* seq or mpi */ /* see io_dh.h HYPRE_Real **aval, char *filename); */ @@ -1808,7 +1810,7 @@ extern void ilut_seq(Euclid_dh ctx); * Mat_dhSolve, and is in src/Mat_dh.c * * Users should only need to call functions with names of the form - * Euclid_dhXXX (public functions). + * Euclid_dhXXX (public functions). * * Some of the functions whose names are of the form XXX_private_XXX, * as could easily be static functions; similarly, the enums and @@ -1871,21 +1873,21 @@ enum{ SOLVE_START_T, #define STATS_BINS 10 enum{ NZA_STATS, /* cumulative nonzeros for all systems solved */ NZF_STATS, /* cumulative nonzeros for all systems solved */ - NZA_USED_STATS, /* cumulative nonzeros NOT dropped by sparseA */ + NZA_USED_STATS, /* cumulative nonzeros NOT dropped by sparseA */ NZA_RATIO_STATS /* NZA_USED_STATS/NZA_STATS, over all processors */ }; -/* primary data structure: this is monstrously long; but it works. +/* primary data structure: this is monstrously long; but it works. Users must ensure the following fields are initialized prior to calling Euclid_dhSetup(): m, n, beg_row, A */ struct _mpi_interface_dh { bool isSetup; - HYPRE_Real rho_init; - HYPRE_Real rho_final; - /* Memory allocation for factor; will initially allocate space for + HYPRE_Real rho_init; + HYPRE_Real rho_final; + /* Memory allocation for factor; will initially allocate space for rho_init*nzA nonzeros; rho_final is computed after factorization, and is the minimum that rho_init whoulc have been to avoid memory reallocation; rho_final is a maximum across all processors. @@ -1896,7 +1898,7 @@ struct _mpi_interface_dh { HYPRE_Real *rhs; /* used for debugging; this vector is not owned! */ void *A; /* PETSc, HYPRE, Euclid, or other matrix object. */ Factor_dh F; /* data structure for the factor, F = L+U-I */ - SubdomainGraph_dh sg; + SubdomainGraph_dh sg; REAL_DH *scale; /* row scaling vector */ bool isScaled; /* set at runtime, turns scaling on or off */ @@ -1937,10 +1939,10 @@ struct _mpi_interface_dh { bool timingsWereReduced; bool printStats; /* if true, on 2nd and subsequent calls to Setup, calls Euclid_dhPrintStatsShorter(). Intent is to - print out stats for each setup phase when + print out stats for each setup phase when using Euclid, e.g, for nonlinear solves. */ -}; +}; #endif /* #ifndef EUCLID_MPI_INTERFACE_DH */ /****************************************************************************** @@ -1955,10 +1957,10 @@ struct _mpi_interface_dh { /* #include "blas_dh.h" */ -extern void bicgstab_euclid(Mat_dh A, Euclid_dh ctx, HYPRE_Real *x, HYPRE_Real *b, +extern void bicgstab_euclid(Mat_dh A, Euclid_dh ctx, HYPRE_Real *x, HYPRE_Real *b, HYPRE_Int *itsOUT); -extern void cg_euclid(Mat_dh A, Euclid_dh ctx, HYPRE_Real *x, HYPRE_Real *b, +extern void cg_euclid(Mat_dh A, Euclid_dh ctx, HYPRE_Real *x, HYPRE_Real *b, HYPRE_Int *itsOUT); #endif @@ -1970,7 +1972,7 @@ extern void cg_euclid(Mat_dh A, Euclid_dh ctx, HYPRE_Real *x, HYPRE_Real *b, ******************************************************************************/ /* - Note: this module contains functionality for reading/writing + Note: this module contains functionality for reading/writing Euclid's binary io format, and opening and closing files. Additional io can be found in in mat_dh_private, which contains private functions for reading/writing various matrix and @@ -1997,7 +1999,7 @@ bool isSmallEndian(); /* seq only ?? */ extern void io_dh_print_ebin_mat_private(HYPRE_Int m, HYPRE_Int beg_row, - HYPRE_Int *rp, HYPRE_Int *cval, HYPRE_Real *aval, + HYPRE_Int *rp, HYPRE_Int *cval, HYPRE_Real *aval, HYPRE_Int *n2o, HYPRE_Int *o2n, Hash_i_dh hash, char *filename); /* seq only ?? */ @@ -2050,4 +2052,3 @@ extern void ScaleVec(HYPRE_Int n, HYPRE_Real alpha, HYPRE_Real *x); #endif #endif - diff --git a/src/distributed_ls/Euclid/euclid_common.h b/src/distributed_ls/Euclid/euclid_common.h index ef0e3ee6f5..24dbaa4d67 100644 --- a/src/distributed_ls/Euclid/euclid_common.h +++ b/src/distributed_ls/Euclid/euclid_common.h @@ -24,16 +24,6 @@ * files are included. *-----------------------------------------------------------------------*/ -#if defined(HYPRE_MODE) -#include "HYPRE_parcsr_mv.h" -#include "HYPRE_config.h" -#include "HYPRE_distributed_matrix_mv.h" -#include "_hypre_utilities.h" - -#elif defined(PETSC_MODE) -#include "petsc_config.h" -#endif - #if ( !defined(FAKE_MPI) && defined(USING_MPI) && \ !defined(HYPRE_MODE) && !defined(PETSC_MODE) ) #include diff --git a/src/distributed_ls/Euclid/globalObjects.c b/src/distributed_ls/Euclid/globalObjects.c index 43c6d546c2..3740bf038c 100644 --- a/src/distributed_ls/Euclid/globalObjects.c +++ b/src/distributed_ls/Euclid/globalObjects.c @@ -7,7 +7,7 @@ #include "_hypre_Euclid.h" -/* Contains definitions of globally scoped objects; +/* Contains definitions of globally scoped objects; * Also, functions for error handling and message logging. */ @@ -25,17 +25,14 @@ Parser_dh parser_dh = NULL; /* for setting/getting runtime options */ TimeLog_dh tlog_dh = NULL; /* internal timing functionality */ Mem_dh mem_dh = NULL; /* memory management */ FILE *logFile = NULL; -#if defined(HYPRE_USING_RAJA) || defined(HYPRE_USING_KOKKOS) || defined(HYPRE_USING_CUDA) -#else char msgBuf_dh[MSG_BUF_SIZE_DH]; /* for internal use */ -#endif HYPRE_Int np_dh = 1; /* number of processors and subdomains */ HYPRE_Int myid_dh = 0; /* rank of this processor (and subdomain) */ MPI_Comm comm_dh = 0; /* Each processor (may) open a logfile. - * The bools are switches for controlling the amount of informational + * The bools are switches for controlling the amount of informational * output, and where it gets written to. Function logging is only enabled * when compiled with the debugging (-g) option. */ @@ -52,7 +49,7 @@ HYPRE_Int ref_counter = 0; /*------------------------------------------------------------------------- - * End of global definitions. + * End of global definitions. * Error and info functions follow. *-------------------------------------------------------------------------*/ @@ -75,7 +72,7 @@ void openLogfile_dh(HYPRE_Int argc, char *argv[]) /* this doesn't really belong here, but it's gotta go someplace! */ /* strcpy(errMsg, "error msg was never set -- ??"); */ - if (logFile != NULL) return; + if (logFile != NULL) return; /* set default logging filename */ hypre_sprintf(buf, "logFile"); @@ -84,7 +81,7 @@ void openLogfile_dh(HYPRE_Int argc, char *argv[]) if (argc && argv != NULL) { HYPRE_Int j; for (j=1; j%s< for writing; continuing anyway\n", buf); } - } + } } void closeLogfile_dh() @@ -118,12 +115,12 @@ void closeLogfile_dh() void setInfo_dh(const char *msg,const char *function,const char *file, HYPRE_Int line) { if (logInfoToFile && logFile != NULL) { - hypre_fprintf(logFile, "INFO: %s;\n function= %s file=%s line=%i\n", + hypre_fprintf(logFile, "INFO: %s;\n function= %s file=%s line=%i\n", msg, function, file, line); fflush(logFile); } if (logInfoToStderr) { - hypre_fprintf(stderr, "INFO: %s;\n function= %s file=%s line=%i\n", + hypre_fprintf(stderr, "INFO: %s;\n function= %s file=%s line=%i\n", msg, function, file, line); } } @@ -135,7 +132,7 @@ void setInfo_dh(const char *msg,const char *function,const char *file, HYPRE_In void dh_StartFunc(const char *function,const char *file, HYPRE_Int line, HYPRE_Int priority) { if (priority == 1) { - hypre_sprintf(calling_stack[calling_stack_count], + hypre_sprintf(calling_stack[calling_stack_count], "[%i] %s file= %s line= %i", myid_dh, function, file, line); /* priority_private[calling_stack_count] = priority; */ ++calling_stack_count; @@ -170,12 +167,12 @@ void setError_dh(const char *msg,const char *function,const char *file, HYPRE_I { errFlag_dh = true; if (! strcmp(msg, "")) { - hypre_sprintf(errMsg_private[errCount_private], - "[%i] called from: %s file= %s line= %i", + hypre_sprintf(errMsg_private[errCount_private], + "[%i] called from: %s file= %s line= %i", myid_dh, function, file, line); } else { - hypre_sprintf(errMsg_private[errCount_private], - "[%i] ERROR: %s\n %s file= %s line= %i\n", + hypre_sprintf(errMsg_private[errCount_private], + "[%i] ERROR: %s\n %s file= %s line= %i\n", myid_dh, msg, function, file, line); } ++errCount_private; @@ -234,26 +231,26 @@ void Error_dhStartFunc(char *function, char *file, HYPRE_Int line) /* get rid of string null-terminator from last * call (if any) to Error_dhStartFunc() */ - spaces[INDENT_DH*nesting] = ' '; + spaces[INDENT_DH*nesting] = ' '; /* add null-terminator, so the correct number of spaces will be printed */ - ++nesting; + ++nesting; if (nesting > MAX_ERROR_SPACES-1) nesting = MAX_ERROR_SPACES-1; spaces[INDENT_DH*nesting] = '\0'; if (logFuncsToStderr) { - hypre_fprintf(stderr, "%s(%i) %s [file= %s line= %i]\n", + hypre_fprintf(stderr, "%s(%i) %s [file= %s line= %i]\n", spaces, nesting, function, file, line); } if (logFuncsToFile && logFile != NULL) { - hypre_fprintf(logFile, "%s(%i) %s [file= %s line= %i]\n", + hypre_fprintf(logFile, "%s(%i) %s [file= %s line= %i]\n", spaces, nesting, function, file, line); fflush(logFile); } } void Error_dhEndFunc(char *function) -{ +{ nesting -= 1; if (nesting < 0) nesting = 0; spaces[INDENT_DH*nesting] = '\0'; @@ -279,7 +276,7 @@ void EuclidInitialize(HYPRE_Int argc, char *argv[], char *help) if (! EuclidIsActive) { hypre_MPI_Comm_size(comm_dh, &np_dh); hypre_MPI_Comm_rank(comm_dh, &myid_dh); - openLogfile_dh(argc, argv); + openLogfile_dh(argc, argv); if (mem_dh == NULL) { Mem_dhCreate(&mem_dh); CHECK_V_ERROR; } if (tlog_dh == NULL) { TimeLog_dhCreate(&tlog_dh); CHECK_V_ERROR; } if (parser_dh == NULL) { Parser_dhCreate(&parser_dh); CHECK_V_ERROR; } @@ -291,7 +288,7 @@ void EuclidInitialize(HYPRE_Int argc, char *argv[], char *help) if (myid_dh == 0) hypre_printf("%s\n\n", help); EUCLID_EXIT; } - if (Parser_dhHasSwitch(parser_dh, "-logFuncsToFile")) { + if (Parser_dhHasSwitch(parser_dh, "-logFuncsToFile")) { logFuncsToFile = true; } if (Parser_dhHasSwitch(parser_dh, "-logFuncsToStderr")) { diff --git a/src/distributed_ls/Euclid/headers b/src/distributed_ls/Euclid/headers index 5315dbab9b..22af069180 100755 --- a/src/distributed_ls/Euclid/headers +++ b/src/distributed_ls/Euclid/headers @@ -12,6 +12,8 @@ INTERNAL_HEADER=_hypre_Euclid.h cat > $INTERNAL_HEADER <<@ +/*** DO NOT EDIT THIS FILE DIRECTLY (use 'headers' to generate) ***/ + #ifndef hypre_EUCLID_HEADER #define hypre_EUCLID_HEADER @@ -20,6 +22,16 @@ cat > $INTERNAL_HEADER <<@ #define HYPRE_MODE #define OPTIMIZED_DH +#if defined(HYPRE_MODE) +#include "HYPRE_parcsr_mv.h" +#include "HYPRE_config.h" +#include "HYPRE_distributed_matrix_mv.h" +#include "_hypre_utilities.h" + +#elif defined(PETSC_MODE) +#include "petsc_config.h" +#endif + #ifdef __cplusplus extern "C" { #endif @@ -71,4 +83,3 @@ cat >> $INTERNAL_HEADER <<@ #endif @ - diff --git a/src/parcsr_ls/HYPRE_parcsr_ls.h b/src/parcsr_ls/HYPRE_parcsr_ls.h index 9dd4d9680a..b0f025cdf6 100644 --- a/src/parcsr_ls/HYPRE_parcsr_ls.h +++ b/src/parcsr_ls/HYPRE_parcsr_ls.h @@ -3630,7 +3630,7 @@ HYPRE_Int HYPRE_MGRSetFSolver(HYPRE_Solver solver, HYPRE_PtrToParSolverFcn fine_grid_solver_setup, HYPRE_Solver fsolver ); -HYPRE_Int HYPRE_MGRBuildAffNew(HYPRE_ParCSRMatrix A, +HYPRE_Int HYPRE_MGRBuildAff(HYPRE_ParCSRMatrix A, HYPRE_Int *CF_marker, HYPRE_Int debug_flag, HYPRE_ParCSRMatrix *A_ff); diff --git a/src/parcsr_ls/HYPRE_parcsr_mgr.c b/src/parcsr_ls/HYPRE_parcsr_mgr.c index cbfc040e0e..662e9400f2 100644 --- a/src/parcsr_ls/HYPRE_parcsr_mgr.c +++ b/src/parcsr_ls/HYPRE_parcsr_mgr.c @@ -135,12 +135,12 @@ HYPRE_MGRSetFSolver(HYPRE_Solver solver, (void *) fsolver ) ); } -HYPRE_Int HYPRE_MGRBuildAffNew(HYPRE_ParCSRMatrix A, +HYPRE_Int HYPRE_MGRBuildAff(HYPRE_ParCSRMatrix A, HYPRE_Int *CF_marker, HYPRE_Int debug_flag, HYPRE_ParCSRMatrix *A_ff) { - return (hypre_MGRBuildAffNew(A, CF_marker, debug_flag, A_ff)); + return (hypre_MGRBuildAff(A, CF_marker, debug_flag, A_ff)); } /*-------------------------------------------------------------------------- diff --git a/src/parcsr_ls/_hypre_parcsr_ls.h b/src/parcsr_ls/_hypre_parcsr_ls.h index 59fd5960b0..18074a85fe 100644 --- a/src/parcsr_ls/_hypre_parcsr_ls.h +++ b/src/parcsr_ls/_hypre_parcsr_ls.h @@ -1802,11 +1802,11 @@ HYPRE_Int hypre_blockRelax_solve(hypre_ParCSRMatrix *A, hypre_ParVector *f, hypr HYPRE_Int hypre_blockRelax_setup(hypre_ParCSRMatrix *A,HYPRE_Int blk_size, HYPRE_Int reserved_coarse_size, HYPRE_Real **diaginvptr); HYPRE_Int hypre_blockRelax(hypre_ParCSRMatrix *A, hypre_ParVector *f, hypre_ParVector *u, HYPRE_Int blk_size, HYPRE_Int reserved_coarse_size, HYPRE_Int method, hypre_ParVector *Vtemp, hypre_ParVector *Ztemp); -HYPRE_Int hypre_MGRBuildAff( MPI_Comm comm, HYPRE_Int local_num_variables, HYPRE_Int num_functions, -HYPRE_Int *dof_func, HYPRE_Int *CF_marker, HYPRE_Int **coarse_dof_func_ptr, HYPRE_BigInt **coarse_pnts_global_ptr, -hypre_ParCSRMatrix *A, HYPRE_Int debug_flag, hypre_ParCSRMatrix **P_f_ptr, hypre_ParCSRMatrix **A_ff_ptr ); +//HYPRE_Int hypre_MGRBuildAffRAP( MPI_Comm comm, HYPRE_Int local_num_variables, HYPRE_Int num_functions, +//HYPRE_Int *dof_func, HYPRE_Int *CF_marker, HYPRE_Int **coarse_dof_func_ptr, HYPRE_BigInt **coarse_pnts_global_ptr, +//hypre_ParCSRMatrix *A, HYPRE_Int debug_flag, hypre_ParCSRMatrix **P_f_ptr, hypre_ParCSRMatrix **A_ff_ptr ); HYPRE_Int hypre_MGRGetSubBlock( hypre_ParCSRMatrix *A, HYPRE_Int *row_cf_marker, HYPRE_Int *col_cf_marker, HYPRE_Int debug_flag, hypre_ParCSRMatrix **A_ff_ptr ); -HYPRE_Int hypre_MGRBuildAffNew( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, HYPRE_Int debug_flag, hypre_ParCSRMatrix **A_ff_ptr ); +HYPRE_Int hypre_MGRBuildAff( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, HYPRE_Int debug_flag, hypre_ParCSRMatrix **A_ff_ptr ); HYPRE_Int hypre_MGRApproximateInverse(hypre_ParCSRMatrix *A, hypre_ParCSRMatrix **A_inv); HYPRE_Int hypre_MGRAddVectorP ( HYPRE_Int *CF_marker, HYPRE_Int point_type, HYPRE_Real a, hypre_ParVector *fromVector, HYPRE_Real b, hypre_ParVector **toVector ); HYPRE_Int hypre_MGRAddVectorR ( HYPRE_Int *CF_marker, HYPRE_Int point_type, HYPRE_Real a, hypre_ParVector *fromVector, HYPRE_Real b, hypre_ParVector **toVector ); diff --git a/src/parcsr_ls/par_mgr.c b/src/parcsr_ls/par_mgr.c index 4b72bdead9..37bf93fd59 100644 --- a/src/parcsr_ls/par_mgr.c +++ b/src/parcsr_ls/par_mgr.c @@ -889,7 +889,10 @@ hypre_MGRBuildP( hypre_ParCSRMatrix *A, hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm,&my_id); - num_threads = hypre_NumThreads(); + //num_threads = hypre_NumThreads(); + // Temporary fix, disable threading + // TODO: enable threading + num_threads = 1; #ifdef HYPRE_NO_GLOBAL_PARTITION //my_first_cpt = num_cpts_global[0]; @@ -1460,7 +1463,10 @@ hypre_MGRBuildPDRS( hypre_ParCSRMatrix *A, hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm,&my_id); - num_threads = hypre_NumThreads(); + //num_threads = hypre_NumThreads(); + // Temporary fix, disable threading + // TODO: enable threading + num_threads = 1; #ifdef HYPRE_NO_GLOBAL_PARTITION //my_first_cpt = num_cpts_global[0]; @@ -2128,8 +2134,9 @@ hypre_MGRComputeNonGalerkinCoarseGrid(hypre_ParCSRMatrix *A, HYPRE_Int *A_h_correction_offd_i = hypre_CSRMatrixI(A_h_correction_offd); HYPRE_Int *A_h_correction_offd_j = hypre_CSRMatrixJ(A_h_correction_offd); - if (Pmax > 0) - { + // Allow for maximum dropping with Pmax = 0 + //if (Pmax > 0) + //{ if (ordering == 0) // interleaved ordering { HYPRE_Int *A_h_correction_diag_i_new = hypre_CTAlloc(HYPRE_Int, n_local_cpoints+1, HYPRE_MEMORY_HOST); @@ -2229,7 +2236,7 @@ hypre_MGRComputeNonGalerkinCoarseGrid(hypre_ParCSRMatrix *A, hypre_printf("Error!! Block ordering is not supported at the moment\n"); exit(-1); } - } + //} //hypre_MGRParCSRMatrixTruncate(A_h_correction, max_elmts); //wall_time = time_getWallclockSeconds() - wall_time; //hypre_printf("Filter A_h_correction time: %1.5f\n", wall_time); @@ -4687,7 +4694,10 @@ hypre_MGRGetSubBlock( hypre_ParCSRMatrix *A, hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm,&my_id); - num_threads = hypre_NumThreads(); + //num_threads = hypre_NumThreads(); + // Temporary fix, disable threading + // TODO: enable threading + num_threads = 1; /* get the number of coarse rows */ hypre_BoomerAMGCoarseParms(comm, local_numrows, 1, NULL, row_cf_marker, &coarse_dof_func_ptr, &num_row_cpts_global); @@ -5081,7 +5091,7 @@ hypre_MGRGetSubBlock( hypre_ParCSRMatrix *A, /* Build A_FF matrix from A given a CF_marker array */ HYPRE_Int -hypre_MGRBuildAffNew( hypre_ParCSRMatrix *A, +hypre_MGRBuildAff( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, HYPRE_Int debug_flag, hypre_ParCSRMatrix **A_ff_ptr ) @@ -5173,8 +5183,9 @@ hypre_MGRAddVectorR ( HYPRE_Int *CF_marker, return 0; } +/* HYPRE_Int -hypre_MGRBuildAff( MPI_Comm comm, HYPRE_Int local_num_variables, HYPRE_Int num_functions, +hypre_MGRBuildAffRAP( MPI_Comm comm, HYPRE_Int local_num_variables, HYPRE_Int num_functions, HYPRE_Int *dof_func, HYPRE_Int *CF_marker, HYPRE_Int **coarse_dof_func_ptr, HYPRE_BigInt **coarse_pnts_global_ptr, hypre_ParCSRMatrix *A, HYPRE_Int debug_flag, hypre_ParCSRMatrix **P_f_ptr, hypre_ParCSRMatrix **A_ff_ptr ) { @@ -5191,6 +5202,7 @@ hypre_MGRBuildAff( MPI_Comm comm, HYPRE_Int local_num_variables, HYPRE_Int num_f hypre_TFree(CF_marker_copy, HYPRE_MEMORY_HOST); return 0; } +*/ /* Get pointer to coarse grid matrix for MGR solver */ HYPRE_Int diff --git a/src/parcsr_ls/par_mgr.h b/src/parcsr_ls/par_mgr.h index d1e4e9763f..c62240cecc 100644 --- a/src/parcsr_ls/par_mgr.h +++ b/src/parcsr_ls/par_mgr.h @@ -72,6 +72,7 @@ typedef struct HYPRE_Int use_default_cgrid_solver; HYPRE_Int use_default_fsolver; +// HYPRE_Int fsolver_type; HYPRE_Real omega; /* temp vectors for solve phase */ diff --git a/src/parcsr_ls/par_mgr_setup.c b/src/parcsr_ls/par_mgr_setup.c index 57bdc7dc93..f7769d0581 100644 --- a/src/parcsr_ls/par_mgr_setup.c +++ b/src/parcsr_ls/par_mgr_setup.c @@ -441,6 +441,7 @@ hypre_MGRSetup( void *mgr_vdata, HYPRE_ILUSetType(mgr_data -> global_smoother, 0); HYPRE_ILUSetLevelOfFill(mgr_data -> global_smoother, 0); HYPRE_ILUSetMaxIter(mgr_data -> global_smoother, global_smooth_iters); + HYPRE_ILUSetTol(mgr_data -> global_smoother, 0.0); HYPRE_ILUSetup(mgr_data -> global_smoother, A, f, u); } } @@ -857,8 +858,8 @@ hypre_MGRSetup( void *mgr_vdata, /* Compute RAP for next level */ if (use_non_galerkin_cg[lev] != 0) { - //HYPRE_Int keep_stencil = (set_c_points_method == 1 ? 0 : 1); - hypre_MGRComputeNonGalerkinCoarseGrid(A_array[lev], P, RT, 2/*hypre_max(block_size - lev - 1, 1)*/, + HYPRE_Int block_num_f_points = (lev == 0 ? block_size : block_num_coarse_indexes[lev-1]) - block_num_coarse_indexes[lev]; + hypre_MGRComputeNonGalerkinCoarseGrid(A_array[lev], P, RT, block_num_f_points, /* ordering */0, /* method */ 0, max_elmts, /* keep_stencil */ 0, CF_marker_array[lev], &RAP_ptr); hypre_ParCSRMatrixOwnsColStarts(RAP_ptr) = 0; hypre_ParCSRMatrixOwnsColStarts(P_array[lev]) = 0; @@ -870,11 +871,23 @@ hypre_MGRSetup( void *mgr_vdata, } } - if (Frelax_method[lev] == 99) // full AMG + if (Frelax_method[lev] == 2) // full AMG { - if (!use_default_fsolver) // user provided AMG solver + // user provided AMG solver + // only support AMG at the first level + // TODO: input check to avoid crashing + if (lev == 0 && use_default_fsolver == 0) { - A_ff_ptr = ((hypre_ParAMGData*)aff_solver[lev])->A_array[0]; + if (((hypre_ParAMGData*)aff_solver[0])->A_array[0] == NULL) + { + if (my_id == 0) + { + printf("Error!!! F-relaxation solver has not been setup.\n"); + hypre_error(1); + return hypre_error_flag; + } + } + A_ff_ptr = ((hypre_ParAMGData*)aff_solver[0])->A_array[0]; F_fine_array[lev+1] = hypre_ParVectorCreate(hypre_ParCSRMatrixComm(A_ff_ptr), @@ -893,7 +906,7 @@ hypre_MGRSetup( void *mgr_vdata, } else // construct default AMG solver { - hypre_MGRBuildAffNew(A_array[lev], CF_marker_array[lev], debug_flag, &A_ff_ptr); + hypre_MGRBuildAff(A_array[lev], CF_marker_array[lev], debug_flag, &A_ff_ptr); F_fine_array[lev+1] = hypre_ParVectorCreate(hypre_ParCSRMatrixComm(A_ff_ptr), @@ -912,6 +925,7 @@ hypre_MGRSetup( void *mgr_vdata, aff_solver[lev] = (HYPRE_Solver*) hypre_BoomerAMGCreate(); hypre_BoomerAMGSetMaxIter(aff_solver[lev], 1); + hypre_BoomerAMGSetTol(aff_solver[lev], 0.0); hypre_BoomerAMGSetRelaxOrder(aff_solver[lev], 1); //hypre_BoomerAMGSetAggNumLevels(aff_solver[lev], 1); hypre_BoomerAMGSetNumSweeps(aff_solver[lev], 3); @@ -1051,6 +1065,7 @@ hypre_MGRSetup( void *mgr_vdata, /* create and set default solver parameters here */ default_cg_solver = (HYPRE_Solver) hypre_BoomerAMGCreate(); hypre_BoomerAMGSetMaxIter ( default_cg_solver, 1 ); + hypre_BoomerAMGSetTol ( default_cg_solver, 0.0 ); hypre_BoomerAMGSetRelaxOrder( default_cg_solver, 1); hypre_BoomerAMGSetPrintLevel(default_cg_solver, print_level); /* set setup and solve functions */ diff --git a/src/parcsr_ls/par_mgr_solve.c b/src/parcsr_ls/par_mgr_solve.c index bcbb6ec0bd..ec4d235cee 100644 --- a/src/parcsr_ls/par_mgr_solve.c +++ b/src/parcsr_ls/par_mgr_solve.c @@ -643,14 +643,10 @@ hypre_MGRCycle( void *mgr_vdata, HYPRE_Real convergence_factor_cg; hypre_BoomerAMGGetRelResidualNorm(cg_solver, &convergence_factor_cg); (mgr_data -> cg_convergence_factor) = convergence_factor_cg; - if (my_id == 0 && convergence_factor_cg > 1.0) + if ((mgr_data -> print_level) > 1 && my_id == 0 && convergence_factor_cg > 1.0) { hypre_printf("Warning!!! Coarse grid solve diverges. Factor = %1.2e\n", convergence_factor_cg); } - if ((mgr_data -> print_level) > 1 && my_id == 0) - { - hypre_printf("Coarse grid V-cycle convergence factor: %5f\n", convergence_factor_cg); - } } wall_time = time_getWallclockSeconds() - wall_time; //if (my_id == 0) hypre_printf("Coarse grid solve: %f\n", wall_time); @@ -730,7 +726,7 @@ hypre_MGRCycle( void *mgr_vdata, //convergence_factor_frelax = hypre_ParVectorInnerProd(Vtemp, Vtemp)/convergence_factor_frelax; //hypre_printf("F-relaxation V-cycle convergence factor: %5f\n", convergence_factor_frelax); } - else if (Frelax_method[level] == 99) + else if (Frelax_method[level] == 2) { hypre_ParVectorSetConstantValues(F_fine_array[coarse_grid], 0.0); hypre_MGRAddVectorR(CF_marker[fine_grid], FMRK, 1.0, F_array[fine_grid], 0.0, &(F_fine_array[coarse_grid])); diff --git a/src/parcsr_ls/protos.h b/src/parcsr_ls/protos.h index 8d786de595..2931f2c46c 100644 --- a/src/parcsr_ls/protos.h +++ b/src/parcsr_ls/protos.h @@ -1288,11 +1288,11 @@ HYPRE_Int hypre_blockRelax_solve(hypre_ParCSRMatrix *A, hypre_ParVector *f, hypr HYPRE_Int hypre_blockRelax_setup(hypre_ParCSRMatrix *A,HYPRE_Int blk_size, HYPRE_Int reserved_coarse_size, HYPRE_Real **diaginvptr); HYPRE_Int hypre_blockRelax(hypre_ParCSRMatrix *A, hypre_ParVector *f, hypre_ParVector *u, HYPRE_Int blk_size, HYPRE_Int reserved_coarse_size, HYPRE_Int method, hypre_ParVector *Vtemp, hypre_ParVector *Ztemp); -HYPRE_Int hypre_MGRBuildAff( MPI_Comm comm, HYPRE_Int local_num_variables, HYPRE_Int num_functions, -HYPRE_Int *dof_func, HYPRE_Int *CF_marker, HYPRE_Int **coarse_dof_func_ptr, HYPRE_BigInt **coarse_pnts_global_ptr, -hypre_ParCSRMatrix *A, HYPRE_Int debug_flag, hypre_ParCSRMatrix **P_f_ptr, hypre_ParCSRMatrix **A_ff_ptr ); +//HYPRE_Int hypre_MGRBuildAffRAP( MPI_Comm comm, HYPRE_Int local_num_variables, HYPRE_Int num_functions, +//HYPRE_Int *dof_func, HYPRE_Int *CF_marker, HYPRE_Int **coarse_dof_func_ptr, HYPRE_BigInt **coarse_pnts_global_ptr, +//hypre_ParCSRMatrix *A, HYPRE_Int debug_flag, hypre_ParCSRMatrix **P_f_ptr, hypre_ParCSRMatrix **A_ff_ptr ); HYPRE_Int hypre_MGRGetSubBlock( hypre_ParCSRMatrix *A, HYPRE_Int *row_cf_marker, HYPRE_Int *col_cf_marker, HYPRE_Int debug_flag, hypre_ParCSRMatrix **A_ff_ptr ); -HYPRE_Int hypre_MGRBuildAffNew( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, HYPRE_Int debug_flag, hypre_ParCSRMatrix **A_ff_ptr ); +HYPRE_Int hypre_MGRBuildAff( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, HYPRE_Int debug_flag, hypre_ParCSRMatrix **A_ff_ptr ); HYPRE_Int hypre_MGRApproximateInverse(hypre_ParCSRMatrix *A, hypre_ParCSRMatrix **A_inv); HYPRE_Int hypre_MGRAddVectorP ( HYPRE_Int *CF_marker, HYPRE_Int point_type, HYPRE_Real a, hypre_ParVector *fromVector, HYPRE_Real b, hypre_ParVector **toVector ); HYPRE_Int hypre_MGRAddVectorR ( HYPRE_Int *CF_marker, HYPRE_Int point_type, HYPRE_Real a, hypre_ParVector *fromVector, HYPRE_Real b, hypre_ParVector **toVector ); diff --git a/src/struct_ls/F90_HYPRE_struct_bicgstab.c b/src/struct_ls/F90_HYPRE_struct_bicgstab.c index b0a1ebf29f..16970e41b0 100644 --- a/src/struct_ls/F90_HYPRE_struct_bicgstab.c +++ b/src/struct_ls/F90_HYPRE_struct_bicgstab.c @@ -11,7 +11,7 @@ #ifdef __cplusplus extern "C" { #endif - + /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ @@ -30,7 +30,7 @@ hypre_F90_IFACE(hypre_structbicgstabcreate, HYPRE_STRUCTBICGSTABCREATE) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structbicgstabdestroy, HYPRE_STRUCTBICGSTABDESTROY) ( hypre_F90_Obj *solver, hypre_F90_Int *ierr ) @@ -43,7 +43,7 @@ hypre_F90_IFACE(hypre_structbicgstabdestroy, HYPRE_STRUCTBICGSTABDESTROY) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structbicgstabsetup, HYPRE_STRUCTBICGSTABSETUP) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -62,7 +62,7 @@ hypre_F90_IFACE(hypre_structbicgstabsetup, HYPRE_STRUCTBICGSTABSETUP) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structbicgstabsolve, HYPRE_STRUCTBICGSTABSOLVE) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -138,6 +138,7 @@ hypre_F90_IFACE(hypre_structbicgstabsetprecond, HYPRE_STRUCTBICGSTABSETPRECOND) * The precond_id flags mean : * 0 - setup a smg preconditioner * 1 - setup a pfmg preconditioner + * 7 - setup a jacobi preconditioner * 8 - setup a ds preconditioner * 9 - dont setup a preconditioner *------------------------------------------------------------*/ @@ -160,6 +161,15 @@ hypre_F90_IFACE(hypre_structbicgstabsetprecond, HYPRE_STRUCTBICGSTABSETPRECOND) HYPRE_StructPFMGSetup, hypre_F90_PassObj (HYPRE_StructSolver, precond_solver)) ); } + else if (*precond_id == 7) + { + *ierr = (hypre_F90_Int) + ( HYPRE_StructBiCGSTABSetPrecond( + hypre_F90_PassObj (HYPRE_StructSolver, solver), + HYPRE_StructJacobiSolve, + HYPRE_StructJacobiSetup, + hypre_F90_PassObj (HYPRE_StructSolver, precond_solver)) ); + } else if (*precond_id == 8) { *ierr = (hypre_F90_Int) @@ -253,7 +263,7 @@ hypre_F90_IFACE(hypre_structbicgstabgetfinalrel, HYPRE_STRUCTBICGSTABGETFINALREL hypre_F90_PassObj (HYPRE_StructSolver, solver), hypre_F90_PassRealRef (norm) ) ); } - + #ifdef __cplusplus } #endif diff --git a/src/struct_ls/F90_HYPRE_struct_flexgmres.c b/src/struct_ls/F90_HYPRE_struct_flexgmres.c index a9dc76acad..22eadd7212 100644 --- a/src/struct_ls/F90_HYPRE_struct_flexgmres.c +++ b/src/struct_ls/F90_HYPRE_struct_flexgmres.c @@ -11,7 +11,7 @@ #ifdef __cplusplus extern "C" { #endif - + /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ @@ -30,7 +30,7 @@ hypre_F90_IFACE(hypre_structfgmrescreate, HYPRE_STRUCTFGMRESCREATE) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structfgmresdestroy, HYPRE_STRUCTFGMRESDESTROY) ( hypre_F90_Obj *solver, hypre_F90_Int *ierr ) @@ -43,7 +43,7 @@ hypre_F90_IFACE(hypre_structfgmresdestroy, HYPRE_STRUCTFGMRESDESTROY) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structfgmressetup, HYPRE_STRUCTFGMRESSETUP) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -62,7 +62,7 @@ hypre_F90_IFACE(hypre_structfgmressetup, HYPRE_STRUCTFGMRESSETUP) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structfgmressolve, HYPRE_STRUCTFGMRESSOLVE) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -153,6 +153,7 @@ hypre_F90_IFACE(hypre_structfgmressetprecond, HYPRE_STRUCTFGMRESSETPRECOND) * The precond_id flags mean : * 0 - setup a smg preconditioner * 1 - setup a pfmg preconditioner + * 6 - setup a jacobi preconditioner * 8 - setup a ds preconditioner * 9 - dont setup a preconditioner *------------------------------------------------------------*/ @@ -175,15 +176,6 @@ hypre_F90_IFACE(hypre_structfgmressetprecond, HYPRE_STRUCTFGMRESSETPRECOND) HYPRE_StructPFMGSetup, hypre_F90_PassObj (HYPRE_StructSolver, precond_solver)) ); } - else if (*precond_id == 5) - { - *ierr = (hypre_F90_Int) - ( HYPRE_StructFlexGMRESSetPrecond( - hypre_F90_PassObj (HYPRE_StructSolver, solver), - HYPRE_StructSparseMSGSolve, - HYPRE_StructSparseMSGSetup, - hypre_F90_PassObj (HYPRE_StructSolver, precond_solver)) ); - } else if (*precond_id == 6) { *ierr = (hypre_F90_Int) @@ -271,7 +263,7 @@ hypre_F90_IFACE(hypre_structfgmresgetfinalrel, HYPRE_STRUCTFGMRESGETFINALREL) hypre_F90_PassObj (HYPRE_StructSolver, solver), hypre_F90_PassRealRef (norm) ) ); } - + #ifdef __cplusplus } #endif diff --git a/src/struct_ls/F90_HYPRE_struct_gmres.c b/src/struct_ls/F90_HYPRE_struct_gmres.c index 3b174136cf..3126afecd0 100644 --- a/src/struct_ls/F90_HYPRE_struct_gmres.c +++ b/src/struct_ls/F90_HYPRE_struct_gmres.c @@ -11,7 +11,7 @@ #ifdef __cplusplus extern "C" { #endif - + /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ @@ -30,7 +30,7 @@ hypre_F90_IFACE(hypre_structgmrescreate, HYPRE_STRUCTGMRESCREATE) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structgmresdestroy, HYPRE_STRUCTGMRESDESTROY) ( hypre_F90_Obj *solver, hypre_F90_Int *ierr ) @@ -43,7 +43,7 @@ hypre_F90_IFACE(hypre_structgmresdestroy, HYPRE_STRUCTGMRESDESTROY) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structgmressetup, HYPRE_STRUCTGMRESSETUP) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -62,7 +62,7 @@ hypre_F90_IFACE(hypre_structgmressetup, HYPRE_STRUCTGMRESSETUP) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structgmressolve, HYPRE_STRUCTGMRESSOLVE) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -153,6 +153,7 @@ hypre_F90_IFACE(hypre_structgmressetprecond, HYPRE_STRUCTGMRESSETPRECOND) * The precond_id flags mean : * 0 - setup a smg preconditioner * 1 - setup a pfmg preconditioner + * 6 - setup a jacobi preconditioner * 8 - setup a ds preconditioner * 9 - dont setup a preconditioner *------------------------------------------------------------*/ @@ -175,15 +176,6 @@ hypre_F90_IFACE(hypre_structgmressetprecond, HYPRE_STRUCTGMRESSETPRECOND) HYPRE_StructPFMGSetup, hypre_F90_PassObj (HYPRE_StructSolver, precond_solver)) ); } - else if (*precond_id == 5) - { - *ierr = (hypre_F90_Int) - ( HYPRE_StructGMRESSetPrecond( - hypre_F90_PassObj (HYPRE_StructSolver, solver), - HYPRE_StructSparseMSGSolve, - HYPRE_StructSparseMSGSetup, - hypre_F90_PassObj (HYPRE_StructSolver, precond_solver)) ); - } else if (*precond_id == 6) { *ierr = (hypre_F90_Int) @@ -271,7 +263,7 @@ hypre_F90_IFACE(hypre_structgmresgetfinalrelati, HYPRE_STRUCTGMRESGETFINALRELATI hypre_F90_PassObj (HYPRE_StructSolver, solver), hypre_F90_PassRealRef (norm) ) ); } - + #ifdef __cplusplus } #endif diff --git a/src/struct_ls/F90_HYPRE_struct_hybrid.c b/src/struct_ls/F90_HYPRE_struct_hybrid.c index 98475c4e88..fccb81723f 100644 --- a/src/struct_ls/F90_HYPRE_struct_hybrid.c +++ b/src/struct_ls/F90_HYPRE_struct_hybrid.c @@ -11,7 +11,7 @@ #ifdef __cplusplus extern "C" { #endif - + /*-------------------------------------------------------------------------- * HYPRE_StructHybridCreate *--------------------------------------------------------------------------*/ @@ -205,7 +205,7 @@ hypre_F90_IFACE(hypre_structhybridsetrelchange, HYPRE_STRUCTHYBRIDSETRELCHANGE) hypre_F90_Int *rel_change, hypre_F90_Int *ierr ) { - *ierr = (hypre_F90_Int) + *ierr = (hypre_F90_Int) ( HYPRE_StructHybridSetRelChange( hypre_F90_PassObj (HYPRE_StructSolver, solver), hypre_F90_PassInt (rel_change) ) ); @@ -259,6 +259,8 @@ hypre_F90_IFACE(hypre_structhybridsetprecond, HYPRE_STRUCTHYBRIDSETPRECOND) * The precond_id flags mean : * 0 - setup a smg preconditioner * 1 - setup a pfmg preconditioner + * 7 - setup a jacobi preconditioner + * 8 - setup a ds preconditioner *------------------------------------------------------------*/ if (*precond_id == 0) @@ -279,6 +281,24 @@ hypre_F90_IFACE(hypre_structhybridsetprecond, HYPRE_STRUCTHYBRIDSETPRECOND) HYPRE_StructPFMGSetup, hypre_F90_PassObj (HYPRE_StructSolver, precond_solver)) ); } + else if (*precond_id == 7) + { + *ierr = (hypre_F90_Int) + ( HYPRE_StructHybridSetPrecond( + hypre_F90_PassObj (HYPRE_StructSolver, solver), + HYPRE_StructJacobiSolve, + HYPRE_StructJacobiSetup, + hypre_F90_PassObj (HYPRE_StructSolver, precond_solver)) ); + } + else if (*precond_id == 8) + { + *ierr = (hypre_F90_Int) + ( HYPRE_StructHybridSetPrecond( + hypre_F90_PassObj (HYPRE_StructSolver, solver), + HYPRE_StructDiagScale, + HYPRE_StructDiagScaleSetup, + hypre_F90_PassObj (HYPRE_StructSolver, precond_solver)) ); + } else { *ierr = -1; @@ -379,7 +399,7 @@ hypre_F90_IFACE(hypre_structhybridgetfinalrelat, HYPRE_STRUCTHYBRIDGETFINALRELAT hypre_F90_PassObj (HYPRE_StructSolver, solver), hypre_F90_PassRealRef (norm) ) ); } - + #ifdef __cplusplus } #endif diff --git a/src/struct_ls/F90_HYPRE_struct_lgmres.c b/src/struct_ls/F90_HYPRE_struct_lgmres.c index bc21bb065e..f8d566a0ec 100644 --- a/src/struct_ls/F90_HYPRE_struct_lgmres.c +++ b/src/struct_ls/F90_HYPRE_struct_lgmres.c @@ -11,7 +11,7 @@ #ifdef __cplusplus extern "C" { #endif - + /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ @@ -30,7 +30,7 @@ hypre_F90_IFACE(hypre_structlgmrescreate, HYPRE_STRUCTLGMRESCREATE) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structlgmresdestroy, HYPRE_STRUCTLGMRESDESTROY) ( hypre_F90_Obj *solver, hypre_F90_Int *ierr ) @@ -43,7 +43,7 @@ hypre_F90_IFACE(hypre_structlgmresdestroy, HYPRE_STRUCTLGMRESDESTROY) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structlgmressetup, HYPRE_STRUCTLGMRESSETUP) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -62,7 +62,7 @@ hypre_F90_IFACE(hypre_structlgmressetup, HYPRE_STRUCTLGMRESSETUP) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structlgmressolve, HYPRE_STRUCTLGMRESSOLVE) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -168,6 +168,7 @@ hypre_F90_IFACE(hypre_structlgmressetprecond, HYPRE_STRUCTLGMRESSETPRECOND) * The precond_id flags mean : * 0 - setup a smg preconditioner * 1 - setup a pfmg preconditioner + * 6 - setup a jacobi preconditioner * 8 - setup a ds preconditioner * 9 - dont setup a preconditioner *------------------------------------------------------------*/ @@ -190,15 +191,6 @@ hypre_F90_IFACE(hypre_structlgmressetprecond, HYPRE_STRUCTLGMRESSETPRECOND) HYPRE_StructPFMGSetup, hypre_F90_PassObj (HYPRE_StructSolver, precond_solver)) ); } - else if (*precond_id == 5) - { - *ierr = (hypre_F90_Int) - ( HYPRE_StructLGMRESSetPrecond( - hypre_F90_PassObj (HYPRE_StructSolver, solver), - HYPRE_StructSparseMSGSolve, - HYPRE_StructSparseMSGSetup, - hypre_F90_PassObj (HYPRE_StructSolver, precond_solver)) ); - } else if (*precond_id == 6) { *ierr = (hypre_F90_Int) @@ -286,7 +278,7 @@ hypre_F90_IFACE(hypre_structlgmresgetfinalrel, HYPRE_STRUCTLGMRESGETFINALREL) hypre_F90_PassObj (HYPRE_StructSolver, solver), hypre_F90_PassRealRef (norm) ) ); } - + #ifdef __cplusplus } #endif diff --git a/src/struct_ls/F90_HYPRE_struct_pcg.c b/src/struct_ls/F90_HYPRE_struct_pcg.c index c92be80e51..0385003197 100644 --- a/src/struct_ls/F90_HYPRE_struct_pcg.c +++ b/src/struct_ls/F90_HYPRE_struct_pcg.c @@ -11,7 +11,7 @@ #ifdef __cplusplus extern "C" { #endif - + /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ @@ -30,7 +30,7 @@ hypre_F90_IFACE(hypre_structpcgcreate, HYPRE_STRUCTPCGCREATE) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structpcgdestroy, HYPRE_STRUCTPCGDESTROY) ( hypre_F90_Obj *solver, hypre_F90_Int *ierr ) @@ -43,7 +43,7 @@ hypre_F90_IFACE(hypre_structpcgdestroy, HYPRE_STRUCTPCGDESTROY) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structpcgsetup, HYPRE_STRUCTPCGSETUP) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -62,7 +62,7 @@ hypre_F90_IFACE(hypre_structpcgsetup, HYPRE_STRUCTPCGSETUP) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structpcgsolve, HYPRE_STRUCTPCGSOLVE) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -282,7 +282,7 @@ hypre_F90_IFACE(hypre_structpcggetfinalrelative, HYPRE_STRUCTPCGGETFINALRELATIVE /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structdiagscalesetup, HYPRE_STRUCTDIAGSCALESETUP) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -301,7 +301,7 @@ hypre_F90_IFACE(hypre_structdiagscalesetup, HYPRE_STRUCTDIAGSCALESETUP) /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_structdiagscale, HYPRE_STRUCTDIAGSCALE) ( hypre_F90_Obj *solver, hypre_F90_Obj *HA, @@ -316,7 +316,7 @@ hypre_F90_IFACE(hypre_structdiagscale, HYPRE_STRUCTDIAGSCALE) hypre_F90_PassObj (HYPRE_StructVector, Hy), hypre_F90_PassObj (HYPRE_StructVector, Hx) ) ); } - + #ifdef __cplusplus } #endif diff --git a/src/test/f77_struct.f b/src/test/f77_struct.f index ab2e5967bc..e8cb256539 100644 --- a/src/test/f77_struct.f +++ b/src/test/f77_struct.f @@ -6,7 +6,7 @@ !----------------------------------------------------------------------- ! Test driver for structured matrix interface (structured storage) !----------------------------------------------------------------------- - + !----------------------------------------------------------------------- ! Standard 7-point laplacian in 3D with grid and anisotropy determined ! as user settings. @@ -14,13 +14,20 @@ program test + implicit none + include 'mpif.h' + integer MAXZONS + integer MAXBLKS + integer MAXDIM + parameter (MAXZONS=4194304) parameter (MAXBLKS=32) parameter (MAXDIM=3) integer num_procs, myid + logical file_exists integer dim integer nx, ny, nz @@ -28,16 +35,20 @@ program test integer bx, by, bz double precision cx, cy, cz integer n_pre, n_post - integer solver_id - integer precond_id + integer slvr_id + integer prec_id integer zero, one - integer maxiter, dscgmaxiter, pcgmaxiter - double precision tol, convtol + integer prec_iter + integer slvr_iter + integer dscg_iter + double precision slvr_tol + double precision prec_tol + double precision convtol integer num_iterations double precision final_res_norm - + ! HYPRE_StructMatrix A ! HYPRE_StructVector b ! HYPRE_StructVector x @@ -117,7 +128,7 @@ program test n_pre = 1 n_post = 1 - solver_id = 0 + slvr_id = 1 istart(1) = -3 istart(2) = -3 @@ -126,33 +137,34 @@ program test !----------------------------------------------------------------------- ! Read options !----------------------------------------------------------------------- - -! open( 5, file='struct_linear_solver.in', status='old') -! -! read( 5, *) dim -! -! read( 5, *) nx -! read( 5, *) ny -! read( 5, *) nz -! -! read( 5, *) Px -! read( 5, *) Py -! read( 5, *) Pz -! -! read( 5, *) bx -! read( 5, *) by -! read( 5, *) bz -! -! read( 5, *) cx -! read( 5, *) cy -! read( 5, *) cz -! -! read( 5, *) n_pre -! read( 5, *) n_post -! -! read( 5, *) solver_id -! -! close( 5 ) + inquire(file='struct_linear_solver.in', exist=file_exists) + if (file_exists) then + open(5, file='struct_linear_solver.in', status='old') + + read(5, *) dim + + read(5, *) nx + read(5, *) ny + read(5, *) nz + + read(5, *) Px + read(5, *) Py + read(5, *) Pz + + read(5, *) bx + read(5, *) by + read(5, *) bz + + read(5, *) cx + read(5, *) cy + read(5, *) cz + + read(5, *) n_pre + read(5, *) n_post + read(5, *) slvr_id + + close(5) + endif !----------------------------------------------------------------------- ! Check a few things @@ -183,14 +195,21 @@ program test !----------------------------------------------------------------------- if (myid .eq. 0) then - print *, 'Running with these driver parameters:' - print *, ' (nx, ny, nz) = (', nx, ',', ny, ',', nz, ')' - print *, ' (Px, Py, Pz) = (', Px, ',', Py, ',', Pz, ')' - print *, ' (bx, by, bz) = (', bx, ',', by, ',', bz, ')' - print *, ' (cx, cy, cz) = (', cx, ',', cy, ',', cz, ')' - print *, ' (n_pre, n_post) = (', n_pre, ',', n_post, ')' - print *, ' dim = ', dim - print *, ' solver ID = ', solver_id + write(*,*) + write(*,'(a)') 'Running with these driver parameters:' + write(*,'(3x,a,i0,a,i0,a,i0,a)') '(nx, ny, nz) = (', + & nx, ', ', ny, ', ', nz, ')' + write(*,'(3x,a,i0,a,i0,a,i0,a)') '(Px, Py, Pz) = (', + & Px, ', ', Py, ', ', Pz, ')' + write(*,'(3x,a,i0,a,i0,a,i0,a)') '(bx, by, bz) = (', + & bx, ', ', by, ', ', bz, ')' + write(*,'(3x,a,f0.1,a,f0.1,a,f0.1,a)') '(cx, cy, cz) = (', + & cx, ', ', cy, ', ', cz, ')' + write(*,'(3x,a,i0,a,i0,a)') '(n_pre, n_post) = (', + & n_pre, ', ', n_post, ')' + write(*,'(3x,a,i0)') 'dim = ', dim + write(*,'(3x,a,i0)') 'solver ID = ', slvr_id + write(*,*) endif !----------------------------------------------------------------------- @@ -264,7 +283,7 @@ program test enddo enddo enddo - endif + endif call HYPRE_StructGridCreate(MPI_COMM_WORLD, dim, grid, ierr) do ib=1,nblocks @@ -282,9 +301,9 @@ program test offsets(1,2) = 0 elseif (dim .eq. 2) then offsets(1,1) = -1 - offsets(2,1) = 0 + offsets(2,1) = 0 offsets(1,2) = 0 - offsets(2,2) = -1 + offsets(2,2) = -1 offsets(1,3) = 0 offsets(2,3) = 0 elseif (dim .eq. 3) then @@ -293,7 +312,7 @@ program test offsets(3,1) = 0 offsets(1,2) = 0 offsets(2,2) = -1 - offsets(3,2) = 0 + offsets(3,2) = 0 offsets(1,3) = 0 offsets(2,3) = 0 offsets(3,3) = -1 @@ -301,8 +320,8 @@ program test offsets(2,4) = 0 offsets(3,4) = 0 endif - - call HYPRE_StructStencilCreate(dim, (dim+1), stencil, ierr) + + call HYPRE_StructStencilCreate(dim, (dim+1), stencil, ierr) do s=1,dim+1 call HYPRE_StructStencilSetElement(stencil, (s - 1), & offsets(1,s), ierr) @@ -316,7 +335,7 @@ program test A_num_ghost(2*i - 1) = 1 A_num_ghost(2*i) = 1 enddo - + call HYPRE_StructMatrixCreate(MPI_COMM_WORLD, grid, stencil, & A, ierr) call HYPRE_StructMatrixSetSymmetric(A, 1, ierr) @@ -404,46 +423,47 @@ program test call HYPRE_StructVectorAssemble(x, ierr) ! call HYPRE_StructVectorPrint(x, zero, ierr) ! call HYPRE_StructVectorPrint("driver.out.x0", x, zero, ierr) - + !----------------------------------------------------------------------- ! Solve the linear system !----------------------------------------------------------------------- ! General solver parameters, passing hard coded constants ! will break the interface. - maxiter = 50 - dscgmaxiter = 100 - pcgmaxiter = 50 - tol = 0.000001 - convtol = 0.9 - - if (solver_id .eq. 0) then + slvr_iter = 50 + prec_iter = 1 + dscg_iter = 100 + slvr_tol = 0.000001 + prec_tol = 0.0 + convtol = 0.9 + prec_id = -1 + + if (slvr_id .eq. 0) then ! Solve the system using SMG call HYPRE_StructSMGCreate(MPI_COMM_WORLD, solver, ierr) call HYPRE_StructSMGSetMemoryUse(solver, zero, ierr) - call HYPRE_StructSMGSetMaxIter(solver, maxiter, ierr) - call HYPRE_StructSMGSetTol(solver, tol, ierr) + call HYPRE_StructSMGSetMaxIter(solver, slvr_iter, ierr) + call HYPRE_StructSMGSetTol(solver, slvr_tol, ierr) call HYPRE_StructSMGSetRelChange(solver, zero, ierr) call HYPRE_StructSMGSetNumPreRelax(solver, n_pre, ierr) call HYPRE_StructSMGSetNumPostRelax(solver, n_post, ierr) call HYPRE_StructSMGSetLogging(solver, one, ierr) call HYPRE_StructSMGSetup(solver, A, b, x, ierr) - call HYPRE_StructSMGSolve(solver, A, b, x, ierr) - call HYPRE_StructSMGGetNumIterations(solver, num_iterations, & ierr) call HYPRE_StructSMGGetFinalRelative(solver, final_res_norm, & ierr) call HYPRE_StructSMGDestroy(solver, ierr) - elseif (solver_id .eq. 1) then + + elseif (slvr_id .eq. 1) then ! Solve the system using PFMG call HYPRE_StructPFMGCreate(MPI_COMM_WORLD, solver, ierr) - call HYPRE_StructPFMGSetMaxIter(solver, maxiter, ierr) - call HYPRE_StructPFMGSetTol(solver, tol, ierr) + call HYPRE_StructPFMGSetMaxIter(solver, slvr_iter, ierr) + call HYPRE_StructPFMGSetTol(solver, slvr_tol, ierr) call HYPRE_StructPFMGSetRelChange(solver, zero, ierr) ! weighted Jacobi = 1; red-black GS = 2 call HYPRE_StructPFMGSetRelaxType(solver, one, ierr) @@ -451,53 +471,47 @@ program test call HYPRE_StructPFMGSetNumPostRelax(solver, n_post, ierr) ! call HYPRE_StructPFMGSetDxyz(solver, dxyz, ierr) call HYPRE_StructPFMGSetLogging(solver, one, ierr) + call HYPRE_StructPFMGSetPrintLevel(solver, one, ierr) call HYPRE_StructPFMGSetup(solver, A, b, x, ierr) call HYPRE_StructPFMGSolve(solver, A, b, x, ierr) - call HYPRE_StructPFMGGetNumIteration(solver, num_iterations, & ierr) call HYPRE_StructPFMGGetFinalRelativ(solver, final_res_norm, & ierr) call HYPRE_StructPFMGDestroy(solver, ierr) - elseif ((solver_id .gt. 9) .and. (solver_id .lt. 20)) then + + elseif ((slvr_id .gt. 9) .and. (slvr_id .lt. 20)) then ! Solve the system using CG - precond_id = -1 call HYPRE_StructPCGCreate(MPI_COMM_WORLD, solver, ierr) - call HYPRE_StructPCGSetMaxIter(solver, maxiter, ierr) - call HYPRE_StructPCGSetTol(solver, tol, ierr) + call HYPRE_StructPCGSetMaxIter(solver, slvr_iter, ierr) + call HYPRE_StructPCGSetTol(solver, slvr_tol, ierr) call HYPRE_StructPCGSetTwoNorm(solver, one, ierr) call HYPRE_StructPCGSetRelChange(solver, zero, ierr) call HYPRE_StructPCGSetLogging(solver, one, ierr) - if (solver_id .eq. 10) then + if (slvr_id .eq. 10) then ! use symmetric SMG as preconditioner - precond_id = 0 - maxiter = 1 - tol = 0.0 + prec_id = 0 call HYPRE_StructSMGCreate(MPI_COMM_WORLD, precond, & ierr) call HYPRE_StructSMGSetMemoryUse(precond, zero, ierr) - call HYPRE_StructSMGSetMaxIter(precond, maxiter, ierr) - call HYPRE_StructSMGSetTol(precond, tol, ierr) + call HYPRE_StructSMGSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructSMGSetTol(precond, prec_tol, ierr) call HYPRE_StructSMGSetNumPreRelax(precond, n_pre, ierr) call HYPRE_StructSMGSetNumPostRelax(precond, n_post, ierr) call HYPRE_StructSMGSetLogging(precond, zero, ierr) - call HYPRE_StructPCGSetPrecond(solver, precond_id, precond, - & ierr) - elseif (solver_id .eq. 11) then + elseif (slvr_id .eq. 11) then ! use symmetric PFMG as preconditioner - precond_id = 1 - maxiter = 1 - tol = 0.0 + prec_id = 1 call HYPRE_StructPFMGCreate(MPI_COMM_WORLD, precond, & ierr) - call HYPRE_StructPFMGSetMaxIter(precond, maxiter, ierr) - call HYPRE_StructPFMGSetTol(precond, tol, ierr) + call HYPRE_StructPFMGSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructPFMGSetTol(precond, prec_tol, ierr) ! weighted Jacobi = 1; red-black GS = 2 call HYPRE_StructPFMGSetRelaxType(precond, one, ierr) call HYPRE_StructPFMGSetNumPreRelax(precond, n_pre, ierr) @@ -505,101 +519,431 @@ program test ! call HYPRE_StructPFMGSetDxyz(precond, dxyz, ierr) call HYPRE_StructPFMGSetLogging(precond, zero, ierr) - call HYPRE_StructPCGSetPrecond(solver, precond_id, precond, - & ierr) - elseif (solver_id .eq. 18) then + elseif (slvr_id .eq. 17) then +! use 2-step jacobi as preconditioner + prec_id = 7 + prec_iter = 2 + + call HYPRE_StructJacobiCreate(MPI_COMM_WORLD, precond, ierr) + call HYPRE_StructJacobiSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructJacobiSetTol(precond, prec_tol, ierr) + + elseif (slvr_id .eq. 18) then ! use diagonal scaling as preconditioner - precond_id = 8 + prec_id = 8 precond = zero - call HYPRE_StructPCGSetPrecond(solver, precond_id, precond, - & ierr) - elseif (solver_id .eq. 19) then -! use diagonal scaling as preconditioner - precond_id = 9 + elseif (slvr_id .eq. 19) then +! use no preconditioner + prec_id = 9 - call HYPRE_StructPCGSetPrecond(solver, precond_id, precond, - & ierr) + else +! Invalid preconditioner + if (myid .eq. 0) then + write(*,*) 'Invalid preconditioner!' + endif + call MPI_ABORT(MPI_COMM_WORLD, -2, ierr) endif + call HYPRE_StructPCGSetPrecond(solver, prec_id, precond, + & ierr) call HYPRE_StructPCGSetup(solver, A, b, x, ierr) - call HYPRE_StructPCGSolve(solver, A, b, x, ierr) - call HYPRE_StructPCGGetNumIterations(solver, num_iterations, & ierr) call HYPRE_StructPCGGetFinalRelative(solver, final_res_norm, & ierr) call HYPRE_StructPCGDestroy(solver, ierr) - if (solver_id .eq. 10) then - call HYPRE_StructSMGDestroy(precond, ierr) - elseif (solver_id .eq. 11) then - call HYPRE_StructPFMGDestroy(precond, ierr) - endif - elseif ((solver_id .gt. 19) .and. (solver_id .le. 30)) then + elseif ((slvr_id .gt. 19) .and. (slvr_id .lt. 30)) then ! Solve the system using Hybrid - precond_id = -1 call HYPRE_StructHybridCreate(MPI_COMM_WORLD, solver, ierr) - call HYPRE_StructHybridSetDSCGMaxIte(solver, dscgmaxiter, ierr) - call HYPRE_StructHybridSetPCGMaxIter(solver, pcgmaxiter, ierr) - call HYPRE_StructHybridSetTol(solver, tol, ierr) + call HYPRE_StructHybridSetDSCGMaxIte(solver, dscg_iter, ierr) + call HYPRE_StructHybridSetPCGMaxIter(solver, slvr_iter, ierr) + call HYPRE_StructHybridSetTol(solver, slvr_tol, ierr) call HYPRE_StructHybridSetConvergenc(solver, convtol, ierr) call HYPRE_StructHybridSetTwoNorm(solver, one, ierr) call HYPRE_StructHybridSetRelChange(solver, zero, ierr) call HYPRE_StructHybridSetLogging(solver, one, ierr) - if (solver_id .eq. 20) then + if (slvr_id .eq. 20) then ! use symmetric SMG as preconditioner - precond_id = 0 - maxiter = 1 - tol = 0.0 + prec_id = 0 call HYPRE_StructSMGCreate(MPI_COMM_WORLD, precond, & ierr) call HYPRE_StructSMGSetMemoryUse(precond, zero, ierr) - call HYPRE_StructSMGSetMaxIter(precond, maxiter, ierr) - call HYPRE_StructSMGSetTol(precond, tol, ierr) + call HYPRE_StructSMGSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructSMGSetTol(precond, prec_tol, ierr) call HYPRE_StructSMGSetNumPreRelax(precond, n_pre, ierr) call HYPRE_StructSMGSetNumPostRelax(precond, n_post, ierr) call HYPRE_StructSMGSetLogging(precond, zero, ierr) - elseif (solver_id .eq. 21) then + + elseif (slvr_id .eq. 21) then ! use symmetric PFMG as preconditioner - precond_id = 1 - maxiter = 1 - tol = 0.0 + prec_id = 1 call HYPRE_StructPFMGCreate(MPI_COMM_WORLD, precond, & ierr) - call HYPRE_StructPFMGSetMaxIter(precond, maxiter, ierr) - call HYPRE_StructPFMGSetTol(precond, tol, ierr) + call HYPRE_StructPFMGSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructPFMGSetTol(precond, prec_tol, ierr) ! weighted Jacobi = 1; red-black GS = 2 call HYPRE_StructPFMGSetRelaxType(precond, one, ierr) call HYPRE_StructPFMGSetNumPreRelax(precond, n_pre, ierr) call HYPRE_StructPFMGSetNumPostRelax(precond, n_post, ierr) ! call HYPRE_StructPFMGSetDxyz(precond, dxyz, ierr) call HYPRE_StructPFMGSetLogging(precond, zero, ierr) + + elseif (slvr_id .eq. 27) then +! use 2-step jacobi as preconditioner + prec_id = 7 + prec_iter = 2 + + call HYPRE_StructJacobiCreate(MPI_COMM_WORLD, precond, ierr) + call HYPRE_StructJacobiSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructJacobiSetTol(precond, prec_tol, ierr) + + elseif (slvr_id .eq. 28) then +! use diagonal scaling as preconditioner + prec_id = 8 + precond = zero + + elseif (slvr_id .eq. 29) then +! use no preconditioner + prec_id = 9 + + else +! Invalid preconditioner + if (myid .eq. 0) then + write(*,*) 'Invalid preconditioner!' + endif + call MPI_ABORT(MPI_COMM_WORLD, -2, ierr) endif - call HYPRE_StructHybridSetPrecond(solver, precond_id, precond, + call HYPRE_StructHybridSetPrecond(solver, prec_id, precond, & ierr) - call HYPRE_StructHybridSetup(solver, A, b, x, ierr) - call HYPRE_StructHybridSolve(solver, A, b, x, ierr) - call HYPRE_StructHybridGetNumIterati(solver, num_iterations, & ierr) call HYPRE_StructHybridGetFinalRelat(solver, final_res_norm, & ierr) call HYPRE_StructHybridDestroy(solver, ierr) - if (solver_id .eq. 20) then - call HYPRE_StructSMGDestroy(precond, ierr) - elseif (solver_id .eq. 21) then - call HYPRE_StructPFMGDestroy(precond, ierr) + elseif ((slvr_id .gt. 29) .and. (slvr_id .lt. 40)) then +! Solve the system using GMRes + + call HYPRE_StructGMResCreate(MPI_COMM_WORLD, solver, ierr) + call HYPRE_StructGMResSetMaxIter(solver, slvr_iter, ierr) + call HYPRE_StructGMResSetKDim(solver, slvr_iter, ierr) + call HYPRE_StructGMResSetTol(solver, slvr_tol, ierr) + call HYPRE_StructGMResSetPrintLevel(solver, one); + call HYPRE_StructGMResSetLogging(solver, one, ierr) + + if (slvr_id .eq. 30) then +! use symmetric SMG as preconditioner + prec_id = 0 + + call HYPRE_StructSMGCreate(MPI_COMM_WORLD, precond, + & ierr) + call HYPRE_StructSMGSetMemoryUse(precond, zero, ierr) + call HYPRE_StructSMGSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructSMGSetTol(precond, prec_tol, ierr) + call HYPRE_StructSMGSetNumPreRelax(precond, n_pre, ierr) + call HYPRE_StructSMGSetNumPostRelax(precond, n_post, ierr) + call HYPRE_StructSMGSetLogging(precond, zero, ierr) + + elseif (slvr_id .eq. 31) then +! use symmetric PFMG as preconditioner + prec_id = 1 + + call HYPRE_StructPFMGCreate(MPI_COMM_WORLD, precond, + & ierr) + call HYPRE_StructPFMGSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructPFMGSetTol(precond, prec_tol, ierr) +! weighted Jacobi = 1; red-black GS = 2 + call HYPRE_StructPFMGSetRelaxType(precond, one, ierr) + call HYPRE_StructPFMGSetNumPreRelax(precond, n_pre, ierr) + call HYPRE_StructPFMGSetNumPostRelax(precond, n_post, ierr) +! call HYPRE_StructPFMGSetDxyz(precond, dxyz, ierr) + call HYPRE_StructPFMGSetLogging(precond, zero, ierr) + + elseif (slvr_id .eq. 36) then +! use 2-step jacobi as preconditioner + prec_id = 6 + prec_iter = 2 + + call HYPRE_StructJacobiCreate(MPI_COMM_WORLD, precond, ierr) + call HYPRE_StructJacobiSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructJacobiSetTol(precond, prec_tol, ierr) + prec_id = 7 + + elseif (slvr_id .eq. 38) then +! use diagonal scaling as preconditioner + prec_id = 8 + precond = zero + + elseif (slvr_id .eq. 39) then +! use no preconditioner + prec_id = 9 + + else +! Invalid preconditioner + if (myid .eq. 0) then + write(*,*) 'Invalid preconditioner!' + endif + call MPI_ABORT(MPI_COMM_WORLD, -2, ierr) + endif + + call HYPRE_StructGMResSetPrecond(solver, prec_id, precond, + & ierr) + call HYPRE_StructGMResSetup(solver, A, b, x, ierr) + call HYPRE_StructGMResSolve(solver, A, b, x, ierr) + call HYPRE_StructGMResGetNumIteratio(solver, num_iterations, + & ierr) + call HYPRE_StructGMResGetFinalRelati(solver, final_res_norm, + & ierr) + call HYPRE_StructGMResDestroy(solver, ierr) + + elseif ((slvr_id .gt. 39) .and. (slvr_id .lt. 50)) then +! Solve the system using BiCGStab + + call HYPRE_StructBiCGStabCreate(MPI_COMM_WORLD, solver, ierr) + call HYPRE_StructBiCGStabSetMaxIter(solver, slvr_iter, ierr) + call HYPRE_StructBiCGStabSetTol(solver, slvr_tol, ierr) + call HYPRE_StructBiCGStabSetPrintLev(solver, one); + call HYPRE_StructBiCGStabSetLogging(solver, one, ierr) + + if (slvr_id .eq. 40) then +! use symmetric SMG as preconditioner + prec_id = 0 + + call HYPRE_StructSMGCreate(MPI_COMM_WORLD, precond, + & ierr) + call HYPRE_StructSMGSetMemoryUse(precond, zero, ierr) + call HYPRE_StructSMGSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructSMGSetTol(precond, prec_tol, ierr) + call HYPRE_StructSMGSetNumPreRelax(precond, n_pre, ierr) + call HYPRE_StructSMGSetNumPostRelax(precond, n_post, ierr) + call HYPRE_StructSMGSetLogging(precond, zero, ierr) + + elseif (slvr_id .eq. 41) then +! use symmetric PFMG as preconditioner + prec_id = 1 + + call HYPRE_StructPFMGCreate(MPI_COMM_WORLD, precond, + & ierr) + call HYPRE_StructPFMGSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructPFMGSetTol(precond, prec_tol, ierr) +! weighted Jacobi = 1; red-black GS = 2 + call HYPRE_StructPFMGSetRelaxType(precond, one, ierr) + call HYPRE_StructPFMGSetNumPreRelax(precond, n_pre, ierr) + call HYPRE_StructPFMGSetNumPostRelax(precond, n_post, ierr) +! call HYPRE_StructPFMGSetDxyz(precond, dxyz, ierr) + call HYPRE_StructPFMGSetLogging(precond, zero, ierr) + + elseif (slvr_id .eq. 47) then +! use 2-step jacobi as preconditioner + prec_id = 7 + prec_iter = 2 + + call HYPRE_StructJacobiCreate(MPI_COMM_WORLD, precond, ierr) + call HYPRE_StructJacobiSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructJacobiSetTol(precond, prec_tol, ierr) + + elseif (slvr_id .eq. 38) then +! use diagonal scaling as preconditioner + prec_id = 8 + precond = zero + + elseif (slvr_id .eq. 39) then +! use no preconditioner + prec_id = 9 + + else +! Invalid preconditioner + if (myid .eq. 0) then + write(*,*) 'Invalid preconditioner!' + endif + call MPI_ABORT(MPI_COMM_WORLD, -2, ierr) + endif + + call HYPRE_StructBiCGStabSetPrecond(solver, prec_id, precond, + & ierr) + call HYPRE_StructBiCGStabSetup(solver, A, b, x, ierr) + call HYPRE_StructBiCGStabSolve(solver, A, b, x, ierr) + call HYPRE_StructBiCGStabGetNumItera(solver, num_iterations, + & ierr) + call HYPRE_StructBiCGStabGetFinalRel(solver, final_res_norm, + & ierr) + call HYPRE_StructBiCGStabDestroy(solver, ierr) + + elseif ((slvr_id .gt. 49) .and. (slvr_id .lt. 60)) then +! Solve the system using LGMRes + + call HYPRE_StructLGMResCreate(MPI_COMM_WORLD, solver, ierr) + call HYPRE_StructLGMResSetMaxIter(solver, slvr_iter, ierr) + call HYPRE_StructLGMResSetKDim(solver, slvr_iter, ierr) + call HYPRE_StructLGMResSetTol(solver, slvr_tol, ierr) + call HYPRE_StructLGMResSetPrintLevel(solver, one); + call HYPRE_StructLGMResSetLogging(solver, one, ierr) + + if (slvr_id .eq. 50) then +! use symmetric SMG as preconditioner + prec_id = 0 + + call HYPRE_StructSMGCreate(MPI_COMM_WORLD, precond, + & ierr) + call HYPRE_StructSMGSetMemoryUse(precond, zero, ierr) + call HYPRE_StructSMGSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructSMGSetTol(precond, prec_tol, ierr) + call HYPRE_StructSMGSetNumPreRelax(precond, n_pre, ierr) + call HYPRE_StructSMGSetNumPostRelax(precond, n_post, ierr) + call HYPRE_StructSMGSetLogging(precond, zero, ierr) + + elseif (slvr_id .eq. 51) then +! use symmetric PFMG as preconditioner + prec_id = 1 + + call HYPRE_StructPFMGCreate(MPI_COMM_WORLD, precond, + & ierr) + call HYPRE_StructPFMGSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructPFMGSetTol(precond, prec_tol, ierr) +! weighted Jacobi = 1; red-black GS = 2 + call HYPRE_StructPFMGSetRelaxType(precond, one, ierr) + call HYPRE_StructPFMGSetNumPreRelax(precond, n_pre, ierr) + call HYPRE_StructPFMGSetNumPostRelax(precond, n_post, ierr) +! call HYPRE_StructPFMGSetDxyz(precond, dxyz, ierr) + call HYPRE_StructPFMGSetLogging(precond, zero, ierr) + + elseif (slvr_id .eq. 56) then +! use 2-step jacobi as preconditioner + prec_id = 6 + prec_iter = 2 + + call HYPRE_StructJacobiCreate(MPI_COMM_WORLD, precond, ierr) + call HYPRE_StructJacobiSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructJacobiSetTol(precond, prec_tol, ierr) + prec_id = 7 + + elseif (slvr_id .eq. 58) then +! use diagonal scaling as preconditioner + prec_id = 8 + precond = zero + + elseif (slvr_id .eq. 59) then +! use no preconditioner + prec_id = 9 + + else +! Invalid preconditioner + if (myid .eq. 0) then + write(*,*) 'Invalid preconditioner!' + endif + call MPI_ABORT(MPI_COMM_WORLD, -2, ierr) + endif + + call HYPRE_StructLGMResSetPrecond(solver, prec_id, precond, + & ierr) + call HYPRE_StructLGMResSetup(solver, A, b, x, ierr) + call HYPRE_StructLGMResSolve(solver, A, b, x, ierr) + call HYPRE_StructLGMResGetNumIter(solver, num_iterations, + & ierr) + call HYPRE_StructLGMResGetFinalRel(solver, final_res_norm, + & ierr) + call HYPRE_StructLGMResDestroy(solver, ierr) + + elseif ((slvr_id .gt. 59) .and. (slvr_id .lt. 70)) then +! Solve the system using FlexGMRes + + call HYPRE_StructFGMResCreate(MPI_COMM_WORLD, solver, ierr) + call HYPRE_StructFGMResSetMaxIter(solver, slvr_iter, ierr) + call HYPRE_StructFGMResSetKDim(solver, slvr_iter, ierr) + call HYPRE_StructFGMResSetTol(solver, slvr_tol, ierr) + call HYPRE_StructFGMResSetPrintLevel(solver, one); + call HYPRE_StructFGMResSetLogging(solver, one, ierr) + + if (slvr_id .eq. 60) then +! use symmetric SMG as preconditioner + prec_id = 0 + + call HYPRE_StructSMGCreate(MPI_COMM_WORLD, precond, + & ierr) + call HYPRE_StructSMGSetMemoryUse(precond, zero, ierr) + call HYPRE_StructSMGSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructSMGSetTol(precond, prec_tol, ierr) + call HYPRE_StructSMGSetNumPreRelax(precond, n_pre, ierr) + call HYPRE_StructSMGSetNumPostRelax(precond, n_post, ierr) + call HYPRE_StructSMGSetLogging(precond, zero, ierr) + + elseif (slvr_id .eq. 61) then +! use symmetric PFMG as preconditioner + prec_id = 1 + + call HYPRE_StructPFMGCreate(MPI_COMM_WORLD, precond, + & ierr) + call HYPRE_StructPFMGSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructPFMGSetTol(precond, prec_tol, ierr) +! weighted Jacobi = 1; red-black GS = 2 + call HYPRE_StructPFMGSetRelaxType(precond, one, ierr) + call HYPRE_StructPFMGSetNumPreRelax(precond, n_pre, ierr) + call HYPRE_StructPFMGSetNumPostRelax(precond, n_post, ierr) +! call HYPRE_StructPFMGSetDxyz(precond, dxyz, ierr) + call HYPRE_StructPFMGSetLogging(precond, zero, ierr) + + elseif (slvr_id .eq. 66) then +! use 2-step jacobi as preconditioner + prec_id = 6 + prec_iter = 2 + + call HYPRE_StructJacobiCreate(MPI_COMM_WORLD, precond, ierr) + call HYPRE_StructJacobiSetMaxIter(precond, prec_iter, ierr) + call HYPRE_StructJacobiSetTol(precond, prec_tol, ierr) + prec_id = 7 + + elseif (slvr_id .eq. 68) then +! use diagonal scaling as preconditioner + prec_id = 8 + precond = zero + + elseif (slvr_id .eq. 69) then +! use no preconditioner + prec_id = 9 + + else +! Invalid preconditioner + if (myid .eq. 0) then + write(*,*) 'Invalid preconditioner!' + endif + call MPI_ABORT(MPI_COMM_WORLD, -2, ierr) + endif + + call HYPRE_StructFGMResSetPrecond(solver, prec_id, precond, + & ierr) + call HYPRE_StructFGMResSetup(solver, A, b, x, ierr) + call HYPRE_StructFGMResSolve(solver, A, b, x, ierr) + call HYPRE_StructFGMResGetNumIter(solver, num_iterations, + & ierr) + call HYPRE_StructFGMResGetFinalRel(solver, final_res_norm, + & ierr) + call HYPRE_StructFGMResDestroy(solver, ierr) + + else + if (myid .eq. 0) then + write(*,*) 'Invalid solver!' endif + call MPI_ABORT(MPI_COMM_WORLD, -1, ierr) + endif + + if (prec_id .eq. 0) then + call HYPRE_StructSMGDestroy(precond, ierr) + + elseif (prec_id .eq. 1) then + call HYPRE_StructPFMGDestroy(precond, ierr) + + elseif (prec_id .eq. 7) then + call HYPRE_StructJacobiDestroy(precond, ierr) endif !----------------------------------------------------------------------- @@ -609,8 +953,9 @@ program test ! call HYPRE_StructVectorPrint("driver.out.x", x, zero, ierr) if (myid .eq. 0) then - print *, 'Iterations = ', num_iterations - print *, 'Final Relative Residual Norm = ', final_res_norm + write(*,'(a, i0)') 'Number of iterations = ', num_iterations + write(*,'(a, e15.7)') 'Final Relative Residual Norm = ', + & final_res_norm endif !----------------------------------------------------------------------- diff --git a/src/test/runtest.sh b/src/test/runtest.sh index adf12ac0f1..aaedae8c03 100755 --- a/src/test/runtest.sh +++ b/src/test/runtest.sh @@ -549,6 +549,7 @@ hypre_MPI_Init job [0-9]* queued and waiting for resources job [0-9]* has been allocated resources SLURMINFO: Job [0-9]* is pending allocation of resources. +slurmstepd: error: _is_a_lwp: open ATTENTION: [0-9\-]* Couldn't create .*, job may not be checkpointable ATTENTION: [0-9\-]* Error opening file ### .*File.cc.* diff --git a/src/utilities/Makefile b/src/utilities/Makefile index 0341169034..aa939847cd 100644 --- a/src/utilities/Makefile +++ b/src/utilities/Makefile @@ -45,7 +45,6 @@ FILES =\ hypre_hopscotch_hash.c\ hypre_merge_sort.c\ hypre_mpi_comm_f2c.c\ - hypre_nvtx.c\ hypre_prefix_sum.c\ hypre_printf.c\ hypre_qsort.c\ @@ -60,7 +59,8 @@ CUFILES=\ hypre_cuda_utils.c\ hypre_general.c\ hypre_memory.c\ - hypre_omp_device.c + hypre_omp_device.c \ + hypre_nvtx.c COBJS = ${FILES:.c=.o} CUOBJS = ${CUFILES:.c=.obj}